rave-canvas.js 421 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295
  1. (function() {
  2. // During the rave-canvas.js build, this file is added to the top.
  3. // Create an inner self-executing function that will be run with the global scope
  4. // On browsers, this is 'window'. Everywhere else should use 'this' if available.
  5. // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :)
  6. var _window = (1, eval)('this');
  7. (function (global, factory) {
  8. // dynamically determine how 'rave' variable should be loaded depeneding on loader type
  9. var _rave;
  10. if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") {
  11. // CommonJS/node.js
  12. module.exports = factory(global,require("rave"));
  13. } else if (typeof define === "function" && define.amd) {
  14. // AMD
  15. define(['rave'], function(rave) {
  16. return factory(global,rave);
  17. });
  18. } else {
  19. // probably loading via script tag. run as is, setting stuff on rave
  20. factory(global,global['rave']);
  21. }
  22. }(_window, function (_global, _rave) {// $source: com/ibm/rave/core/canvas/internal/nativeImpl/ModuleHeader
  23. /************************************************************************
  24. ** IBM Confidential
  25. **
  26. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27. **
  28. ** (C) Copyright IBM Corp. 2014, 2015
  29. **
  30. ** The source code for this program is not published or otherwise divested of its trade secrets,
  31. ** irrespective of what has been deposited with the U.S. Copyright Office.
  32. ************************************************************************/
  33. // setup
  34. "use strict";
  35. // _global and _rave are initialized in the wrapping rave-canvas.js-header.js code
  36. /** @expose */
  37. var global = typeof _global !== "undefined" ? _global : (1, eval)('this');
  38. var rave = typeof _rave !== "undefined" ? _rave : global['rave'];
  39. var window = global;
  40. var rave_externs={},
  41. com_ibm_rave_core_Rave = rave,
  42. com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
  43. com_ibm_rave_core_nativeImpl_Object = rave["_"]["com_ibm_rave_core_nativeImpl_Object"],
  44. com_ibm_rave_core_internal_nativeImpl_Lang = rave["_"]["com_ibm_rave_core_internal_nativeImpl_Lang"],
  45. com_ibm_rave_core_geom_PointStruct = rave["_"]["com_ibm_rave_core_geom_PointStruct"],
  46. com_ibm_rave_core_geom_RectStruct = rave["internal"]["RectStruct"],
  47. com_ibm_rave_core_geom_RaveRect = rave["internal"]["RaveRect"],
  48. com_ibm_rave_core_transform_MatrixUtil = rave["internal"]["MatrixUtil"],
  49. com_ibm_rave_core_scene_SceneNodeType = rave["_"]["com_ibm_rave_core_scene_SceneNodeType"],
  50. com_ibm_rave_core_internal_css_CSSUtil = rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"],
  51. com_ibm_rave_core_internal_css_CSSTransformParser = rave["_"]["com_ibm_rave_core_internal_css_CSSTransformParser"],
  52. com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl = rave["_"]["com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl"],
  53. com_ibm_rave_core_internal_css_CSSParser = rave["_"]["com_ibm_rave_core_internal_css_CSSParser"],
  54. com_ibm_rave_core_context_RaveContextManager = rave["internal"]["RaveContextManager"],
  55. com_ibm_rave_core_context_RaveOperationalMode = rave["internal"]["RaveOperationalMode"],
  56. rave_document = rave["_"]["rave_document"];
  57. // $source: com/ibm/rave/core/internal/util/CollectionsUtil
  58. /************************************************************************
  59. ** IBM Confidential
  60. **
  61. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  62. **
  63. ** (C) Copyright IBM Corp. 2017
  64. **
  65. ** The source code for this program is not published or otherwise divested of its trade secrets,
  66. ** irrespective of what has been deposited with the U.S. Copyright Office.
  67. ************************************************************************/
  68. // GENERATED
  69. var com_ibm_rave_core_internal_util_CollectionsUtil = {
  70. //constructor : function() {}
  71. };
  72. /**
  73. * Removes the value from the list.
  74. * @param (Array) list the list to remove the value from
  75. * @param (Object) value the value to remove
  76. * @return (boolean) <code>true</code> if the value was found in the list, <code>false</code> otherwise
  77. */
  78. com_ibm_rave_core_internal_util_CollectionsUtil.remove = function(list, value) {
  79. var i = list.indexOf(value);
  80. if (i >= 0) {
  81. list.splice(i, 1);
  82. return true;
  83. }
  84. return false;
  85. };
  86. // $source: com/ibm/rave/core/internal/css/CSSStyle
  87. /************************************************************************
  88. ** IBM Confidential
  89. **
  90. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  91. **
  92. ** (C) Copyright IBM Corp. 2017
  93. **
  94. ** The source code for this program is not published or otherwise divested of its trade secrets,
  95. ** irrespective of what has been deposited with the U.S. Copyright Office.
  96. ************************************************************************/
  97. // GENERATED
  98. var com_ibm_rave_core_internal_css_CSSStyle = function(id, name, inheritable) {
  99. this.id = id;
  100. this.name = name;
  101. this.inheritable = inheritable;
  102. };
  103. // $source: com/ibm/rave/core/internal/css/CSSConstants
  104. /************************************************************************
  105. ** IBM Confidential
  106. **
  107. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  108. **
  109. ** (C) Copyright IBM Corp. 2017
  110. **
  111. ** The source code for this program is not published or otherwise divested of its trade secrets,
  112. ** irrespective of what has been deposited with the U.S. Copyright Office.
  113. ************************************************************************/
  114. // GENERATED
  115. var com_ibm_rave_core_internal_css_CSSConstants = {
  116. };
  117. com_ibm_rave_core_internal_css_CSSConstants.TRANSFORM = "transform";
  118. com_ibm_rave_core_internal_css_CSSConstants.ID = "id";
  119. com_ibm_rave_core_internal_css_CSSConstants.IMPORTANT = "important";
  120. com_ibm_rave_core_internal_css_CSSConstants.INITIAL = "initial";
  121. com_ibm_rave_core_internal_css_CSSConstants.INHERIT = "inherit";
  122. com_ibm_rave_core_internal_css_CSSConstants.NONE = "none";
  123. com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT = "transparent";
  124. com_ibm_rave_core_internal_css_CSSConstants.IN_PX = 96.0;
  125. com_ibm_rave_core_internal_css_CSSConstants.PT_IN = 0.0138888889;
  126. com_ibm_rave_core_internal_css_CSSConstants.PC_IN = 0.1666666667;
  127. com_ibm_rave_core_internal_css_CSSConstants.CM_IN = 0.3937007874;
  128. com_ibm_rave_core_internal_css_CSSConstants.MM_IN = 0.0393700787;
  129. com_ibm_rave_core_internal_css_CSSConstants.NORMAL = "normal";
  130. com_ibm_rave_core_internal_css_CSSConstants.BOLD = "bold";
  131. com_ibm_rave_core_internal_css_CSSConstants.OBLIQUE = "oblique";
  132. com_ibm_rave_core_internal_css_CSSConstants.ITALIC = "italic";
  133. com_ibm_rave_core_internal_css_CSSConstants.BOLDER = "bolder";
  134. com_ibm_rave_core_internal_css_CSSConstants.LIGHTER = "lighter";
  135. com_ibm_rave_core_internal_css_CSSConstants.SMALLCAPS = "small-caps";
  136. // $source: com/ibm/rave/render/internal/properties/SceneNodeStyles
  137. /************************************************************************
  138. ** IBM Confidential
  139. **
  140. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  141. **
  142. ** (C) Copyright IBM Corp. 2017
  143. **
  144. ** The source code for this program is not published or otherwise divested of its trade secrets,
  145. ** irrespective of what has been deposited with the U.S. Copyright Office.
  146. ************************************************************************/
  147. // GENERATED
  148. /**
  149. * A list of public style properties for scene nodes. These style attributes are also "presentation attributes", meaning they can be defined as a style (style="fill:red") or an attribute (fill="red").
  150. */
  151. var com_ibm_rave_render_internal_properties_SceneNodeStyles = {
  152. };
  153. /**
  154. * Is the style represented by 'index' one that affects layout? For instance, x, y, etc styles all affect layout.
  155. * @param (int) index style index to search
  156. * @return (boolean) <code>true</code> if this index represents a 'layout' style, <code>false</code> otherwise.
  157. */
  158. com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle = function(index) {
  159. return index <= 27;
  160. };
  161. com_ibm_rave_render_internal_properties_SceneNodeStyles.x = 0;
  162. com_ibm_rave_render_internal_properties_SceneNodeStyles.y = 1;
  163. com_ibm_rave_render_internal_properties_SceneNodeStyles.width = 2;
  164. com_ibm_rave_render_internal_properties_SceneNodeStyles.height = 3;
  165. com_ibm_rave_render_internal_properties_SceneNodeStyles.x1 = 4;
  166. com_ibm_rave_render_internal_properties_SceneNodeStyles.x2 = 5;
  167. com_ibm_rave_render_internal_properties_SceneNodeStyles.r = 6;
  168. com_ibm_rave_render_internal_properties_SceneNodeStyles.y1 = 7;
  169. com_ibm_rave_render_internal_properties_SceneNodeStyles.y2 = 8;
  170. com_ibm_rave_render_internal_properties_SceneNodeStyles.cx = 9;
  171. com_ibm_rave_render_internal_properties_SceneNodeStyles.cy = 10;
  172. com_ibm_rave_render_internal_properties_SceneNodeStyles.transform = 11;
  173. com_ibm_rave_render_internal_properties_SceneNodeStyles.rx = 12;
  174. com_ibm_rave_render_internal_properties_SceneNodeStyles.ry = 13;
  175. com_ibm_rave_render_internal_properties_SceneNodeStyles.line_height = 14;
  176. com_ibm_rave_render_internal_properties_SceneNodeStyles.dx = 15;
  177. com_ibm_rave_render_internal_properties_SceneNodeStyles.dy = 16;
  178. com_ibm_rave_render_internal_properties_SceneNodeStyles.offset = 17;
  179. com_ibm_rave_render_internal_properties_SceneNodeStyles.fx = 18;
  180. com_ibm_rave_render_internal_properties_SceneNodeStyles.fy = 19;
  181. com_ibm_rave_render_internal_properties_SceneNodeStyles.font = 20;
  182. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_family = 21;
  183. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_size = 22;
  184. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_style = 23;
  185. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_weight = 24;
  186. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_variant = 25;
  187. com_ibm_rave_render_internal_properties_SceneNodeStyles.display = 26;
  188. com_ibm_rave_render_internal_properties_SceneNodeStyles.text_anchor = 27;
  189. com_ibm_rave_render_internal_properties_SceneNodeStyles.LAYOUT_INDEX = 27;
  190. com_ibm_rave_render_internal_properties_SceneNodeStyles.fill = 28;
  191. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke = 29;
  192. com_ibm_rave_render_internal_properties_SceneNodeStyles.opacity = 30;
  193. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_width = 31;
  194. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_opacity = 32;
  195. com_ibm_rave_render_internal_properties_SceneNodeStyles.fill_opacity = 33;
  196. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dasharray = 34;
  197. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dashoffset = 35;
  198. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linecap = 36;
  199. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linejoin = 37;
  200. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_miterlimit = 38;
  201. com_ibm_rave_render_internal_properties_SceneNodeStyles.text_decoration = 39;
  202. com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_color = 40;
  203. com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_opacity = 41;
  204. com_ibm_rave_render_internal_properties_SceneNodeStyles.pointer_events = 42;
  205. com_ibm_rave_render_internal_properties_SceneNodeStyles.cursor = 43;
  206. com_ibm_rave_render_internal_properties_SceneNodeStyles.clip_path = 44;
  207. com_ibm_rave_render_internal_properties_SceneNodeStyles.visibility = 45;
  208. com_ibm_rave_render_internal_properties_SceneNodeStyles.text_shadow = 46;
  209. com_ibm_rave_render_internal_properties_SceneNodeStyles.shape_rendering = 47;
  210. com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames = ["x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "transform", "rx", "ry", "line-height", "dx", "dy", "offset", "fx", "fy", "font", "font-family", "font-size", "font-style", "font-weight", "font-variant", "display", "text-anchor", "fill", "stroke", "opacity", "stroke-width", "stroke-opacity", "fill-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "text-decoration", "stop-color", "stop-opacity", "pointer-events", "cursor", "clip-path", "visibility", "text-shadow", "shape-rendering"];
  211. // $source: com/ibm/rave/render/internal/nodes/NodeUtil
  212. /************************************************************************
  213. ** IBM Confidential
  214. **
  215. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  216. **
  217. ** (C) Copyright IBM Corp. 2017
  218. **
  219. ** The source code for this program is not published or otherwise divested of its trade secrets,
  220. ** irrespective of what has been deposited with the U.S. Copyright Office.
  221. ************************************************************************/
  222. // GENERATED
  223. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  224. var com_ibm_rave_render_internal_nodes_NodeUtil = {
  225. };
  226. /**
  227. * Find the referenced scene node matching the expected type. The search is performed from the root of the given context node.
  228. * @param (com.ibm.rave.core.scene.SceneNode) context the context node in which to search
  229. * @param (String) id the node ID to search for
  230. * @param (int[]) expectedTypes array of expected node types (of type from SceneNodeType)
  231. * @return (com.ibm.rave.core.scene.SceneNode) the matching scene node, or <code>null</code> if not found or expected type differs
  232. */
  233. com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode = function(context, id, expectedTypes) {
  234. var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
  235. if (id != null && rootProvider) {
  236. var cm = rootProvider.getCacheManager();
  237. if (cm) {
  238. var match = cm.matchId(1000, id, rootProvider.getRoot());
  239. if (match) {
  240. for (var __i_enFor0 = 0, __len_enFor0 = expectedTypes.length;
  241. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  242. var expectedType = expectedTypes[__i_enFor0];
  243. if (match.rave_getDrawType() == expectedType) {
  244. return match;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. return null;
  251. };
  252. // $source: com/ibm/rave/core/internal/svg/SVGConstants
  253. /************************************************************************
  254. ** IBM Confidential
  255. **
  256. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  257. **
  258. ** (C) Copyright IBM Corp. 2017
  259. **
  260. ** The source code for this program is not published or otherwise divested of its trade secrets,
  261. ** irrespective of what has been deposited with the U.S. Copyright Office.
  262. ************************************************************************/
  263. // GENERATED
  264. var com_ibm_rave_core_internal_svg_SVGConstants = {
  265. };
  266. com_ibm_rave_core_internal_svg_SVGConstants.ELLIPSE = "ellipse";
  267. com_ibm_rave_core_internal_svg_SVGConstants.RECT = "rect";
  268. com_ibm_rave_core_internal_svg_SVGConstants.CIRCLE = "circle";
  269. com_ibm_rave_core_internal_svg_SVGConstants.LINE = "line";
  270. com_ibm_rave_core_internal_svg_SVGConstants.TEXT = "text";
  271. com_ibm_rave_core_internal_svg_SVGConstants.TEXTPATH = "textPath";
  272. com_ibm_rave_core_internal_svg_SVGConstants.G = "g";
  273. com_ibm_rave_core_internal_svg_SVGConstants.PATH = "path";
  274. com_ibm_rave_core_internal_svg_SVGConstants.POLYGON = "polygon";
  275. com_ibm_rave_core_internal_svg_SVGConstants.POLYLINE = "polyline";
  276. com_ibm_rave_core_internal_svg_SVGConstants.DEFS = "defs";
  277. com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT = "linearGradient";
  278. com_ibm_rave_core_internal_svg_SVGConstants.STOP = "stop";
  279. com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT = "radialGradient";
  280. com_ibm_rave_core_internal_svg_SVGConstants.IMAGE = "image";
  281. com_ibm_rave_core_internal_svg_SVGConstants.CLIP_PATH = "clipPath";
  282. com_ibm_rave_core_internal_svg_SVGConstants.STOP_COLOR = "stop-color";
  283. com_ibm_rave_core_internal_svg_SVGConstants.OFFSET = "offset";
  284. com_ibm_rave_core_internal_svg_SVGConstants.TSPAN = "tspan";
  285. //com_ibm_rave_core_internal_svg_SVGConstants.MOVE_TO = "M";
  286. //com_ibm_rave_core_internal_svg_SVGConstants.LINE_TO = "L";
  287. //com_ibm_rave_core_internal_svg_SVGConstants.CLOSE_PATH = "Z";
  288. //com_ibm_rave_core_internal_svg_SVGConstants.PATH_SEPARATOR = ",";
  289. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing
  290. /************************************************************************
  291. ** IBM Confidential
  292. **
  293. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  294. **
  295. ** (C) Copyright IBM Corp. 2015
  296. **
  297. ** The source code for this program is not published or otherwise divested of its trade secrets,
  298. ** irrespective of what has been deposited with the U.S. Copyright Office.
  299. ************************************************************************/
  300. // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils (runtime)
  301. var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing = {
  302. /**
  303. * Split the points into curve segments.
  304. *
  305. * @param ctx
  306. * the canvas context
  307. * @param dash
  308. * the dash array
  309. * @param newPoints
  310. * an array to be filled with curve info
  311. * @param prevResidue
  312. * optional object containing previous dash info
  313. */
  314. splitToDashedBezier : function(points, dash, newPoints, prevResidue) {
  315. var residue = 0, t = 0, da, i = 0;
  316. if (prevResidue) {
  317. da = prevResidue.l;
  318. i = prevResidue.i;
  319. } else {
  320. da = dash[0];
  321. }
  322. while (t < 1) {
  323. // get the 't' corresponding to the given dash value.
  324. t = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.tAtLength(points, da);
  325. if (t == 1) {
  326. var rl = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.computeLength(points);
  327. residue = {
  328. l : da - rl,
  329. i : i
  330. };
  331. }
  332. // split bezier at t: left part is the "dash" curve, right part is the remaining bezier points
  333. var curves = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.splitBezierAtT(points, t);
  334. if (!(i % 2)) {
  335. // only keep the "dash" curve
  336. newPoints.push(curves[0]);
  337. }
  338. points = curves[1];
  339. ++i;
  340. da = dash[i % dash.length];
  341. }
  342. return residue;
  343. },
  344. /**
  345. * Builds a set of bezier (cubic || quadratic)CurveTo' canvas instructions
  346. * that represents a dashed stroke of the specified bezier geometry.
  347. *
  348. * @param ctx
  349. * the canvas context
  350. * @param dash
  351. * the dash array
  352. * @param x
  353. * the start x coordinate
  354. * @param y
  355. * the start y coordinate
  356. * @param points
  357. * the control points
  358. * @param prevResidue
  359. * optional object containing previous dash info
  360. */
  361. toDashedCurveTo : function(ctx, dash, x, y, points, prevResidue) {
  362. var pts = [x, y].concat(points), quadratic = points.length === 4, api = quadratic ? "quadraticCurveTo"
  363. : "bezierCurveTo", curves = [];
  364. var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.splitToDashedBezier(pts, dash, curves, prevResidue);
  365. for (var c = 0; c < curves.length; ++c) {
  366. var curve = curves[c];
  367. ctx.moveTo(curve[0], curve[1]);
  368. ctx[api].apply(ctx, curve.slice(2));
  369. }
  370. return residue;
  371. },
  372. /**
  373. * Builds a set of moveTo/lineTo' canvas instructions that represents a
  374. * dashed stroke of the specified line geometry.
  375. *
  376. * @param ctx
  377. * the canvas context
  378. * @param dash
  379. * the dash array
  380. * @param x1
  381. * the start x coordinate
  382. * @param y1
  383. * the start y coordinate
  384. * @param x2
  385. * the end x coordinate
  386. * @param y2
  387. * the end y coordinate
  388. * @param prevResidue
  389. * optional object containing previous dash info
  390. */
  391. toDashedLineTo : function(ctx, dash, x1, y1, x2, y2, prevResidue) {
  392. var residue = 0, r = 0, da = 0, tlength = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.distance(x1, y1, x2, y2), i = 0, prevx = x1, prevy = y1, x, y;
  393. if (prevResidue) {
  394. da = prevResidue.l;
  395. i = prevResidue.i;
  396. } else {
  397. da += dash[0];
  398. }
  399. while (Math.abs(1 - r) > 0) {
  400. if (da > tlength) {
  401. residue = {
  402. l : da - tlength,
  403. i : i
  404. };
  405. da = tlength;
  406. }
  407. r = da / tlength;
  408. x = x1 + (x2 - x1) * r;
  409. y = y1 + (y2 - y1) * r;
  410. if (!(i++ % 2)) {
  411. ctx.moveTo(prevx, prevy);
  412. ctx.lineTo(x, y);
  413. }
  414. prevx = x;
  415. prevy = y;
  416. da += dash[i % dash.length];
  417. }
  418. if (!residue && i) {
  419. residue = {l: dash[i % dash.length], i: i};
  420. }
  421. return residue;
  422. }
  423. };
  424. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils
  425. /************************************************************************
  426. ** IBM Confidential
  427. **
  428. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  429. **
  430. ** (C) Copyright IBM Corp. 2015
  431. **
  432. ** The source code for this program is not published or otherwise divested of its trade secrets,
  433. ** irrespective of what has been deposited with the U.S. Copyright Office.
  434. ************************************************************************/
  435. // From dojo without the gfx dependency.
  436. // Required to support non-native dashing.
  437. var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils = (function() {
  438. var bu = {},
  439. error = 0.1;
  440. bu.tAtLength = function(points, length){
  441. // summary:
  442. // Returns the t corresponding to the given length for the specified bezier curve.
  443. // points: Number[]
  444. // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
  445. // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
  446. // length: Number
  447. // The length.
  448. var t = 0,
  449. quadratic = points.length == 6,
  450. currentLen = 0,
  451. splitCount = 0,
  452. splitFunc = quadratic ? splitQBezierAtT : splitBezierAtT;
  453. var _compute = function(p, error){
  454. // control points polygon length
  455. var pLen = 0;
  456. for(var i = 0; i < p.length-2; i+=2)
  457. pLen += distance(p[i],p[i+1],p[i+2],p[i+3]);
  458. // chord length
  459. var chord = quadratic ?
  460. distance(points[0],points[1],points[4],points[5]) :
  461. distance(points[0],points[1],points[6],points[7]);
  462. // if needs more approx. or if currentLen is greater than the target length,
  463. // split the curve one more time
  464. if(pLen - chord > error || currentLen + pLen > length + error){
  465. ++splitCount;
  466. var newbezier = splitFunc(p, .5);
  467. // check 1st subpath
  468. _compute(newbezier[0], error);
  469. // the 1st subcurve was the good one, we stop
  470. if(Math.abs(currentLen - length) <= error){
  471. return;
  472. }
  473. // need to continue with the 2nde subcurve
  474. _compute(newbezier[1], error);
  475. return ;
  476. }
  477. currentLen += pLen;
  478. t += 1.0 / (1 << splitCount);
  479. };
  480. if(length)
  481. _compute(points, 0.5);
  482. return t;
  483. };
  484. var computeLength = bu.computeLength = function(/*Array*/points){
  485. // summary:
  486. // Returns the length of the given bezier curve.
  487. // points: Number[]
  488. // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
  489. // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
  490. var quadratic = points.length == 6, pLen=0;
  491. // control points polygon length
  492. for(var i = 0; i < points.length-2; i+=2)
  493. pLen += distance(points[i],points[i+1],points[i+2],points[i+3]);
  494. // chord length
  495. var chord = quadratic ?
  496. distance(points[0],points[1],points[4],points[5]) :
  497. distance(points[0],points[1],points[6],points[7]);
  498. // split polygons until the polygon and the chord are "the same"
  499. if(pLen-chord>error){
  500. var newBeziers = quadratic ? splitQBezierAtT(points,.5) : splitCBezierAtT(points,.5);
  501. var length = computeLength(newBeziers[0], quadratic);
  502. length += computeLength(newBeziers[1], quadratic);
  503. return length;
  504. }
  505. // pLen is close enough, done.
  506. return pLen;
  507. };
  508. var distance = bu.distance = function(x1, y1, x2, y2){
  509. // summary:
  510. // Returns the distance between the specified points.
  511. return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
  512. };
  513. var splitQBezierAtT = function(points, t){
  514. // summary:
  515. // Split a quadratic bezier curve into 2 sub-quadratic beziers at the specified t.
  516. // de Casteljau
  517. var r = 1-t,
  518. r2 = r*r,
  519. t2 = t*t,
  520. p1x = points[0],
  521. p1y = points[1],
  522. cx = points[2],
  523. cy = points[3],
  524. p2x = points[4],
  525. p2y = points[5],
  526. ax = r*p1x + t*cx,
  527. ay = r*p1y + t*cy,
  528. bx = r*cx + t*p2x,
  529. by = r*cy + t*p2y,
  530. px = r2*p1x + 2*r*t*cx + t2*p2x,
  531. py = r2*p1y + 2*r*t*cy + t2*p2y;
  532. return [
  533. [
  534. p1x, p1y,
  535. ax, ay,
  536. px, py
  537. ],
  538. [
  539. px, py,
  540. bx, by,
  541. p2x, p2y
  542. ]
  543. ];
  544. };
  545. var splitCBezierAtT = function(points, t){
  546. // summary:
  547. // Split a cubic bezier curve into 2 sub-cubic beziers at the specified t.
  548. // de Casteljau
  549. var r = 1-t,
  550. r2 = r*r,
  551. r3 = r2*r,
  552. t2 = t*t,
  553. t3 = t2*t,
  554. p1x = points[0],
  555. p1y = points[1],
  556. c1x = points[2],
  557. c1y = points[3],
  558. c2x = points[4],
  559. c2y = points[5],
  560. p2x = points[6],
  561. p2y = points[7],
  562. ax = r*p1x + t*c1x,
  563. ay = r*p1y + t*c1y,
  564. cx = r*c2x + t*p2x,
  565. cy = r*c2y + t*p2y,
  566. mx = r2*p1x + 2*r*t*c1x + t2*c2x,
  567. my = r2*p1y + 2*r*t*c1y + t2*c2y,
  568. nx = r2*c1x + 2*r*t*c2x + t2*p2x,
  569. ny = r2*c1y + 2*r*t*c2y + t2*p2y,
  570. px = r3*p1x + 3*r2*t*c1x + 3*r*t2*c2x+t3*p2x,
  571. py = r3*p1y + 3*r2*t*c1y + 3*r*t2*c2y+t3*p2y;
  572. return [
  573. [
  574. p1x, p1y,
  575. ax, ay,
  576. mx, my,
  577. px, py
  578. ],
  579. [
  580. px, py,
  581. nx, ny,
  582. cx, cy,
  583. p2x, p2y
  584. ]
  585. ];
  586. };
  587. var splitBezierAtT = bu.splitBezierAtT = function(points, t){
  588. return points.length == 6 ? splitQBezierAtT(points, t) : splitCBezierAtT(points, t);
  589. };
  590. return bu;
  591. })();
  592. // $source: com/ibm/rave/render/internal/select/jsoup/select/QueryParser
  593. /************************************************************************
  594. ** IBM Confidential
  595. **
  596. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  597. **
  598. ** (C) Copyright IBM Corp. 2017
  599. **
  600. ** The source code for this program is not published or otherwise divested of its trade secrets,
  601. ** irrespective of what has been deposited with the U.S. Copyright Office.
  602. ************************************************************************/
  603. // GENERATED
  604. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  605. //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager
  606. //@import com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator (runtime) // new
  607. //@import com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator (runtime) // new
  608. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (runtime) // new
  609. //@import com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue (runtime) // new, unescape
  610. /**
  611. * Parses a CSS selector into an Evaluator tree.
  612. */
  613. var com_ibm_rave_render_internal_select_jsoup_select_QueryParser = com_ibm_rave_core_nativeImpl_Declare({
  614. //tq : null,
  615. //evals : null,
  616. constructor : function(query) {
  617. this.evals = [];
  618. /**
  619. * Create a new QueryParser.
  620. * @param (String) query CSS query
  621. */
  622. {
  623. this.tq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(query);
  624. }
  625. },
  626. getQueryParserRegExps : function() {
  627. var queryParserRegExps = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("QUERY_PARSER_REG_EXP_KEY");
  628. if (!queryParserRegExps) {
  629. queryParserRegExps = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps();
  630. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("QUERY_PARSER_REG_EXP_KEY", queryParserRegExps);
  631. }
  632. return queryParserRegExps;
  633. },
  634. /**
  635. * Parse the query
  636. * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
  637. */
  638. parse$1 : function() {
  639. this.tq.consumeWhitespace();
  640. if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  641. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root());
  642. this.combinator(this.tq.consume$0());
  643. } else {
  644. if (!(this.findElements())) {
  645. return null;
  646. }
  647. }
  648. while (!(this.tq.isEmpty())) {
  649. var seenWhite = this.tq.consumeWhitespace();
  650. if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  651. this.combinator(this.tq.consume$0());
  652. } else if (seenWhite) {
  653. this.combinator(32);
  654. } else {
  655. if (!(this.findElements())) {
  656. return null;
  657. }
  658. }
  659. }
  660. if (this.evals.length == 1) {
  661. return this.evals[0];
  662. }
  663. return new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
  664. },
  665. combinator : function(combinator) {
  666. this.tq.consumeWhitespace();
  667. var subQuery = this.consumeSubQuery();
  668. var rootEval;
  669. var currentEval;
  670. var newEval = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery);
  671. var replaceRightMost = false;
  672. if (this.evals.length == 1) {
  673. rootEval = currentEval = this.evals[0];
  674. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(rootEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or) && combinator != 44) {
  675. currentEval = (currentEval).rightMostEvaluator();
  676. replaceRightMost = true;
  677. }
  678. } else {
  679. rootEval = currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
  680. }
  681. this.evals = [];
  682. if (combinator == 62) {
  683. currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent(currentEval)]);
  684. } else if (combinator == 32) {
  685. currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent(currentEval)]);
  686. } else if (combinator == 43) {
  687. currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling(currentEval)]);
  688. } else if (combinator == 126) {
  689. currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling(currentEval)]);
  690. } else if (combinator == 44) {
  691. var or;
  692. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(currentEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or)) {
  693. or = currentEval;
  694. or.add(newEval);
  695. } else {
  696. or = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or(null);
  697. or.add(currentEval);
  698. or.add(newEval);
  699. }
  700. currentEval = or;
  701. } else {
  702. return;
  703. }
  704. if (replaceRightMost) {
  705. (rootEval).replaceRightMostEvaluator(currentEval);
  706. } else {
  707. rootEval = currentEval;
  708. }
  709. this.evals.push(rootEval);
  710. },
  711. consumeSubQuery : function() {
  712. var sq = "";
  713. while (!(this.tq.isEmpty())) {
  714. if (this.tq.matchesChar(40)) {
  715. sq += "(" + this.tq.chompBalanced(40, 41) + ")";
  716. } else if (this.tq.matchesChar(91)) {
  717. sq += "[" + this.tq.chompBalanced(91, 93) + "]";
  718. } else if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  719. break;
  720. } else {
  721. sq += String.fromCharCode(this.tq.consume$0());
  722. }
  723. }
  724. return sq;
  725. },
  726. findElements : function() {
  727. if (this.tq.matchCharChomp(46)) {
  728. this.byClass();
  729. } else if (this.tq.matchCharChomp(35)) {
  730. this.byId();
  731. } else if (this.tq.matchCharChomp(42)) {
  732. this.allElements();
  733. } else if (this.tq.matchesChar(91)) {
  734. this.byAttribute();
  735. } else if (this.tq.matchesWord()) {
  736. this.byTag();
  737. } else if (this.tq.matchesChar(58)) {
  738. if (this.tq.matchChomp(":lt(")) {
  739. this.indexLessThan();
  740. } else if (this.tq.matchChomp(":gt(")) {
  741. this.indexGreaterThan();
  742. } else if (this.tq.matchChomp(":eq(")) {
  743. this.indexEquals();
  744. } else if (this.tq.matches(":has(")) {
  745. this.has();
  746. } else if (this.tq.matches(":contains(")) {
  747. this.contains(false);
  748. } else if (this.tq.matches(":containsOwn(")) {
  749. this.contains(true);
  750. } else if (this.tq.matches(":matches(")) {
  751. this.matches(false);
  752. } else if (this.tq.matches(":matchesOwn(")) {
  753. this.matches(true);
  754. } else if (this.tq.matches(":not(")) {
  755. this.not();
  756. } else if (this.tq.matchChomp(":nth-child(")) {
  757. this.cssNthChild(false, false);
  758. } else if (this.tq.matchChomp(":nth-last-child(")) {
  759. this.cssNthChild(true, false);
  760. } else if (this.tq.matchChomp(":nth-of-type(")) {
  761. this.cssNthChild(false, true);
  762. } else if (this.tq.matchChomp(":nth-last-of-type(")) {
  763. this.cssNthChild(true, true);
  764. } else if (this.tq.matchChomp(":first-child")) {
  765. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild());
  766. } else if (this.tq.matchChomp(":last-child")) {
  767. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild());
  768. } else if (this.tq.matchChomp(":first-of-type")) {
  769. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(0, 1));
  770. } else if (this.tq.matchChomp(":last-of-type")) {
  771. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(0, 1));
  772. } else if (this.tq.matchChomp(":only-child")) {
  773. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild());
  774. } else if (this.tq.matchChomp(":only-of-type")) {
  775. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType());
  776. } else if (this.tq.matchChomp(":empty")) {
  777. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty());
  778. } else if (this.tq.matchChomp(":root")) {
  779. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot());
  780. } else {
  781. return false;
  782. }
  783. return true;
  784. } else {
  785. return false;
  786. }
  787. return true;
  788. },
  789. byId : function() {
  790. var id = this.tq.consumeCssIdentifier();
  791. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id(id));
  792. },
  793. byClass : function() {
  794. var className = this.tq.consumeCssIdentifier();
  795. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class(className.trim()));
  796. },
  797. byTag : function() {
  798. var tagName = this.tq.consumeElementSelector();
  799. if (0 <= tagName.indexOf("|")) {
  800. tagName = tagName.replace("|", ":");
  801. }
  802. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag(tagName.trim()));
  803. },
  804. byAttribute : function() {
  805. var cq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(this.tq.chompBalanced(91, 93));
  806. var key = cq.consumeToAny.apply(cq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals);
  807. cq.consumeWhitespace();
  808. if (cq.isEmpty()) {
  809. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute(key));
  810. } else {
  811. if (cq.matchChomp("=")) {
  812. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue(key, cq.remainder()));
  813. } else if (cq.matchChomp("!=")) {
  814. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot(key, cq.remainder()));
  815. } else if (cq.matchChomp("^=")) {
  816. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting(key, cq.remainder()));
  817. } else if (cq.matchChomp("$=")) {
  818. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding(key, cq.remainder()));
  819. } else if (cq.matchChomp("*=")) {
  820. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining(key, cq.remainder()));
  821. } else if (cq.matchChomp("~=")) {
  822. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching(key, new RegExp(cq.remainder(), "i")));
  823. } else {
  824. return;
  825. }
  826. }
  827. },
  828. allElements : function() {
  829. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements());
  830. },
  831. indexLessThan : function() {
  832. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan(this.consumeIndex()));
  833. },
  834. indexGreaterThan : function() {
  835. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan(this.consumeIndex()));
  836. },
  837. indexEquals : function() {
  838. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals(this.consumeIndex()));
  839. },
  840. cssNthChild : function(backwards, ofType) {
  841. var argS = this.tq.chompTo(")").trim().toLowerCase();
  842. var queryParserRegExps = this.getQueryParserRegExps();
  843. var mAB = queryParserRegExps.NTH_AB.exec(argS);
  844. var mB = queryParserRegExps.NTH_B.exec(argS);
  845. var a, b;
  846. if ("odd" == argS) {
  847. a = 2;
  848. b = 1;
  849. } else if ("even" == argS) {
  850. a = 2;
  851. b = 0;
  852. } else if (mAB && mAB.length > 0) {
  853. a = mAB[3] != null ? ~~ (mAB[1].replace("^\\+", "")) : 1;
  854. b = mAB[4] != null ? ~~ (mAB[4].replace("^\\+", "")) : 1;
  855. } else if (mB && mB.length > 0) {
  856. a = 0;
  857. b = ~~ (mB[0].replace("^\\+", ""));
  858. } else {
  859. return;
  860. }
  861. if (ofType) {
  862. if (backwards) {
  863. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(a, b));
  864. } else {
  865. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(a, b));
  866. }
  867. } else {
  868. if (backwards) {
  869. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild(a, b));
  870. } else {
  871. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild(a, b));
  872. }
  873. }
  874. },
  875. consumeIndex : function() {
  876. var indexS = this.tq.chompTo(")").trim();
  877. return parseInt(indexS);
  878. },
  879. has : function() {
  880. this.tq.consume$1(":has");
  881. var subQuery = this.tq.chompBalanced(40, 41);
  882. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery)));
  883. },
  884. contains : function(own) {
  885. this.tq.consume$1(own ? ":containsOwn" : ":contains");
  886. var searchText = com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape(this.tq.chompBalanced(40, 41));
  887. if (own) {
  888. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText(searchText));
  889. } else {
  890. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText(searchText));
  891. }
  892. },
  893. matches : function(own) {
  894. this.tq.consume$1(own ? ":matchesOwn" : ":matches");
  895. var regex = this.tq.chompBalanced(40, 41);
  896. if (own) {
  897. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn(new RegExp(regex, "")));
  898. } else {
  899. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches(new RegExp(regex, "")));
  900. }
  901. },
  902. not : function() {
  903. this.tq.consume$1(":not");
  904. var subQuery = this.tq.chompBalanced(40, 41);
  905. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery)));
  906. },
  907. parse : function() {
  908. var args = arguments;
  909. return this.parse$1();
  910. }
  911. });
  912. /**
  913. * Parse a CSS query into an Evaluator.
  914. * @param (String) query CSS query
  915. * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
  916. */
  917. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0 = function(query) {
  918. var p = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser(query);
  919. return p.parse$1();
  920. };
  921. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse = function(a0) {
  922. var args = arguments;
  923. return com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(a0);
  924. };
  925. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps = com_ibm_rave_core_nativeImpl_Declare({
  926. //NTH_AB : null,
  927. //NTH_B : null,
  928. constructor : function() {
  929. this.NTH_AB = new RegExp("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d*)?", "i");
  930. this.NTH_B = new RegExp("(\\+|-)?(\\d+)", "");
  931. }
  932. });
  933. //com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QUERY_PARSER_REG_EXP_KEY = "QUERY_PARSER_REG_EXP_KEY";
  934. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators = [44, 62, 43, 126, 32];
  935. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals = ["=", "!=", "^=", "$=", "*=", "~="];
  936. // $source: com/ibm/rave/render/internal/select/jsoup/select/Evaluator
  937. /************************************************************************
  938. ** IBM Confidential
  939. **
  940. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  941. **
  942. ** (C) Copyright IBM Corp. 2017
  943. **
  944. ** The source code for this program is not published or otherwise divested of its trade secrets,
  945. ** irrespective of what has been deposited with the U.S. Copyright Office.
  946. ************************************************************************/
  947. // GENERATED
  948. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  949. /**
  950. * Evaluates that an SceneNode matches the selector.
  951. */
  952. var com_ibm_rave_render_internal_select_jsoup_select_Evaluator = com_ibm_rave_core_nativeImpl_Declare({
  953. /**
  954. * Test if a SceneNode has been cached for this evaluator.
  955. * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) manager The external cache manager
  956. * @param (com.ibm.rave.core.scene.SceneNode) element The element currently being tested for a match.
  957. * @return (Array) list of cached scene nodes.
  958. */
  959. cached : function(manager, element) {
  960. return null;
  961. }
  962. //constructor : function() {},
  963. /**
  964. * Test if the SceneNode meets the evaluator's requirements.
  965. * @param (com.ibm.rave.core.scene.SceneNode) root Root of the matching subtree
  966. * @param (com.ibm.rave.core.scene.SceneNode) element tested SceneNode
  967. * @return (boolean) <code>true</code> if it matches, <code>false</code> otherwise.
  968. */
  969. //matches : function(root, element) {}
  970. });
  971. /**
  972. * Evaluator for tag name
  973. */
  974. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  975. //tagName : null,
  976. constructor : function(tagName) {
  977. this.tagName = tagName;
  978. },
  979. matches : function(root, element) {
  980. if (root == element) {
  981. return false;
  982. }
  983. return (element.rave_getName() == this.tagName);
  984. }
  985. });
  986. /**
  987. * Evaluator for SceneNode id
  988. */
  989. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  990. //id : null,
  991. constructor : function(id) {
  992. this.id = id;
  993. },
  994. matches : function(root, element) {
  995. return (this.id == (element).getId());
  996. },
  997. cached : function(cache, root) {
  998. if (!cache) {
  999. return null;
  1000. }
  1001. var cached = cache.matchId(1000, this.id, root);
  1002. return !cached ? null : [cached];
  1003. }
  1004. });
  1005. /**
  1006. * Evaluator for SceneNode class
  1007. */
  1008. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1009. //className : null,
  1010. constructor : function(className) {
  1011. this.className = className;
  1012. },
  1013. cached : function(cache, root) {
  1014. return null;
  1015. },
  1016. matches : function(root, element) {
  1017. return (element).getClassList().indexOf(this.className)> -1;
  1018. }
  1019. });
  1020. /**
  1021. * Abstract evaluator for attribute name/value matching
  1022. */
  1023. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1024. //key : null,
  1025. //value : null,
  1026. isIdKey : false,
  1027. isClassKey : false,
  1028. constructor : function(key, value) {
  1029. var _value = value;
  1030. this.key = key.trim().toLowerCase();
  1031. if (_value != null) {
  1032. if ((_value.match("^[\"'].*") && _value.match(".*[\"']$"))) {
  1033. _value = _value.substring(1, _value.length - 1);
  1034. }
  1035. this.value = _value.trim();
  1036. }
  1037. if (this.key == "id") {
  1038. this.isIdKey = true;
  1039. } else if (this.key == "class") {
  1040. this.isClassKey = true;
  1041. }
  1042. },
  1043. cached : function(node, root) {
  1044. return null;
  1045. }
  1046. });
  1047. /**
  1048. * Evaluator for attribute name matching
  1049. */
  1050. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1051. matches : function(root, element) {
  1052. if (root == element) {
  1053. return false;
  1054. }
  1055. if (this.isIdKey) {
  1056. return (element).getId() != null;
  1057. }
  1058. return element.getAttribute(this.key) != null;
  1059. },
  1060. cached : function(node, root) {
  1061. return null;
  1062. }
  1063. //constructor : function(key) {}
  1064. });
  1065. /**
  1066. * Evaluator for attribute name/value matching
  1067. */
  1068. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1069. cached : function(cache, root) {
  1070. if (!cache) {
  1071. return null;
  1072. }
  1073. if (this.isIdKey) {
  1074. var cached = cache.matchId(1000, this.value, root);
  1075. return !cached ? null : [cached];
  1076. } else if (this.isClassKey) {
  1077. return cache.matchClass(1001, this.value, root);
  1078. }
  1079. return null;
  1080. },
  1081. matches : function(root, element) {
  1082. if (root == element) {
  1083. return false;
  1084. }
  1085. if (this.isIdKey) {
  1086. return this.value == (element).getId();
  1087. }
  1088. var val = element.getAttribute(this.key);
  1089. var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
  1090. return this.value.toUpperCase() == attributeValue.toUpperCase();
  1091. }
  1092. //constructor : function(key, value) {}
  1093. });
  1094. /**
  1095. * Evaluator for attribute name != value matching
  1096. */
  1097. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1098. matches : function(root, element) {
  1099. var val = element.getAttribute(this.key);
  1100. var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
  1101. return !(this.value.toUpperCase() == attributeValue.toUpperCase());
  1102. }
  1103. //constructor : function(key, value) {}
  1104. });
  1105. /**
  1106. * Evaluator for attribute name/value matching (value prefix)
  1107. */
  1108. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1109. matches : function(root, element) {
  1110. var attributeValue = element.getAttribute(this.key);
  1111. if (attributeValue == null) {
  1112. return false;
  1113. }
  1114. var elementValue = ""+(attributeValue);
  1115. return elementValue.match("^" + this.value + ".*");
  1116. }
  1117. //constructor : function(key, value) {}
  1118. });
  1119. /**
  1120. * Evaluator for attribute name/value matching (value ending)
  1121. */
  1122. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1123. matches : function(root, element) {
  1124. var attributeVal = element.getAttribute(this.key);
  1125. if (attributeVal == null) {
  1126. return false;
  1127. }
  1128. var elementValue = ""+(attributeVal);
  1129. return elementValue.match(".*" + this.value + "$");
  1130. }
  1131. //constructor : function(key, value) {}
  1132. });
  1133. /**
  1134. * Evaluator for attribute name/value matching (value containing)
  1135. */
  1136. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, {
  1137. matches : function(root, element) {
  1138. var attributeValue = element.getAttribute(this.key);
  1139. if (attributeValue == null) {
  1140. return false;
  1141. }
  1142. var elementValue = ""+(attributeValue);
  1143. return 0 <= elementValue.indexOf(this.value);
  1144. }
  1145. //constructor : function(key, value) {}
  1146. });
  1147. /**
  1148. * Evaluator for attribute name/value matching (value regex matching)
  1149. */
  1150. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1151. //key : null,
  1152. //pattern : null,
  1153. constructor : function(key, pattern) {
  1154. this.key = key.trim().toLowerCase();
  1155. this.pattern = pattern;
  1156. },
  1157. matches : function(root, element) {
  1158. return element.getAttribute(this.key) != null && this.pattern.test(""+(element.getAttribute(this.key)));
  1159. }
  1160. });
  1161. /**
  1162. * Evaluator for any / all SceneNode matching
  1163. */
  1164. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1165. matches : function(root, element) {
  1166. return element != root;
  1167. }
  1168. });
  1169. /**
  1170. * Abstract evaluator for sibling index matching
  1171. * @author ant
  1172. */
  1173. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1174. index : 0,
  1175. constructor : function(index) {
  1176. this.index = index;
  1177. }
  1178. });
  1179. /**
  1180. * Evaluator for matching by sibling index number (e < idx)
  1181. */
  1182. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
  1183. matches : function(root, element) {
  1184. return (element).getSiblingIndex() < this.index;
  1185. }
  1186. //constructor : function(index) {}
  1187. });
  1188. /**
  1189. * Evaluator for matching by sibling index number (e > idx)
  1190. */
  1191. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
  1192. matches : function(root, element) {
  1193. return (element).getSiblingIndex() > this.index;
  1194. }
  1195. //constructor : function(index) {}
  1196. });
  1197. /**
  1198. * Evaluator for matching by sibling index number (e = idx)
  1199. */
  1200. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, {
  1201. matches : function(root, element) {
  1202. return (element).getSiblingIndex() == this.index;
  1203. }
  1204. //constructor : function(index) {}
  1205. });
  1206. /**
  1207. * Evaluator for matching the last sibling (css :last-child)
  1208. */
  1209. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1210. matches : function(root, element) {
  1211. var p = element.rave_getParentNode();
  1212. return element != root && p && ((element).getSiblingIndex() == p.rave_getChildNodes().length - 1);
  1213. }
  1214. });
  1215. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1216. a : 0, b : 0,
  1217. constructor : function(a, b) {
  1218. this.a = a;
  1219. this.b = b;
  1220. },
  1221. matches : function(root, element) {
  1222. var p = element.rave_getParentNode();
  1223. if (!p) {
  1224. return false;
  1225. }
  1226. var pos = this.calculatePosition(root, element);
  1227. if (this.a == 0) {
  1228. return pos == this.b;
  1229. }
  1230. return (pos - this.b) * this.a >= 0 && (pos - this.b) % this.a == 0;
  1231. }
  1232. //calculatePosition : function(root, element) {}
  1233. });
  1234. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
  1235. calculatePosition : function(root, element) {
  1236. var pos = 0;
  1237. var family = element.rave_getParentNode().rave_getChildNodes();
  1238. for (var i = (element).getSiblingIndex(); i < family.length; ++i) {
  1239. if (family[i].rave_getName() == element.rave_getName()) {
  1240. pos++;
  1241. }
  1242. }
  1243. return pos;
  1244. }
  1245. //constructor : function(a, b) {}
  1246. });
  1247. /**
  1248. * css pseudo class nth-of-type
  1249. */
  1250. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
  1251. calculatePosition : function(root, element) {
  1252. var pos = 0;
  1253. var family = element.rave_getParentNode().rave_getChildNodes();
  1254. for (var i = 0; i < family.length; ++i) {
  1255. if (family[i].rave_getName() == element.rave_getName()) {
  1256. pos++;
  1257. }
  1258. if (family[i] == element) {
  1259. break;
  1260. }
  1261. }
  1262. return pos;
  1263. }
  1264. //constructor : function(a, b) {}
  1265. });
  1266. /**
  1267. * css-compatible Evaluator for :eq (css :nth-child)
  1268. * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
  1269. */
  1270. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
  1271. calculatePosition : function(root, element) {
  1272. return (element).getSiblingIndex() + 1;
  1273. }
  1274. //constructor : function(a, b) {}
  1275. });
  1276. /**
  1277. * css pseudo class :nth-last-child)
  1278. * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
  1279. */
  1280. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, {
  1281. calculatePosition : function(root, element) {
  1282. return element.rave_getParentNode().rave_getChildNodes().length - (element).getSiblingIndex();
  1283. }
  1284. //constructor : function(a, b) {}
  1285. });
  1286. /**
  1287. * Evaluator for matching the first sibling (css :first-child)
  1288. */
  1289. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1290. matches : function(root, element) {
  1291. var p = element.rave_getParentNode();
  1292. return p && (element).getSiblingIndex() == 0;
  1293. }
  1294. });
  1295. /**
  1296. * css3 pseudo-class :root
  1297. * @see <a href="http://www.w3.org/TR/selectors/#root-pseudo">:root selector</a>
  1298. */
  1299. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1300. matches : function(root, element) {
  1301. return !element.rave_getParentNode();
  1302. }
  1303. });
  1304. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1305. matches : function(root, element) {
  1306. var p = element.rave_getParentNode();
  1307. return p && !element.rave_getPreviousSibling() && !element.rave_getNextSibling();
  1308. }
  1309. });
  1310. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1311. matches : function(root, element) {
  1312. var p = element.rave_getParentNode();
  1313. if (!p) {
  1314. return false;
  1315. }
  1316. var pos = 0;
  1317. var family = p.rave_getChildNodes();
  1318. for (var i = 0; i < family.length; ++i) {
  1319. if (family[i].rave_getName() == element.rave_getName()) {
  1320. pos++;
  1321. }
  1322. }
  1323. return pos == 1;
  1324. }
  1325. });
  1326. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1327. matches : function(root, element) {
  1328. return !(element.rave_hasChildNodes());
  1329. }
  1330. });
  1331. /**
  1332. * Evaluator for matching SceneNode (and its descendants) text
  1333. */
  1334. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1335. //searchText : null,
  1336. constructor : function(searchText) {
  1337. this.searchText = searchText.toLowerCase();
  1338. },
  1339. matches : function(root, element) {
  1340. if (root == element) {
  1341. return false;
  1342. }
  1343. if (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)) {
  1344. return true;
  1345. }
  1346. for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1347. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1348. var child = __exp_enFor0[__i_enFor0];
  1349. if (this.matches(element, child)) {
  1350. return true;
  1351. }
  1352. }
  1353. return false;
  1354. }
  1355. });
  1356. /**
  1357. * Evaluator for matching SceneNode's own text
  1358. */
  1359. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1360. //searchText : null,
  1361. constructor : function(searchText) {
  1362. this.searchText = searchText.toLowerCase();
  1363. },
  1364. matches : function(root, element) {
  1365. return (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText));
  1366. }
  1367. });
  1368. /**
  1369. * Evaluator for matching SceneNode (and its descendants) text with regex
  1370. */
  1371. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1372. //pattern : null,
  1373. constructor : function(pattern) {
  1374. this.pattern = pattern;
  1375. },
  1376. matches : function(root, element) {
  1377. if (this.pattern.test(element.rave_getText())) {
  1378. return true;
  1379. }
  1380. for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1381. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1382. var child = __exp_enFor0[__i_enFor0];
  1383. if (this.matches(element, child)) {
  1384. return true;
  1385. }
  1386. }
  1387. return false;
  1388. }
  1389. });
  1390. /**
  1391. * Evaluator for matching SceneNode's own text with regex
  1392. */
  1393. com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1394. //pattern : null,
  1395. constructor : function(pattern) {
  1396. this.pattern = pattern;
  1397. },
  1398. matches : function(root, element) {
  1399. return this.pattern.test(element.rave_getText());
  1400. }
  1401. });
  1402. // $source: com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator
  1403. /************************************************************************
  1404. ** IBM Confidential
  1405. **
  1406. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1407. **
  1408. ** (C) Copyright IBM Corp. 2017
  1409. **
  1410. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1411. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1412. ************************************************************************/
  1413. // GENERATED
  1414. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1415. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // new, superclass
  1416. //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
  1417. /**
  1418. * Base structural evaluator.
  1419. */
  1420. var com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1421. //evaluator : null
  1422. });
  1423. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1424. matches : function(root, element) {
  1425. return root == element;
  1426. }
  1427. });
  1428. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1429. constructor : function(evaluator) {
  1430. this.evaluator = evaluator;
  1431. },
  1432. matches : function(root, element) {
  1433. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements(), element, null), __len_enFor0 = __exp_enFor0.length;
  1434. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1435. var e = __exp_enFor0[__i_enFor0];
  1436. if (e != element && this.evaluator.matches(root, e)) {
  1437. return true;
  1438. }
  1439. }
  1440. return false;
  1441. }
  1442. });
  1443. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1444. constructor : function(evaluator) {
  1445. this.evaluator = evaluator;
  1446. },
  1447. matches : function(root, node) {
  1448. return !(this.evaluator.matches(root, node));
  1449. }
  1450. });
  1451. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1452. constructor : function(evaluator) {
  1453. this.evaluator = evaluator;
  1454. },
  1455. matches : function(root, element) {
  1456. if (root == element) {
  1457. return false;
  1458. }
  1459. var parent = element.rave_getParentNode();
  1460. while (parent) {
  1461. if (this.evaluator.matches(root, parent)) {
  1462. return true;
  1463. }
  1464. parent = parent.rave_getParentNode();
  1465. }
  1466. return false;
  1467. }
  1468. });
  1469. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1470. constructor : function(evaluator) {
  1471. this.evaluator = evaluator;
  1472. },
  1473. matches : function(root, element) {
  1474. if (root == element) {
  1475. return false;
  1476. }
  1477. var parent = element.rave_getParentNode();
  1478. return parent && this.evaluator.matches(root, parent);
  1479. }
  1480. });
  1481. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1482. constructor : function(evaluator) {
  1483. this.evaluator = evaluator;
  1484. },
  1485. matches : function(root, element) {
  1486. if (root == element) {
  1487. return false;
  1488. }
  1489. var prev = element.rave_getPreviousSibling();
  1490. while (prev) {
  1491. if (this.evaluator.matches(root, prev)) {
  1492. return true;
  1493. }
  1494. prev = prev.rave_getPreviousSibling();
  1495. }
  1496. return false;
  1497. }
  1498. });
  1499. com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, {
  1500. constructor : function(evaluator) {
  1501. this.evaluator = evaluator;
  1502. },
  1503. matches : function(root, element) {
  1504. if (root == element) {
  1505. return false;
  1506. }
  1507. var prev = element.rave_getPreviousSibling();
  1508. return prev && this.evaluator.matches(root, prev);
  1509. }
  1510. });
  1511. // $source: com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor
  1512. /************************************************************************
  1513. ** IBM Confidential
  1514. **
  1515. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1516. **
  1517. ** (C) Copyright IBM Corp. 2017
  1518. **
  1519. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1520. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1521. ************************************************************************/
  1522. // GENERATED
  1523. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1524. /**
  1525. * Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.
  1526. */
  1527. var com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor = com_ibm_rave_core_nativeImpl_Declare({
  1528. //visitor : null,
  1529. /**
  1530. * Create a new traversor.
  1531. * @param (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) visitor a class implementing the {@link (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) NodeVisitor} interface, to be called when visiting each node.
  1532. */
  1533. constructor : function(visitor) {
  1534. this.visitor = visitor;
  1535. },
  1536. /**
  1537. * Start a depth-first traverse of the root and all of its descendants.
  1538. * @param (com.ibm.rave.core.scene.SceneNode) root the root node point to traverse.
  1539. */
  1540. traverse : function(root) {
  1541. if (!root) {
  1542. return;
  1543. }
  1544. var node = root;
  1545. var depth = 0;
  1546. this.visit(node, depth);
  1547. },
  1548. visit : function(node, depth) {
  1549. if (!node) {
  1550. return;
  1551. }
  1552. this.visitor.head(node, depth);
  1553. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1554. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1555. var child = __exp_enFor0[__i_enFor0];
  1556. this.visit(child, depth + 1);
  1557. }
  1558. this.visitor.tail(node, depth);
  1559. }
  1560. });
  1561. // $source: com/ibm/rave/render/internal/select/jsoup/select/Collector
  1562. /************************************************************************
  1563. ** IBM Confidential
  1564. **
  1565. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1566. **
  1567. ** (C) Copyright IBM Corp. 2017
  1568. **
  1569. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1570. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1571. ************************************************************************/
  1572. // GENERATED
  1573. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1574. //@import com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor (static) // new
  1575. /**
  1576. * Collects a list of elements that match the supplied criteria.
  1577. * @author Jonathan Hedley
  1578. */
  1579. var com_ibm_rave_render_internal_select_jsoup_select_Collector = com_ibm_rave_core_nativeImpl_Declare({
  1580. //constructor : function() {}
  1581. });
  1582. /**
  1583. * Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.
  1584. * @param (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) evaluator Evaluator to test elements against
  1585. * @param (com.ibm.rave.core.scene.SceneNode) root root of tree to descend
  1586. * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache
  1587. * @return (Array) list of matches; empty if none
  1588. */
  1589. com_ibm_rave_render_internal_select_jsoup_select_Collector.collect = function(evaluator, root, cache) {
  1590. var elements = [];
  1591. if (evaluator) {
  1592. var cachedVals = evaluator.cached(cache, root);
  1593. if (cachedVals) {
  1594. for (var __i_enFor0 = 0, __exp_enFor0 = cachedVals, __len_enFor0 = __exp_enFor0.length;
  1595. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1596. var node = __exp_enFor0[__i_enFor0];
  1597. elements.push(node);
  1598. }
  1599. } else {
  1600. new com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor(new com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator(root, elements, evaluator)).traverse(root);
  1601. }
  1602. }
  1603. return elements;
  1604. };
  1605. com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator = com_ibm_rave_core_nativeImpl_Declare({
  1606. //root : null,
  1607. //elements : null,
  1608. //evaluator : null,
  1609. constructor : function(root, elements, evaluator) {
  1610. this.root = root;
  1611. this.elements = elements;
  1612. this.evaluator = evaluator;
  1613. },
  1614. head : function(node, depth) {
  1615. if (this.evaluator && this.evaluator.matches(this.root, node)) {
  1616. this.elements.push(node);
  1617. }
  1618. },
  1619. tail : function(node, depth) {}
  1620. });
  1621. // $source: com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator
  1622. /************************************************************************
  1623. ** IBM Confidential
  1624. **
  1625. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1626. **
  1627. ** (C) Copyright IBM Corp. 2017
  1628. **
  1629. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1630. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1631. ************************************************************************/
  1632. // GENERATED
  1633. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1634. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // superclass
  1635. /**
  1636. * Base combining (and, or) evaluator.
  1637. */
  1638. var com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, {
  1639. //evaluators : null,
  1640. num : 0,
  1641. constructor : function(evaluators) {
  1642. this.evaluators = [];
  1643. {
  1644. if (evaluators) {
  1645. for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
  1646. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1647. var evaluator = __exp_enFor0[__i_enFor0];
  1648. this.evaluators.push(evaluator);
  1649. }
  1650. }
  1651. this.updateNumEvaluators();
  1652. }
  1653. },
  1654. rightMostEvaluator : function() {
  1655. return this.num > 0 ? this.evaluators[this.num - 1] : null;
  1656. },
  1657. replaceRightMostEvaluator : function(replacement) {
  1658. this.evaluators[this.num - 1] = replacement;
  1659. },
  1660. updateNumEvaluators : function() {
  1661. this.num = this.evaluators.length;
  1662. }
  1663. });
  1664. com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, {
  1665. matches : function(root, node) {
  1666. for (var i = 0; i < this.num; ++i) {
  1667. var s = this.evaluators[i];
  1668. if (!(s.matches(root, node))) {
  1669. return false;
  1670. }
  1671. }
  1672. return true;
  1673. }
  1674. //constructor : function(evaluators) {}
  1675. });
  1676. com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, {
  1677. /**
  1678. * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR.
  1679. * @param (Array) evaluators initial OR clause (these are wrapped into an AND evaluator).
  1680. */
  1681. constructor : function(evaluators) {
  1682. if (this.num > 1) {
  1683. this.evaluators.push(new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(evaluators));
  1684. } else if (evaluators) {
  1685. for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
  1686. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1687. var evaluator = __exp_enFor0[__i_enFor0];
  1688. this.evaluators.push(evaluator);
  1689. }
  1690. }
  1691. this.updateNumEvaluators();
  1692. },
  1693. add : function(e) {
  1694. this.evaluators.push(e);
  1695. this.updateNumEvaluators();
  1696. },
  1697. matches : function(root, node) {
  1698. for (var i = 0; i < this.num; ++i) {
  1699. var s = this.evaluators[i];
  1700. if (s.matches(root, node)) {
  1701. return true;
  1702. }
  1703. }
  1704. return false;
  1705. }
  1706. });
  1707. // $source: com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue
  1708. /************************************************************************
  1709. ** IBM Confidential
  1710. **
  1711. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1712. **
  1713. ** (C) Copyright IBM Corp. 2017
  1714. **
  1715. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1716. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1717. ************************************************************************/
  1718. // GENERATED
  1719. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1720. //@import com/ibm/rave/render/internal/select/jsoup/helper/StringUtil (runtime) // regionMatches, isWhitespace, startsWith
  1721. //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
  1722. /**
  1723. * A character queue with parsing helpers.
  1724. * @author Jonathan Hedley
  1725. */
  1726. var com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue = com_ibm_rave_core_nativeImpl_Declare({
  1727. //queue : null,
  1728. pos : 0,
  1729. /**
  1730. * Create a new TokenQueue.
  1731. * @param (String) data string of data to back queue.
  1732. */
  1733. constructor : function(data) {
  1734. this.queue = data;
  1735. },
  1736. /**
  1737. * Is the queue empty?
  1738. * @return (boolean) true if no data left in queue.
  1739. */
  1740. isEmpty : function() {
  1741. return this.remainingLength() == 0;
  1742. },
  1743. remainingLength : function() {
  1744. return this.queue.length - this.pos;
  1745. },
  1746. /**
  1747. * Tests if the next characters on the queue match the sequence. Case insensitive.
  1748. * @param (String) seq String to check queue for.
  1749. * @return (boolean) true if the next characters match.
  1750. */
  1751. matches : function(seq) {
  1752. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(this.queue, true, this.pos, seq, 0, seq.length);
  1753. },
  1754. /**
  1755. * Case sensitive match test.
  1756. * @param (String) seq string to case sensitively check for
  1757. * @return (boolean) true if matched, false if not
  1758. */
  1759. matchesCS : function(seq) {
  1760. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith(this.queue, seq, this.pos);
  1761. },
  1762. /**
  1763. * Tests if the next characters match any of the sequences. Case insensitive.
  1764. * @param (java.lang.String[]) seq list of strings to case insensitively check for
  1765. * @return (boolean) true of any matched, false if none did
  1766. */
  1767. matchesAny : function(seq) {
  1768. if (seq !== null || arguments.length > 1){
  1769. seq = Array.prototype.slice.call(arguments);
  1770. }
  1771. {
  1772. for (var __i_enFor0 = 0, __len_enFor0 = seq.length;
  1773. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1774. var s = seq[__i_enFor0];
  1775. if (this.matches(s)) {
  1776. return true;
  1777. }
  1778. }
  1779. return false;
  1780. }
  1781. },
  1782. matchesAnyChar : function(cs) {
  1783. if (cs !== null || arguments.length > 1){
  1784. cs = Array.prototype.slice.call(arguments);
  1785. }
  1786. {
  1787. var c = this.queue.charCodeAt(this.pos);
  1788. for (var i = 0; i < cs.length; ++i) {
  1789. if (cs[i] == c) {
  1790. return true;
  1791. }
  1792. }
  1793. return false;
  1794. }
  1795. },
  1796. matchesChar : function(cs) {
  1797. return this.queue.charCodeAt(this.pos) == cs;
  1798. },
  1799. /**
  1800. * Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue.
  1801. * @param (String) seq String to search for, and if found, remove from queue.
  1802. * @return (boolean) true if found and removed, false if not found.
  1803. */
  1804. matchChomp : function(seq) {
  1805. if (this.matches(seq)) {
  1806. this.pos += seq.length;
  1807. return true;
  1808. }
  1809. return false;
  1810. },
  1811. matchCharChomp : function(c) {
  1812. if (this.matchesChar(c)) {
  1813. this.pos++;
  1814. return true;
  1815. }
  1816. return false;
  1817. },
  1818. /**
  1819. * Tests if queue starts with a whitespace character.
  1820. * @return (boolean) if starts with whitespace
  1821. */
  1822. matchesWhitespace : function() {
  1823. return !(this.isEmpty()) && com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace(this.queue.charCodeAt(this.pos));
  1824. },
  1825. /**
  1826. * Test if the queue matches a word character (letter or digit).
  1827. * @return (boolean) if matches a word character
  1828. */
  1829. matchesWord : function() {
  1830. var c = this.queue.charCodeAt(this.pos);
  1831. return (c >= 97 && c <= 122) || (c >= 65 && c <= 90) || (c >= 48 && c <= 57);
  1832. },
  1833. /**
  1834. * Consume one character off queue.
  1835. * @return (char) first character on queue.
  1836. */
  1837. consume$0 : function() {
  1838. return this.queue.charCodeAt(this.pos++);
  1839. },
  1840. /**
  1841. * Consumes the supplied sequence of the queue. If the queue does not start with the supplied sequence, will throw an illegal state exception -- but you should be running match() against that condition. <p> Case insensitive.
  1842. * @param (String) seq sequence to remove from head of queue.
  1843. */
  1844. consume$1 : function(seq) {
  1845. var len = seq.length;
  1846. this.pos += len;
  1847. },
  1848. /**
  1849. * Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out.
  1850. * @param (String) seq String to end on (and not include in return, but leave on queue). <b>Case sensitive.</b>
  1851. * @return (String) The matched data consumed from queue.
  1852. */
  1853. consumeTo : function(seq) {
  1854. var offset = this.queue.indexOf(seq, this.pos);
  1855. if (offset != -1) {
  1856. var consumed = this.queue.substring(this.pos, offset);
  1857. this.pos += consumed.length;
  1858. return consumed;
  1859. }
  1860. return this.remainder();
  1861. },
  1862. /**
  1863. * Consumes to the first sequence provided, or to the end of the queue. Leaves the terminator on the queue.
  1864. * @param (java.lang.String[]) seq any number of terminators to consume to. <b>Case insensitive.</b>
  1865. * @return (String) consumed string
  1866. */
  1867. consumeToAny : function(seq) {
  1868. if (seq !== null || arguments.length > 1){
  1869. seq = Array.prototype.slice.call(arguments);
  1870. }
  1871. {
  1872. var start = this.pos;
  1873. while (!(this.isEmpty()) && !(this.matchesAny.apply(this, seq))) {
  1874. this.pos++;
  1875. }
  1876. var data = this.queue.substring(start, this.pos);
  1877. return data;
  1878. }
  1879. },
  1880. /**
  1881. * Pulls a string off the queue (like consumeTo), and then pulls off the matched string (but does not return it). <p> If the queue runs out of characters before finding the seq, will return as much as it can (and queue will go isEmpty() == true).
  1882. * @param (String) seq String to match up to, and not include in return, and to pull off queue. <b>Case sensitive.</b>
  1883. * @return (String) Data matched from queue.
  1884. */
  1885. chompTo : function(seq) {
  1886. var data = this.consumeTo(seq);
  1887. this.matchChomp(seq);
  1888. return data;
  1889. },
  1890. /**
  1891. * Pulls a balanced string off the queue. E.g. if queue is "(one (two) three) four", (,) will return "one (two) three", and leave " four" on the queue. Unbalanced openers and closers can be escaped (with \). Those escapes will be left in the returned string, which is suitable for regexes (where we need to preserve the escape), but unsuitable for contains text strings; use unescape for that.
  1892. * @param (char) open opener
  1893. * @param (char) close closer
  1894. * @return (String) data matched from the queue
  1895. */
  1896. chompBalanced : function(open, close) {
  1897. var start = -1;
  1898. var end = -1;
  1899. var depth = 0;
  1900. var last = 0;
  1901. do {
  1902. if (this.isEmpty()) {
  1903. break;
  1904. }
  1905. var c = this.consume$0();
  1906. if (last == 0 || last != 92) {
  1907. if (c == open) {
  1908. depth++;
  1909. if (start == -1) {
  1910. start = this.pos;
  1911. }
  1912. } else if (c == close) {
  1913. depth--;
  1914. }
  1915. }
  1916. if (depth > 0 && last != 0) {
  1917. end = this.pos;
  1918. }
  1919. last = c;
  1920. } while (depth > 0);
  1921. return (end >= 0) ? this.queue.substring(start, end) : "";
  1922. },
  1923. /**
  1924. * Pulls the next run of whitespace characters of the queue.
  1925. */
  1926. consumeWhitespace : function() {
  1927. var seen = false;
  1928. while (this.matchesWhitespace()) {
  1929. this.pos++;
  1930. seen = true;
  1931. }
  1932. return seen;
  1933. },
  1934. /**
  1935. * Retrieves the next run of word type (letter or digit) off the queue.
  1936. * @return (String) String of word characters from queue, or empty string if none.
  1937. */
  1938. consumeWord : function() {
  1939. var start = this.pos;
  1940. while (this.matchesWord()) {
  1941. this.pos++;
  1942. }
  1943. return this.queue.substring(start, this.pos);
  1944. },
  1945. /**
  1946. * Consume an tag name off the queue (word or :, _, -)
  1947. * @return (String) tag name
  1948. */
  1949. consumeTagName : function() {
  1950. var start = this.pos;
  1951. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(58, 95, 45))) {
  1952. this.pos++;
  1953. }
  1954. return this.queue.substring(start, this.pos);
  1955. },
  1956. /**
  1957. * Consume a CSS element selector (tag name, but | instead of : for namespaces, to not conflict with :pseudo selects).
  1958. * @return (String) tag name
  1959. */
  1960. consumeElementSelector : function() {
  1961. var start = this.pos;
  1962. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(124, 95, 45))) {
  1963. this.pos++;
  1964. }
  1965. return this.queue.substring(start, this.pos);
  1966. },
  1967. /**
  1968. * Consume a CSS identifier (ID or class) off the queue (letter, digit, -, _) http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
  1969. * @return (String) identifier
  1970. */
  1971. consumeCssIdentifier : function() {
  1972. var start = this.pos;
  1973. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95))) {
  1974. this.pos++;
  1975. }
  1976. return this.queue.substring(start, this.pos);
  1977. },
  1978. /**
  1979. * Consume an attribute key off the queue (letter, digit, -, _, :")
  1980. * @return (String) attribute key
  1981. */
  1982. consumeAttributeKey : function() {
  1983. var start = this.pos;
  1984. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95, 58))) {
  1985. this.pos++;
  1986. }
  1987. return this.queue.substring(start, this.pos);
  1988. },
  1989. /**
  1990. * Consume and return whatever is left on the queue.
  1991. * @return (String) remained of queue.
  1992. */
  1993. remainder : function() {
  1994. var remainder = this.queue.substring(this.pos, this.queue.length);
  1995. this.pos = this.queue.length;
  1996. return remainder;
  1997. },
  1998. consume : function(a0) {
  1999. var args = arguments;
  2000. if (args.length == 0) {
  2001. return this.consume$0();
  2002. }
  2003. return this.consume$1(a0);
  2004. }
  2005. });
  2006. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.getTokenQueueRegExp = function() {
  2007. var regexp = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TOKEN_QUEUE_REG_EXP_KEY");
  2008. if (!regexp) {
  2009. regexp = new RegExp("[A-Z\\d]", "i");
  2010. com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TOKEN_QUEUE_REG_EXP_KEY", regexp);
  2011. }
  2012. return regexp;
  2013. };
  2014. /**
  2015. * Unescaped a \ escaped string.
  2016. * @param (String) text backslash escaped string
  2017. * @return (String) unescaped string
  2018. */
  2019. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape = function(text) {
  2020. var out = "";
  2021. var last = 0;
  2022. for (var i = 0; i < text.length; ++i) {
  2023. var c = text.charCodeAt(i);
  2024. if (c == 92) {
  2025. if (last != 0 && last == 92) {
  2026. out += String.fromCharCode(c);
  2027. }
  2028. } else {
  2029. out += String.fromCharCode(c);
  2030. }
  2031. last = c;
  2032. }
  2033. return out.valueOf();
  2034. };
  2035. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.ESC = 92;
  2036. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.NIL = 0;
  2037. //com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.TOKEN_QUEUE_REG_EXP_KEY = "TOKEN_QUEUE_REG_EXP_KEY";
  2038. // $source: com/ibm/rave/render/internal/select/jsoup/helper/StringUtil
  2039. /************************************************************************
  2040. ** IBM Confidential
  2041. **
  2042. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2043. **
  2044. ** (C) Copyright IBM Corp. 2017
  2045. **
  2046. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2047. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2048. ************************************************************************/
  2049. // GENERATED
  2050. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2051. /**
  2052. * A minimal String utility class. Designed for internal jsoup use only.
  2053. */
  2054. var com_ibm_rave_render_internal_select_jsoup_helper_StringUtil = com_ibm_rave_core_nativeImpl_Declare({
  2055. });
  2056. /**
  2057. * Tests if a code point is "whitespace" as defined in the HTML spec.
  2058. * @param (int) c code point to test
  2059. * @return (boolean) true if code point is whitespace, false otherwise
  2060. */
  2061. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace = function(c) {
  2062. return c == 32 || c == 9 || c == 10 || c == 12 || c == 13;
  2063. };
  2064. /**
  2065. * Translatable version of Java String#regionMaches().
  2066. * @param (String) original String to
  2067. * @param (boolean) ignoreCase ignore case or not
  2068. * @param (int) toffset starting offset of the original string
  2069. * @param (String) other the string to compare
  2070. * @param (int) ooffset starting offset of the subregion in the string
  2071. * @param (int) len number of chars to compare
  2072. * @return (boolean) true if regions match.
  2073. */
  2074. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches = function(original, ignoreCase, toffset, other, ooffset, len) {
  2075. if (original.length < toffset + len || original.length < ooffset + len) {
  2076. return false;
  2077. }
  2078. var substring1 = original.substring(toffset, toffset + len);
  2079. var substring2 = other.substring(ooffset, ooffset + len);
  2080. if (ignoreCase) {
  2081. return substring1.toLowerCase() == substring2.toLowerCase();
  2082. }
  2083. return substring1 == substring2;
  2084. };
  2085. /**
  2086. * @param (String) queue
  2087. * @param (String) seq
  2088. * @param (int) pos
  2089. * @return (boolean) <code>true</code> if starts with, <code>false</code> otherwise.
  2090. */
  2091. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith = function(queue, seq, pos) {
  2092. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(queue, false, 0, seq, 0, pos);
  2093. };
  2094. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.padding = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "];
  2095. // $source: com/ibm/rave/render/internal/RendererConfiguration
  2096. /************************************************************************
  2097. ** IBM Confidential
  2098. **
  2099. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2100. **
  2101. ** (C) Copyright IBM Corp. 2017
  2102. **
  2103. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2104. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2105. ************************************************************************/
  2106. // GENERATED
  2107. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2108. /**
  2109. * Configuration specific to native renderers and scene nodes.
  2110. */
  2111. var com_ibm_rave_render_internal_RendererConfiguration = com_ibm_rave_core_nativeImpl_Declare({
  2112. //roots : null,
  2113. constructor : function() {
  2114. this.roots = [];
  2115. },
  2116. /**
  2117. * Return all registered root providers.
  2118. * @return (Array) A list of all registered root providers.
  2119. */
  2120. getRootProviders : function() {
  2121. return this.roots;
  2122. },
  2123. /**
  2124. * Return the root provider that contains a specific node.
  2125. * @param (com.ibm.rave.core.scene.SceneNode) node Return the provider that contains this node.
  2126. * @return (com.ibm.rave.render.internal.nodes.RootProvider) Matching root provider, or null if none found.
  2127. */
  2128. getRootProviderForNode : function(node) {
  2129. for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
  2130. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2131. var root = __exp_enFor0[__i_enFor0];
  2132. if (node.rave_getOwner() == root.getRoot().rave_getOwner()) {
  2133. return root;
  2134. }
  2135. }
  2136. return null;
  2137. },
  2138. /**
  2139. * Add a root provider to the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree.
  2140. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to add to the system.
  2141. */
  2142. addRootProvider : function(rootProvider) {
  2143. this.roots.push(rootProvider);
  2144. },
  2145. /**
  2146. * Remove a root provider from the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree.
  2147. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to remove from the system.
  2148. */
  2149. removeRootProvider : function(rootProvider) {
  2150. var i = this.roots.indexOf(rootProvider);
  2151. if (i >= 0) {
  2152. this.roots.splice(i, 1);
  2153. }
  2154. },
  2155. /**
  2156. * Remove the root provider that contains a specific node.
  2157. * @param (com.ibm.rave.core.scene.SceneNode) node Find the root provider that contains this node and remove it from the list of root providers.
  2158. */
  2159. removeRootProviderForNode : function(node) {
  2160. var i = -1;
  2161. var found = false;
  2162. for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
  2163. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2164. var root = __exp_enFor0[__i_enFor0];
  2165. i++;
  2166. if (node == root.getRoot().rave_getOwner()) {
  2167. found = true;
  2168. break;
  2169. }
  2170. }
  2171. if (found) {
  2172. this.roots.splice(i, 1);
  2173. }
  2174. }
  2175. //constructor : function() {}
  2176. });
  2177. /**
  2178. * Singleton instance of this renderer configuration.
  2179. */
  2180. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE = new com_ibm_rave_render_internal_RendererConfiguration();
  2181. // $source: com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector
  2182. /************************************************************************
  2183. ** IBM Confidential
  2184. **
  2185. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2186. **
  2187. ** (C) Copyright IBM Corp. 2017
  2188. **
  2189. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2190. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2191. ************************************************************************/
  2192. // GENERATED
  2193. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2194. //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
  2195. //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
  2196. /**
  2197. * CSS-like element selector, that finds elements matching a query. <p/> <h2>Selector syntax</h2> A selector is a chain of simple selectors, separated by combinators. Selectors are case insensitive (including against elements, attributes, and attribute values). <p/> The universal selector (*) is implicit when no element selector is supplied (i.e. {@code *.header} and {@code .header} is equivalent). <p/> <table> <tr> <th align="left">Pattern</th> <th align="left">Matches</th> <th align="left">Example</th> </tr> <tr> <td><code>*</code></td> <td>any element</td> <td><code>*</code></td> </tr> <tr> <td><code>tag</code></td> <td>elements with the given tag name</td> <td><code>div</code></td> </tr> <tr> <td><code>ns|E</code></td> <td>elements of type E in the namespace <i>ns</i></td> <td><code>fb|name</code> finds <code>&lt;fb:name></code> elements</td> </tr> <tr> <td><code>#id</code></td> <td>elements with attribute ID of "id"</td> <td><code>div#wrap</code>, <code>#logo</code></td> </tr> <tr> <td><code>.class</code></td> <td>elements with a class name of "class"</td> <td><code>div.left</code>, <code>.result</code></td> </tr> <tr> <td><code>[attr]</code></td> <td>elements with an attribute named "attr" (with any value)</td> <td><code>a[href]</code>, <code>[title]</code></td> </tr> <tr> <td><code>[^attrPrefix]</code></td> <td>elements with an attribute name starting with "attrPrefix". Use to find elements with HTML5 datasets</td> <td><code>[^data-]</code>, <code>div[^data-]</code></td> </tr> <tr> <td><code>[attr=val]</code></td> <td>elements with an attribute named "attr", and value equal to "val"</td> <td><code>img[width=500]</code>, <code>a[rel=nofollow]</code></td> </tr> <tr> <td><code>[attr=&quot;val&quot;]</code></td> <td>elements with an attribute named "attr", and value equal to "val"</td> <td><code>span[hello="Cleveland"][goodbye="Columbus"]</code>, <code>a[rel=&quot;nofollow&quot;]</code></td> </tr> <tr> <td><code>[attr^=valPrefix]</code></td> <td>elements with an attribute named "attr", and value starting with "valPrefix"</td> <td><code>a[href^=http:]</code></code></td> </tr> <tr> <td><code>[attr$=valSuffix]</code></td> <td>elements with an attribute named "attr", and value ending with "valSuffix"</td> <td><code>img[src$=.png]</code></td> </tr> <tr> <td><code>[attr*=valContaining]</code></td> <td>elements with an attribute named "attr", and value containing "valContaining"</td> <td><code>a[href*=/search/]</code></td> </tr> <tr> <td><code>[attr~=<em>regex</em>]</code></td> <td>elements with an attribute named "attr", and value matching the regular expression</td> <td><code>img[src~=(?i)\\.(png|jpe?g)]</code></td> </tr> <tr> <td></td> <td>The above may be combined in any order</td> <td><code>div.header[title]</code></td> </tr> <tr> <td> <td colspan="3"> <h3>Combinators</h3></td> </tr> <tr> <td><code>E F</code></td> <td>an F element descended from an E element</td> <td><code>div a</code>, <code>.logo h1</code></td> </tr> <tr> <td><code>E > F</code></td> <td>an F direct child of E</td> <td><code>ol > li</code></td> </tr> <tr> <td><code>E + F</code></td> <td>an F element immediately preceded by sibling E</td> <td><code>li + li</code>, <code>div.head + div</code></td> </tr> <tr> <td><code>E ~ F</code></td> <td>an F element preceded by sibling E</td> <td><code>h1 ~ p</code></td> </tr> <tr> <td><code>E, F, G</code></td> <td>all matching elements E, F, or G</td> <td><code>a[href], div, h3</code></td> </tr> <tr> <td> <td colspan="3"> <h3>Pseudo selectors</h3></td> </tr> <tr> <td><code>:lt(<em>n</em>)</code></td> <td>elements whose sibling index is less than <em>n</em></td> <td><code>td:lt(3)</code> finds the first 2 cells of each row</td> </tr> <tr> <td><code>:gt(<em>n</em>)</code></td> <td>elements whose sibling index is greater than <em>n</em></td> <td><code>td:gt(1)</code> finds cells after skipping the first two</td> </tr> <tr> <td><code>:eq(<em>n</em>)</code></td> <td>elements whose sibling index is equal to <em>n</em></td> <td><code>td:eq(0)</code> finds the first cell of each row</td> </tr> <tr> <td><code>:has(<em>selector</em>)</code></td> <td>elements that contains at least one element matching the <em>selector</em></td> <td><code>div:has(p)</code> finds divs that contain p elements</td> </tr> <tr> <td><code>:not(<em>selector</em>)</code></td> <td>elements that do not match the <em>selector</em>. See also Elements#not(String)</td> <td><code>div:not(.logo)</code> finds all divs that do not have the "logo" class.<br /> <code>div:not(:has(div))</code> finds divs that do not contain divs.</code></td> </tr> <tr> <td><code>:contains(<em>text</em>)</code></td> <td>elements that contains the specified text. The search is case insensitive. The text may appear in the found element, or any of its descendants.</td> <td><code>p:contains(jsoup)</code> finds p elements containing the text "jsoup".</td> </tr> <tr> <td><code>:matches(<em>regex</em>)</code></td> <td>elements whose text matches the specified regular expression. The text may appear in the found element, or any of its descendants.</td> <td><code>td:matches(\\d+)</code> finds table cells containing digits. <code>div:matches((?i)login)</code> finds divs containing the text, case insensitively.</td> </tr> <tr> <td><code>:containsOwn(<em>text</em>)</code></td> <td>elements that directly contain the specified text. The search is case insensitive. The text must appear in the found element, not any of its descendants.</td> <td><code>p:containsOwn(jsoup)</code> finds p elements with own text "jsoup". </td> </tr> <tr> <td><code>:matchesOwn(<em>regex</em>)</code></td> <td>elements whose own text matches the specified regular expression. The text must appear in the found element, not any of its descendants.</td> <td><code>td:matchesOwn(\\d+)</code> finds table cells directly containing digits. <code>div:matchesOwn((?i)login)</code> finds divs containing the text, case insensitively.</td> </tr> <tr> <td></td> <td>The above may be combined in any order and with other selectors</td> <td><code>.light:contains(name):eq(0)</code></td> </tr> <tr> <td colspan="3"> <h3>Structural pseudo selectors</h3></td> </tr> <tr> <td><code>:root</code></td> <td>The element that is the root of the document. In HTML, this is the <code>html</code> element</td> <td><code>:root</code></td> </tr> <tr> <td><code>:nth-child(<em>a</em>n+<em>b</em>)</code></td> <td> <p> elements that have <code><em>a</em>n+<em>b</em>-1</code> siblings <b>before</b> it in the document tree, for any positive integer or zero value of <code>n</code>, and has a parent element. For values of <code>a</code> and <code>b</code> greater than zero, this effectively divides the element's children into groups of a elements (the last group taking the remainder), and selecting the <em>b</em>th element of each group. For example, this allows the selectors to address every other row in a table, and could be used to alternate the color of paragraph text in a cycle of four. The <code>a</code> and <code>b</code> values must be integers (positive, negative, or zero). The index of the first child of an element is 1. </p> In addition to this, <code>:nth-child()</code> can take <code>odd</code> and <code>even</code> as arguments instead. <code>odd</code> has the same signification as <code>2n+1</code>, and <code>even</code> has the same signification as <code>2n</code>.</td> <td><code>tr:nth-child(2n+1)</code> finds every odd row of a table. <code>:nth-child(10n-1)</code> the 9th, 19th, 29th, etc, element. <code>li:nth-child(5)</code> the 5h li</td> </tr> <tr> <td><code>:nth-last-child(<em>a</em>n+<em>b</em>)</code></td> <td>elements that have <code><em>a</em>n+<em>b</em>-1</code> siblings <b>after</b> it in the document tree. Otherwise like <code>:nth-child()</code></td> <td><code>tr:nth-last-child(-n+2)</code> the last two rows of a table</td> </tr> <tr> <td><code>:nth-of-type(<em>a</em>n+<em>b</em>)</code></td> <td>pseudo-class notation represents an element that has <code><em>a</em>n+<em>b</em>-1</code> siblings with the same expanded element name <em>before</em> it in the document tree, for any zero or positive integer value of n, and has a parent element</td> <td><code>img:nth-of-type(2n+1)</code></td> </tr> <tr> <td><code>:nth-last-of-type(<em>a</em>n+<em>b</em>)</code></td> <td>pseudo-class notation represents an element that has <code><em>a</em>n+<em>b</em>-1</code> siblings with the same expanded element name <em>after</em> it in the document tree, for any zero or positive integer value of n, and has a parent element</td> <td><code>img:nth-last-of-type(2n+1)</code></td> </tr> <tr> <td><code>:first-child</code></td> <td>elements that are the first child of some other element.</td> <td><code>div > p:first-child</code></td> </tr> <tr> <td><code>:last-child</code></td> <td>elements that are the last child of some other element.</td> <td><code>ol > li:last-child</code></td> </tr> <tr> <td><code>:first-of-type</code></td> <td>elements that are the first sibling of its type in the list of children of its parent element</td> <td><code>dl dt:first-of-type</code></td> </tr> <tr> <td><code>:last-of-type</code></td> <td>elements that are the last sibling of its type in the list of children of its parent element</td> <td><code>tr > td:last-of-type</code></td> </tr> <tr> <td><code>:only-child</code></td> <td>elements that have a parent element and whose parent element hasve no other element children</td> <td></td> </tr> <tr> <td><code>:only-of-type</code></td> <td>an element that has a parent element and whose parent element has no other element children with the same expanded element name</td> <td></td> </tr> <tr> <td><code>:empty</code></td> <td>elements that have no children at all</td> <td></td> </tr> </table>
  2198. * @author Jonathan Hedley, jonathan@hedley.net
  2199. * @see #this.select(String, com_ibm_rave_core_scene_SceneNode, com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager)
  2200. */
  2201. var com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector = com_ibm_rave_core_nativeImpl_Declare({
  2202. //evaluator : null,
  2203. //root : null,
  2204. //cache : null,
  2205. constructor : function(query, root, cache) {
  2206. var _query = query.trim();
  2207. this.evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(_query);
  2208. this.root = root;
  2209. this.cache = cache;
  2210. },
  2211. selectAll : function() {
  2212. return com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(this.evaluator, this.root, this.cache);
  2213. }
  2214. });
  2215. /**
  2216. * Find elements matching selector.
  2217. * @param (String) query CSS selector
  2218. * @param (com.ibm.rave.core.scene.SceneNode) root root element to descend into
  2219. * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache Optional caching manager that contains caches for classes, ids, etc.
  2220. * @return (Array) matching elements, empty if not
  2221. */
  2222. com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select = function(query, root, cache) {
  2223. return new com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector(query, root, cache).selectAll();
  2224. };
  2225. // $source: com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine
  2226. /************************************************************************
  2227. ** IBM Confidential
  2228. **
  2229. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2230. **
  2231. ** (C) Copyright IBM Corp. 2017
  2232. **
  2233. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2234. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2235. ************************************************************************/
  2236. // GENERATED
  2237. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2238. //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
  2239. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  2240. //@import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (static) // select
  2241. /**
  2242. * A CSS3 selection query engine for abstract scene tree/node type scene nodes.
  2243. */
  2244. var com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
  2245. matches : function(context, selectorString) {
  2246. if (selectorString != null) {
  2247. var evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(selectorString);
  2248. if (evaluator) {
  2249. return evaluator.matches(context.rave_getOwner(), context);
  2250. }
  2251. }
  2252. return false;
  2253. },
  2254. querySelector$0 : function(match, rootNode) {
  2255. if (match != null) {
  2256. var results = this.querySelectorAll$1(match, rootNode);
  2257. if (results.length > 0) {
  2258. return results[0];
  2259. }
  2260. }
  2261. return null;
  2262. },
  2263. querySelector$1 : function(match) {
  2264. if (match != null) {
  2265. var matches = this.querySelectorAll$0(match);
  2266. if (matches && matches.length > 0) {
  2267. return matches[0];
  2268. }
  2269. }
  2270. return null;
  2271. },
  2272. querySelectorAll$0 : function(match) {
  2273. return this.querySelectorAll$1(match, null);
  2274. },
  2275. querySelectorAll$1 : function(match, rootNode) {
  2276. var results = [];
  2277. if (match != null) {
  2278. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, rootNode, ":root" == match);
  2279. }
  2280. return results;
  2281. },
  2282. querySelector : function(a0, a1) {
  2283. var args = arguments;
  2284. if (args.length == 1) {
  2285. return this.querySelector$1(a0);
  2286. }
  2287. return this.querySelector$0(a0, a1);
  2288. },
  2289. querySelectorAll : function(a0, a1) {
  2290. var args = arguments;
  2291. if (args.length == 1) {
  2292. return this.querySelectorAll$0(a0);
  2293. }
  2294. return this.querySelectorAll$1(a0, a1);
  2295. }
  2296. });
  2297. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll = function(results, match, rootNode, includeRootInResults) {
  2298. var _rootNode = rootNode;
  2299. if (_rootNode) {
  2300. var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(_rootNode);
  2301. var cache = null;
  2302. if (rootProvider) {
  2303. cache = rootProvider.getCacheManager();
  2304. if (_rootNode == rootProvider.getRoot().rave_getOwner()) {
  2305. _rootNode = rootProvider.getRoot();
  2306. }
  2307. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(match, _rootNode, cache), __len_enFor0 = __exp_enFor0.length;
  2308. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2309. var node = __exp_enFor0[__i_enFor0];
  2310. if (!(includeRootInResults == false && node == _rootNode)) {
  2311. results.push(node);
  2312. }
  2313. }
  2314. }
  2315. } else {
  2316. var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
  2317. for (var __i_enFor1 = 0, __exp_enFor1 = providers, __len_enFor1 = __exp_enFor1.length;
  2318. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  2319. var provider = __exp_enFor1[__i_enFor1];
  2320. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, provider.getRoot(), true);
  2321. }
  2322. }
  2323. };
  2324. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CanvasSelectionQueryEngine
  2325. /************************************************************************
  2326. ** IBM Confidential
  2327. **
  2328. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2329. **
  2330. ** (C) Copyright IBM Corp. 2016
  2331. **
  2332. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2333. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2334. ************************************************************************/
  2335. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2336. // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (loadtime)
  2337. var com_ibm_rave_core_canvas_internal_nativeImpl_CanvasSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine, {
  2338. constructor : function(delegateQueryEngine) {
  2339. this._delegateQueryEngine = delegateQueryEngine;
  2340. },
  2341. matches : function(context, selectorString) {
  2342. return this._delegateQueryEngine.querySelectorAll(selectorString, null).indexOf(context) >= 0;
  2343. }
  2344. });
  2345. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine
  2346. /************************************************************************
  2347. ** IBM Confidential
  2348. **
  2349. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2350. **
  2351. ** (C) Copyright IBM Corp. 2014, 2016
  2352. **
  2353. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2354. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2355. ************************************************************************/
  2356. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2357. // @import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  2358. // @import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (runtime) // select
  2359. // @import com/ibm/rave/core/internal/css/CSSParser (runtime)
  2360. /*
  2361. * This class provides query support at the DOM level and into the canvas scene tree allowing
  2362. * query selectors to cross the boundary from DOM to non-DOM.
  2363. *
  2364. * Example:
  2365. * "body .visualization .axis text"
  2366. *
  2367. * Lets assume that ".axis text" is within a canvas.
  2368. *
  2369. * Start by executing this query against the DOM. No matches.
  2370. * Then for each root provider, execute the same query. No matches.
  2371. *
  2372. * Breakdown the query into parts: ['body', '.visualization', '.axis', 'text']
  2373. *
  2374. * Remove the last part and execute the query on the DOM, ".body .visualization .axis". No matches.
  2375. * Remove the last part again and execute the query on the DOM, ".body .visualization". We have a match.
  2376. *
  2377. * Now that we have a match reconstruct a query from the removed parts: ".axis text"
  2378. * Find all root providers which are descendants of the DOM query matches.
  2379. *
  2380. * For all root providers which are descendants, execute the query ".axis text". We have a match.
  2381. * Add the matches to the result.
  2382. *
  2383. * Keep breaking down the original query and performing the above steps until the query is empty.
  2384. *
  2385. * All the while making sure not to add duplicates to the results.
  2386. *
  2387. */
  2388. var com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine = (function() {
  2389. return com_ibm_rave_core_nativeImpl_Declare({
  2390. constructor : function(domQueryEngine) {
  2391. this._domQueryEngine = domQueryEngine;
  2392. },
  2393. matches : function(context, query) {
  2394. return this._domQueryEngine.matches(context, query) || this.querySelectorAll(query, null).indexOf(context) >= 0;
  2395. },
  2396. querySelector : function(query, rootNode) {
  2397. if (query){
  2398. var result = this._domQueryEngine.querySelector(query, rootNode);
  2399. if (result) {
  2400. return result;
  2401. }
  2402. // TODO optimize
  2403. var result = this.querySelectorAll(query, rootNode);
  2404. if (result && result.length) {
  2405. return result[0];
  2406. }
  2407. }
  2408. return null;
  2409. },
  2410. querySelectorAll : function(query, rootNode) {
  2411. if (!query) {
  2412. return [];
  2413. }
  2414. rootNode = rootNode || rave_document;
  2415. var results = this._domQueryEngine.querySelectorAll(query, rootNode);
  2416. if (!results.concat) {
  2417. // since results from the DOM query engine is a NodeList,
  2418. // convert it to an array such that we can use the Array#concat method
  2419. results = Array.prototype.slice.call(results, 0)
  2420. }
  2421. var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
  2422. for (var i = 0; i < providers.length; i++) {
  2423. // Add jsoup selection to results
  2424. var matches = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(query, providers[i].getRoot(), providers[i].getCacheManager());
  2425. if (matches && matches.length) {
  2426. results = results.concat(matches);
  2427. }
  2428. }
  2429. // break up the original query into parts
  2430. var queries = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(query);
  2431. for (var i = 0; i < queries.length; i++) {
  2432. var queryParts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(queries[i]);
  2433. if (queryParts.length > 1) {
  2434. // this array holds all the query parts we pop
  2435. var endParts = [];
  2436. while (queryParts.length > 1) {
  2437. // remove a query part and insert it at the start of the endParts
  2438. endParts.unshift(queryParts.pop());
  2439. // construct the inner query from the end parts
  2440. var innerQuery = endParts.join(' ');
  2441. // execute the broken down query on the DOM
  2442. var partialFind = this._domQueryEngine.querySelectorAll(queryParts.join(' '), rootNode);
  2443. if (partialFind && partialFind.length) {
  2444. // if we have matches we need to identify root providers were are descendants of the matches
  2445. for (var i = 0; i < providers.length; i++) {
  2446. var provider = providers[i];
  2447. for (var j = 0; j < partialFind.length; j++) {
  2448. // check if the root node is a child of any partial find
  2449. var nodeToCompare = partialFind[j],
  2450. parent = provider.getRoot().rave_getOwner();
  2451. do {
  2452. if (parent == nodeToCompare) {
  2453. break;
  2454. }
  2455. } while (parent = parent.parentNode);
  2456. if (parent) {
  2457. // we have a match
  2458. // now perform the remainder of the query on the provider's root node
  2459. var innerResults = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(innerQuery, provider.getRoot(), provider.getCacheManager())
  2460. if (innerResults && innerResults.length) {
  2461. for (var k = 0; k < innerResults.length; k++) {
  2462. // don't add duplicates
  2463. if (results.indexOf(innerResults[k]) == -1) {
  2464. results.push(innerResults[k]);
  2465. }
  2466. }
  2467. }
  2468. break;
  2469. }
  2470. }
  2471. }
  2472. }
  2473. }
  2474. }
  2475. }
  2476. return results;
  2477. }
  2478. });
  2479. })();
  2480. // $source: com/ibm/rave/render/SceneItemFactory
  2481. /************************************************************************
  2482. ** IBM Confidential
  2483. **
  2484. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2485. **
  2486. ** (C) Copyright IBM Corp. 2017
  2487. **
  2488. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2489. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2490. ************************************************************************/
  2491. // GENERATED
  2492. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2493. //@import com/ibm/rave/render/internal/nodes/RectSceneItem (runtime) // new
  2494. //@import com/ibm/rave/render/internal/nodes/CircleSceneItem (runtime) // new
  2495. //@import com/ibm/rave/render/internal/nodes/LineSceneItem (runtime) // new
  2496. //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
  2497. //@import com/ibm/rave/render/internal/nodes/TextPathSceneItem (runtime) // new
  2498. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (runtime) // new
  2499. //@import com/ibm/rave/render/internal/nodes/PathSceneItem (runtime) // new
  2500. //@import com/ibm/rave/render/internal/nodes/PolygonSceneItem (runtime) // new
  2501. //@import com/ibm/rave/render/internal/nodes/PolylineSceneItem (runtime) // new
  2502. //@import com/ibm/rave/render/internal/nodes/DefsSceneItem (runtime) // new
  2503. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  2504. //@import com/ibm/rave/render/internal/nodes/LinearGradientSceneItem (runtime) // new
  2505. //@import com/ibm/rave/render/internal/nodes/RadialGradientSceneItem (runtime) // new
  2506. //@import com/ibm/rave/render/internal/nodes/StopSceneItem (runtime) // new
  2507. //@import com/ibm/rave/render/internal/nodes/ImageSceneItem (runtime) // new
  2508. //@import com/ibm/rave/render/internal/nodes/EllipseSceneItem (runtime) // new
  2509. //@import com/ibm/rave/render/internal/nodes/ClipPathSceneItem (runtime) // new
  2510. //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
  2511. //@import com/ibm/rave/render/internal/nodes/GenericSceneNode (runtime) // new
  2512. var com_ibm_rave_render_SceneItemFactory = rave_externs["SceneItemFactory"] = com_ibm_rave_core_nativeImpl_Declare({
  2513. _$functionClassMethod : function() {
  2514. var _$self = /**
  2515. * Create items that can be appended to the root scene tree. Ultimately the renderer will draw these shapes.
  2516. * @return (com.ibm.rave.core.scene.SceneNode) Returns a new scene node of the requested type. Returns null if this is an unsupported type.
  2517. */
  2518. function(nsuri, name, parentContext) {
  2519. if ("rect" == name) {
  2520. return new com_ibm_rave_render_internal_nodes_RectSceneItem(nsuri, parentContext);
  2521. } else if ("circle" == name) {
  2522. return new com_ibm_rave_render_internal_nodes_CircleSceneItem(nsuri, parentContext);
  2523. } else if ("line" == name) {
  2524. return new com_ibm_rave_render_internal_nodes_LineSceneItem(nsuri, parentContext);
  2525. } else if ("text" == name) {
  2526. return new com_ibm_rave_render_internal_nodes_TextSceneItem(nsuri, parentContext);
  2527. } else if ("textPath" == name) {
  2528. return new com_ibm_rave_render_internal_nodes_TextPathSceneItem(nsuri, parentContext);
  2529. } else if ("g" == name) {
  2530. return new com_ibm_rave_render_internal_nodes_GroupSceneItem(nsuri, parentContext);
  2531. } else if ("path" == name) {
  2532. return new com_ibm_rave_render_internal_nodes_PathSceneItem(nsuri, parentContext);
  2533. } else if ("polygon" == name) {
  2534. return new com_ibm_rave_render_internal_nodes_PolygonSceneItem(nsuri, parentContext);
  2535. } else if ("polyline" == name) {
  2536. return new com_ibm_rave_render_internal_nodes_PolylineSceneItem(nsuri, parentContext);
  2537. } else if ("defs" == name) {
  2538. return new com_ibm_rave_render_internal_nodes_DefsSceneItem(nsuri, parentContext);
  2539. } else if (com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT == name) {
  2540. return new com_ibm_rave_render_internal_nodes_LinearGradientSceneItem(nsuri, parentContext);
  2541. } else if (com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT == name) {
  2542. return new com_ibm_rave_render_internal_nodes_RadialGradientSceneItem(nsuri, parentContext);
  2543. } else if ("stop" == name) {
  2544. return new com_ibm_rave_render_internal_nodes_StopSceneItem(nsuri, parentContext);
  2545. } else if ("image" == name) {
  2546. return new com_ibm_rave_render_internal_nodes_ImageSceneItem(nsuri, parentContext);
  2547. } else if ("ellipse" == name) {
  2548. return new com_ibm_rave_render_internal_nodes_EllipseSceneItem(nsuri, parentContext);
  2549. } else if ("clipPath" == name) {
  2550. return new com_ibm_rave_render_internal_nodes_ClipPathSceneItem(nsuri, parentContext);
  2551. } else if ("tspan" == name) {
  2552. return new com_ibm_rave_render_internal_nodes_TSpanSceneItem(nsuri, parentContext);
  2553. }
  2554. return new com_ibm_rave_render_internal_nodes_GenericSceneNode(nsuri, parentContext, name);
  2555. };
  2556. return _$self;
  2557. }
  2558. });
  2559. // $source: com/ibm/rave/core/scene/SceneNode
  2560. /************************************************************************
  2561. ** IBM Confidential
  2562. **
  2563. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2564. **
  2565. ** (C) Copyright IBM Corp. 2017
  2566. **
  2567. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2568. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2569. ************************************************************************/
  2570. // GENERATED
  2571. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2572. /**
  2573. * The base type for all nodes.
  2574. */
  2575. var com_ibm_rave_core_scene_SceneNode = rave_externs["SceneNode"] = com_ibm_rave_core_nativeImpl_Declare({
  2576. /**
  2577. * Get the parent of this node.
  2578. * @return (com.ibm.rave.core.scene.SceneNode) the parent of this node, or <code>null</code> if this node has no parent.
  2579. */
  2580. /** @expose */
  2581. rave_getParentNode : function() {
  2582. return this.rave_getParentNode.call(this);
  2583. },
  2584. /**
  2585. * Get this node's owner node. Depending on the backing implementation, the owner may be equal to the root. In other cases, the owner is a special node with application level capabilities such as handling of accessibility or interactions with the rest of the application.
  2586. * @return (com.ibm.rave.core.scene.SceneNode) the owner node
  2587. */
  2588. /** @expose */
  2589. rave_getOwner : function() {},
  2590. /**
  2591. * Set the node's owner node.
  2592. * @param (com.ibm.rave.core.scene.SceneNode) owner the owner node
  2593. * @see #this.getOwner()
  2594. */
  2595. /** @expose */
  2596. rave_setOwner : function(owner) {},
  2597. /**
  2598. * Set this node's parent. Clients should not call this method directly.
  2599. * @param (com.ibm.rave.core.scene.SceneNode) parent the parent node, may be <code>null</code>
  2600. */
  2601. /** @expose */
  2602. rave_setParentNode : function(parent) {},
  2603. /**
  2604. * Appends the given node to the end of the children.
  2605. * @param (com.ibm.rave.core.scene.SceneNode) node the node to append
  2606. */
  2607. /** @expose */
  2608. rave_appendChild : function(node) {
  2609. this.appendChild.call(this, node);
  2610. },
  2611. /**
  2612. * Does this node have children.
  2613. * @return (boolean) <code>true</code> if this node has children, <code>false</code> otherwise
  2614. */
  2615. /** @expose */
  2616. rave_hasChildNodes : function() {
  2617. return this.rave_hasChildNodes.call(this);
  2618. },
  2619. /**
  2620. * Get the children of this node.
  2621. * @return (Array) a list of child nodes
  2622. */
  2623. /** @expose */
  2624. rave_getChildNodes : function() {
  2625. return this.rave_getChildNodes.call(this);
  2626. },
  2627. /**
  2628. * Get this node's next sibling.
  2629. * @return (com.ibm.rave.core.scene.SceneNode) The next sibling node, or <code>null</code> if the parent contains no more nodes.
  2630. */
  2631. /** @expose */
  2632. rave_getNextSibling : function() {
  2633. return this.rave_getNextSibling.call(this);
  2634. },
  2635. /**
  2636. * Get this node's first child.
  2637. * @return (com.ibm.rave.core.scene.SceneNode) The first child node, or <code>null</code> if this node has no children.
  2638. */
  2639. /** @expose */
  2640. rave_getFirstChild : function() {
  2641. return this.rave_getFirstChild.call(this);
  2642. },
  2643. /**
  2644. * Get this node's previous sibling.
  2645. * @return (com.ibm.rave.core.scene.SceneNode) The previous sibling node, or <code>null</code> if the parent contains no more nodes.
  2646. */
  2647. /** @expose */
  2648. rave_getPreviousSibling : function() {
  2649. return this.rave_getPreviousSibling.call(this);
  2650. },
  2651. /**
  2652. * Insert the given node before the other specified node.
  2653. * @param (com.ibm.rave.core.scene.SceneNode) node the node to insert
  2654. * @param (com.ibm.rave.core.scene.SceneNode) before the node to insert before
  2655. */
  2656. /** @expose */
  2657. rave_insertBefore : function(node, before) {
  2658. this.insertBefore.call(this, node, before);
  2659. },
  2660. /**
  2661. * Set the text content.
  2662. * @param (String) text the text content
  2663. */
  2664. /** @expose */
  2665. rave_setText : function(text) {
  2666. this.rave_setText.call(this, text);
  2667. },
  2668. /**
  2669. * Removes the node from the list of children.
  2670. * @param (com.ibm.rave.core.scene.SceneNode) node the node to remove
  2671. * @return (boolean) <code>true</code> if the node was a child node and removed, <code>false</code> otherwise
  2672. */
  2673. /** @expose */
  2674. removeChild : function(node) {
  2675. return this.removeChild.call(this, node);
  2676. },
  2677. /**
  2678. * Set the style for the given name.
  2679. * @param (String) styleName the style name
  2680. * @param (Object) value the style value This method sets a style using default priority
  2681. */
  2682. rave_setStyle$0 : function(styleName, value) {
  2683. this.rave_setStyle.call(this, styleName, value, "");
  2684. },
  2685. /**
  2686. * Set the style for the given name.
  2687. * @param (String) styleName the style name
  2688. * @param (Object) value the style value
  2689. * @param (String) priority the style priority (ie, "important")
  2690. */
  2691. rave_setStyle$1 : function(styleName, value, priority) {
  2692. this.rave_setStyle.call(this, styleName, value, priority);
  2693. },
  2694. /**
  2695. * Dispatches an event on this node.
  2696. * @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event the triggering event
  2697. * @return (boolean) <code>false</code> if at least one of the event handlers which handled this event called {@link this.Event#this.preventDefault()} , <code>true</code> otherwise
  2698. */
  2699. /** @expose */
  2700. dispatchEvent : function(event) {},
  2701. /**
  2702. * Retrieve the event listener for the given event type.
  2703. * @param (String) eventType the event type
  2704. * @return (com.ibm.rave.core.event.EventListener) the event listener, may be <code>null</code>
  2705. */
  2706. /** @expose */
  2707. rave_getEventListener : function(eventType) {},
  2708. /**
  2709. * Removes all event listeners for the given qualifier.
  2710. * @param (String) group a qualifier to the event type for grouping like events
  2711. */
  2712. /** @expose */
  2713. rave_removeEventListeners : function(group) {},
  2714. /**
  2715. * Get the attribute value for the given attribute name.
  2716. * @param (String) attribute the attribute name
  2717. * @return (Object) the attribute value
  2718. */
  2719. /** @expose */
  2720. getAttribute : function(attribute) {},
  2721. /**
  2722. * Get the attribute value for the given attribute name.
  2723. * @param (String) namespace the namespace
  2724. * @param (String) attribute the attribute name
  2725. * @return (Object) the attribute value
  2726. */
  2727. /** @expose */
  2728. getAttributeNS : function(namespace, attribute) {},
  2729. /**
  2730. * Set the attribute value for the given attribute.
  2731. * @param (String) namespace the namespace
  2732. * @param (String) attribute the attribute name
  2733. * @param (Object) value the attribute value
  2734. */
  2735. /** @expose */
  2736. setAttributeNS : function(namespace, attribute, value) {},
  2737. /**
  2738. * Remove the attribute for the given attribute name.
  2739. * @param (String) attribute the attribute name
  2740. */
  2741. /** @expose */
  2742. removeAttribute : function(attribute) {},
  2743. /**
  2744. * Remove the attribute for the given attribute name.
  2745. * @param (String) namespace the namespace
  2746. * @param (String) attribute the attribute name
  2747. */
  2748. /** @expose */
  2749. removeAttributeNS : function(namespace, attribute) {},
  2750. /**
  2751. * Get the style for the given name.
  2752. * @param (String) styleName the style name
  2753. * @return (Object) the style value
  2754. */
  2755. /** @expose */
  2756. rave_getStyle : function(styleName) {},
  2757. /**
  2758. * Get the computed style for the given name.
  2759. * @param (String) styleName the style name
  2760. * @return (Object) the computed style value
  2761. */
  2762. /** @expose */
  2763. rave_getComputedStyle : function(styleName) {},
  2764. /**
  2765. * Remove the style for the given name.
  2766. * @param (String) styleName the style name
  2767. */
  2768. /** @expose */
  2769. rave_removeStyle : function(styleName) {},
  2770. /**
  2771. * Get the text content.
  2772. * @return (String) the text content
  2773. */
  2774. /** @expose */
  2775. rave_getText : function() {},
  2776. /**
  2777. * Get the html content.
  2778. * @return (String) the html content
  2779. */
  2780. /** @expose */
  2781. rave_getHtml : function() {},
  2782. /**
  2783. * Set the html content.
  2784. * @param (String) html the html content
  2785. */
  2786. /** @expose */
  2787. rave_setHtml : function(html) {},
  2788. /**
  2789. * Query whether the CSS class is set on the node.
  2790. * @param (String) className the class to query
  2791. * @return (boolean) <code>true</code> if the class is set, <code>false</code> otherwise
  2792. */
  2793. /** @expose */
  2794. rave_containsClass : function(className) {},
  2795. /**
  2796. * Set or unset the CSS class on the node.
  2797. * @param (String) className the class to query
  2798. * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
  2799. */
  2800. /** @expose */
  2801. rave_addClass : function(className) {},
  2802. /**
  2803. * Remove the CSS class on the node.
  2804. * @param (String) className the class to query
  2805. * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
  2806. */
  2807. /** @expose */
  2808. rave_removeClass : function(className) {},
  2809. /**
  2810. * Get the data associated with this node.
  2811. * @return (Object) the associated data
  2812. */
  2813. /** @expose */
  2814. rave_getData : function() {
  2815. return this.rave_getProperty("__data__");
  2816. },
  2817. /**
  2818. * Set the data for this node.
  2819. * @param (Object) value the data value
  2820. */
  2821. /** @expose */
  2822. rave_setData : function(value) {
  2823. this.rave_setProperty("__data__", value);
  2824. },
  2825. /**
  2826. * Returns true if the data had been set on this element
  2827. * @return (boolean) true if data has been set otherwise false
  2828. */
  2829. /** @expose */
  2830. rave_hasData : function() {
  2831. return this.rave_hasProperty("__data__");
  2832. },
  2833. /**
  2834. * Store a value on this node for a given key.
  2835. * @param (String) key the property key
  2836. * @param (Object) value the property value
  2837. */
  2838. /** @expose */
  2839. rave_setProperty : function(key, value) {
  2840. this.rave_setProperty.call(this, key, value);
  2841. },
  2842. /**
  2843. * Remove a property from the node.
  2844. * @param (String) key The property to remove.
  2845. */
  2846. /** @expose */
  2847. rave_removeProperty : function(key) {
  2848. this.removePropertyExt.call(this, key);
  2849. },
  2850. /**
  2851. * Set the attribute value for the given attribute.
  2852. * @param (String) key the attribute key
  2853. * @param (Object) value the attribute value
  2854. */
  2855. /** @expose */
  2856. setAttribute : function(key, value) {
  2857. this.setAttribute.call(this, key, value);
  2858. },
  2859. /**
  2860. * Get a stored value from this node for a given key.
  2861. * @param (String) key the property key
  2862. * @return (Object) the property value
  2863. */
  2864. /** @expose */
  2865. rave_getProperty : function(key) {},
  2866. /**
  2867. * Returns true if this element has a property with the same name as the string passed in
  2868. * @param (String) proName property name to check
  2869. * @return (boolean) true if the property exist otherwise false
  2870. */
  2871. /** @expose */
  2872. rave_hasProperty : function(proName) {},
  2873. /**
  2874. * Get the name of this node.
  2875. * @return (String) the name of this node
  2876. */
  2877. /** @expose */
  2878. rave_getName : function() {},
  2879. /**
  2880. * Get the namespace URI of this node.
  2881. * @return (String) the namespace URI, may be <code>null</code>
  2882. */
  2883. /** @expose */
  2884. rave_getNamespaceURI : function() {},
  2885. /**
  2886. * Get the qualified name of this node. The qualified name is a concatenation of the namespace URI and the name with a colon delimiter.
  2887. * @return (String) the qualified name
  2888. */
  2889. /** @expose */
  2890. rave_getQualifiedName : function() {},
  2891. /**
  2892. * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other styles.
  2893. */
  2894. /** @expose */
  2895. getBoundingClientRect : function() {},
  2896. /**
  2897. * Returns the local bounds of this node in a rectangle geom relative to its parent node. Typically these are the set positioning properties (x,y,width,height,etc). Does not take transforms into account. Does not include stroke or other styles.
  2898. * @return (com.ibm.rave.core.geom.RaveRect) Bounding box of this shape. Must never return null.
  2899. */
  2900. /** @expose */
  2901. getBBox : function() {},
  2902. /**
  2903. * Returns the draw type of node as an int.
  2904. * @return (int) The integer representation of the type of drawable shape of this node.
  2905. */
  2906. /** @expose */
  2907. rave_getDrawType : function() {
  2908. return 0;
  2909. },
  2910. /**
  2911. * Returns the computed transform matrix of this node in screen coordinates.
  2912. * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation.
  2913. */
  2914. /** @expose */
  2915. getScreenCTM : function() {
  2916. return this.getScreenCTM.call(this);
  2917. },
  2918. /**
  2919. * Returns the computed transform matrix of this node in local coordinates.
  2920. * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation.
  2921. */
  2922. /** @expose */
  2923. getCTM : function() {
  2924. return this.getCTM.call(this);
  2925. },
  2926. /**
  2927. * Dispose of this node; allow any clean up to be performed.
  2928. */
  2929. /** @expose */
  2930. rave_dispose : function() {},
  2931. /**
  2932. * Return all scene nodes which intersect with the rectangle
  2933. * @param (com.ibm.rave.core.geom.RectStruct) rect test rectangle
  2934. * @return (Array) all scene nodes which intersect with the test rectangle
  2935. */
  2936. /** @expose */
  2937. rave_intersectionList : function(rect) {},
  2938. /** @expose */
  2939. rave_getSizePx : function(size) {},
  2940. /**
  2941. * Return a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates
  2942. * @param (double) x coordinate x
  2943. * @param (double) y coordinate y
  2944. * @return (com.ibm.rave.core.scene.SceneNode) a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates
  2945. */
  2946. /** @expose */
  2947. rave_intersection : function(x, y) {},
  2948. /** @expose */
  2949. rave_initExtensions : function() {},
  2950. /**
  2951. * Return a map of css property names to set property css values on this node. This mimics window.getComputedStyles(node) on the web. (We delegate to that API on Javascript).
  2952. * @return (Object) map of css property names to set property css values
  2953. */
  2954. /** @expose */
  2955. rave_getComputedStyles : function() {},
  2956. /** @expose */
  2957. rave_setStyle : function(a0, a1, a2) {
  2958. var args = arguments;
  2959. if (args.length == 2) {
  2960. return this.rave_setStyle$0(a0, a1);
  2961. }
  2962. return this.rave_setStyle$1(a0, a1, a2);
  2963. },
  2964. /** @expose */
  2965. rave_addEventListener : function(a0, a1, a2, a3) {
  2966. var args = arguments;
  2967. if (args.length == 2) {
  2968. return this.rave_addEventListener$1(a0, a1);
  2969. }
  2970. if (args.length == 3) {
  2971. return this.rave_addEventListener$2(a0, a1, a2);
  2972. }
  2973. return this.rave_addEventListener$0(a0, a1, a2, a3);
  2974. },
  2975. /** @expose */
  2976. rave_removeEventListener : function(a0, a1) {
  2977. var args = arguments;
  2978. if (args.length == 1) {
  2979. return this.rave_removeEventListener$0(a0);
  2980. }
  2981. return this.rave_removeEventListener$1(a0, a1);
  2982. }
  2983. /**
  2984. * Adds an event listener for the given qualifier and event type.
  2985. * @param (String) eventType the event type
  2986. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  2987. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  2988. * @param (String) group a qualified to the event type for grouping like events
  2989. */
  2990. //rave_addEventListener$0 : function(eventType, listener, useCapture, group) {},
  2991. /**
  2992. * Adds an event listener for the given event type.
  2993. * @param (String) eventType the event type
  2994. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  2995. */
  2996. //rave_addEventListener$1 : function(eventType, listener) {},
  2997. /**
  2998. * Adds an event listener for the given event type.
  2999. * @param (String) eventType the event type
  3000. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  3001. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  3002. */
  3003. //rave_addEventListener$2 : function(eventType, listener, useCapture) {},
  3004. /**
  3005. * Removes an event listener for the given type.
  3006. * @param (String) eventType the event type
  3007. */
  3008. //rave_removeEventListener$0 : function(eventType) {},
  3009. /**
  3010. * Removes an event listener for the given qualifier and type.
  3011. * @param (String) eventType the event type
  3012. * @param (String) group a qualifier to the event type for grouping like events
  3013. */
  3014. //rave_removeEventListener$1 : function(eventType, group) {}
  3015. });
  3016. /** @expose */
  3017. com_ibm_rave_core_scene_SceneNode.DATA_PROPERTY = "__data__";
  3018. // $source: com/ibm/rave/render/internal/nodes/AbstractSceneNode
  3019. /************************************************************************
  3020. ** IBM Confidential
  3021. **
  3022. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3023. **
  3024. ** (C) Copyright IBM Corp. 2017
  3025. **
  3026. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3027. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3028. ************************************************************************/
  3029. // GENERATED
  3030. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3031. //@import com/ibm/rave/core/scene/SceneNode (loadtime) // superclass
  3032. //@import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime) // new
  3033. //@import com/ibm/rave/core/internal/util/CollectionsUtil (runtime) // remove
  3034. //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // getIndex
  3035. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isArray
  3036. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // identity, transformBounds, isIdentityMatrix
  3037. //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
  3038. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  3039. //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
  3040. //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
  3041. //@import com/ibm/rave/render/internal/nodes/SceneNodeStyleManager (runtime) // new
  3042. //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parse
  3043. /**
  3044. * A base type for scene nodes.
  3045. */
  3046. var com_ibm_rave_render_internal_nodes_AbstractSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scene_SceneNode, {
  3047. //cachedBBox : null,
  3048. //cachedBoundingClientRect : null,
  3049. //parent : null,
  3050. //owner : null,
  3051. //children : null,
  3052. //namespaceURI : null,
  3053. //attributes : null,
  3054. //propertyBag : null,
  3055. //classList : null,
  3056. //eventListeners : null,
  3057. //listenersByGroup : null,
  3058. //listenersByType : null,
  3059. //qname : null,
  3060. /**
  3061. * Scene tree context used retrieve data about the scene tree.
  3062. */
  3063. //sceneTreeContext : null,
  3064. /**
  3065. * Native object holding specific platform information for this node. For instance on AWT, this might be a Rectangle2d object.
  3066. */
  3067. //nativeSceneNode : null,
  3068. //styleManager : null,
  3069. //cachedCTM : null,
  3070. //cachedScreenCTM : null,
  3071. text : "",
  3072. html : "",
  3073. invalidLayout : true,
  3074. dirty : false,
  3075. constructor : function(nsuri, context) {
  3076. this.attributes = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
  3077. {
  3078. this.rave_initExtensions();
  3079. this.namespaceURI = nsuri;
  3080. if (context) {
  3081. this.sceneTreeContext = (context).sceneTreeContext;
  3082. }
  3083. this.styleManager = new com_ibm_rave_render_internal_nodes_SceneNodeStyleManager(this);
  3084. }
  3085. },
  3086. /**
  3087. * Return this node's 'id' attribute. Must return the same value as getAttribute('id');
  3088. * @return (String) String representation of this node's ID value.
  3089. */
  3090. getId : function() {
  3091. var id = this.attributes.getByIndex(0);
  3092. if (id == null) {
  3093. return null;
  3094. }
  3095. return ""+(id);
  3096. },
  3097. /** @expose */
  3098. rave_hasProperty : function(propName) {
  3099. return this.propertyBag ? this.propertyBag.hasOwnProperty(propName) : false;
  3100. },
  3101. /**
  3102. * Create an instance of our children list
  3103. */
  3104. createChildren : function() {
  3105. this.children = [];
  3106. },
  3107. /** @expose */
  3108. rave_getEventListener : function(eventType) {
  3109. var info = this.eventListeners ? this.eventListeners[eventType] : null;
  3110. return info ? info.listener : null;
  3111. },
  3112. rave_addEventListener$1 : function(eventType, listener) {
  3113. this.rave_addEventListener$0(eventType, listener, false, null);
  3114. },
  3115. rave_addEventListener$2 : function(eventType, listener, useCapture) {
  3116. this.rave_addEventListener$0(eventType, listener, useCapture, null);
  3117. },
  3118. rave_addEventListener$0 : function(eventType, listener, useCapture, group) {
  3119. var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
  3120. if (!this.eventListeners) {
  3121. this.eventListeners = {};
  3122. this.listenersByGroup = {};
  3123. this.listenersByType = {};
  3124. } else if (this.eventListeners.hasOwnProperty(eventId)) {
  3125. this.rave_removeEventListener$1(eventType, group);
  3126. }
  3127. var info = new com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo(eventId, eventType, listener, useCapture);
  3128. this.eventListeners[eventId] = info;
  3129. var groupList = this.listenersByGroup[group];
  3130. if (!groupList) {
  3131. groupList = [];
  3132. this.listenersByGroup[group] = groupList;
  3133. }
  3134. groupList.push(info);
  3135. var typeList = this.listenersByType[eventType];
  3136. if (!typeList) {
  3137. typeList = [];
  3138. this.listenersByType[eventType] = typeList;
  3139. var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
  3140. if (renderer) {
  3141. renderer.registerEvent(eventType, this);
  3142. }
  3143. }
  3144. typeList.push(info);
  3145. },
  3146. rave_removeEventListener$0 : function(eventType) {
  3147. if (this.eventListeners) {
  3148. this.rave_removeEventListener$1(eventType, null);
  3149. }
  3150. },
  3151. rave_removeEventListener$1 : function(eventType, group) {
  3152. if (this.eventListeners) {
  3153. var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
  3154. var info = this.eventListeners[eventId];
  3155. if (info) {
  3156. delete this.eventListeners[eventId];
  3157. info.isRemoved = true;
  3158. var byGroupList = this.listenersByGroup[group];
  3159. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byGroupList, info) && byGroupList.length == 0) {
  3160. delete this.listenersByGroup[group];
  3161. }
  3162. var byTypeList = this.listenersByType[eventType];
  3163. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info) && byTypeList.length == 0) {
  3164. delete this.listenersByType[eventType];
  3165. var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
  3166. if (renderer) {
  3167. renderer.unregisterEvent(eventType, this);
  3168. }
  3169. }
  3170. }
  3171. }
  3172. },
  3173. /** @expose */
  3174. rave_removeEventListeners : function(group) {
  3175. if (this.listenersByGroup) {
  3176. var list = this.listenersByGroup[group];
  3177. if (list) {
  3178. var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null;
  3179. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  3180. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3181. var info = __exp_enFor0[__i_enFor0];
  3182. delete this.eventListeners[info.id];
  3183. info.isRemoved = true;
  3184. var byTypeList = this.listenersByType[info.type];
  3185. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info)) {
  3186. if (byTypeList.length == 0) {
  3187. delete this.listenersByType[info.type];
  3188. if (renderer) {
  3189. renderer.unregisterEvent(info.type, this);
  3190. }
  3191. }
  3192. }
  3193. }
  3194. delete this.listenersByGroup[group];
  3195. }
  3196. }
  3197. },
  3198. /** @expose */
  3199. dispatchEvent : function(event) {
  3200. if (!event) {
  3201. throw new Error("Null event");
  3202. }
  3203. if (event.type == null || event.type.length == 0) {
  3204. throw new Error("Uninitialized event");
  3205. }
  3206. var targetList = [];
  3207. event.target = this;
  3208. var targetParent = this.rave_getParentNode();
  3209. while (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(targetParent, com_ibm_rave_render_internal_nodes_AbstractSceneNode)) {
  3210. targetList.push(targetParent);
  3211. targetParent = targetParent.rave_getParentNode();
  3212. }
  3213. event.eventPhase = 1;
  3214. if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, true, false)) {
  3215. event.eventPhase = 2;
  3216. if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, this, false, true)) {
  3217. if (event.bubbles && !event.propagationStopped) {
  3218. event.eventPhase = 3;
  3219. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, false, false);
  3220. }
  3221. }
  3222. }
  3223. event.currentTarget = null;
  3224. event.eventPhase = 0;
  3225. return event.defaultPrevented;
  3226. },
  3227. /** @expose */
  3228. getAttribute : function(attribute) {
  3229. return attribute != null ? this.attributes.get(attribute) : null;
  3230. },
  3231. setSceneTreeContext : function(stc) {
  3232. this.sceneTreeContext = stc;
  3233. if (this.children) {
  3234. for (var __i_enFor0 = 0, __exp_enFor0 = this.children, __len_enFor0 = __exp_enFor0.length;
  3235. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3236. var child = __exp_enFor0[__i_enFor0];
  3237. (child).setSceneTreeContext(stc);
  3238. }
  3239. }
  3240. },
  3241. /**
  3242. * Notify listeners of a 'type' notification change on this node. Happens after the change has been made.
  3243. * @param (int) type The SceneItemNotificationType to notify listeners about.
  3244. * @param (int) subType Optional SceneItemNotificationType to notify listeners about.
  3245. * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
  3246. * @param (Object) toValue The value that the key is being updated to.
  3247. * @param (Object) fromValue The value that the key is being updated from (will be null if this is a new property).
  3248. */
  3249. notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
  3250. if (this.sceneTreeContext) {
  3251. if (this.sceneTreeContext.getCacheManager()) {
  3252. this.sceneTreeContext.getCacheManager().afterUpdate(type, subType, key, toValue, fromValue, this);
  3253. }
  3254. if (this.sceneTreeContext.getRenderer()) {
  3255. this.sceneTreeContext.getRenderer().handleDrawEvent(type, this);
  3256. }
  3257. }
  3258. },
  3259. /** @expose */
  3260. rave_getStyle : function(attribute) {
  3261. var style = this.styleManager.getStyleByName(attribute);
  3262. if (style && !style.fromAttribute) {
  3263. return style.value != null ? style.value.toString() : "";
  3264. }
  3265. return "";
  3266. },
  3267. computeStyleValue : function(id) {
  3268. this.computeStylesToRoot();
  3269. return this.styleManager.getComputedCSSStyle(id).value;
  3270. },
  3271. computeCSSStyle : function(id) {
  3272. this.computeStylesToRoot();
  3273. return this.styleManager.getComputedCSSStyle(id);
  3274. },
  3275. /**
  3276. * Get the value of a previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeStyleValue().
  3277. * @see #this.computeStyleValue( this.id)
  3278. * @param (int) id The internal style id to look for.
  3279. * @return (Object) The value of the CSSStyle associated with this computed style. The caller is responsible for properly casting.
  3280. */
  3281. getComputedStyleValue : function(id) {
  3282. return this.styleManager.getComputedStyleValue(id);
  3283. },
  3284. /**
  3285. * Get the previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeCSSStyle().
  3286. * @see #this.computeCSSStyle( this.id)
  3287. * @param (int) id The internal style id to look for.
  3288. * @return (com.ibm.rave.core.internal.css.CSSStyle) The CSSStyle associated with this computed style.
  3289. */
  3290. getComputedCSSStyle : function(id) {
  3291. return this.styleManager.getComputedCSSStyle(id);
  3292. },
  3293. /** @expose */
  3294. rave_getComputedStyle : function(attribute) {
  3295. this.computeStylesToRoot();
  3296. var cssStyle = this.styleManager.getComputedCSSStyle(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(attribute));
  3297. return cssStyle ? cssStyle.value != null ? cssStyle.value.toString() : "" : undefined;
  3298. },
  3299. /** @expose */
  3300. rave_getComputedStyles : function() {
  3301. this.computeStylesToRoot();
  3302. var results = {};
  3303. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styleManager.computedStyles), __len_enFor0 = __exp_enFor0.length;
  3304. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3305. var index = __exp_enFor0[__i_enFor0];
  3306. var style = this.styleManager.computedStyles[index];
  3307. var value;
  3308. if ((typeof style.value === "string" || style.value instanceof String) || (typeof style.value === "number" || style.value instanceof Number)) {
  3309. value = ""+(style.value);
  3310. } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isArray(style.value)) {
  3311. value = "";
  3312. var array = style.value;
  3313. for (var i = 0; i < array.length; ++i) {
  3314. value += array[i].toString();
  3315. if (i < array.length - 1) {
  3316. value += ",";
  3317. }
  3318. }
  3319. } else {
  3320. value = style.value == null ? "" : style.value.toString();
  3321. }
  3322. results[style.name] = value;
  3323. }
  3324. return results;
  3325. },
  3326. /**
  3327. * Compute all styles all the way up to the root. This ensures that inherited styles are up to date for this node. TODO we need a better way to determine if the styles have changed on a node and when to recompute.
  3328. */
  3329. computeStylesToRoot : function() {
  3330. var parentNode = this.rave_getParentNode();
  3331. if (parentNode) {
  3332. (parentNode).computeStylesToRoot();
  3333. }
  3334. this.computeStyles();
  3335. },
  3336. /** @expose */
  3337. rave_getText : function() {
  3338. var result = this.text;
  3339. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  3340. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3341. var child = __exp_enFor0[__i_enFor0];
  3342. result += child.rave_getText();
  3343. }
  3344. return result;
  3345. },
  3346. /** @expose */
  3347. rave_getHtml : function() {
  3348. var builder = "";
  3349. builder+=("<" + this.rave_getName() + " " + this.attributes.serialize() + " " + this.styleManager.serialize());
  3350. if (this.rave_hasChildNodes()) {
  3351. builder+=(">");
  3352. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  3353. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3354. var child = __exp_enFor0[__i_enFor0];
  3355. builder+=((child).rave_getHtml());
  3356. }
  3357. builder+=(this.text + "</" + this.rave_getName() + ">");
  3358. } else {
  3359. if (this.text != null && this.text.length > 0) {
  3360. builder+=(">" + this.text + "</" + this.rave_getName() + ">");
  3361. } else {
  3362. builder+=("/>");
  3363. }
  3364. }
  3365. return builder;
  3366. },
  3367. /** @expose */
  3368. rave_setHtml : function(html) {
  3369. this.setDirty(true, true);
  3370. var newValue = html == null ? "" : html;
  3371. this.html = newValue;
  3372. this.notifyAfterUpdate(1000, 2003, "html", newValue, null);
  3373. },
  3374. /** @expose */
  3375. rave_addClass : function(className) {
  3376. return this.addClassAndUpdateClassAttr(className, true);
  3377. },
  3378. addClassAndUpdateClassAttr : function(className, updateClassAttr) {
  3379. var added = false;
  3380. var classes = className.split(new RegExp("\\s+"));
  3381. if (classes.length > 0) {
  3382. if (!this.classList) {
  3383. this.classList = [];
  3384. }
  3385. var newClassName = null;
  3386. for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
  3387. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3388. var clazz = classes[__i_enFor0];
  3389. if (clazz.length > 0 && !(this.classList.indexOf(clazz)> -1)) {
  3390. if (!added) {
  3391. added = true;
  3392. this.setDirty(true, true);
  3393. this.styleManager.dirtyExternalStyles = true;
  3394. newClassName = this.attributes.getByIndex(2);
  3395. if (newClassName == null) {
  3396. newClassName = "";
  3397. }
  3398. }
  3399. if (newClassName.length > 0) {
  3400. newClassName += " ";
  3401. }
  3402. newClassName += clazz;
  3403. this.classList.push(clazz);
  3404. this.notifyAfterUpdate(1001, 2001, "class", clazz, null);
  3405. }
  3406. }
  3407. if (added && updateClassAttr) {
  3408. this.attributes.setPropertyValue(2, newClassName);
  3409. }
  3410. }
  3411. return added;
  3412. },
  3413. /** @expose */
  3414. rave_removeClass : function(className) {
  3415. var removed = false;
  3416. if (this.classList && this.classList.length > 0) {
  3417. var classes = className.split(new RegExp("\\s+"));
  3418. if (classes.length > 0) {
  3419. for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
  3420. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3421. var clazz = classes[__i_enFor0];
  3422. if (clazz.length > 0 && this.classList.indexOf(clazz)> -1) {
  3423. if (!removed) {
  3424. removed = true;
  3425. this.setDirty(true, true);
  3426. this.styleManager.dirtyExternalStyles = true;
  3427. }
  3428. com_ibm_rave_core_internal_util_CollectionsUtil.remove(this.classList, clazz);
  3429. this.notifyAfterUpdate(1002, 2001, "class", null, clazz);
  3430. }
  3431. }
  3432. if (removed) {
  3433. this.attributes.setPropertyValue(2, this.classList.join(" "));
  3434. }
  3435. }
  3436. }
  3437. return removed;
  3438. },
  3439. /** @expose */
  3440. rave_containsClass : function(className) {
  3441. if (!this.classList) {
  3442. return false;
  3443. }
  3444. var classes = className.trim().split(new RegExp("\\s"));
  3445. for (var __i_enFor0 = 0, __len_enFor0 = classes.length;
  3446. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3447. var clazz = classes[__i_enFor0];
  3448. if (!(this.classList.indexOf(clazz.trim())> -1)) {
  3449. return false;
  3450. }
  3451. }
  3452. return true;
  3453. },
  3454. /** @expose */
  3455. rave_getNamespaceURI : function() {
  3456. return this.namespaceURI;
  3457. },
  3458. /** @expose */
  3459. rave_getQualifiedName : function() {
  3460. if (this.qname == null) {
  3461. this.qname = this.namespaceURI + ":" + this.rave_getName();
  3462. }
  3463. return this.qname;
  3464. },
  3465. /** @expose */
  3466. getAttributeNS : function(namespace, attribute) {
  3467. return this.getAttribute(namespace + ":" + attribute);
  3468. },
  3469. /** @expose */
  3470. setAttributeNS : function(namespace, attribute, value) {
  3471. this.setAttribute(namespace + ":" + attribute, value);
  3472. },
  3473. /** @expose */
  3474. removeAttribute : function(attribute) {
  3475. var oldValue = this.attributes.get(attribute);
  3476. if (oldValue == null) {
  3477. return;
  3478. }
  3479. this.setAttribute(attribute, null);
  3480. this.notifyAfterUpdate(1002, 2000, attribute, null, oldValue);
  3481. },
  3482. /** @expose */
  3483. removeAttributeNS : function(namespace, attribute) {
  3484. this.removeAttribute(namespace + ":" + attribute);
  3485. },
  3486. /** @expose */
  3487. rave_removeStyle : function(styleName) {
  3488. this.styleManager.removeStyle(styleName);
  3489. },
  3490. /**
  3491. * Computes all styles for this node. The caller must ensure that all parent nodes have had their styles computed already.
  3492. */
  3493. computeStyles : function() {
  3494. this.styleManager.computeStyles();
  3495. },
  3496. /** @expose */
  3497. rave_getProperty : function(key) {
  3498. return this.propertyBag ? this.propertyBag[key] : null;
  3499. },
  3500. /**
  3501. * @return (Array) List of class names on this node.
  3502. */
  3503. getClassList : function() {
  3504. if (!this.classList) {
  3505. this.classList = [];
  3506. }
  3507. return this.classList;
  3508. },
  3509. getPropertyBag : function() {
  3510. if (!this.propertyBag) {
  3511. this.propertyBag = {};
  3512. }
  3513. return this.propertyBag;
  3514. },
  3515. /** @expose */
  3516. rave_setParentNode : function(parent) {
  3517. var rendererSet = false;
  3518. if (!this.sceneTreeContext && parent) {
  3519. var r = (parent).sceneTreeContext;
  3520. if (r) {
  3521. this.setSceneTreeContext(r);
  3522. rendererSet = true;
  3523. }
  3524. }
  3525. if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) {
  3526. if ((!this.parent && parent) || rendererSet) {
  3527. this.recursiveRegisterEventListeners();
  3528. } else if (this.parent && !parent) {
  3529. this.recursiveUnregisterEventListeners();
  3530. }
  3531. if (!parent) {
  3532. this.setSceneTreeContext(null);
  3533. }
  3534. }
  3535. this.parent = parent;
  3536. },
  3537. /** @expose */
  3538. rave_getOwner : function() {
  3539. if (this.owner) {
  3540. return this.owner;
  3541. }
  3542. var p = this.rave_getParentNode();
  3543. return !p ? null : p.rave_getOwner();
  3544. },
  3545. /** @expose */
  3546. rave_setOwner : function(owner) {
  3547. this.owner = owner;
  3548. },
  3549. /**
  3550. * @expose
  3551. */
  3552. computeCTM : function(context, isScreenCTM) {
  3553. var abstractContext = context;
  3554. var ctm = com_ibm_rave_core_transform_MatrixUtil.identity();
  3555. var t = abstractContext.computeStyleValue(11);
  3556. if (t) {
  3557. ctm = t;
  3558. }
  3559. var parent = context.rave_getParentNode();
  3560. if (parent) {
  3561. var pctm = isScreenCTM ? parent.getScreenCTM() : parent.getCTM();
  3562. if (pctm) {
  3563. if (!ctm) {
  3564. ctm = pctm;
  3565. } else if (!(com_ibm_rave_core_transform_MatrixUtil.isIdentityMatrix(pctm))) {
  3566. ctm = pctm.multiply(ctm);
  3567. }
  3568. }
  3569. }
  3570. return ctm ? ctm : com_ibm_rave_core_transform_MatrixUtil.identity();
  3571. },
  3572. recursiveRegisterEventListeners : function() {
  3573. if (this.eventListeners) {
  3574. var renderer = this.sceneTreeContext.getRenderer();
  3575. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
  3576. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3577. var type = __exp_enFor0[__i_enFor0];
  3578. renderer.registerEvent(type, this);
  3579. }
  3580. }
  3581. if (this.children) {
  3582. for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
  3583. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3584. var child = __exp_enFor1[__i_enFor1];
  3585. (child).recursiveRegisterEventListeners();
  3586. }
  3587. }
  3588. },
  3589. recursiveUnregisterEventListeners : function() {
  3590. if (this.eventListeners) {
  3591. var renderer = this.sceneTreeContext.getRenderer();
  3592. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
  3593. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3594. var type = __exp_enFor0[__i_enFor0];
  3595. renderer.unregisterEvent(type, this);
  3596. }
  3597. }
  3598. if (this.children) {
  3599. for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
  3600. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3601. var child = __exp_enFor1[__i_enFor1];
  3602. (child).recursiveUnregisterEventListeners();
  3603. }
  3604. }
  3605. },
  3606. /**
  3607. * Removes the child from this parent but does not update the parent node of the child.
  3608. * @param (com.ibm.rave.core.scene.SceneNode) child
  3609. */
  3610. internalRemoveChild : function(child) {
  3611. var idx = this.children.indexOf(child);
  3612. if (idx >= 0) {
  3613. this.children.splice(idx, 1);
  3614. }
  3615. },
  3616. /**
  3617. * Helper method to append a child item.
  3618. * @param (com.ibm.rave.core.scene.SceneNode) item the child item to append
  3619. * @return (int) the index of the appended item
  3620. */
  3621. internalAppendChild : function(item) {
  3622. if (!this.children) {
  3623. this.createChildren();
  3624. }
  3625. this.setDirty(true, true);
  3626. if (item.rave_getParentNode()) {
  3627. item.rave_getParentNode().removeChild(item);
  3628. }
  3629. this.children.push(item);
  3630. item.rave_setParentNode(this);
  3631. return this.children.length - 1;
  3632. },
  3633. /**
  3634. * Helper method to insert a child item before another one. If the 'before' item isn't actually a child of this node, then insert 'item' at the end.
  3635. * @param (com.ibm.rave.core.scene.SceneNode) item the item to insert
  3636. * @param (com.ibm.rave.core.scene.SceneNode) before the item to insert before
  3637. * @return (int) the index of the inserted item.
  3638. */
  3639. insertChildBefore : function(item, before) {
  3640. if (!this.children) {
  3641. this.createChildren();
  3642. }
  3643. var bidx = this.children.indexOf(before);
  3644. if (before && bidx >= 0) {
  3645. if (item == before) {
  3646. return bidx;
  3647. }
  3648. this.setDirty(true, true);
  3649. this.internalRemoveChild(item);
  3650. bidx = this.children.indexOf(before);
  3651. item.rave_setParentNode(this);
  3652. this.children.splice(bidx, 0, item);
  3653. return bidx;
  3654. }
  3655. this.setDirty(true, true);
  3656. this.children.push(item);
  3657. item.rave_setParentNode(this);
  3658. return this.children.length - 1;
  3659. },
  3660. /**
  3661. * Get the sibling of this scene item at the specified index offset. The offset can be any integer, including 0 or negative values. For a negative offset, this method will return a sibling at a position <em>preceding</em> this item.
  3662. * @param (int) offset Integer index offset.
  3663. * @return (com.ibm.rave.core.scene.SceneNode) This item's sibling at the specified index offset.
  3664. */
  3665. getSibling : function(offset) {
  3666. var sibling;
  3667. if (this.parent) {
  3668. var c = this.parent.rave_getChildNodes();
  3669. var idx = c.indexOf(this);
  3670. var idxOffset = idx + offset;
  3671. if (idx > -1 && (idxOffset >= 0 && idxOffset < c.length)) {
  3672. sibling = c[idxOffset];
  3673. }
  3674. }
  3675. return sibling;
  3676. },
  3677. _detectHits : function(list, rectangle) {
  3678. if (this._hitDetectionEntryTest()) {
  3679. return;
  3680. }
  3681. if (this.rave_intersects(rectangle)) {
  3682. if (this.rave_hasChildNodes()) {
  3683. var childNodes = this.getChildrenArray();
  3684. for (var i = childNodes.length - 1; i >= 0; --i) {
  3685. var child = childNodes[i];
  3686. var ctm = child.getComputedStyleValue(11);
  3687. child._detectHits(list, ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle);
  3688. }
  3689. } else if (!("none" == this.getComputedStyleValue(42))) {
  3690. list.push(this);
  3691. }
  3692. }
  3693. },
  3694. _detectHit : function(rectangle) {
  3695. if (this._hitDetectionEntryTest()) {
  3696. return null;
  3697. }
  3698. if (this.rave_intersects(rectangle)) {
  3699. if (this.rave_hasChildNodes()) {
  3700. var childNodes = this.getChildrenArray();
  3701. for (var i = childNodes.length - 1; i >= 0; --i) {
  3702. var child = childNodes[i];
  3703. var ctm = child.getComputedStyleValue(11);
  3704. var hit = child._detectHit(ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle);
  3705. if (hit) {
  3706. return hit;
  3707. }
  3708. }
  3709. } else if (!("none" == this.getComputedStyleValue(42))) {
  3710. return this;
  3711. }
  3712. return !this.rave_getParentNode() ? this : null;
  3713. }
  3714. return null;
  3715. },
  3716. _hitDetectionEntryTest : function() {
  3717. return !(this.isVisible()) || "none" == this.getComputedStyleValue(26);
  3718. },
  3719. rave_intersects : function(rect) {
  3720. if ("none" == this.computeStyleValue(26) || "none" == this.getComputedStyleValue(42) || !(this.intersectsClip(rect))) {
  3721. return false;
  3722. }
  3723. var r = this.getBBox();
  3724. return r.intersects(rect);
  3725. },
  3726. /**
  3727. * Helper method to check if the given rect intersects with the clip on this node. If no clip is present, returns <code>true</code>.
  3728. * @param (com.ibm.rave.core.geom.RectStruct) rect the rectangle hit testing region
  3729. * @return (boolean) <code>true</code> if the rectangle intersects the clip or if no clip is present, <code>false</code> otherwise
  3730. */
  3731. intersectsClip : function(rect) {
  3732. var clip = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(this, this.getComputedStyleValue(44), [1014]);
  3733. return !clip || clip.rave_intersects(rect);
  3734. },
  3735. /** @expose */
  3736. rave_intersectionList : function(r) {
  3737. var list = [];
  3738. this._detectHits(list, r);
  3739. return list;
  3740. },
  3741. /** @expose */
  3742. rave_intersection : function(x, y) {
  3743. return this._detectHit(new com_ibm_rave_core_geom_RectStruct(x, y, 0.5, 0.5));
  3744. },
  3745. /** @expose */
  3746. rave_initExtensions : function() {
  3747. this.rave_setProperty = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT;
  3748. this.removePropertyExt = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT;
  3749. this.appendChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT;
  3750. this.rave_getParentNode = com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT;
  3751. this.insertBefore = com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT;
  3752. this.rave_getNextSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT;
  3753. this.rave_getPreviousSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT;
  3754. this.rave_getFirstChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD;
  3755. this.rave_hasChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT;
  3756. this.rave_getChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT;
  3757. this.removeChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT;
  3758. this.rave_setStyle = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT;
  3759. this.setAttribute = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT;
  3760. this.rave_setText = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT;
  3761. this.getCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT;
  3762. this.getScreenCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT;
  3763. },
  3764. /**
  3765. * Return the index of this node relative to its siblings.
  3766. * @return (int) The index of this node relative to its siblings.
  3767. */
  3768. getSiblingIndex : function() {
  3769. return this.parent.rave_getChildNodes().indexOf(this);
  3770. },
  3771. /**
  3772. * Called after painting of node and its children. By default, this does nothing. Nodes can override as needed.
  3773. * @param (com.ibm.rave.render.AbstractRenderer) renderer The renderer to draw to
  3774. */
  3775. postPaint : function(renderer) {},
  3776. /**
  3777. * Is this a 'drawable' scene node. ie - one that can be drawn on a canvas. For instance, a "rect" shape is drawable, while a "defs" node is not.
  3778. * @return (boolean) <code>true</code> if this is a drawable node, <code>false</code> otherwise.
  3779. */
  3780. isDrawable : function() {
  3781. return true;
  3782. },
  3783. /**
  3784. * Get the size from the computed style and convert to pixel value.
  3785. * @param (com.ibm.rave.core.css.CSSSize) size the CSS size
  3786. * @return (double) a pixel value of the size for the given style
  3787. */
  3788. /** @expose */
  3789. rave_getSizePx : function(size) {
  3790. var value = 0;
  3791. if (size) {
  3792. value = size.value;
  3793. switch (size.unit.type) {
  3794. case 1:
  3795. break;
  3796. case 2:
  3797. break;
  3798. case 4:
  3799. value = 96.0 * 0.3937007874 * value;
  3800. break;
  3801. case 3:
  3802. value = 96.0 * value;
  3803. break;
  3804. case 6:
  3805. value = 96.0 * 0.0138888889 * value;
  3806. break;
  3807. case 7:
  3808. value = 96.0 * 0.1666666667 * value;
  3809. break;
  3810. case 5:
  3811. value = 96.0 * 0.0393700787 * value;
  3812. break;
  3813. }
  3814. }
  3815. return value;
  3816. },
  3817. /**
  3818. * Return a pixel size for the computed style information for the style referenced by styleId.
  3819. * @param (int) styleId Style id from SceneNodeStyles.
  3820. * @return (double) Computed pixel value for this style.
  3821. */
  3822. getComputedSizePx : function(styleId) {
  3823. return this.rave_getSizePx(this.getComputedCSSStyle(styleId).value);
  3824. },
  3825. /** @expose */
  3826. getBBox : function() {
  3827. if (this.invalidLayout) {
  3828. this.layout();
  3829. }
  3830. if (!this.cachedBBox) {
  3831. this.cachedBBox = this.calculateBBox();
  3832. }
  3833. return this.cachedBBox;
  3834. },
  3835. /**
  3836. * A method to get the bounding box to use in getBoundingClientRect() calculations. By default this method just calls getBBox(), but some scene node types may need to override this. For instance, text nodes change their x values based on text-anchor.
  3837. * @return (com.ibm.rave.core.geom.RaveRect) Bounding box to be used in getBoundingClientRect() before transforms are applied.
  3838. */
  3839. getBoundingClientRectBBox : function() {
  3840. return this.getBBox();
  3841. },
  3842. /**
  3843. * Perform a layout pass on this node and this node only. Invalidate our layout caches.
  3844. */
  3845. layout : function() {
  3846. if (this.invalidLayout) {
  3847. this.computeStylesToRoot();
  3848. this.doLayout();
  3849. }
  3850. this.invalidLayout = false;
  3851. },
  3852. /**
  3853. * We call invalidateLayout whenever an attribute or style changes that changes the bounding box of this node.
  3854. */
  3855. invalidateLayout : function() {
  3856. this.invalidLayout = true;
  3857. this.cachedBBox = null;
  3858. var parent = this;
  3859. if ((parent = parent.rave_getParentNode()) && !(parent).invalidLayout) {
  3860. (parent).invalidateLayout();
  3861. }
  3862. },
  3863. /**
  3864. * Called whenever transform information has changed. This invalidates our CTM and cached bounding client rect.
  3865. */
  3866. invalidateTransform : function() {
  3867. this.cachedBoundingClientRect = null;
  3868. this.cachedScreenCTM = null;
  3869. this.cachedCTM = null;
  3870. if (this.rave_hasChildNodes()) {
  3871. for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  3872. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3873. var child = __exp_enFor0[__i_enFor0];
  3874. (child).invalidateTransform();
  3875. }
  3876. }
  3877. },
  3878. /**
  3879. * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other non-layout attributes.
  3880. */
  3881. /** @expose */
  3882. getBoundingClientRect : function() {
  3883. if (this.invalidLayout) {
  3884. this.layout();
  3885. }
  3886. if (!this.cachedBoundingClientRect) {
  3887. var bb = this.getBoundingClientRectBBox();
  3888. var ownerLeft = 0;
  3889. var ownerTop = 0;
  3890. if (this.rave_getOwner() != this) {
  3891. var ownerRect = this.rave_getOwner().getBoundingClientRect();
  3892. ownerLeft = ownerRect.left;
  3893. ownerTop = ownerRect.top;
  3894. }
  3895. var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(bb.x, bb.y, bb.width, bb.height), this.getCTM());
  3896. var left = bstruct.x + ownerLeft;
  3897. var right = left + bstruct.width;
  3898. var top = bstruct.y + ownerTop;
  3899. var bottom = top + bstruct.height;
  3900. this.cachedBoundingClientRect = new com_ibm_rave_core_geom_NodeRect(left, right, bottom, top, bstruct.width, bstruct.height);
  3901. }
  3902. return this.cachedBoundingClientRect;
  3903. },
  3904. /**
  3905. * Is this node 'visible' meaning it will be fully drawn. This method only takes the visibility attribute into account.
  3906. * @return (boolean) <code>true</code> if this node should be painted. <code>false</code> otherwise.
  3907. */
  3908. isVisible : function() {
  3909. return this.styleManager.isVisible();
  3910. },
  3911. isDirty : function() {
  3912. return this.dirty;
  3913. },
  3914. setDirty : function(dirty_, invalidateLayout) {
  3915. if (dirty_) {
  3916. var notifyChildren = false;
  3917. if (!this.dirty) {
  3918. this.dirty = true;
  3919. notifyChildren = true;
  3920. switch (this.rave_getDrawType()) {
  3921. case -1:
  3922. case 1004:
  3923. case 1015:
  3924. break;
  3925. default:
  3926. if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) {
  3927. this.sceneTreeContext.getRenderer().makeDirty(this);
  3928. }
  3929. }
  3930. }
  3931. if (invalidateLayout) {
  3932. this.invalidateLayout();
  3933. this.invalidateTransform();
  3934. }
  3935. if (notifyChildren && this.rave_hasChildNodes()) {
  3936. for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  3937. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3938. var child = __exp_enFor0[__i_enFor0];
  3939. (child).setDirty(true, false);
  3940. }
  3941. }
  3942. } else {
  3943. this.dirty = false;
  3944. }
  3945. },
  3946. /**
  3947. * Internal API to return raw children nodes collection (including mirrored groups if any). Can return null
  3948. * @return (Array) raw children nodes collection (including mirrored groups if any). Can return null
  3949. */
  3950. getChildrenArray : function() {
  3951. return this.children;
  3952. },
  3953. getShadow : function() {
  3954. return com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
  3955. },
  3956. /** @expose */
  3957. rave_addEventListener : function(a0, a1, a2, a3) {
  3958. var args = arguments;
  3959. if (args.length == 2) {
  3960. return this.rave_addEventListener$1(a0, a1);
  3961. }
  3962. if (args.length == 3) {
  3963. return this.rave_addEventListener$2(a0, a1, a2);
  3964. }
  3965. return this.rave_addEventListener$0(a0, a1, a2, a3);
  3966. },
  3967. /** @expose */
  3968. rave_removeEventListener : function(a0, a1) {
  3969. var args = arguments;
  3970. if (args.length == 1) {
  3971. return this.rave_removeEventListener$0(a0);
  3972. }
  3973. return this.rave_removeEventListener$1(a0, a1);
  3974. }
  3975. //paint : function(renderer) {},
  3976. /**
  3977. * Calculate the bounding box based on the currently set attributes.
  3978. */
  3979. //calculateBBox : function() {},
  3980. /**
  3981. * Perform a layout pass on this node.
  3982. */
  3983. //doLayout : function() {}
  3984. });
  3985. com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId = function(eventType, group) {
  3986. return eventType + (group != null ? "." + group : "");
  3987. };
  3988. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets = function(event, targetList, capturing, atTargetPhase) {
  3989. var start = 0, inc = 1, end = targetList.length;
  3990. if (capturing) {
  3991. start = targetList.length - 1;
  3992. inc = end = -1;
  3993. }
  3994. for (var i = start; i != end && !event.propagationStopped && !event.immediatePropagationStopped; i += inc) {
  3995. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, targetList[i], capturing, atTargetPhase);
  3996. }
  3997. return !event.propagationStopped;
  3998. };
  3999. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget = function(event, currentTarget, capturing, atTargetPhase) {
  4000. if (currentTarget.listenersByType) {
  4001. var list = currentTarget.listenersByType[event.type];
  4002. if (list) {
  4003. list = list.slice();
  4004. var currentListener = list.length;
  4005. while (--currentListener >= 0) {
  4006. var info = list[currentListener];
  4007. if (!info.isRemoved && (atTargetPhase || info.capture == capturing)) {
  4008. event.currentTarget = currentTarget;
  4009. info.listener.call(currentTarget, event);
  4010. }
  4011. }
  4012. }
  4013. }
  4014. return !event.propagationStopped;
  4015. };
  4016. com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo = function(id, type, listener, capture) {
  4017. this.id = id;
  4018. this.type = type;
  4019. this.listener = listener;
  4020. this.capture = capture;
  4021. };
  4022. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT = function(key, value) {
  4023. if ("__rave-mirrored__" == key) {
  4024. (this).invalidateLayout();
  4025. }
  4026. (this).getPropertyBag()[key] = value;
  4027. };
  4028. com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT = function(key) {
  4029. delete (this).getPropertyBag()[key];
  4030. };
  4031. com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT = function(node) {
  4032. (this).internalAppendChild(node);
  4033. (node).notifyAfterUpdate(1001, 3000, null, null, null);
  4034. };
  4035. com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT = function(node, before) {
  4036. (this).insertChildBefore(node, before);
  4037. (node).notifyAfterUpdate(1001, 3000, null, null, null);
  4038. };
  4039. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT = function() {
  4040. return (this).getSibling(1);
  4041. };
  4042. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT = function() {
  4043. return (this).getSibling(-1);
  4044. };
  4045. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD = function() {
  4046. var asc = this;
  4047. if (asc.children && asc.children.length > 0) {
  4048. return asc.children[0];
  4049. }
  4050. return asc.getSibling(1);
  4051. };
  4052. com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT = function() {
  4053. var asc = this;
  4054. return asc.children && asc.children.length > 0;
  4055. };
  4056. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT = function() {
  4057. var asc = this;
  4058. if (!asc.children) {
  4059. asc.createChildren();
  4060. }
  4061. return asc.children;
  4062. };
  4063. com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT = function(node) {
  4064. var asc = this;
  4065. var removed = false;
  4066. var idx = asc.children.indexOf(node);
  4067. if (idx >= 0) {
  4068. removed = true;
  4069. (node).setDirty(true, true);
  4070. asc.children.splice(idx, 1);
  4071. (node).notifyAfterUpdate(1002, 3000, null, null, null);
  4072. node.rave_setParentNode(null);
  4073. }
  4074. return removed;
  4075. };
  4076. com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT = function() {
  4077. return (this).parent;
  4078. };
  4079. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT = function(text) {
  4080. (this).setDirty(true, true);
  4081. var oldValue = (this).text;
  4082. var newValue = text == null ? "" : text;
  4083. var copy = [];
  4084. for (var __i_enFor0 = 0, __exp_enFor0 = (this).rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  4085. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4086. var child = __exp_enFor0[__i_enFor0];
  4087. copy.push(child);
  4088. }
  4089. for (var __i_enFor1 = 0, __exp_enFor1 = copy, __len_enFor1 = __exp_enFor1.length;
  4090. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4091. var child = __exp_enFor1[__i_enFor1];
  4092. (this).removeChild(child);
  4093. }
  4094. (this).text = newValue;
  4095. (this).notifyAfterUpdate(1000, 2004, "text", newValue, oldValue);
  4096. };
  4097. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT = function(key, value) {
  4098. if (key != null) {
  4099. var k = key.toLowerCase();
  4100. var acontext = this;
  4101. var oldValue;
  4102. var index = acontext.attributes.getIndex(k);
  4103. switch (index) {
  4104. case 2:
  4105. if (acontext.classList) {
  4106. acontext.classList = null;
  4107. }
  4108. if (value != null) {
  4109. acontext.addClassAndUpdateClassAttr(""+(value), false);
  4110. } else {
  4111. acontext.setDirty(true, false);
  4112. }
  4113. break;
  4114. case 1:
  4115. acontext.styleManager.removeAllInlineStyles();
  4116. var styleSheet = com_ibm_rave_core_internal_css_CSSParser.parse("a{" + ""+(value) + "}");
  4117. for (var __i_enFor0 = 0, __exp_enFor0 = styleSheet.cssRules, __len_enFor0 = __exp_enFor0.length;
  4118. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4119. var rule = __exp_enFor0[__i_enFor0];
  4120. var styleDecl = rule.style;
  4121. for (var i = 0; i < styleDecl.length; ++i) {
  4122. var styleName = styleDecl.item(i);
  4123. acontext.rave_setStyle(styleName, styleDecl.getPropertyValue(styleName), styleDecl.getPropertyPriority(styleName));
  4124. }
  4125. }
  4126. break;
  4127. default:
  4128. var styleIndex = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(k);
  4129. if (styleIndex >= 0) {
  4130. var style = acontext.styleManager.getStyleByIndex(styleIndex);
  4131. if (!style) {
  4132. acontext.rave_setStyle(k, value, null);
  4133. style = acontext.styleManager.getStyleByIndex(styleIndex);
  4134. if (style) {
  4135. style.fromAttribute = true;
  4136. }
  4137. } else if (style.fromAttribute) {
  4138. acontext.rave_setStyle(k, value, null);
  4139. style.fromAttribute = true;
  4140. }
  4141. } else {
  4142. acontext.setDirty(true, true);
  4143. }
  4144. }
  4145. if (index == -1) {
  4146. oldValue = acontext.attributes.get(k);
  4147. index = acontext.attributes.put(k, value);
  4148. } else {
  4149. oldValue = acontext.attributes.getByIndex(index);
  4150. acontext.attributes.setPropertyValue(index, value);
  4151. }
  4152. acontext.notifyAfterUpdate(1000, 2000, k, value, oldValue);
  4153. }
  4154. };
  4155. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT = function(styleName, value, priority) {
  4156. (this).styleManager.setStyle(this, styleName, value, priority);
  4157. };
  4158. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT = function() {
  4159. var abstractContext = this;
  4160. if (!abstractContext.cachedCTM) {
  4161. abstractContext.cachedCTM = abstractContext.computeCTM(this, false);
  4162. }
  4163. return abstractContext.cachedCTM;
  4164. };
  4165. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT = function() {
  4166. var abstractContext = this;
  4167. if (!abstractContext.cachedScreenCTM) {
  4168. abstractContext.cachedScreenCTM = abstractContext.computeCTM(this, true);
  4169. }
  4170. return abstractContext.cachedScreenCTM;
  4171. };
  4172. // $source: com/ibm/rave/render/internal/nodes/RectSceneItem
  4173. /************************************************************************
  4174. ** IBM Confidential
  4175. **
  4176. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4177. **
  4178. ** (C) Copyright IBM Corp. 2017
  4179. **
  4180. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4181. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4182. ************************************************************************/
  4183. // GENERATED
  4184. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4185. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  4186. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  4187. //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
  4188. /**
  4189. * Rectangle shape.
  4190. */
  4191. var com_ibm_rave_render_internal_nodes_RectSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  4192. x : 0,
  4193. y : 0,
  4194. width : 0,
  4195. height : 0,
  4196. rx : 0,
  4197. ry : 0,
  4198. calculateBBox : function() {
  4199. return new com_ibm_rave_core_geom_RaveRect(this.x, this.y, this.width, this.height);
  4200. },
  4201. /** @expose */
  4202. rave_getDrawType : function() {
  4203. return 1000;
  4204. },
  4205. /** @expose */
  4206. rave_getName : function() {
  4207. return "rect";
  4208. },
  4209. getX : function() {
  4210. return this.x;
  4211. },
  4212. getY : function() {
  4213. return this.y;
  4214. },
  4215. getWidth : function() {
  4216. return this.width;
  4217. },
  4218. getHeight : function() {
  4219. return this.height;
  4220. },
  4221. getRx : function() {
  4222. return this.rx;
  4223. },
  4224. getRy : function() {
  4225. return this.ry;
  4226. },
  4227. rave_intersects : function(rect) {
  4228. var rx = this.getRx();
  4229. var ry = this.getRy();
  4230. if (rx < 1 && ry < 1) {
  4231. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect);
  4232. }
  4233. var x = this.getX();
  4234. var y = this.getY();
  4235. var w = this.getWidth();
  4236. var h = this.getHeight();
  4237. rx = (rx == 0) ? ry : rx;
  4238. ry = (ry == 0) ? rx : ry;
  4239. if (rx > w / 2) {
  4240. rx = w / 2;
  4241. }
  4242. if (ry > h / 2) {
  4243. ry = h / 2;
  4244. }
  4245. var kappa = 0.5522848;
  4246. var ox = rx * kappa;
  4247. var oy = ry * kappa;
  4248. var xe = x + w;
  4249. var ye = y + h;
  4250. var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
  4251. pathHandler.moveTo(x + rx, y);
  4252. pathHandler.lineTo(x + w - rx, y);
  4253. pathHandler.bezierCurveTo(xe - rx + ox, y, xe, y + ry - oy, xe, y + ry);
  4254. pathHandler.lineTo(x + w, y + h - ry);
  4255. pathHandler.bezierCurveTo(xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye);
  4256. pathHandler.lineTo(x + rx, y + h);
  4257. pathHandler.bezierCurveTo(x + rx - ox, ye, x, ye - ry + oy, x, ye - ry);
  4258. pathHandler.lineTo(x, y + ry);
  4259. pathHandler.bezierCurveTo(x, y + ry - oy, x + rx - ox, y, x + rx, y);
  4260. pathHandler.closePath();
  4261. var shapes = pathHandler.getShapes();
  4262. return shapes[0].intersect$1(rect) && this.intersectsClip(rect);
  4263. },
  4264. paint : function(renderer) {
  4265. renderer.setStrokeAndFill(this);
  4266. renderer.drawRect(this);
  4267. },
  4268. doLayout : function() {
  4269. this.x = this.rave_getSizePx(this.getComputedCSSStyle(0).value);
  4270. this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value);
  4271. this.width = this.rave_getSizePx(this.getComputedCSSStyle(2).value);
  4272. this.height = this.rave_getSizePx(this.getComputedCSSStyle(3).value);
  4273. this.rx = this.rave_getSizePx(this.getComputedCSSStyle(12).value);
  4274. this.ry = this.rave_getSizePx(this.getComputedCSSStyle(13).value);
  4275. }
  4276. //constructor : function(nsuri, context) {}
  4277. });
  4278. // $source: com/ibm/rave/render/internal/properties/DynamicAttributesCollection
  4279. /************************************************************************
  4280. ** IBM Confidential
  4281. **
  4282. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4283. **
  4284. ** (C) Copyright IBM Corp. 2017
  4285. **
  4286. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4287. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4288. ************************************************************************/
  4289. // GENERATED
  4290. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4291. /**
  4292. * A representation of a set of attributes on a scene item. Uses a fixed array of 'propertyNames' and 'propertyValues'. The values can be modified, names cannot. This is done for speed because we can access the values by index which is much faster than using a string->object map.
  4293. */
  4294. var com_ibm_rave_render_internal_properties_DynamicAttributesCollection = com_ibm_rave_core_nativeImpl_Declare({
  4295. //propNames : null,
  4296. //propValues : null,
  4297. //dynamicMap : null,
  4298. allowUnknownProperties : true,
  4299. getByIndex : function(i) {
  4300. return this.propValues[i];
  4301. },
  4302. setPropertyValue : function(index, value) {
  4303. this.propValues[index] = value;
  4304. },
  4305. get : function(propName) {
  4306. var i = this.getIndex(propName);
  4307. if (i == -1) {
  4308. return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap[propName.toLowerCase()] : null;
  4309. }
  4310. return this.propValues[i];
  4311. },
  4312. put : function(propName, value) {
  4313. var i = this.getIndex(propName);
  4314. if (i == -1) {
  4315. if (this.allowUnknownProperties) {
  4316. if (!this.dynamicMap) {
  4317. this.dynamicMap = {};
  4318. }
  4319. this.dynamicMap[propName] = value;
  4320. }
  4321. } else {
  4322. this.setPropertyValue(i, value);
  4323. }
  4324. return i;
  4325. },
  4326. getIndex : function(propName) {
  4327. for (var i = 0, len = this.propNames.length; i < len; ++i) {
  4328. if (this.propNames[i] == propName) {
  4329. return i;
  4330. }
  4331. }
  4332. return -1;
  4333. },
  4334. /**
  4335. * returns how many attributes exist in this attribute collection
  4336. * @return (int) Number of properties in this collection.
  4337. */
  4338. size : function() {
  4339. return this.propNames.length + (!this.allowUnknownProperties || !this.dynamicMap ? 0 : Object.keys(this.dynamicMap).length);
  4340. },
  4341. /**
  4342. * Determine if this collection contains a property with the same name as the passed string The method implementation relies on the fact that string are interned so for example in java do not do containsProperty(new String("key")) performance is very important in this method
  4343. * @param (String) propName property to check
  4344. * @return (boolean) true if there is a property with the same name otherwise false
  4345. */
  4346. containsProperty : function(propName) {
  4347. var props = this.propNames;
  4348. for (var index = 0; index < props.length; ++index) {
  4349. if (props[index] == propName) {
  4350. return true;
  4351. }
  4352. }
  4353. return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap.hasOwnProperty(propName) : false;
  4354. },
  4355. getKeys : function() {
  4356. var result = [];
  4357. for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
  4358. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4359. var name = __exp_enFor0[__i_enFor0];
  4360. result.push(name);
  4361. }
  4362. if (this.dynamicMap) {
  4363. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.dynamicMap), __len_enFor1 = __exp_enFor1.length;
  4364. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4365. var name = __exp_enFor1[__i_enFor1];
  4366. result.push(name);
  4367. }
  4368. }
  4369. return result;
  4370. },
  4371. /**
  4372. * Return a serialized version of all set values in this collection in the form: "key="value" key="value""
  4373. * @return (String) serialized version in the form "key="value" key="value""
  4374. */
  4375. serialize : function() {
  4376. var builder = "";
  4377. for (var __i_enFor0 = 0, __exp_enFor0 = this.getKeys(), __len_enFor0 = __exp_enFor0.length;
  4378. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4379. var key = __exp_enFor0[__i_enFor0];
  4380. var val = this.get(key);
  4381. if (val != null) {
  4382. builder+=(key + "=\"" + val + "\"" + " ");
  4383. }
  4384. }
  4385. return builder.trim();
  4386. }
  4387. });
  4388. // $source: com/ibm/rave/render/internal/properties/SceneNodeAttributes
  4389. /************************************************************************
  4390. ** IBM Confidential
  4391. **
  4392. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4393. **
  4394. ** (C) Copyright IBM Corp. 2017
  4395. **
  4396. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4397. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4398. ************************************************************************/
  4399. // GENERATED
  4400. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4401. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  4402. /**
  4403. * A list of public attribute properties for scene nodes. Typically only used by renderers for quick access to properties.
  4404. */
  4405. var com_ibm_rave_render_internal_properties_SceneNodeAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  4406. constructor : function() {
  4407. this.propNames = com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames;
  4408. this.propValues = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null];
  4409. }
  4410. });
  4411. com_ibm_rave_render_internal_properties_SceneNodeAttributes.id = 0;
  4412. com_ibm_rave_render_internal_properties_SceneNodeAttributes.style = 1;
  4413. com_ibm_rave_render_internal_properties_SceneNodeAttributes.class_attr = 2;
  4414. com_ibm_rave_render_internal_properties_SceneNodeAttributes.transform = 3;
  4415. com_ibm_rave_render_internal_properties_SceneNodeAttributes.clip_path = 4;
  4416. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x = 5;
  4417. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y = 6;
  4418. com_ibm_rave_render_internal_properties_SceneNodeAttributes.width = 7;
  4419. com_ibm_rave_render_internal_properties_SceneNodeAttributes.height = 8;
  4420. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x1 = 9;
  4421. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x2 = 10;
  4422. com_ibm_rave_render_internal_properties_SceneNodeAttributes.r = 11;
  4423. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y1 = 12;
  4424. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y2 = 13;
  4425. com_ibm_rave_render_internal_properties_SceneNodeAttributes.cx = 14;
  4426. com_ibm_rave_render_internal_properties_SceneNodeAttributes.cy = 15;
  4427. com_ibm_rave_render_internal_properties_SceneNodeAttributes.d = 16;
  4428. com_ibm_rave_render_internal_properties_SceneNodeAttributes.points = 17;
  4429. com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames = ["id", "style", "class", "transform", "clip-path", "x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "d", "points"];
  4430. // $source: com/ibm/rave/render/internal/style/ShorthandStyle
  4431. /************************************************************************
  4432. ** IBM Confidential
  4433. **
  4434. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4435. **
  4436. ** (C) Copyright IBM Corp. 2017
  4437. **
  4438. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4439. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4440. ************************************************************************/
  4441. // GENERATED
  4442. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4443. /**
  4444. * Abstract class describing a shorthand style definition. Basically just a set of key/value pairs that describe each piece of a shorthand property. For instance, the "font" style is a shorthanded way of defining "font-size", "font-weight", "font-family", etc.
  4445. */
  4446. var com_ibm_rave_render_internal_style_ShorthandStyle = com_ibm_rave_core_nativeImpl_Declare({
  4447. //getKeys : function() {},
  4448. //getValue : function(key) {}
  4449. });
  4450. // $source: com/ibm/rave/render/internal/style/FontStyle
  4451. /************************************************************************
  4452. ** IBM Confidential
  4453. **
  4454. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4455. **
  4456. ** (C) Copyright IBM Corp. 2017
  4457. **
  4458. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4459. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4460. ************************************************************************/
  4461. // GENERATED
  4462. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4463. //@import com/ibm/rave/render/internal/style/ShorthandStyle (loadtime) // superclass
  4464. //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseFont, parseWeight, parseSize, parseFontFamily
  4465. /**
  4466. * <p> Represents CSS font information. Properties are: </p> <dl> <dt><code>font-size</code></dt> <dd>A CSSSize with numeric value ( {@link #this.getSize()} ) and unit ( {@link #this.getUnit()} ).</dd> <dt><code>font-family</code></dt> <dd>A string ( {@link #this.getFamily()} ). The family is a comma-separated list of family names. The names in the input list may be quoted. The stored names are all quoted, using double-quotes if the original was not quoted. </dd> <dt><code>font-style</code></dt> <dd>A string ( {@link #this.getStyle()} ). Supported values are "normal", "oblique", or "italic".</dd> <dt><code>font-weight</code></dt> <dd>A string ( {@link #this.getWeight()} ). Supported values are "normal", "bold", "bolder", "lighter", or a multiple of 100 between 100 and 900 inclusive.</dd> <dt><code>font-variant</code></dt> <dd>A string ( {@link #this.getFontVariant()} ). Supported values are "normal", "small-caps".</dd> <dt>lineHeight</dt> <dd>A string ( {@link #this.getLineHeightAsString()} ), only available by the {@link #this.toString()} method.</dd> </dl>
  4467. */
  4468. var com_ibm_rave_render_internal_style_FontStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_ShorthandStyle, {
  4469. //values : null,
  4470. //style : null,
  4471. //size : null,
  4472. //family : null,
  4473. //lineHeight : null,
  4474. //weight : null,
  4475. //variant : null,
  4476. constructor : function(style, family, size, weight, lineHeight, variant) {
  4477. this.values = [];
  4478. /**
  4479. * A class that holds font styling information. Typically used only by external renderers but still needs to be public. This class is not responsible for ensuring the local system supports any or all font information.
  4480. * @param (String) style The style in which the font is displayed. Valid values are "normal", "italic", "oblique".
  4481. * @param (String) family The font face to display the font in. Must be a valid system/web font. Default depends on the renderer and system.
  4482. * @param (com.ibm.rave.core.css.CSSSize) size The font size in 'unit' measurements.
  4483. * @param (String) weight The 'boldness' of a font. Similar to a CSS font-weight value. Weights are interpolated over a range of 0-900 with steps of 100. Each step is more bold than the last, providing the font supports different weight values. For fonts that only support "normal" and "bold" 100-500 is normal and 600-900 is bold.
  4484. * @param (String) lineHeight A string describing the height of each line of this font.
  4485. * @param (String) variant The variant type of this font. Only options are "normal" or "small-caps".
  4486. */
  4487. {
  4488. var _style = style;
  4489. var _family = com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(family);
  4490. var _variant = variant;
  4491. if (_style == null) {
  4492. _style = "";
  4493. }
  4494. this.values.push(_style);
  4495. this.style = _style;
  4496. this.values.push(size);
  4497. this.size = size;
  4498. if (_family == null) {
  4499. _family = "";
  4500. }
  4501. this.values.push(_family);
  4502. this.family = _family;
  4503. this.weight = weight;
  4504. this.values.push(this.weight);
  4505. if (_variant == null) {
  4506. _variant = "";
  4507. }
  4508. this.values.push(_variant);
  4509. this.variant = _variant;
  4510. this.values.push(lineHeight);
  4511. this.lineHeight = lineHeight;
  4512. }
  4513. },
  4514. /**
  4515. * Return the 'style' of this font. Valid current values are "normal", "italic", "oblique".
  4516. * @return (String) style of this font. ("normal", "italic", "oblique").
  4517. */
  4518. getStyle : function() {
  4519. return this.style;
  4520. },
  4521. /**
  4522. * Returns the current size of the font in the set unit.
  4523. * @return (double) The size of the font in the current unit measurement.
  4524. */
  4525. getSize : function() {
  4526. return this.size.value;
  4527. },
  4528. /**
  4529. * Return the unit type set for this style.
  4530. * @return (com.ibm.rave.core.css.CSSUnit) a {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit}
  4531. */
  4532. getUnit : function() {
  4533. return this.size.unit;
  4534. },
  4535. /**
  4536. * @return (com.ibm.rave.core.css.CSSSize) The {@link (com.ibm.rave.core.css.CSSSize) CSSSize} of this font, with size and unit
  4537. */
  4538. getCSSSize : function() {
  4539. return this.size;
  4540. },
  4541. /**
  4542. * Return the set font family as a simple string. Typically follows CSS-style format (comma separated list). This class is not responsible for ensuring the local system supports any or all font family information.
  4543. * @return (String) Font family as a comma separated (CSS-style) list.
  4544. */
  4545. getFamily : function() {
  4546. return this.family;
  4547. },
  4548. /**
  4549. * Return the weight type set for this style.
  4550. * @return (String) String representing the font weight style.
  4551. */
  4552. getWeight : function() {
  4553. return this.weight;
  4554. },
  4555. getLineHeightAsString : function() {
  4556. if (this.lineHeight == null) {
  4557. return "normal";
  4558. }
  4559. return this.lineHeight;
  4560. },
  4561. /**
  4562. * Return the variant definition of this font style.
  4563. * @return (String) font variant. Current values are "normal" or "small-caps".
  4564. */
  4565. getFontVariant : function() {
  4566. return this.variant;
  4567. },
  4568. /**
  4569. * Return the shorthand font CSS property of this style.
  4570. */
  4571. toString : function() {
  4572. var str = this.style + " " + this.variant + " " + this.weight + " " + (~~this.getSize()) + this.getUnit() + "/" + this.getLineHeightAsString() + " " + this.family;
  4573. return str.trim();
  4574. },
  4575. getKeys : function() {
  4576. return com_ibm_rave_render_internal_style_FontStyle.keys;
  4577. },
  4578. getValue : function(key) {
  4579. var i = com_ibm_rave_render_internal_style_FontStyle.keys.indexOf(key);
  4580. if (i > -1) {
  4581. return this.values[i];
  4582. }
  4583. return null;
  4584. }
  4585. });
  4586. /**
  4587. * Parse a shorthand font per the rules defined by <a href="https ://developer.mozilla.org/en/docs/Web/CSS/font">W3 CSS</a>. <p> <code>[ [ &lt;'font-style'> || &lt;font-variant-css21> || &lt;'font-weight'> || &lt;'font-stretch'> ]? &lt;'font-size'> [ / &lt;'line-height'> ]? &lt;'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar where &lt;font-variant-css21> = [ normal | small-caps ] </code>
  4588. * @param (Object) value Font CSS style rule text.
  4589. * @return (com.ibm.rave.render.internal.style.FontStyle) TextStyle representing font. Returns null if invalid specification (missing size or family, or invalid weight number)
  4590. */
  4591. com_ibm_rave_render_internal_style_FontStyle.parseFont = function(value) {
  4592. var parsed = com_ibm_rave_core_internal_css_CSSUtil.parseFont(value);
  4593. var _size = com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[3]);
  4594. var _weight = com_ibm_rave_core_internal_css_CSSUtil.parseWeight(parsed[2]);
  4595. var _family = parsed[5];
  4596. if (!_size || _family == null || _weight == null) {
  4597. return null;
  4598. }
  4599. return new com_ibm_rave_render_internal_style_FontStyle(parsed[0], _family, _size, _weight, parsed[4], parsed[1]);
  4600. };
  4601. com_ibm_rave_render_internal_style_FontStyle.keys = ["font-style", "font-size", "font-family", "font-weight", "font-variant", "line-height"];
  4602. // $source: com/ibm/rave/render/internal/style/AbstractStyle
  4603. /************************************************************************
  4604. ** IBM Confidential
  4605. **
  4606. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4607. **
  4608. ** (C) Copyright IBM Corp. 2017
  4609. **
  4610. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4611. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4612. ************************************************************************/
  4613. // GENERATED
  4614. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4615. //@import com/ibm/rave/core/Rave (runtime) // rgba
  4616. /**
  4617. * An abstract implementation of a style. Includes things typically required in a style class like color, opacity, etc.
  4618. */
  4619. var com_ibm_rave_render_internal_style_AbstractStyle = com_ibm_rave_core_nativeImpl_Declare({
  4620. opacity : 1,
  4621. /**
  4622. * Return opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
  4623. * @return (double) opacity of this style between 0-1.
  4624. */
  4625. getOpacity : function() {
  4626. return this.opacity;
  4627. },
  4628. /**
  4629. * Set opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
  4630. * @param (double) opacity Opacity to set.
  4631. */
  4632. setOpacity : function(opacity) {
  4633. this.opacity = opacity;
  4634. },
  4635. /**
  4636. * Does this style produce a style that is visible and should be drawn.
  4637. * @return (boolean) <code>true</code> if this style is visible <code>false</code> otherwise.
  4638. */
  4639. isVisible : function() {
  4640. return this.opacity > 0;
  4641. },
  4642. calculateColorWithOpacity : function() {
  4643. var color = this.getColor();
  4644. return com_ibm_rave_core_Rave.rgba(color.r, color.g, color.b, color.a * this.opacity);
  4645. }
  4646. /**
  4647. * Returns the type of style.
  4648. * @return (int) enum value from StyleTypes
  4649. * @see (com.ibm.rave.render.internal.style.StyleTypes) StyleTypes
  4650. */
  4651. //getType : function() {},
  4652. /**
  4653. * Some styles have a default color.
  4654. * @return (com.ibm.rave.core.color.RGB) Color object for this style, this takes opacity and fill-opacity into account. May return null.
  4655. */
  4656. //getColor : function() {}
  4657. });
  4658. // $source: com/ibm/rave/render/internal/style/ShadowStyle
  4659. /************************************************************************
  4660. ** IBM Confidential
  4661. **
  4662. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4663. **
  4664. ** (C) Copyright IBM Corp. 2017
  4665. **
  4666. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4667. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4668. ************************************************************************/
  4669. // GENERATED
  4670. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4671. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  4672. //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseShadowStyle
  4673. /**
  4674. * [offset_x offset_y blur-radius color] | none | initial | inherit
  4675. */
  4676. var com_ibm_rave_render_internal_style_ShadowStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  4677. //offset_x : null,
  4678. //offset_y : null,
  4679. //blur_radius : null,
  4680. //color : null,
  4681. constructor : function(h_shadow, v_shadow, blur_radius, color) {
  4682. this.offset_x = h_shadow;
  4683. this.offset_y = v_shadow;
  4684. this.blur_radius = blur_radius;
  4685. this.color = color;
  4686. },
  4687. getType : function() {
  4688. return 1004;
  4689. },
  4690. getColor : function() {
  4691. return this.color;
  4692. }
  4693. });
  4694. /**
  4695. * Parse a shorthand font per the rules defined by <a href="https ://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow">W3 CSS</a>. offset_x offset_y blur-radius color| none | initial | inherit
  4696. * @param (Object) value shadow CSS style rule text.
  4697. * @return (com.ibm.rave.render.internal.style.ShadowStyle) ShadowStyle representing text shadow. Returns null if invalid specification
  4698. */
  4699. com_ibm_rave_render_internal_style_ShadowStyle.parse = function(value) {
  4700. var style = com_ibm_rave_core_internal_css_CSSUtil.parseShadowStyle(value);
  4701. if (!style) {
  4702. return null;
  4703. }
  4704. return new com_ibm_rave_render_internal_style_ShadowStyle(style[0], style[1], style[2], style[3]);
  4705. };
  4706. // $source: com/ibm/rave/render/internal/DefaultStyleValueConverter
  4707. /************************************************************************
  4708. ** IBM Confidential
  4709. **
  4710. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4711. **
  4712. ** (C) Copyright IBM Corp. 2017
  4713. **
  4714. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4715. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4716. ************************************************************************/
  4717. // GENERATED
  4718. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4719. //@import com/ibm/rave/core/internal/css/CSSTransformParser (static) // parse
  4720. //@import com/ibm/rave/core/internal/css/CSSUtil (static) // parseIdUrlLink, parseWeight, parseSize, parseDashArray, parseFontFamily
  4721. //@import com/ibm/rave/core/internal/css/CSSConstants (static) // CSSConstants
  4722. //@import com/ibm/rave/core/Rave (static) // rgb
  4723. //@import com/ibm/rave/render/internal/style/FontStyle (static) // parseFont
  4724. //@import com/ibm/rave/render/internal/style/ShadowStyle (static) // parse
  4725. /**
  4726. * Converts style values into generic objects.
  4727. */
  4728. var com_ibm_rave_render_internal_DefaultStyleValueConverter = com_ibm_rave_core_nativeImpl_Declare({
  4729. });
  4730. com_ibm_rave_render_internal_DefaultStyleValueConverter.convert = function(index, styleName, value) {
  4731. switch (index) {
  4732. case 11:
  4733. return com_ibm_rave_core_internal_css_CSSTransformParser.parse(""+(value));
  4734. case 38:
  4735. case 30:
  4736. case 32:
  4737. case 33:
  4738. case 41:
  4739. return + (value);
  4740. case 35:
  4741. case 31:
  4742. case 0:
  4743. case 1:
  4744. case 2:
  4745. case 3:
  4746. case 4:
  4747. case 5:
  4748. case 6:
  4749. case 7:
  4750. case 8:
  4751. case 16:
  4752. case 15:
  4753. case 9:
  4754. case 10:
  4755. case 22:
  4756. case 12:
  4757. case 13:
  4758. case 17:
  4759. case 18:
  4760. case 19:
  4761. return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value);
  4762. case 14:
  4763. if (value == null) {
  4764. return "normal";
  4765. }
  4766. var _value = ""+(value);
  4767. _value = _value.trim();
  4768. if ("normal" == _value) {
  4769. return "normal";
  4770. }
  4771. return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value).toString();
  4772. case 34:
  4773. return com_ibm_rave_core_internal_css_CSSUtil.parseDashArray(value.toString());
  4774. case 28:
  4775. var link = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value);
  4776. if (link != null) {
  4777. return value;
  4778. }
  4779. case 29:
  4780. return com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT == value.toString().toLowerCase() || "none" == value.toString().toLowerCase() ? "none" : com_ibm_rave_core_Rave.rgb(value);
  4781. case 24:
  4782. return com_ibm_rave_core_internal_css_CSSUtil.parseWeight(value);
  4783. case 44:
  4784. return com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value);
  4785. case 20:
  4786. return com_ibm_rave_render_internal_style_FontStyle.parseFont(value);
  4787. case 21:
  4788. return com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(value);
  4789. case 46:
  4790. return com_ibm_rave_render_internal_style_ShadowStyle.parse(value);
  4791. default:
  4792. return value;
  4793. }
  4794. };
  4795. // $source: com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles
  4796. /************************************************************************
  4797. ** IBM Confidential
  4798. **
  4799. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4800. **
  4801. ** (C) Copyright IBM Corp. 2017
  4802. **
  4803. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4804. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4805. ************************************************************************/
  4806. // GENERATED
  4807. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4808. //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new
  4809. //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (static) // convert
  4810. //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (static) // SceneNodeStyles
  4811. /**
  4812. * Helper class for creating default style objects for nodes.
  4813. */
  4814. var com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles = com_ibm_rave_core_nativeImpl_Declare({
  4815. });
  4816. com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle = function(id, name) {
  4817. return new com_ibm_rave_core_internal_css_CSSStyle(id, name, com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[id].inheritable);
  4818. };
  4819. com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle = function(id, name, value, inheritable) {
  4820. var style = new com_ibm_rave_core_internal_css_CSSStyle(id, name, inheritable);
  4821. style.value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, name, value);
  4822. style.rawValue = value.toString();
  4823. return style;
  4824. };
  4825. /**
  4826. * Return the index of the passed style name from the list of default styles. Used to map into our maps of styles which should all share the same indexing.
  4827. * @param (String) styleName The name of the style to get the index of. (ie - "fill")
  4828. * @return (int) Index of this style in our default map.
  4829. */
  4830. com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex = function(styleName) {
  4831. return com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.indexOf(styleName);
  4832. };
  4833. com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults = function() {
  4834. var styles = [];
  4835. styles[46] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(46, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[46], "none", true);
  4836. styles[28] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(28, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[28], "#000000", true);
  4837. styles[29] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(29, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[29], "none", true);
  4838. styles[30] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(30, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[30], 1.0, false);
  4839. styles[31] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(31, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[31], "1px", true);
  4840. styles[32] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(32, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[32], 1, true);
  4841. styles[33] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(33, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[33], 1.0, true);
  4842. styles[26] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(26, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[26], "block", false);
  4843. styles[21] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(21, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[21], "serif", true);
  4844. styles[22] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(22, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[22], "16px", true);
  4845. styles[23] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(23, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[23], "normal", true);
  4846. styles[24] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(24, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[24], "normal", true);
  4847. styles[25] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(25, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[25], "normal", true);
  4848. styles[34] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(34, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[34], "none", true);
  4849. styles[35] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(35, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[35], 0, true);
  4850. styles[36] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(36, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[36], "butt", true);
  4851. styles[37] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(37, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[37], "miter", true);
  4852. styles[38] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(38, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[38], 4, true);
  4853. styles[27] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(27, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[27], "start", true);
  4854. styles[39] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(39, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[39], "none", false);
  4855. styles[45] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(45, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[45], "visible", true);
  4856. styles[40] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(40, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[40], "#000000", false);
  4857. styles[41] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(41, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[41], 1.0, false);
  4858. styles[42] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(42, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[42], "auto", true);
  4859. styles[43] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(43, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[43], "auto", true);
  4860. styles[20] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(20, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[20], "normal normal normal 16/normal serif", true);
  4861. styles[47] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(47, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[47], "auto", true);
  4862. styles[0] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(0, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[0], "", false);
  4863. styles[1] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(1, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[1], "", false);
  4864. styles[2] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(2, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[2], "", false);
  4865. styles[3] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(3, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[3], "", false);
  4866. styles[4] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(4, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[4], "", false);
  4867. styles[5] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(5, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[5], "", false);
  4868. styles[6] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(6, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[6], "", false);
  4869. styles[7] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(7, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[7], "", false);
  4870. styles[8] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(8, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[8], "", false);
  4871. styles[9] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(9, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[9], "", false);
  4872. styles[10] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(10, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[10], "", false);
  4873. styles[11] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(11, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[11], "", false);
  4874. styles[12] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(12, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[12], "", false);
  4875. styles[13] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(13, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[13], "", false);
  4876. styles[44] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(44, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[44], "", false);
  4877. styles[14] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(14, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[14], "normal", true);
  4878. styles[15] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(15, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[15], "", false);
  4879. styles[16] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(16, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[16], "", false);
  4880. styles[17] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(17, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[17], "", false);
  4881. styles[18] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(18, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[18], "", false);
  4882. styles[19] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(19, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[19], "", false);
  4883. return styles;
  4884. };
  4885. com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults();
  4886. // $source: com/ibm/rave/render/internal/nodes/SceneNodeStyleManager
  4887. /************************************************************************
  4888. ** IBM Confidential
  4889. **
  4890. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4891. **
  4892. ** (C) Copyright IBM Corp. 2017
  4893. **
  4894. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4895. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4896. ************************************************************************/
  4897. // GENERATED
  4898. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4899. //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime) // SceneNodeStyles, isLayoutStyle
  4900. //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // SceneNodeDefaultStyles, getIndex, createCSSStyle
  4901. //@import com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector (runtime) // collectAll
  4902. //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (runtime) // convert
  4903. //@import com/ibm/rave/render/internal/style/ShorthandStyle (runtime) // new
  4904. //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new
  4905. /**
  4906. * A class for helping scene nodes keep track of styling information.
  4907. */
  4908. var com_ibm_rave_render_internal_nodes_SceneNodeStyleManager = com_ibm_rave_core_nativeImpl_Declare({
  4909. //changedStyles : null,
  4910. //importantChangedStyles : null,
  4911. //computedStyles : null,
  4912. //styles : null,
  4913. //node : null,
  4914. invalidStyles : true,
  4915. dirtyExternalStyles : true,
  4916. dirtyInlineStyles : true,
  4917. constructor : function(abstractSceneNode) {
  4918. this.computedStyles = {};
  4919. this.styles = {};
  4920. {
  4921. this.node = abstractSceneNode;
  4922. }
  4923. },
  4924. updateStyle : function(style, index, important, newValue, rawValue, name) {
  4925. this.styles[index] = style;
  4926. this.dirtyInlineStyles = true;
  4927. if (important) {
  4928. if (!this.importantChangedStyles) {
  4929. this.importantChangedStyles = {};
  4930. }
  4931. this.importantChangedStyles[index] = style;
  4932. if (this.changedStyles) {
  4933. delete this.changedStyles[index];
  4934. }
  4935. } else {
  4936. if (!this.changedStyles) {
  4937. this.changedStyles = {};
  4938. }
  4939. this.changedStyles[index] = style;
  4940. if (this.importantChangedStyles) {
  4941. delete this.importantChangedStyles[index];
  4942. }
  4943. }
  4944. if (style) {
  4945. style.value = newValue;
  4946. style.rawValue = rawValue;
  4947. style.important = important;
  4948. style.fromAttribute = false;
  4949. } else {
  4950. this.dirtyExternalStyles = true;
  4951. }
  4952. this.node.setDirty(true, com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle(index));
  4953. var oldValue = (style ? style.value : null);
  4954. this.node.notifyAfterUpdate(1000, 2002, name, newValue, oldValue);
  4955. },
  4956. computeStyles : function() {
  4957. if (this.dirtyInlineStyles || this.dirtyExternalStyles || this.invalidStyles) {
  4958. var inheritableStyleChanges = null;
  4959. if (this.dirtyInlineStyles) {
  4960. if (this.importantChangedStyles) {
  4961. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.importantChangedStyles), __len_enFor0 = __exp_enFor0.length;
  4962. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4963. var key = __exp_enFor0[__i_enFor0];
  4964. var style = this.importantChangedStyles[key];
  4965. var styleId = style.id;
  4966. var cstyle = this.computedStyles[styleId];
  4967. if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) {
  4968. cstyle = style;
  4969. this.computedStyles[cstyle.id] = style;
  4970. }
  4971. if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
  4972. if (!inheritableStyleChanges) {
  4973. inheritableStyleChanges = [];
  4974. }
  4975. inheritableStyleChanges.push(styleId);
  4976. }
  4977. }
  4978. this.importantChangedStyles = null;
  4979. }
  4980. if (this.changedStyles) {
  4981. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.changedStyles), __len_enFor1 = __exp_enFor1.length;
  4982. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4983. var key = __exp_enFor1[__i_enFor1];
  4984. var style = this.changedStyles[key];
  4985. var styleId = key;
  4986. var cstyle = this.computedStyles[styleId];
  4987. if (cstyle && cstyle.important) {
  4988. continue;
  4989. }
  4990. if (!style) {
  4991. if (cstyle && cstyle.owner == this.node) {
  4992. this.computedStyles[styleId] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE;
  4993. if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
  4994. if (!inheritableStyleChanges) {
  4995. inheritableStyleChanges = [];
  4996. }
  4997. inheritableStyleChanges.push(styleId);
  4998. }
  4999. cstyle = null;
  5000. this.invalidStyles = true;
  5001. }
  5002. } else if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) {
  5003. cstyle = style;
  5004. this.computedStyles[styleId] = cstyle;
  5005. if (this.node.rave_hasChildNodes() && cstyle.inheritable) {
  5006. if (!inheritableStyleChanges) {
  5007. inheritableStyleChanges = [];
  5008. }
  5009. inheritableStyleChanges.push(styleId);
  5010. }
  5011. }
  5012. }
  5013. this.changedStyles = null;
  5014. }
  5015. }
  5016. if (this.dirtyExternalStyles || this.invalidStyles) {
  5017. var externalStyles = null;
  5018. var parentNode = this.node.rave_getParentNode();
  5019. for (var i = 0, len = com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.length; i < len; ++i) {
  5020. var style = this.computedStyles[i];
  5021. if (style && style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE && this.node.rave_hasChildNodes() && style.inheritable) {
  5022. if (!inheritableStyleChanges) {
  5023. inheritableStyleChanges = [];
  5024. }
  5025. inheritableStyleChanges.push(i);
  5026. }
  5027. if (this.dirtyExternalStyles) {
  5028. if (!externalStyles) {
  5029. externalStyles = this.getExternalStyles();
  5030. }
  5031. if (externalStyles.length > 0 && externalStyles[i]) {
  5032. if (externalStyles[i].important || !style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || style.owner != this.node || style.fromAttribute) {
  5033. style = externalStyles[i];
  5034. this.computedStyles[i] = style;
  5035. }
  5036. } else if (style && style.owner == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) {
  5037. style = null;
  5038. this.computedStyles[i] = style;
  5039. }
  5040. }
  5041. if (!style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE) {
  5042. style = null;
  5043. if (parentNode && com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i].inheritable && parentNode.rave_getDrawType() != -1) {
  5044. style = parentNode.getComputedCSSStyle(i);
  5045. }
  5046. }
  5047. if (!style) {
  5048. style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i];
  5049. }
  5050. this.computedStyles[i] = style;
  5051. }
  5052. this.invalidStyles = false;
  5053. }
  5054. if (inheritableStyleChanges) {
  5055. for (var __i_enFor2 = 0, __exp_enFor2 = this.node.getChildrenArray(), __len_enFor2 = __exp_enFor2.length;
  5056. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  5057. var child = __exp_enFor2[__i_enFor2];
  5058. var achild = child;
  5059. for (var __i_enFor3 = 0, __exp_enFor3 = inheritableStyleChanges, __len_enFor3 = __exp_enFor3.length;
  5060. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  5061. var key = __exp_enFor3[__i_enFor3];
  5062. var childStyle = achild.styleManager.computedStyles[key];
  5063. if (childStyle && childStyle.owner != child && childStyle.owner != com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) {
  5064. achild.styleManager.computedStyles[key] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE;
  5065. achild.styleManager.dirtyInlineStyles = true;
  5066. achild.styleManager.invalidStyles = true;
  5067. }
  5068. }
  5069. }
  5070. }
  5071. this.dirtyInlineStyles = false;
  5072. this.dirtyExternalStyles = false;
  5073. }
  5074. },
  5075. /**
  5076. * Returns a style structure with all applicable external styles. Mimics the same array and index of SceneNodeStyles.
  5077. * @return (com.ibm.rave.core.internal.css.CSSStyle[]) an array of applicable external styles.
  5078. */
  5079. getExternalStyles : function() {
  5080. var styleValues;
  5081. var rules = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll(this.node);
  5082. if (rules.length > 0) {
  5083. styleValues = [];
  5084. for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length;
  5085. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5086. var rule = __exp_enFor0[__i_enFor0];
  5087. var style = rule.style;
  5088. for (var i = 0, len = style.length; i < len; ++i) {
  5089. var item = style.item(i);
  5090. this.updateExternalStyle(item, styleValues, style.getPropertyValue(item), "important" == style.getPropertyPriority(item));
  5091. }
  5092. }
  5093. } else {
  5094. styleValues = [];
  5095. }
  5096. return styleValues;
  5097. },
  5098. updateExternalStyle : function(item, styleValues, value1, isImportant) {
  5099. var id = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(item);
  5100. if (id != -1) {
  5101. var existingStyle = styleValues[id];
  5102. if (!existingStyle || (isImportant && !existingStyle.important)) {
  5103. var value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, item, value1);
  5104. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(value, com_ibm_rave_render_internal_style_ShorthandStyle)) {
  5105. for (var __i_enFor0 = 0, __exp_enFor0 = (value).getKeys(), __len_enFor0 = __exp_enFor0.length;
  5106. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5107. var key = __exp_enFor0[__i_enFor0];
  5108. this.updateExternalStyle(key, styleValues, (value).getValue(key), isImportant);
  5109. }
  5110. }
  5111. if (value != null) {
  5112. styleValues[id] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(id, item);
  5113. styleValues[id].owner = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER;
  5114. styleValues[id].value = value;
  5115. styleValues[id].rawValue = value.toString();
  5116. styleValues[id].important = isImportant;
  5117. }
  5118. }
  5119. }
  5120. },
  5121. /**
  5122. * Remove all inline styles from this node's styles.
  5123. */
  5124. removeAllInlineStyles : function() {
  5125. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length;
  5126. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5127. var key = __exp_enFor0[__i_enFor0];
  5128. if (this.styles[key]) {
  5129. this.node.rave_removeStyle(com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[key]);
  5130. }
  5131. }
  5132. },
  5133. /**
  5134. * @param (String) styleName
  5135. */
  5136. removeStyle : function(styleName) {
  5137. if (styleName != null) {
  5138. var name = styleName.toLowerCase();
  5139. var idx = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName);
  5140. var style = this.styles[idx];
  5141. if (style) {
  5142. var hasNewStyle = false;
  5143. if (!style.fromAttribute) {
  5144. var attrValue = this.node.attributes.get(styleName);
  5145. if (attrValue != null) {
  5146. var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(idx, name, attrValue);
  5147. if (newValue != null) {
  5148. style.value = newValue;
  5149. style.rawValue = newValue.toString();
  5150. style.fromAttribute = true;
  5151. style.important = false;
  5152. hasNewStyle = true;
  5153. }
  5154. }
  5155. }
  5156. if (!hasNewStyle) {
  5157. this.updateStyle(null, idx, false, null, null, name);
  5158. if (this.importantChangedStyles) {
  5159. delete this.importantChangedStyles[idx];
  5160. }
  5161. }
  5162. }
  5163. }
  5164. },
  5165. setStyle : function(context, styleName, value, priority) {
  5166. if (styleName != null) {
  5167. if (value == null) {
  5168. this.removeStyle(styleName);
  5169. } else {
  5170. var acontext = context;
  5171. var name = styleName.toLowerCase();
  5172. var index = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(name);
  5173. if (index >= 0) {
  5174. var oldCssStyle = acontext.styleManager.getComputedCSSStyle(index);
  5175. if (!oldCssStyle || !(value===oldCssStyle.rawValue)) {
  5176. var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(index, name, value);
  5177. if (newValue != null) {
  5178. var important = priority != null && "important" == priority.toLowerCase();
  5179. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(newValue, com_ibm_rave_render_internal_style_ShorthandStyle)) {
  5180. for (var __i_enFor0 = 0, __exp_enFor0 = (newValue).getKeys(), __len_enFor0 = __exp_enFor0.length;
  5181. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5182. var key = __exp_enFor0[__i_enFor0];
  5183. acontext.rave_setStyle(key, (newValue).getValue(key), priority);
  5184. }
  5185. }
  5186. var style = this.styles[index];
  5187. if (!style) {
  5188. style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(index, name);
  5189. style.owner = acontext;
  5190. }
  5191. this.updateStyle(style, index, important, newValue, value, name);
  5192. }
  5193. }
  5194. }
  5195. }
  5196. }
  5197. },
  5198. getComputedStyleValue : function(id) {
  5199. var style = this.getComputedCSSStyle(id);
  5200. return !style ? null : style.value;
  5201. },
  5202. getComputedCSSStyle : function(id) {
  5203. return this.computedStyles[id];
  5204. },
  5205. setDirtyExternalStyles : function(dirtyExternalStyles) {
  5206. this.dirtyExternalStyles = dirtyExternalStyles;
  5207. },
  5208. getStyleByName : function(styleName) {
  5209. return this.getStyleByIndex(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName));
  5210. },
  5211. getStyleByIndex : function(styleIndex) {
  5212. return this.styles[styleIndex];
  5213. },
  5214. isVisible : function() {
  5215. return !("hidden" == this.getComputedStyleValue(45));
  5216. },
  5217. serialize : function() {
  5218. var result = [];
  5219. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length;
  5220. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5221. var index = __exp_enFor0[__i_enFor0];
  5222. var val = this.styles[index];
  5223. if (val) {
  5224. result.push(val.name + ":" + val.value + ";");
  5225. }
  5226. }
  5227. var str = "";
  5228. if (result.length > 0) {
  5229. str = "style=\"" + result.join(" ") + "\"";
  5230. }
  5231. return str;
  5232. }
  5233. });
  5234. com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER = {};
  5235. com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE = new com_ibm_rave_core_internal_css_CSSStyle(-1, null, true);
  5236. // $source: com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector
  5237. /************************************************************************
  5238. ** IBM Confidential
  5239. **
  5240. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5241. **
  5242. ** (C) Copyright IBM Corp. 2017
  5243. **
  5244. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5245. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5246. ************************************************************************/
  5247. // GENERATED
  5248. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5249. //@import com/ibm/rave/core/Rave (runtime) // Rave
  5250. //@import com/ibm/rave/core/internal/css/CSSStyleSheetManager (runtime) // CSSStyleSheetManager
  5251. /**
  5252. * Responsible for collecting external stylesheet rules that apply to a particular SceneNode. Orders these results based on results from CSSStyleSheetManager based on specificity.
  5253. */
  5254. var com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector = com_ibm_rave_core_nativeImpl_Declare({
  5255. });
  5256. /**
  5257. * Returns a list of matching external CSS rules for a scene node. Note that this method does not take internal styles into account at all - it matches only external styles to scene nodes. This list is sorted by most significant style specificity to lowest.
  5258. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node
  5259. * @return (Array) List of matching CSSStyleRules.
  5260. */
  5261. com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll = function(node) {
  5262. var matches = [];
  5263. var selectorCache = {};
  5264. var engine = com_ibm_rave_core_Rave.configuration.getQueryEngine(null);
  5265. if (engine) {
  5266. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches(node), __len_enFor0 = __exp_enFor0.length;
  5267. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5268. var potentialMatch = __exp_enFor0[__i_enFor0];
  5269. var selectorText = potentialMatch.selectorText;
  5270. if (!(selectorCache.hasOwnProperty(selectorText))) {
  5271. if (engine.matches(node, selectorText)) {
  5272. matches.push(potentialMatch);
  5273. }
  5274. selectorCache[selectorText] = 1;
  5275. }
  5276. }
  5277. }
  5278. return matches;
  5279. };
  5280. com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches = function(node) {
  5281. var manager = com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE;
  5282. var potentialMatches = [];
  5283. var id = node.getId();
  5284. if (id != null) {
  5285. var rules = manager.getPotentialMatchesById("#" + id);
  5286. if (rules) {
  5287. for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length;
  5288. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5289. var rule = __exp_enFor0[__i_enFor0];
  5290. potentialMatches.push(rule);
  5291. }
  5292. }
  5293. }
  5294. var classes = node.getClassList();
  5295. for (var __i_enFor1 = 0, __exp_enFor1 = classes, __len_enFor1 = __exp_enFor1.length;
  5296. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  5297. var className = __exp_enFor1[__i_enFor1];
  5298. if (className != null) {
  5299. var rules = manager.getPotentialMatchesByClass("." + className);
  5300. if (rules) {
  5301. for (var __i_enFor2 = 0, __exp_enFor2 = rules, __len_enFor2 = __exp_enFor2.length;
  5302. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  5303. var rule = __exp_enFor2[__i_enFor2];
  5304. potentialMatches.push(rule);
  5305. }
  5306. }
  5307. }
  5308. }
  5309. var tag = node.rave_getName();
  5310. if (tag != null) {
  5311. var rules = manager.getPotentialMatchesByTag(tag);
  5312. if (rules) {
  5313. for (var __i_enFor3 = 0, __exp_enFor3 = rules, __len_enFor3 = __exp_enFor3.length;
  5314. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  5315. var rule = __exp_enFor3[__i_enFor3];
  5316. potentialMatches.push(rule);
  5317. }
  5318. }
  5319. }
  5320. return potentialMatches;
  5321. };
  5322. // $source: com/ibm/rave/core/internal/css/CSSStyleSheetManager
  5323. /************************************************************************
  5324. ** IBM Confidential
  5325. **
  5326. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5327. **
  5328. ** (C) Copyright IBM Corp. 2017
  5329. **
  5330. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5331. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5332. ************************************************************************/
  5333. // GENERATED
  5334. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5335. //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // splitSelectorText, deconstructSelectorText
  5336. /**
  5337. * This class is responsible for maintaining the state of all external stylesheets. It accepts parsed stylesheets and caches them based on selector.
  5338. */
  5339. var com_ibm_rave_core_internal_css_CSSStyleSheetManager = com_ibm_rave_core_nativeImpl_Declare({
  5340. //idToStyleRules : null,
  5341. //classToStyleRules : null,
  5342. //tagToStyleRules : null,
  5343. //allMaps : null,
  5344. constructor : function() {
  5345. this.allMaps = [];
  5346. {
  5347. this.initialize();
  5348. }
  5349. },
  5350. /**
  5351. * Add a CSSStyleSheet's rule list to our cached internal set of style rules. These can be used later to style scene nodes.
  5352. * @param (com.ibm.rave.core.css.CSSStyleSheet) stylesheet CSSStyleSheet object parsed from CSS text.
  5353. */
  5354. add : function(stylesheet) {
  5355. for (var __i_enFor0 = 0, __exp_enFor0 = stylesheet.cssRules, __len_enFor0 = __exp_enFor0.length;
  5356. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5357. var rule = __exp_enFor0[__i_enFor0];
  5358. if (rule.selectorText != null) {
  5359. this.addToCache(rule);
  5360. }
  5361. }
  5362. },
  5363. initialize : function() {
  5364. this.idToStyleRules = {};
  5365. this.classToStyleRules = {};
  5366. this.tagToStyleRules = {};
  5367. this.allMaps.length = 0;
  5368. this.allMaps.push(this.idToStyleRules);
  5369. this.allMaps.push(this.classToStyleRules);
  5370. this.allMaps.push(this.tagToStyleRules);
  5371. },
  5372. /**
  5373. * Clears all StyleSheets from cache.
  5374. */
  5375. clear : function() {
  5376. this.initialize();
  5377. },
  5378. /**
  5379. * For 'className', return all CSSStyleRules that may potentially match. The className must contain a leading ".".
  5380. * @param (String) className Class name to check for potential matching CSSRules. Must contain a leading ".".
  5381. * @return (Array) List of potential CSSStyleRule matches for this class. Returns null if no match found.
  5382. */
  5383. getPotentialMatchesByClass : function(className) {
  5384. return this.classToStyleRules[className];
  5385. },
  5386. /**
  5387. * For 'id', return all CSSStyleRules that may potentially match. The id must contain a leading "#".
  5388. * @param (String) id id name to check for potential matching CSSRules. Must contain a leading "#".
  5389. * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found.
  5390. */
  5391. getPotentialMatchesById : function(id) {
  5392. return this.idToStyleRules[id];
  5393. },
  5394. /**
  5395. * For node 'tag' name, return all CSSStyleRules that may potentially match.
  5396. * @param (String) tag tag name to check for potential matching CSSRules.
  5397. * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found.
  5398. */
  5399. getPotentialMatchesByTag : function(tag) {
  5400. return this.tagToStyleRules[tag];
  5401. },
  5402. addToCache : function(styleRule) {
  5403. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length;
  5404. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5405. var selector = __exp_enFor0[__i_enFor0];
  5406. var parts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(selector);
  5407. var dominant = parts[parts.length - 1];
  5408. var matches = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(dominant);
  5409. for (var __i_enFor1 = 0, __len_enFor1 = matches.length;
  5410. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  5411. var match = matches[__i_enFor1];
  5412. if (match.length == 0) {
  5413. continue;
  5414. }
  5415. var matchingMap = null;
  5416. switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(match)) {
  5417. case 3:
  5418. matchingMap = this.tagToStyleRules;
  5419. break;
  5420. case 2:
  5421. matchingMap = this.idToStyleRules;
  5422. break;
  5423. case 1:
  5424. matchingMap = this.classToStyleRules;
  5425. break;
  5426. case -1:
  5427. default:
  5428. break;
  5429. }
  5430. if (matchingMap) {
  5431. var rules = matchingMap[match];
  5432. var insertIndex = 0;
  5433. if (!rules) {
  5434. rules = [];
  5435. matchingMap[match] = rules;
  5436. } else {
  5437. for (var i = 0; i < rules.length; ++i) {
  5438. var existingRule = rules[i];
  5439. if (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(styleRule) >= com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(existingRule)) {
  5440. break;
  5441. }
  5442. insertIndex++;
  5443. }
  5444. }
  5445. rules.splice(insertIndex, 0, styleRule);
  5446. }
  5447. }
  5448. }
  5449. },
  5450. /**
  5451. * Remove a selector from all our internal selector maps.
  5452. * @param (com.ibm.rave.core.css.CSSStyleSheet) styleSheet StyleSheet to remove.
  5453. * @return (boolean) <code>true</code> if this stylesheet was removed from the system. <code>false</code> if it did not exist.
  5454. */
  5455. remove : function(styleSheet) {
  5456. var result = false;
  5457. for (var __i_enFor0 = 0, __exp_enFor0 = this.allMaps, __len_enFor0 = __exp_enFor0.length;
  5458. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5459. var map = __exp_enFor0[__i_enFor0];
  5460. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(map), __len_enFor1 = __exp_enFor1.length;
  5461. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  5462. var key = __exp_enFor1[__i_enFor1];
  5463. var list = map[key];
  5464. for (var i = 0; i < list.length; ++i) {
  5465. var rule = list[i];
  5466. if (rule.parentStyleSheet == styleSheet) {
  5467. list.splice(i--, 1);
  5468. result = true;
  5469. }
  5470. }
  5471. if (list.length == 0) {
  5472. delete map[key];
  5473. }
  5474. }
  5475. }
  5476. return result;
  5477. }
  5478. });
  5479. /**
  5480. * Split this individual selector up into tag, class and id pieces So, "img#id.foo" would be split into "tag" "#id" ".foo". Use a lookbehind regex so we keep the special chars
  5481. * @param selectorText A selector string representing a single
  5482. * @return (java.lang.String[]) Array of individual selector pieces that represent a single class/attribute/id of a node.
  5483. */
  5484. com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes = function(selector) {
  5485. return selector.replace(new RegExp(",","g"), " ").split(new RegExp("(?=[\\.\\#\\s])"));
  5486. };
  5487. com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity = function(styleRule) {
  5488. if (styleRule._specificity > 0) {
  5489. return styleRule._specificity;
  5490. }
  5491. var specificity = 0;
  5492. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length;
  5493. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5494. var selector = __exp_enFor0[__i_enFor0];
  5495. switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(selector)) {
  5496. case 3:
  5497. specificity++;
  5498. break;
  5499. case 2:
  5500. specificity += 0x100;
  5501. break;
  5502. case 1:
  5503. specificity += 0x10;
  5504. break;
  5505. default:
  5506. break;
  5507. }
  5508. }
  5509. styleRule._specificity = specificity;
  5510. return specificity;
  5511. };
  5512. com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType = function(selectorText) {
  5513. if (selectorText == null) {
  5514. return -1;
  5515. }
  5516. var firstChar = selectorText.charCodeAt(0);
  5517. if (firstChar == 35) {
  5518. return 2;
  5519. } else if (firstChar == 46 || firstChar == 58) {
  5520. return 1;
  5521. }
  5522. return 3;
  5523. };
  5524. com_ibm_rave_core_internal_css_CSSStyleSheetManager.CLASS = 1;
  5525. com_ibm_rave_core_internal_css_CSSStyleSheetManager.ID = 2;
  5526. com_ibm_rave_core_internal_css_CSSStyleSheetManager.TAG = 3;
  5527. /**
  5528. * Singleton instance of the style sheet manager.
  5529. */
  5530. com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE = new com_ibm_rave_core_internal_css_CSSStyleSheetManager();
  5531. com_ibm_rave_core_internal_css_CSSStyleSheetManager.UNKNOWN = -1;
  5532. // $source: com/ibm/rave/core/geom/RaveRect
  5533. /************************************************************************
  5534. ** IBM Confidential
  5535. **
  5536. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5537. **
  5538. ** (C) Copyright IBM Corp. 2017
  5539. **
  5540. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5541. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5542. ************************************************************************/
  5543. // GENERATED
  5544. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5545. /**
  5546. * A class that describes a Rectangular shape in a non-native way. Immutable. Uses doubles as coordinates.
  5547. * @author jim
  5548. */
  5549. var com_ibm_rave_core_geom_RaveRect = rave_externs["RaveRect"] = com_ibm_rave_core_nativeImpl_Declare({
  5550. /** @expose */
  5551. x : 0,
  5552. /** @expose */
  5553. y : 0,
  5554. /** @expose */
  5555. width : 0,
  5556. /** @expose */
  5557. height : 0,
  5558. /** @expose */
  5559. constructor : function(x, y, width, height) {
  5560. this.x = x;
  5561. this.y = y;
  5562. this.width = width;
  5563. this.height = height;
  5564. },
  5565. /** @expose */
  5566. getX : function() {
  5567. return this.x;
  5568. },
  5569. /** @expose */
  5570. getX2 : function() {
  5571. return this.x + this.width;
  5572. },
  5573. /** @expose */
  5574. getY : function() {
  5575. return this.y;
  5576. },
  5577. /** @expose */
  5578. getY2 : function() {
  5579. return this.y + this.height;
  5580. },
  5581. /** @expose */
  5582. getWidth : function() {
  5583. return this.width;
  5584. },
  5585. /** @expose */
  5586. getHeight : function() {
  5587. return this.height;
  5588. },
  5589. /**
  5590. * Return true if the receiver the the rect intersect, false otherwise
  5591. * @param (com.ibm.rave.core.geom.RectStruct) rect another rectangle to test for intersection
  5592. * @return (boolean) true if the rectangles intersect, false otherwise
  5593. */
  5594. /** @expose */
  5595. intersects : function(rect) {
  5596. return this.x <= (rect.x + rect.width) && (this.x + this.width) >= rect.x && this.y <= (rect.y + rect.height) && (this.y + this.height) >= rect.y;
  5597. },
  5598. /**
  5599. * Checks whether or not this <code>Rectangle</code> contains the point at the specified location {@code (x,y)} .
  5600. * @param (double) X the specified X coordinate
  5601. * @param (double) Y the specified Y coordinate
  5602. * @return (boolean) <code>true</code> if the point {@code (x,y)} is inside this <code>Rectangle</code>; <code>false</code> otherwise.
  5603. */
  5604. /** @expose */
  5605. contains : function(X, Y) {
  5606. if (this.width < 0 || this.height < 0) {
  5607. return false;
  5608. }
  5609. return X >= this.x && Y >= this.y && X <= (this.x + this.width) && Y <= (this.y + this.height);
  5610. }
  5611. });
  5612. // $source: com/ibm/rave/render/internal/nodes/GeometricHelper
  5613. /************************************************************************
  5614. ** IBM Confidential
  5615. **
  5616. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5617. **
  5618. ** (C) Copyright IBM Corp. 2017
  5619. **
  5620. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5621. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5622. ************************************************************************/
  5623. // GENERATED
  5624. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  5625. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5626. //@import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime) // arcToBezier
  5627. /**
  5628. * A handful of geometric helper methods used by SceneNode hit testing
  5629. * @author Ian Ballantyne
  5630. */
  5631. var com_ibm_rave_render_internal_nodes_GeometricHelper = {
  5632. };
  5633. /**
  5634. * Determine if a rectangle intersects with a polygon
  5635. * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection
  5636. * @param (Array) points polygon for testing intersection
  5637. * @return (boolean) true if intersect, false otherwise
  5638. */
  5639. com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect = function(rect, points) {
  5640. var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y);
  5641. if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(topLeft, points)) {
  5642. return true;
  5643. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) {
  5644. return true;
  5645. } else {
  5646. var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y);
  5647. var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height);
  5648. var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height);
  5649. var prevPoint = points[points.length - 1];
  5650. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  5651. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5652. var curPoint = __exp_enFor0[__i_enFor0];
  5653. if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5654. return true;
  5655. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5656. return true;
  5657. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5658. return true;
  5659. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5660. return true;
  5661. }
  5662. prevPoint = curPoint;
  5663. }
  5664. }
  5665. return false;
  5666. };
  5667. /**
  5668. * Determine if a rectangle intersects with a polyline
  5669. * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection
  5670. * @param (Array) points polyline for testing intersection
  5671. * @return (boolean) true if intersect, false otherwise
  5672. */
  5673. com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect = function(rect, points) {
  5674. if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) {
  5675. return true;
  5676. } else {
  5677. var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y);
  5678. var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y);
  5679. var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height);
  5680. var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height);
  5681. var prevPoint = points[points.length - 1];
  5682. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  5683. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5684. var curPoint = __exp_enFor0[__i_enFor0];
  5685. if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5686. return true;
  5687. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5688. return true;
  5689. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5690. return true;
  5691. } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) {
  5692. return true;
  5693. }
  5694. prevPoint = curPoint;
  5695. }
  5696. }
  5697. return false;
  5698. };
  5699. /**
  5700. * Determine if a point is inside a polygon
  5701. * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
  5702. * @param (Array) points polygon for testing
  5703. * @return (boolean) true if point is inside polygon, false otherwise
  5704. */
  5705. com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon = function(pt, points) {
  5706. var isInside = false;
  5707. var prevPoint = points[points.length - 1];
  5708. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  5709. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5710. var curPoint = __exp_enFor0[__i_enFor0];
  5711. var curAbove = curPoint.y >= pt.y;
  5712. var prevAbove = prevPoint.y >= pt.y;
  5713. var stradle = curAbove != prevAbove;
  5714. if (stradle) {
  5715. var xIntersect = (prevPoint.x - curPoint.x) * (pt.y - curPoint.y) / (prevPoint.y - curPoint.y) + curPoint.x;
  5716. var pointLeftOfIntersect = pt.x <= xIntersect;
  5717. if (pointLeftOfIntersect) {
  5718. isInside = !isInside;
  5719. }
  5720. }
  5721. prevPoint = curPoint;
  5722. }
  5723. return isInside;
  5724. };
  5725. /**
  5726. * Determine if a point lies on a polyline
  5727. * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
  5728. * @param (Array) points polyline for testing
  5729. * @param (double) tolerance max distance point can be from polyline to be considered "on"
  5730. * @return (boolean) true if point is on the polyline, false otherwise
  5731. */
  5732. com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline = function(pt, points, tolerance) {
  5733. var prevPoint;
  5734. for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length;
  5735. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5736. var curPoint = __exp_enFor0[__i_enFor0];
  5737. if (!prevPoint) {
  5738. prevPoint = curPoint;
  5739. } else {
  5740. var d = com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance(pt.x, pt.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y);
  5741. if (d <= tolerance) {
  5742. return true;
  5743. }
  5744. prevPoint = curPoint;
  5745. }
  5746. }
  5747. return false;
  5748. };
  5749. /**
  5750. * Determine if a point is in a rectangle
  5751. * @param (com.ibm.rave.core.geom.PointStruct) pt point to test
  5752. * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing
  5753. * @return (boolean) true if point is inside the rectangle, false otherwise
  5754. */
  5755. com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle = function(pt, rect) {
  5756. return pt.x >= rect.x && pt.x < rect.x + rect.width && pt.y >= rect.y && pt.y < rect.y + rect.height;
  5757. };
  5758. /**
  5759. * Determine if a circle intersects with a rectangle
  5760. * @param (double) xCtr center x of circle
  5761. * @param (double) yCtr center y of circle
  5762. * @param (double) radius radius of circle
  5763. * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing
  5764. * @return (boolean) true if intersect, false otherwise
  5765. */
  5766. com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect = function(xCtr, yCtr, radius, rect) {
  5767. var xClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(xCtr, rect.x, rect.x + rect.width);
  5768. var yClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(yCtr, rect.y, rect.y + rect.height);
  5769. var dx = xCtr - xClosest;
  5770. var dy = yCtr - yClosest;
  5771. var distance_sq = dx * dx + dy * dy;
  5772. return distance_sq < (radius * radius);
  5773. };
  5774. com_ibm_rave_render_internal_nodes_GeometricHelper.clamp = function(value, minValue, maxValue) {
  5775. if (value < minValue) {
  5776. return minValue;
  5777. } else if (value > maxValue) {
  5778. return maxValue;
  5779. }
  5780. return value;
  5781. };
  5782. /**
  5783. * Calculate the distance of a point from a line segment
  5784. * @param (double) x x value of point
  5785. * @param (double) y y value of point
  5786. * @param (double) x1 start x of line segment
  5787. * @param (double) y1 start y of line segment
  5788. * @param (double) x2 end x of line segment
  5789. * @param (double) y2 end y of line segment
  5790. * @return (double) distance
  5791. */
  5792. com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance = function(x, y, x1, y1, x2, y2) {
  5793. var dot = (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1);
  5794. var len_sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  5795. var u = -1;
  5796. if (len_sq != 0) {
  5797. u = dot / len_sq;
  5798. }
  5799. var xSeg, ySeg;
  5800. if (u < 0) {
  5801. xSeg = x1;
  5802. ySeg = y1;
  5803. } else if (u > 1) {
  5804. xSeg = x2;
  5805. ySeg = y2;
  5806. } else {
  5807. xSeg = x1 + u * (x2 - x1);
  5808. ySeg = y1 + u * (y2 - y1);
  5809. }
  5810. var dx = x - xSeg;
  5811. var dy = y - ySeg;
  5812. return Math.sqrt(dx * dx + dy * dy);
  5813. };
  5814. /**
  5815. * Determine if two line segments intersect
  5816. * @param (double) x1 start x of first line segment
  5817. * @param (double) y1 start y of first line segment
  5818. * @param (double) x2 end x of first line segment
  5819. * @param (double) y2 end y of first line segment
  5820. * @param (double) x3 start x of second line segment
  5821. * @param (double) y3 start y of second line segment
  5822. * @param (double) x4 end x of second line segment
  5823. * @param (double) y4 end y of second line segment
  5824. * @return (boolean) true if line segments intersect, false otherwise
  5825. */
  5826. com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect = function(x1, y1, x2, y2, x3, y3, x4, y4) {
  5827. var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
  5828. if (denom <= 0.00001) {
  5829. return false;
  5830. }
  5831. var uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
  5832. var uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
  5833. return uA > 0 && uA < 1 && uB > 0 && uB < 1;
  5834. };
  5835. /**
  5836. * Determine if 2 rectangles intersect
  5837. * @param (double) left1 left (x) of first rectangle
  5838. * @param (double) top1 top (y) of first rectangle
  5839. * @param (double) width1 width of first rectangle
  5840. * @param (double) height1 height of first rectangle
  5841. * @param (double) left2 left (x) of second rectangle
  5842. * @param (double) top2 top (y) of second rectangle
  5843. * @param (double) width2 width of second rectangle
  5844. * @param (double) height2 heightof second rectangle
  5845. * @return (boolean) true if intersect, false otherwise
  5846. */
  5847. com_ibm_rave_render_internal_nodes_GeometricHelper.rectIntersects = function(left1, top1, width1, height1, left2, top2, width2, height2) {
  5848. var right1 = left1 + width1;
  5849. var bottom1 = top1 + height1;
  5850. var right2 = left2 + width2;
  5851. var bottom2 = top2 + height2;
  5852. return !(left1 > right2 || right1 < left2 || top1 > bottom2 || bottom1 < top2);
  5853. };
  5854. /**
  5855. * A path can contain 0 or more "shapes" (either polylines or polygons), this object holds on to one of those shapes
  5856. */
  5857. com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape = com_ibm_rave_core_nativeImpl_Declare({
  5858. //points : null,
  5859. //bounds : null,
  5860. isClosed : false,
  5861. isCollinear : true,
  5862. initialSlope : 0,
  5863. initialVertical : false,
  5864. constructor : function() {
  5865. this.points = [];
  5866. },
  5867. addPoint : function(point) {
  5868. if (this.points.length != 0) {
  5869. if (point.x == this.points[this.points.length - 1].x && point.y == this.points[this.points.length - 1].y) {
  5870. return;
  5871. }
  5872. }
  5873. this.points.push(point);
  5874. if (!this.bounds) {
  5875. this.bounds = [];
  5876. this.bounds[0] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y);
  5877. this.bounds[1] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y);
  5878. } else {
  5879. if (point.x < this.bounds[0].x) {
  5880. this.bounds[0].x = point.x;
  5881. } else if (point.x > this.bounds[1].x) {
  5882. this.bounds[1].x = point.x;
  5883. }
  5884. if (point.y < this.bounds[0].y) {
  5885. this.bounds[0].y = point.y;
  5886. } else if (point.y > this.bounds[1].y) {
  5887. this.bounds[1].y = point.y;
  5888. }
  5889. }
  5890. if (this.isCollinear && this.points.length >= 2) {
  5891. var dx = this.points[this.points.length - 1].x - this.points[this.points.length - 2].x;
  5892. var dy = this.points[this.points.length - 1].y - this.points[this.points.length - 2].y;
  5893. var isVertical = Math.abs(dy) < 0.0001;
  5894. var slope = isVertical ? 0 : dx / dy;
  5895. if (this.points.length == 2) {
  5896. this.initialVertical = isVertical;
  5897. this.initialSlope = slope;
  5898. } else {
  5899. this.isCollinear = (isVertical == this.initialVertical && Math.abs(this.initialSlope - slope) < 0.0001);
  5900. }
  5901. }
  5902. },
  5903. setClosed : function() {
  5904. if (!this.isCollinear) {
  5905. this.isClosed = true;
  5906. }
  5907. },
  5908. getBounds : function() {
  5909. return this.bounds;
  5910. },
  5911. intersect$0 : function(point) {
  5912. if (this.isClosed) {
  5913. return com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(point, this.points);
  5914. } else {
  5915. return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(point, this.points, 5.0);
  5916. }
  5917. },
  5918. intersect$1 : function(rect) {
  5919. if (rect.width <= 2 && rect.height <= 2) {
  5920. return this.intersect$0(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y));
  5921. }
  5922. if (rect.x > this.bounds[1].x || (rect.x + rect.width) < this.bounds[0].x || rect.y > this.bounds[1].y || (rect.y + rect.height) < this.bounds[0].y) {
  5923. return false;
  5924. }
  5925. if (this.isClosed) {
  5926. return com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect(rect, this.points);
  5927. } else {
  5928. return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, this.points);
  5929. }
  5930. },
  5931. intersect : function(a0) {
  5932. var args = arguments;
  5933. if (args.length == 1 && (a0 == null || com_ibm_rave_core_nativeImpl_Object.isInstanceOf(a0, com_ibm_rave_core_geom_PointStruct))) {
  5934. return this.intersect$0(a0);
  5935. }
  5936. return this.intersect$1(a0);
  5937. }
  5938. });
  5939. /**
  5940. * An implementation of Path2DHandler that is used to create an array of PathShape objects that represent the contents of a Path
  5941. */
  5942. com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler = com_ibm_rave_core_nativeImpl_Declare({
  5943. //shapes : null,
  5944. //currentPoint : null,
  5945. currentShape : -1,
  5946. constructor : function() {
  5947. this.shapes = [];
  5948. },
  5949. /** @expose */
  5950. fail : function(index) {},
  5951. /** @expose */
  5952. startPath : function() {},
  5953. /** @expose */
  5954. closePath : function() {
  5955. this.shapes[this.currentShape].setClosed();
  5956. this.currentPoint = null;
  5957. },
  5958. /** @expose */
  5959. moveTo : function(x, y) {
  5960. this.currentShape++;
  5961. this.shapes.push(new com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape());
  5962. this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
  5963. this.shapes[this.currentShape].addPoint(this.currentPoint);
  5964. },
  5965. /** @expose */
  5966. lineTo : function(x, y) {
  5967. this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
  5968. this.shapes[this.currentShape].addPoint(this.currentPoint);
  5969. },
  5970. /** @expose */
  5971. quadraticCurveTo : function(cpx, cpy, x, y) {
  5972. var p0x = this.currentPoint.x;
  5973. var p0y = this.currentPoint.y;
  5974. var p1x = cpx;
  5975. var p1y = cpy;
  5976. var p2x = x;
  5977. var p2y = y;
  5978. var dx = p2x - p0x;
  5979. var dy = p2y - p0y;
  5980. var delta = Math.max(Math.abs(dx), Math.abs(dy));
  5981. var curvePointCount = ~~(delta / 2);
  5982. if (curvePointCount > 1) {
  5983. var dt = 1.0 / curvePointCount;
  5984. var t = dt;
  5985. for (var j = 0; j < curvePointCount; ++j) {
  5986. var xp = (1 - t) * (1 - t) * p0x + 2 * (1 - t) * t * p1x + (t * t) * p2x;
  5987. var yp = (1 - t) * (1 - t) * p0y + 2 * (1 - t) * t * p1y + (t * t) * p2y;
  5988. this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp));
  5989. t += dt;
  5990. }
  5991. }
  5992. this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
  5993. this.shapes[this.currentShape].addPoint(this.currentPoint);
  5994. },
  5995. /** @expose */
  5996. bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
  5997. var p0x = this.currentPoint.x;
  5998. var p0y = this.currentPoint.y;
  5999. var p1x = cp1x;
  6000. var p1y = cp1y;
  6001. var p2x = cp2x;
  6002. var p2y = cp2y;
  6003. var p3x = x;
  6004. var p3y = y;
  6005. var dx = p3x - p0x;
  6006. var dy = p3y - p0y;
  6007. var delta = Math.max(Math.abs(dx), Math.abs(dy));
  6008. var curvePointCount = ~~(delta / 2);
  6009. if (curvePointCount > 1) {
  6010. var dt = 1.0 / curvePointCount;
  6011. var t = dt;
  6012. for (var j = 0; j < curvePointCount; ++j) {
  6013. var xp = (1 - t) * (1 - t) * (1 - t) * p0x + 3 * (1 - t) * (1 - t) * t * p1x + 3 * (1 - t) * (t * t) * p2x + (t * t * t) * p3x;
  6014. var yp = (1 - t) * (1 - t) * (1 - t) * p0y + 3 * (1 - t) * (1 - t) * t * p1y + 3 * (1 - t) * (t * t) * p2y + (t * t * t) * p3y;
  6015. this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp));
  6016. t += dt;
  6017. }
  6018. }
  6019. this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y);
  6020. this.shapes[this.currentShape].addPoint(this.currentPoint);
  6021. },
  6022. /** @expose */
  6023. arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
  6024. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
  6025. },
  6026. getShapes : function() {
  6027. return this.shapes;
  6028. }
  6029. });
  6030. // $source: com/ibm/rave/render/internal/nodes/path/Path2DUtil
  6031. /************************************************************************
  6032. ** IBM Confidential
  6033. **
  6034. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6035. **
  6036. ** (C) Copyright IBM Corp. 2017
  6037. **
  6038. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6039. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6040. ************************************************************************/
  6041. // GENERATED
  6042. //@import com/ibm/rave/core/transform/MatrixUtil (static) // identity, mapPoints
  6043. var com_ibm_rave_render_internal_nodes_path_Path2DUtil = {
  6044. //constructor : function() {}
  6045. };
  6046. /**
  6047. * Utility for converting an SVG arc to bezier curves. Useful for platforms that do not support the SVG arc in the same way.
  6048. */
  6049. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier = function(path, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
  6050. var angle = xAxisRotation % 360;
  6051. var dx2 = (x0 - x) / 2.0;
  6052. var dy2 = (y0 - y) / 2.0;
  6053. var angleRad = angle / 180.0 * Math.PI;
  6054. var cosAngle = Math.cos(angleRad);
  6055. var sinAngle = Math.sin(angleRad);
  6056. var x1 = (cosAngle * dx2 + sinAngle * dy2);
  6057. var y1 = (-sinAngle * dx2 + cosAngle * dy2);
  6058. var rxAbs = Math.abs(rx);
  6059. var ryAbs = Math.abs(ry);
  6060. var Prx = rxAbs * rxAbs;
  6061. var Pry = ryAbs * ryAbs;
  6062. var Px1 = x1 * x1;
  6063. var Py1 = y1 * y1;
  6064. var radiiCheck = Px1 / Prx + Py1 / Pry;
  6065. if (radiiCheck > 1) {
  6066. rxAbs = Math.sqrt(radiiCheck) * rxAbs;
  6067. ryAbs = Math.sqrt(radiiCheck) * ryAbs;
  6068. Prx = rxAbs * rxAbs;
  6069. Pry = ryAbs * ryAbs;
  6070. }
  6071. var sign = (largeArcFlag == sweepFlag) ? -1 : 1;
  6072. var sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1));
  6073. sq = (sq < 0) ? 0 : sq;
  6074. var coef = (sign * Math.sqrt(sq));
  6075. var cx1 = coef * ((rxAbs * y1) / ryAbs);
  6076. var cy1 = coef * -((ryAbs * x1) / rxAbs);
  6077. var sx2 = (x0 + x) / 2.0;
  6078. var sy2 = (y0 + y) / 2.0;
  6079. var cx = sx2 + (cosAngle * cx1 - sinAngle * cy1);
  6080. var cy = sy2 + (sinAngle * cx1 + cosAngle * cy1);
  6081. var ux = (x1 - cx1) / rxAbs;
  6082. var uy = (y1 - cy1) / ryAbs;
  6083. var vx = (-x1 - cx1) / rxAbs;
  6084. var vy = (-y1 - cy1) / ryAbs;
  6085. var p, n;
  6086. n = Math.sqrt((ux * ux) + (uy * uy));
  6087. p = ux;
  6088. sign = (uy < 0) ? -1 : 1;
  6089. var angleStart = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
  6090. n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
  6091. p = ux * vx + uy * vy;
  6092. sign = (ux * vy - uy * vx < 0) ? -1 : 1;
  6093. var angleExtent = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
  6094. if (!sweepFlag && angleExtent > 0) {
  6095. angleExtent -= 360;
  6096. } else if (sweepFlag && angleExtent < 0) {
  6097. angleExtent += 360;
  6098. }
  6099. angleExtent %= 360;
  6100. angleStart %= 360;
  6101. var bezierPoints = com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers(angleStart, angleExtent);
  6102. var m = com_ibm_rave_core_transform_MatrixUtil.identity();
  6103. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.scaleNonUniform(rxAbs, ryAbs));
  6104. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.rotate(angle));
  6105. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.translate(cx, cy));
  6106. bezierPoints[bezierPoints.length - 2] = x;
  6107. bezierPoints[bezierPoints.length - 1] = y;
  6108. for (var i = 0; i < bezierPoints.length; i += 6) {
  6109. path.bezierCurveTo(bezierPoints[i], bezierPoints[i + 1], bezierPoints[i + 2], bezierPoints[i + 3], bezierPoints[i + 4], bezierPoints[i + 5]);
  6110. }
  6111. };
  6112. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers = function(angleStart, angleExtent) {
  6113. var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0);
  6114. var angleStartRad = angleStart / 180.0 * Math.PI;
  6115. var angleExtentRad = angleExtent / 180.0 * Math.PI;
  6116. var angleIncrement = (angleExtentRad / numSegments);
  6117. var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));
  6118. var coords = [];
  6119. var pos = 0;
  6120. for (var i = 0; i < numSegments; ++i) {
  6121. var angle = angleStartRad + i * angleIncrement;
  6122. var dx = Math.cos(angle);
  6123. var dy = Math.sin(angle);
  6124. coords[pos++] = (dx - controlLength * dy);
  6125. coords[pos++] = (dy + controlLength * dx);
  6126. angle += angleIncrement;
  6127. dx = Math.cos(angle);
  6128. dy = Math.sin(angle);
  6129. coords[pos++] = (dx + controlLength * dy);
  6130. coords[pos++] = (dy - controlLength * dx);
  6131. coords[pos++] = dx;
  6132. coords[pos++] = dy;
  6133. }
  6134. return coords;
  6135. };
  6136. // $source: com/ibm/rave/render/internal/nodes/CircleSceneItem
  6137. /************************************************************************
  6138. ** IBM Confidential
  6139. **
  6140. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6141. **
  6142. ** (C) Copyright IBM Corp. 2017
  6143. **
  6144. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6145. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6146. ************************************************************************/
  6147. // GENERATED
  6148. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6149. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  6150. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  6151. //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // circleIntersect
  6152. /**
  6153. * Circle shape.
  6154. */
  6155. var com_ibm_rave_render_internal_nodes_CircleSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  6156. cx : 0,
  6157. r : 0,
  6158. cy : 0,
  6159. calculateBBox : function() {
  6160. return new com_ibm_rave_core_geom_RaveRect(this.cx - this.r, this.cy - this.r, this.r * 2, this.r * 2);
  6161. },
  6162. /** @expose */
  6163. rave_getDrawType : function() {
  6164. return 1002;
  6165. },
  6166. /** @expose */
  6167. rave_getName : function() {
  6168. return "circle";
  6169. },
  6170. getCx : function() {
  6171. return this.cx;
  6172. },
  6173. getCy : function() {
  6174. return this.cy;
  6175. },
  6176. getR : function() {
  6177. return this.r;
  6178. },
  6179. rave_intersects : function(rect) {
  6180. return com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect(this.cx, this.cy, this.r, rect) && this.intersectsClip(rect);
  6181. },
  6182. paint : function(renderer) {
  6183. renderer.setStrokeAndFill(this);
  6184. renderer.drawCircle(this);
  6185. },
  6186. doLayout : function() {
  6187. this.cx = this.rave_getSizePx(this.getComputedCSSStyle(9).value);
  6188. this.cy = this.rave_getSizePx(this.getComputedCSSStyle(10).value);
  6189. this.r = this.rave_getSizePx(this.getComputedCSSStyle(6).value);
  6190. }
  6191. //constructor : function(nsuri, context) {}
  6192. });
  6193. // $source: com/ibm/rave/render/internal/nodes/LineSceneItem
  6194. /************************************************************************
  6195. ** IBM Confidential
  6196. **
  6197. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6198. **
  6199. ** (C) Copyright IBM Corp. 2017
  6200. **
  6201. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6202. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6203. ************************************************************************/
  6204. // GENERATED
  6205. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6206. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  6207. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  6208. //@import com/ibm/rave/core/geom/PointStruct (runtime) // new
  6209. //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // pointOnPolyline, polylineIntersect
  6210. /**
  6211. * Circle shape.
  6212. */
  6213. var com_ibm_rave_render_internal_nodes_LineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  6214. x1 : 0,
  6215. x2 : 0,
  6216. y1 : 0,
  6217. y2 : 0,
  6218. calculateBBox : function() {
  6219. var tmp;
  6220. if (this.x1 > this.x2) {
  6221. tmp = this.x1;
  6222. this.x1 = this.x2;
  6223. this.x2 = tmp;
  6224. }
  6225. if (this.y1 > this.y2) {
  6226. tmp = this.y1;
  6227. this.y1 = this.y2;
  6228. this.y2 = tmp;
  6229. }
  6230. return new com_ibm_rave_core_geom_RaveRect(this.x1, this.y1, this.x2 - this.x1, this.y2 - this.y1);
  6231. },
  6232. /** @expose */
  6233. rave_getDrawType : function() {
  6234. return 1001;
  6235. },
  6236. /** @expose */
  6237. rave_getName : function() {
  6238. return "line";
  6239. },
  6240. getX1 : function() {
  6241. return this.x1;
  6242. },
  6243. getX2 : function() {
  6244. return this.x2;
  6245. },
  6246. getY1 : function() {
  6247. return this.y1;
  6248. },
  6249. getY2 : function() {
  6250. return this.y2;
  6251. },
  6252. rave_intersects : function(rect) {
  6253. var line = [];
  6254. line.push(new com_ibm_rave_core_geom_PointStruct(this.x1, this.y1));
  6255. line.push(new com_ibm_rave_core_geom_PointStruct(this.x2, this.y2));
  6256. if (rect.width <= 2 && rect.height <= 2) {
  6257. return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y), line, 5.0);
  6258. }
  6259. return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, line) && this.intersectsClip(rect);
  6260. },
  6261. paint : function(renderer) {
  6262. renderer.setStrokeAndFill(this);
  6263. renderer.drawLine(this);
  6264. },
  6265. doLayout : function() {
  6266. this.x1 = this.rave_getSizePx(this.getComputedCSSStyle(4).value);
  6267. this.x2 = this.rave_getSizePx(this.getComputedCSSStyle(5).value);
  6268. this.y1 = this.rave_getSizePx(this.getComputedCSSStyle(7).value);
  6269. this.y2 = this.rave_getSizePx(this.getComputedCSSStyle(8).value);
  6270. }
  6271. //constructor : function(nsuri, context) {}
  6272. });
  6273. com_ibm_rave_render_internal_nodes_LineSceneItem.LINE_TOUCH_DISTANCE = 5;
  6274. // $source: com/ibm/rave/render/internal/nodes/TextSceneItem
  6275. /************************************************************************
  6276. ** IBM Confidential
  6277. **
  6278. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6279. **
  6280. ** (C) Copyright IBM Corp. 2017
  6281. **
  6282. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6283. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6284. ************************************************************************/
  6285. // GENERATED
  6286. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6287. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  6288. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  6289. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  6290. //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont
  6291. //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
  6292. //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
  6293. //@import com/ibm/rave/core/Rave (runtime) // Rave
  6294. /**
  6295. * Text shape.
  6296. */
  6297. var com_ibm_rave_render_internal_nodes_TextSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  6298. //styleCache : null,
  6299. //ascent : null,
  6300. //descent : null,
  6301. //cachedBoundingClientRectBBox : null,
  6302. x : 0,
  6303. y : 0,
  6304. width : 0,
  6305. height : 0,
  6306. nextX : 0,
  6307. nextY : 0,
  6308. /** @expose */
  6309. rave_getDrawType : function() {
  6310. return 1003;
  6311. },
  6312. /** @expose */
  6313. rave_getName : function() {
  6314. return "text";
  6315. },
  6316. notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
  6317. this.styleCache = null;
  6318. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue);
  6319. },
  6320. invalidateLayout : function() {
  6321. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this);
  6322. this.cachedBoundingClientRectBBox = null;
  6323. },
  6324. calculateBBox : function() {
  6325. var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
  6326. if (this.rave_hasChildNodes()) {
  6327. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6328. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6329. var child = __exp_enFor0[__i_enFor0];
  6330. var childRect = (child).calculateBBox();
  6331. this.expandRect(childRect, clientRect);
  6332. }
  6333. }
  6334. return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
  6335. },
  6336. getBoundingClientRectBBox : function() {
  6337. if (!this.cachedBoundingClientRectBBox) {
  6338. if (this.invalidLayout) {
  6339. this.layout();
  6340. }
  6341. var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
  6342. if (this.rave_hasChildNodes()) {
  6343. for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  6344. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6345. var child = __exp_enFor0[__i_enFor0];
  6346. var childRect = (child).getBoundingClientRectBBox();
  6347. this.expandRect(childRect, clientRect);
  6348. }
  6349. }
  6350. this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
  6351. }
  6352. return this.cachedBoundingClientRectBBox;
  6353. },
  6354. /**
  6355. * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place.
  6356. * @param (com.ibm.rave.core.geom.RaveRect) rect1
  6357. * @param (com.ibm.rave.core.geom.RectStruct) rect2
  6358. */
  6359. expandRect : function(rect1, rect2) {
  6360. var currentX2 = rect2.x + rect2.width;
  6361. var currentY2 = rect2.y + rect2.height;
  6362. var childX2 = rect1.x + rect1.width;
  6363. var childY2 = rect1.y + rect1.height;
  6364. rect2.x = Math.min(rect1.x, rect2.x);
  6365. rect2.y = Math.min(rect1.y, rect2.y);
  6366. rect2.width = Math.max(currentX2, childX2) - rect2.x;
  6367. rect2.height = Math.max(currentY2, childY2) - rect2.y;
  6368. },
  6369. /**
  6370. * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node.
  6371. */
  6372. getFontStyle : function() {
  6373. if (!this.styleCache) {
  6374. this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this);
  6375. }
  6376. return this.styleCache;
  6377. },
  6378. /**
  6379. * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node.
  6380. */
  6381. getShadow : function() {
  6382. var result = this.getComputedStyleValue(46);
  6383. if (!result) {
  6384. result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
  6385. }
  6386. result = (!result || "none" == result) ? null : result;
  6387. return result;
  6388. },
  6389. /**
  6390. * Return the text content.
  6391. * @return (String) text content
  6392. */
  6393. getTextString : function() {
  6394. return this.text;
  6395. },
  6396. /**
  6397. * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account.
  6398. * @return (double) x position taking alignment into account.
  6399. */
  6400. getX : function() {
  6401. return this.x;
  6402. },
  6403. /**
  6404. * Returns the Y position where this item will start drawing from. This returns the text baseline
  6405. * @return (double) y position
  6406. */
  6407. getY : function() {
  6408. return this.y;
  6409. },
  6410. /** @expose */
  6411. rave_getSizePx : function(size) {
  6412. var value = 0;
  6413. if (size) {
  6414. value = size.value;
  6415. switch (size.unit.type) {
  6416. case 1:
  6417. return size.value * this.getFontStyle().getSize();
  6418. default:
  6419. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size);
  6420. }
  6421. }
  6422. return value;
  6423. },
  6424. paint : function(renderer) {
  6425. if (this.text != null && this.text.length > 0) {
  6426. renderer.setStrokeAndFill(this);
  6427. renderer.drawText(this);
  6428. }
  6429. },
  6430. doLayout : function() {
  6431. this.calculateDimensions();
  6432. this.nextX = this.x + this.width;
  6433. this.nextY = this.y;
  6434. this.invalidLayout = false;
  6435. if (this.rave_hasChildNodes()) {
  6436. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6437. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6438. var child = __exp_enFor0[__i_enFor0];
  6439. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
  6440. var achild = child;
  6441. if (achild.invalidLayout) {
  6442. achild.layout();
  6443. }
  6444. this.nextX = achild.nextX;
  6445. this.nextY = achild.nextY;
  6446. }
  6447. }
  6448. }
  6449. },
  6450. /**
  6451. * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children.
  6452. */
  6453. setDirty : function(dirty_, invalidateLayout) {
  6454. if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) {
  6455. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6456. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6457. var child = __exp_enFor0[__i_enFor0];
  6458. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
  6459. (child).invalidateLayout();
  6460. }
  6461. }
  6462. }
  6463. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout);
  6464. },
  6465. /**
  6466. * Perform dimension (x,y,width,height,etc) calculations only.
  6467. */
  6468. calculateDimensions : function() {
  6469. this.computeStylesToRoot();
  6470. var metrics = this.calculateMetrics();
  6471. this.width = metrics["width"];
  6472. var fontSize = this.rave_getSizePx(this.getComputedCSSStyle(22).value);
  6473. this.ascent = metrics["actualBoundingBoxAscent"];
  6474. this.descent = metrics["actualBoundingBoxDescent"];
  6475. if (undefined == this.ascent) {
  6476. this.ascent = fontSize * .7 + fontSize * .1;
  6477. }
  6478. if (undefined == this.descent) {
  6479. this.descent = fontSize * .3;
  6480. }
  6481. this.height = this.ascent + this.descent;
  6482. this.width = this.calculateMetrics()["width"];
  6483. this.x = this.calculateX();
  6484. this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value) + this.rave_getSizePx(this.getComputedCSSStyle(16).value);
  6485. },
  6486. calculateX : function() {
  6487. var calculatedX = this.rave_getSizePx(this.getComputedStyleValue(0));
  6488. var anchor = this.getComputedStyleValue(27);
  6489. if ("middle" == anchor) {
  6490. calculatedX -= this.width / 2;
  6491. } else if ("end" == anchor) {
  6492. calculatedX -= this.width;
  6493. }
  6494. return calculatedX + this.rave_getSizePx(this.getComputedStyleValue(15));
  6495. },
  6496. calculateMetrics : function() {
  6497. var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d");
  6498. context.font = this.getFontStyle().toString();
  6499. var tm = context.measureText(this.text);
  6500. com_ibm_rave_core_Rave.canvas.disposeContext(context);
  6501. return tm;
  6502. }
  6503. //constructor : function(nsuri, context) {}
  6504. });
  6505. // $source: com/ibm/rave/render/internal/style/GradientFillStyle
  6506. /************************************************************************
  6507. ** IBM Confidential
  6508. **
  6509. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6510. **
  6511. ** (C) Copyright IBM Corp. 2017
  6512. **
  6513. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6514. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6515. ************************************************************************/
  6516. // GENERATED
  6517. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6518. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  6519. /**
  6520. * The abstract base class for color gradient used for filling shapes. Gradients are immutable.
  6521. */
  6522. var com_ibm_rave_render_internal_style_GradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  6523. /**
  6524. * A list to hold gradient color stops
  6525. */
  6526. //stops : null,
  6527. constructor : function() {
  6528. this.stops = [];
  6529. },
  6530. /**
  6531. * Add a gradient color stop at a set index.
  6532. * @param (com.ibm.rave.render.internal.style.GradientStop) stop {@link (com.ibm.rave.render.internal.style.GradientStop) GradientStop}
  6533. * @return (com.ibm.rave.render.internal.style.GradientFillStyle) This gradient for easy chaining.
  6534. */
  6535. addStop : function(stop) {
  6536. this.stops.push(this.updateOffset(stop));
  6537. return this;
  6538. },
  6539. /**
  6540. * Return a list of all stop objects associated with this gradient.
  6541. * @return (Array) list of all stop objects associated with this gradient. Returns an empty list if none defined.
  6542. */
  6543. getStops : function() {
  6544. return this.stops;
  6545. },
  6546. getColor : function() {
  6547. return null;
  6548. },
  6549. calculateColorWithOpacity : function() {
  6550. return null;
  6551. },
  6552. /**
  6553. * Update the stop's offset to match the rules of SVG for gradients. (http://www.w3.org/TR/SVG/pservers.html#StopElement)
  6554. */
  6555. updateOffset : function(stop) {
  6556. var maxStop;
  6557. for (var __i_enFor0 = 0, __exp_enFor0 = this.stops, __len_enFor0 = __exp_enFor0.length;
  6558. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6559. var s = __exp_enFor0[__i_enFor0];
  6560. if (!maxStop || s.offset > maxStop.offset) {
  6561. maxStop = s;
  6562. }
  6563. }
  6564. if (maxStop) {
  6565. var maxOffset = maxStop.offset;
  6566. if (stop.offset <= maxOffset) {
  6567. stop.setOffset(maxOffset);
  6568. maxStop.setOffset(maxOffset - 1.0E-5);
  6569. }
  6570. }
  6571. return stop;
  6572. }
  6573. });
  6574. /**
  6575. * A small adjustment to differentiate between equal stop values. AWT renderer throws an exception when stops have the same value. Adjusting one of the values by this amount mimics SVG behavior for equal stop values.
  6576. */
  6577. com_ibm_rave_render_internal_style_GradientFillStyle.EQUAL_DIFF = 0.00001;
  6578. // $source: com/ibm/rave/render/internal/style/LinearGradientFillStyle
  6579. /************************************************************************
  6580. ** IBM Confidential
  6581. **
  6582. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6583. **
  6584. ** (C) Copyright IBM Corp. 2017
  6585. **
  6586. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6587. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6588. ************************************************************************/
  6589. // GENERATED
  6590. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6591. //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass
  6592. var com_ibm_rave_render_internal_style_LinearGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, {
  6593. /**
  6594. * Starting X position.
  6595. */
  6596. x1 : 0,
  6597. /**
  6598. * Starting Y position.
  6599. */
  6600. y1 : 0,
  6601. /**
  6602. * Ending X position.
  6603. */
  6604. x2 : 0,
  6605. /**
  6606. * Ending Y position.
  6607. */
  6608. y2 : 0,
  6609. /**
  6610. * Create a linear gradient style. Has the following public properties defined:<p> x0<p> y0<p> x1<p> y1<p> stops<p>
  6611. * @param (double) x1 The horizontal coordinate of the gradient start point.
  6612. * @param (double) y1 The vertical coordinate of the gradient start point.
  6613. * @param (double) x2 The horizontal coordinate of the gradient end point.
  6614. * @param (double) y2 The vertical coordinate of the gradient end point.
  6615. */
  6616. constructor : function(x1, y1, x2, y2) {
  6617. this.x1 = x1;
  6618. this.y1 = y1;
  6619. this.x2 = x2;
  6620. this.y2 = y2;
  6621. },
  6622. getType : function() {
  6623. return 1001;
  6624. }
  6625. });
  6626. // $source: com/ibm/rave/render/internal/style/RadialGradientFillStyle
  6627. /************************************************************************
  6628. ** IBM Confidential
  6629. **
  6630. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6631. **
  6632. ** (C) Copyright IBM Corp. 2017
  6633. **
  6634. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6635. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6636. ************************************************************************/
  6637. // GENERATED
  6638. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6639. //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass
  6640. var com_ibm_rave_render_internal_style_RadialGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, {
  6641. /**
  6642. * The horizontal coordinate of the gradient start point.
  6643. */
  6644. cx : 0,
  6645. /**
  6646. * The vertical coordinate of the gradient start point.
  6647. */
  6648. cy : 0,
  6649. /**
  6650. * Radius of the starting circle.
  6651. */
  6652. r : 0,
  6653. /**
  6654. * The horizontal coordinate of the gradient end point.
  6655. */
  6656. fx : 0,
  6657. /**
  6658. * The vertical coordinate of the gradient end point.
  6659. */
  6660. fy : 0,
  6661. /**
  6662. * Create a radial gradient style. Has the following public properties defined: <p> cx <p> cy <p> r <p> fx <p> fy <p> stops <p>
  6663. * @param (double) cx The horizontal coordinate of the gradient center point.
  6664. * @param (double) cy The vertical coordinate of the gradient center point.
  6665. * @param (double) r Radius of the starting circle.
  6666. * @param (double) fx The horizontal coordinate of the gradient focal point.
  6667. * @param (double) fy The vertical coordinate of the gradient focal point.
  6668. */
  6669. constructor : function(cx, cy, r, fx, fy) {
  6670. this.cx = cx;
  6671. this.cy = cy;
  6672. this.r = r;
  6673. this.fx = fx;
  6674. this.fy = fy;
  6675. },
  6676. getType : function() {
  6677. return 1002;
  6678. }
  6679. });
  6680. // $source: com/ibm/rave/render/internal/style/FillStyle
  6681. /************************************************************************
  6682. ** IBM Confidential
  6683. **
  6684. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6685. **
  6686. ** (C) Copyright IBM Corp. 2017
  6687. **
  6688. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6689. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6690. ************************************************************************/
  6691. // GENERATED
  6692. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6693. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  6694. //@import com/ibm/rave/core/Rave (runtime) // rgb
  6695. var com_ibm_rave_render_internal_style_FillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  6696. //color : null,
  6697. /**
  6698. * A class representing a fill style for an arbitrary shape. If both a color and gradient are supplied, the renderer has the option to apply either.
  6699. * @param (Object) color A color style to apply as a fill in a CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc).
  6700. * @param (double) opacity The amount of opacity to apply from 0 (transparent) to 1 (opaque).
  6701. * @see <a href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>
  6702. */
  6703. constructor : function(color, opacity) {
  6704. this.setOpacity(opacity);
  6705. this.color = com_ibm_rave_core_Rave.rgb(color);
  6706. },
  6707. /**
  6708. * Parses the value of getColor() as an RGB string and returns a new RGB object.
  6709. * @return (com.ibm.rave.core.color.RGB) RGB object representing color.
  6710. */
  6711. getColor : function() {
  6712. return this.color;
  6713. },
  6714. isVisible : function() {
  6715. return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.color;
  6716. },
  6717. getType : function() {
  6718. return 1000;
  6719. }
  6720. });
  6721. // $source: com/ibm/rave/render/internal/style/GradientStop
  6722. /************************************************************************
  6723. ** IBM Confidential
  6724. **
  6725. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6726. **
  6727. ** (C) Copyright IBM Corp. 2017
  6728. **
  6729. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6730. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6731. ************************************************************************/
  6732. // GENERATED
  6733. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6734. //@import com/ibm/rave/core/Rave (runtime) // rgb
  6735. /**
  6736. * A class representing a stop for a gradient. Holds a stop offset and a color.
  6737. */
  6738. var com_ibm_rave_render_internal_style_GradientStop = com_ibm_rave_core_nativeImpl_Declare({
  6739. /**
  6740. * Gradient stop color.
  6741. */
  6742. //color : null,
  6743. /**
  6744. * Gradient stop offset.
  6745. */
  6746. offset : 0,
  6747. /**
  6748. * Gradient stop opacity
  6749. */
  6750. opacity : 0,
  6751. /**
  6752. * Creates a new object representing a stop inside a gradient.
  6753. * @param (double) offset Where this offset starts. A value between 0-1 representing a percentage of a bounding box. The bounding box is defined by the gradient type and properties.
  6754. * @param (com.ibm.rave.core.color.RGB) color The color of this gradient stop.
  6755. * @param (double) opacity The opacity level of this stop.
  6756. */
  6757. constructor : function(offset, color, opacity) {
  6758. this.offset = this.fix(offset);
  6759. this.color = color;
  6760. this.opacity = this.fix(opacity);
  6761. },
  6762. /**
  6763. * Return this stop as an RGBA color. Multiplies any existing rgba() fill color with stop-opacity to create the alpha value.
  6764. * @return (com.ibm.rave.core.color.RGB) RGBA combining stop-opacity and stop color.
  6765. */
  6766. calculateColor : function() {
  6767. var opacity = this.color.a * this.opacity;
  6768. return com_ibm_rave_core_Rave.rgb("rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + opacity + ")");
  6769. },
  6770. fix : function(number) {
  6771. return Math.min(Math.max(number, 0), 1);
  6772. },
  6773. /**
  6774. * Return the stop offset from 0->1
  6775. * @return (double) The offset from 0-1>
  6776. */
  6777. getOffset : function() {
  6778. return this.offset;
  6779. },
  6780. setOffset : function(offset) {
  6781. this.offset = this.fix(offset);
  6782. },
  6783. /**
  6784. * Return the stop opacity from 0->1. Defaults to 1.
  6785. * @return (double) The stop opacity from 0->1.
  6786. */
  6787. getOpacity : function() {
  6788. return this.opacity;
  6789. }
  6790. });
  6791. // $source: com/ibm/rave/render/internal/style/StrokeStyle
  6792. /************************************************************************
  6793. ** IBM Confidential
  6794. **
  6795. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6796. **
  6797. ** (C) Copyright IBM Corp. 2017
  6798. **
  6799. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6800. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6801. ************************************************************************/
  6802. // GENERATED
  6803. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6804. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  6805. //@import com/ibm/rave/core/Rave (runtime) // rgb
  6806. var com_ibm_rave_render_internal_style_StrokeStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  6807. //lineJoin : null,
  6808. //lineCap : null,
  6809. //dashArray : null,
  6810. //strokeColor : null,
  6811. width : 0,
  6812. miterLimit : 0,
  6813. dashOffset : 0,
  6814. /**
  6815. * A class that holds information about stroke styling.
  6816. * @param (Object) strokeColor A string representation of a color in CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc)
  6817. * @param (double) width the pixel stroke width
  6818. * @param (double) opacity the opacity between 0 and 1 inclusive
  6819. * @param (double) miterLimit the maxmimum miter length. Miter length is the distance between the inner corner and the outer corner where two lines meet. Only valid when lineJoin is 'miter'.
  6820. * @param (String) lineJoin the type of corner created when two lines meet. Valid values: bevel, round, miter
  6821. * @param (String) lineCap the style of end caps for a line. Valid values: butt, round, square
  6822. * @param (float[]) dashArray the pattern of dashes and gaps (positive numbers) used to stroke paths
  6823. * @param (double) dashOffset the distance into the dash pattern to start the dash
  6824. */
  6825. constructor : function(strokeColor, width, opacity, miterLimit, lineJoin, lineCap, dashArray, dashOffset) {
  6826. this.setOpacity(opacity);
  6827. this.strokeColor = com_ibm_rave_core_Rave.rgb(strokeColor);
  6828. this.width = width;
  6829. this.miterLimit = miterLimit;
  6830. this.lineJoin = lineJoin;
  6831. this.lineCap = lineCap;
  6832. this.dashArray = dashArray;
  6833. this.dashOffset = dashOffset;
  6834. },
  6835. isVisible : function() {
  6836. return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.width > 0;
  6837. },
  6838. /**
  6839. * Return the stroke width.
  6840. * @return (double) Stroke width.
  6841. */
  6842. getWidth : function() {
  6843. return this.width;
  6844. },
  6845. /**
  6846. * Return the line cap. Valid values are butt, round, square
  6847. * @return (String) line cap
  6848. */
  6849. getLineCap : function() {
  6850. return this.lineCap;
  6851. },
  6852. /**
  6853. * Return the line join. Valid values are bevel, round, miter.
  6854. * @return (String) line join
  6855. */
  6856. getLineJoin : function() {
  6857. return this.lineJoin;
  6858. },
  6859. /**
  6860. * Return the miter limit.
  6861. * @return (double) the miter limit
  6862. */
  6863. getMiterLimit : function() {
  6864. return this.miterLimit;
  6865. },
  6866. /**
  6867. * Return the stroke color as RGB. May return null.
  6868. * @return (com.ibm.rave.core.color.RGB) Set stroke color. Returns 'black' if the defined color is not valid.
  6869. */
  6870. getColor : function() {
  6871. return this.strokeColor;
  6872. },
  6873. /**
  6874. * Return the dash array.
  6875. * @return (float[]) the dash array
  6876. */
  6877. getDashArray : function() {
  6878. return this.dashArray;
  6879. },
  6880. /**
  6881. * Return the dash offset.
  6882. * @return (double) the dash offset
  6883. */
  6884. getDashOffset : function() {
  6885. return this.dashOffset;
  6886. },
  6887. getType : function() {
  6888. return 1003;
  6889. }
  6890. });
  6891. // $source: com/ibm/rave/render/internal/style/RenderStyleManager
  6892. /************************************************************************
  6893. ** IBM Confidential
  6894. **
  6895. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6896. **
  6897. ** (C) Copyright IBM Corp. 2017
  6898. **
  6899. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6900. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6901. ************************************************************************/
  6902. // GENERATED
  6903. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6904. //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseIdUrlLink
  6905. //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
  6906. //@import com/ibm/rave/render/internal/style/LinearGradientFillStyle (static) // new
  6907. //@import com/ibm/rave/render/internal/style/RadialGradientFillStyle (static) // new
  6908. //@import com/ibm/rave/render/internal/style/FillStyle (static) // new
  6909. //@import com/ibm/rave/render/internal/style/GradientStop (static) // new
  6910. //@import com/ibm/rave/render/internal/style/StrokeStyle (static) // new
  6911. //@import com/ibm/rave/render/internal/style/FontStyle (static) // new
  6912. /**
  6913. * An internal helper class that converts styles on a SceneNode to internal style classes (FillStyle, FontStyle, etc) used by the renderers.
  6914. */
  6915. var com_ibm_rave_render_internal_style_RenderStyleManager = com_ibm_rave_core_nativeImpl_Declare({
  6916. });
  6917. /**
  6918. * Return a FillStyle object based on style properties set on the node. Will return null if there is no fill style defined on the node or if the style would result in a completely transparent fill.
  6919. * @return (com.ibm.rave.render.internal.style.AbstractStyle) FillStyle object representing styles set on the node.
  6920. */
  6921. com_ibm_rave_render_internal_style_RenderStyleManager.getFill = function(node) {
  6922. var fill = node.getComputedStyleValue(28);
  6923. var style;
  6924. if (fill != null && !("none" == fill)) {
  6925. var id = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(fill);
  6926. if (id != null) {
  6927. var gradientNode = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(node, id, [1011, 1012]);
  6928. if (gradientNode) {
  6929. switch (gradientNode.rave_getDrawType()) {
  6930. case 1011:
  6931. var linearGradient = gradientNode;
  6932. style = new com_ibm_rave_render_internal_style_LinearGradientFillStyle(linearGradient.getX1(node), linearGradient.getY1(node), linearGradient.getX2(node), linearGradient.getY2(node));
  6933. com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, linearGradient);
  6934. break;
  6935. case 1012:
  6936. var radialGradient = gradientNode;
  6937. style = new com_ibm_rave_render_internal_style_RadialGradientFillStyle(radialGradient.getCX(node), radialGradient.getCY(node), radialGradient.getR(node), radialGradient.getFX(node), radialGradient.getFY(node));
  6938. com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, radialGradient);
  6939. break;
  6940. }
  6941. }
  6942. } else {
  6943. var oOpacity = node.getComputedStyleValue(30);
  6944. var oFillOpacity = node.getComputedStyleValue(33);
  6945. var opacity = (oOpacity != null) ? (oOpacity) : 1;
  6946. var fillOpacity = (oFillOpacity != null) ? (oFillOpacity) : 1;
  6947. opacity = opacity * fillOpacity;
  6948. if (opacity > 0) {
  6949. style = new com_ibm_rave_render_internal_style_FillStyle(fill, Math.min(opacity, 1));
  6950. }
  6951. }
  6952. }
  6953. return style;
  6954. };
  6955. com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops = function(gradientStyle, gradientNode) {
  6956. for (var __i_enFor0 = 0, __exp_enFor0 = gradientNode.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  6957. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6958. var child = __exp_enFor0[__i_enFor0];
  6959. if (child.rave_getDrawType() == 1016) {
  6960. var stopItem = child;
  6961. gradientStyle.addStop(new com_ibm_rave_render_internal_style_GradientStop(stopItem.getOffset(), stopItem.getColor(), stopItem.getOpacity()));
  6962. }
  6963. }
  6964. };
  6965. /**
  6966. * Return a StrokeStyle object based on style properties set on the node. Will return null if there is no stroke styling defined on the node or if the style would result in a completely transparent stroke.
  6967. * @return (com.ibm.rave.render.internal.style.StrokeStyle) FillStyle object representing styles set on the node.
  6968. */
  6969. com_ibm_rave_render_internal_style_RenderStyleManager.getStroke = function(node) {
  6970. var stroke = node.getComputedStyleValue(29);
  6971. if (stroke == null || "none" == stroke) {
  6972. return null;
  6973. }
  6974. var strokeWidth = node.getComputedSizePx(31);
  6975. if (strokeWidth > 0) {
  6976. var oOpacity = node.getComputedStyleValue(30);
  6977. var oStrokeOpacity = node.getComputedStyleValue(32);
  6978. var opacity = (oOpacity != null) ? (oOpacity) : 1;
  6979. var strokeOpacity = (oStrokeOpacity != null) ? (oStrokeOpacity) : 1;
  6980. opacity = opacity * strokeOpacity;
  6981. if (opacity > 0) {
  6982. var miterLimit = (node.getComputedStyleValue(38));
  6983. var lineJoin = node.getComputedStyleValue(37);
  6984. var lineCap = node.getComputedStyleValue(36);
  6985. var dashArray = node.getComputedStyleValue(34);
  6986. var dashOffset = node.getComputedSizePx(35);
  6987. return new com_ibm_rave_render_internal_style_StrokeStyle(stroke, strokeWidth, Math.min(opacity, 1), miterLimit, lineJoin, lineCap, dashArray, dashOffset);
  6988. }
  6989. }
  6990. return null;
  6991. };
  6992. /**
  6993. * Gets font information from CSS-type styles set on a scene node. Currently supports these style attributes: <p> font-style <p> - Defaults to "normal". <p> font-family <p> - Defaults to "". <p> font-size <p> - Defaults size to FontStyle.DEFAULT_FONT_SIZE <p> - Defaults unit to FontUnitType.PX <p> font-weight <p> - Defaults to "normal". <p>
  6994. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node with styles set.
  6995. * @return (com.ibm.rave.render.internal.style.FontStyle) FontStyle object that holds font information for drawing.
  6996. */
  6997. com_ibm_rave_render_internal_style_RenderStyleManager.getFont = function(node) {
  6998. var style = node.getComputedStyleValue(23);
  6999. var family = node.getComputedStyleValue(21);
  7000. var size = node.getComputedStyleValue(22);
  7001. var weight = node.getComputedStyleValue(24);
  7002. var lineHeight = ""+(node.getComputedStyleValue(14));
  7003. var variant = node.getComputedStyleValue(25);
  7004. return new com_ibm_rave_render_internal_style_FontStyle(style, family, size, weight, lineHeight, variant);
  7005. };
  7006. //com_ibm_rave_render_internal_style_RenderStyleManager.NONE = "none";
  7007. //com_ibm_rave_render_internal_style_RenderStyleManager.BUTT = "butt";
  7008. //com_ibm_rave_render_internal_style_RenderStyleManager.MITER = "miter";
  7009. // $source: com/ibm/rave/render/internal/nodes/TSpanSceneItem
  7010. /************************************************************************
  7011. ** IBM Confidential
  7012. **
  7013. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7014. **
  7015. ** (C) Copyright IBM Corp. 2017
  7016. **
  7017. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7018. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7019. ************************************************************************/
  7020. // GENERATED
  7021. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7022. //@import com/ibm/rave/render/internal/nodes/TextSceneItem (loadtime) // new, superclass
  7023. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime)
  7024. /**
  7025. * A class that describes a text span. tspan nodes are treated like text nodes with the exception that they are positioned relative to their parent element (typically a text node) if no absolute positioning is provided.
  7026. */
  7027. var com_ibm_rave_render_internal_nodes_TSpanSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_TextSceneItem, {
  7028. /** @expose */
  7029. rave_getName : function() {
  7030. return "tspan";
  7031. },
  7032. /**
  7033. * Create a tspan scene node.
  7034. * @param (String) nsuri
  7035. * @param (com.ibm.rave.core.scene.SceneNode) context
  7036. */
  7037. constructor : function(nsuri, context) {
  7038. this.invalidLayout = true;
  7039. },
  7040. doLayout : function() {
  7041. var parent = this.rave_getParentNode();
  7042. if (parent && (parent).invalidLayout) {
  7043. (parent).doLayout();
  7044. } else {
  7045. com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.doLayout.call(this);
  7046. }
  7047. },
  7048. /** @expose */
  7049. getBoundingClientRect : function() {
  7050. var parent = this.rave_getParentNode();
  7051. if (parent) {
  7052. return (parent).getBoundingClientRect();
  7053. }
  7054. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBoundingClientRect.call(this);
  7055. },
  7056. /** @expose */
  7057. getBBox : function() {
  7058. var parent = this.rave_getParentNode();
  7059. if (parent) {
  7060. return (parent).getBBox();
  7061. }
  7062. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBBox.call(this);
  7063. },
  7064. getFontStyle : function() {
  7065. var parent = this.rave_getParentNode();
  7066. if (parent && (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem))) {
  7067. return (parent).getFontStyle();
  7068. }
  7069. return com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.getFontStyle.call(this);
  7070. },
  7071. calculateDimensions : function() {
  7072. com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.calculateDimensions.call(this);
  7073. var parent = this.rave_getParentNode();
  7074. if (parent && com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem)) {
  7075. var parentItem = parent;
  7076. if (this.getAttribute("x") == null) {
  7077. this.x += parentItem.nextX;
  7078. }
  7079. if (this.getAttribute("y") == null) {
  7080. this.y += parentItem.nextY;
  7081. }
  7082. }
  7083. }
  7084. });
  7085. // $source: com/ibm/rave/render/internal/nodes/TextPathSceneItem
  7086. /************************************************************************
  7087. ** IBM Confidential
  7088. **
  7089. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7090. **
  7091. ** (C) Copyright IBM Corp. 2017
  7092. **
  7093. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7094. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7095. ************************************************************************/
  7096. // GENERATED
  7097. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7098. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  7099. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  7100. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  7101. //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont
  7102. //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse
  7103. //@import com/ibm/rave/core/Rave (runtime) // selectAll, Rave
  7104. //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new
  7105. //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
  7106. /**
  7107. * TextPath shape.
  7108. */
  7109. var com_ibm_rave_render_internal_nodes_TextPathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  7110. //styleCache : null,
  7111. //ascent : null,
  7112. //descent : null,
  7113. //cachedBoundingClientRectBBox : null,
  7114. x : 0,
  7115. y : 0,
  7116. width : 0,
  7117. height : 0,
  7118. nextX : 0,
  7119. nextY : 0,
  7120. /** @expose */
  7121. getDrawType : function() {
  7122. return 1017;
  7123. },
  7124. /** @expose */
  7125. getName : function() {
  7126. return "textPath";
  7127. },
  7128. notifyAfterUpdate : function(type, subType, key, toValue, fromValue) {
  7129. this.styleCache = null;
  7130. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue);
  7131. },
  7132. invalidateLayout : function() {
  7133. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this);
  7134. this.cachedBoundingClientRectBBox = null;
  7135. },
  7136. calculateBBox : function() {
  7137. var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
  7138. if (this.rave_hasChildNodes()) {
  7139. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  7140. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7141. var child = __exp_enFor0[__i_enFor0];
  7142. var childRect = (child).calculateBBox();
  7143. this.expandRect(childRect, clientRect);
  7144. }
  7145. }
  7146. return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
  7147. },
  7148. getBoundingClientRectBBox : function() {
  7149. if (!this.cachedBoundingClientRectBBox) {
  7150. if (this.invalidLayout) {
  7151. this.layout();
  7152. }
  7153. var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height);
  7154. if (this.rave_hasChildNodes()) {
  7155. for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  7156. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7157. var child = __exp_enFor0[__i_enFor0];
  7158. var childRect = (child).getBoundingClientRectBBox();
  7159. this.expandRect(childRect, clientRect);
  7160. }
  7161. }
  7162. this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
  7163. }
  7164. return this.cachedBoundingClientRectBBox;
  7165. },
  7166. /**
  7167. * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place.
  7168. * @param (com.ibm.rave.core.geom.RaveRect) rect1
  7169. * @param (com.ibm.rave.core.geom.RectStruct) rect2
  7170. */
  7171. expandRect : function(rect1, rect2) {
  7172. var currentX2 = rect2.x + rect2.width;
  7173. var currentY2 = rect2.y + rect2.height;
  7174. var childX2 = rect1.x + rect1.width;
  7175. var childY2 = rect1.y + rect1.height;
  7176. rect2.x = Math.min(rect1.x, rect2.x);
  7177. rect2.y = Math.min(rect1.y, rect2.y);
  7178. rect2.width = Math.max(currentX2, childX2) - rect2.x;
  7179. rect2.height = Math.max(currentY2, childY2) - rect2.y;
  7180. },
  7181. /**
  7182. * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node.
  7183. */
  7184. getFontStyle : function() {
  7185. if (!this.styleCache) {
  7186. this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this);
  7187. }
  7188. return this.styleCache;
  7189. },
  7190. /**
  7191. * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node.
  7192. */
  7193. getShadow : function() {
  7194. var result = this.getComputedStyleValue(46);
  7195. if (!result) {
  7196. result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow"));
  7197. }
  7198. result = (!result || "none" == result) ? null : result;
  7199. return result;
  7200. },
  7201. /**
  7202. * Return the text content.
  7203. * @return (String) text content
  7204. */
  7205. getTextString : function() {
  7206. return this.text;
  7207. },
  7208. /**
  7209. * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account.
  7210. * @return (double) x position taking alignment into account.
  7211. */
  7212. getX : function() {
  7213. return this.x;
  7214. },
  7215. getXOffset : function() {
  7216. return + (this.rave_getParentNode().getAttribute("x")) + + (this.rave_getParentNode().getAttribute("dx"));
  7217. },
  7218. getYOffset : function() {
  7219. return + (this.rave_getParentNode().getAttribute("y")) + + (this.rave_getParentNode().getAttribute("dy"));
  7220. },
  7221. /**
  7222. * Returns the Y position where this item will start drawing from. This returns the text baseline
  7223. * @return (double) y position
  7224. */
  7225. getY : function() {
  7226. return this.y;
  7227. },
  7228. /** @expose */
  7229. getSizePx : function(size) {
  7230. var value = 0;
  7231. if (size) {
  7232. value = size.value;
  7233. switch (size.unit.type) {
  7234. case 1:
  7235. return size.value * this.getFontStyle().getSize();
  7236. default:
  7237. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size);
  7238. }
  7239. }
  7240. return value;
  7241. },
  7242. paint : function(renderer) {
  7243. if (this.text != null && this.text.length > 0) {
  7244. renderer.setStrokeAndFill(this);
  7245. renderer.drawTextPath(this, this.getFilteredPath());
  7246. }
  7247. },
  7248. /**
  7249. * Will return a selector with all the path matching the provided id
  7250. */
  7251. getFilteredPath : function() {
  7252. var pathID = (this.getAttribute("http://www.w3.org/1999/xlink:href"));
  7253. var finalPathID = pathID.substring(1);
  7254. var filteredPaths = com_ibm_rave_core_Rave.selectAll("path").filter(function(data, index, groupIndex) {
  7255. return finalPathID == (this).getAttribute("id") ? true : false;
  7256. });
  7257. return filteredPaths;
  7258. },
  7259. doLayout : function() {
  7260. this.calculateDimensions();
  7261. this.nextX = this.x + this.width;
  7262. this.nextY = this.y;
  7263. this.invalidLayout = false;
  7264. if (this.rave_hasChildNodes()) {
  7265. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  7266. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7267. var child = __exp_enFor0[__i_enFor0];
  7268. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
  7269. var achild = child;
  7270. if (achild.invalidLayout) {
  7271. achild.layout();
  7272. }
  7273. this.nextX = achild.nextX;
  7274. this.nextY = achild.nextY;
  7275. }
  7276. }
  7277. }
  7278. },
  7279. /**
  7280. * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children.
  7281. */
  7282. setDirty : function(dirty_, invalidateLayout) {
  7283. if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) {
  7284. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  7285. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7286. var child = __exp_enFor0[__i_enFor0];
  7287. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) {
  7288. (child).invalidateLayout();
  7289. }
  7290. }
  7291. }
  7292. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout);
  7293. },
  7294. /**
  7295. * Perform dimension (x,y,width,height,etc) calculations only.
  7296. */
  7297. calculateDimensions : function() {
  7298. this.computeStylesToRoot();
  7299. var metrics = this.calculateMetrics();
  7300. this.width = metrics["width"];
  7301. var fontSize = this.getSizePx(this.getComputedCSSStyle(22).value);
  7302. this.ascent = metrics["actualBoundingBoxAscent"];
  7303. this.descent = metrics["actualBoundingBoxDescent"];
  7304. if (undefined == this.ascent) {
  7305. this.ascent = fontSize * .7 + fontSize * .1;
  7306. }
  7307. if (undefined == this.descent) {
  7308. this.descent = fontSize * .3;
  7309. }
  7310. this.height = this.ascent + this.descent;
  7311. if (!(com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this.rave_getParentNode(), com_ibm_rave_render_internal_nodes_TextSceneItem))) {
  7312. this.x = 0;
  7313. this.y = 0;
  7314. } else {
  7315. this.x = this.calculateX();
  7316. this.y = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(1)) + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(16));
  7317. }
  7318. },
  7319. calculateX : function() {
  7320. var parentCalculatedX = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(0));
  7321. var anchor = this.getComputedStyleValue(27);
  7322. if ("middle" == anchor) {
  7323. parentCalculatedX -= this.width / 2;
  7324. } else if ("end" == anchor) {
  7325. parentCalculatedX -= this.width;
  7326. }
  7327. return parentCalculatedX + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(15));
  7328. },
  7329. calculateMetrics : function() {
  7330. var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d");
  7331. context.font = this.getFontStyle().toString();
  7332. var tm = context.measureText(this.text);
  7333. com_ibm_rave_core_Rave.canvas.disposeContext(context);
  7334. return tm;
  7335. }
  7336. //constructor : function(nsuri, context) {}
  7337. });
  7338. // $source: com/ibm/rave/render/internal/nodes/GroupSceneItem
  7339. /************************************************************************
  7340. ** IBM Confidential
  7341. **
  7342. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7343. **
  7344. ** (C) Copyright IBM Corp. 2017
  7345. **
  7346. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7347. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7348. ************************************************************************/
  7349. // GENERATED
  7350. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7351. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  7352. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds
  7353. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  7354. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  7355. var com_ibm_rave_render_internal_nodes_GroupSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  7356. isolated : false,
  7357. /** @expose */
  7358. rave_getName : function() {
  7359. return "g";
  7360. },
  7361. /** @expose */
  7362. rave_getDrawType : function() {
  7363. return 1004;
  7364. },
  7365. rave_intersects : function(rect) {
  7366. if (this.rave_hasChildNodes()) {
  7367. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect);
  7368. }
  7369. return false;
  7370. },
  7371. calculateBBox : function() {
  7372. var x1, y1, x2, y2, cx2, cy2;
  7373. x1 = y1 = x2 = y2 = 0;
  7374. if (this.rave_hasChildNodes()) {
  7375. x1 = y1 = Infinity;
  7376. x2 = y2 = -Infinity;
  7377. for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  7378. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7379. var child = __exp_enFor0[__i_enFor0];
  7380. var bb = child.getBBox();
  7381. var x = bb.x;
  7382. var y = bb.y;
  7383. var w = bb.width;
  7384. var h = bb.height;
  7385. var t = (child).computeStyleValue(11);
  7386. if (t) {
  7387. var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(x, y, w, h), t);
  7388. x = bstruct.x;
  7389. y = bstruct.y;
  7390. w = bstruct.width;
  7391. h = bstruct.height;
  7392. }
  7393. cx2 = x + w;
  7394. cy2 = y + h;
  7395. if (x < x1) {
  7396. x1 = x;
  7397. }
  7398. if (y < y1) {
  7399. y1 = y;
  7400. }
  7401. if (cx2 > x2) {
  7402. x2 = cx2;
  7403. }
  7404. if (cy2 > y2) {
  7405. y2 = cy2;
  7406. }
  7407. }
  7408. }
  7409. return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
  7410. },
  7411. paint : function(renderer) {
  7412. this.isolated = this.isolate();
  7413. if (this.isolated) {
  7414. renderer.push();
  7415. }
  7416. },
  7417. postPaint : function(renderer) {
  7418. if (this.isolated) {
  7419. renderer.pop(this.getOpacity());
  7420. }
  7421. },
  7422. doLayout : function() {},
  7423. /**
  7424. * Determine if we need to isolate the painting of the group: if we have opacity, we need to isolate the group by drawing into a new context, applying opacity, then drawing that image into the previous context.
  7425. */
  7426. isolate : function() {
  7427. return this.getOpacity() < 1 ? true : false;
  7428. },
  7429. /**
  7430. * Return the opacity of this stop from 0->1. Defaults to 1 (fully opaque)
  7431. * @return (double) opacity of this stop from 0->1
  7432. */
  7433. getOpacity : function() {
  7434. var oOpacity = this.getComputedStyleValue(30);
  7435. return (oOpacity != null) ? (oOpacity) : 1;
  7436. }
  7437. //constructor : function(nsuri, context) {}
  7438. });
  7439. // $source: com/ibm/rave/render/internal/nodes/PathSceneItem
  7440. /************************************************************************
  7441. ** IBM Confidential
  7442. **
  7443. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7444. **
  7445. ** (C) Copyright IBM Corp. 2017
  7446. **
  7447. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7448. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7449. ************************************************************************/
  7450. // GENERATED
  7451. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7452. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  7453. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  7454. //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
  7455. //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFill
  7456. //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isString
  7457. //@import com/ibm/rave/render/internal/nodes/path/StringPathGenerator (runtime) // new
  7458. //@import com/ibm/rave/core/internal/geo/PathActionPathGenerator (runtime) // new
  7459. //@import com/ibm/rave/core/internal/geo/PathActionDrawingContext (runtime) // new
  7460. /**
  7461. * A translated implementation of an SVG path shape.
  7462. */
  7463. var com_ibm_rave_render_internal_nodes_PathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  7464. //d : null,
  7465. //pathString : null,
  7466. calculateBBox : function() {
  7467. if (!this.d) {
  7468. return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  7469. }
  7470. var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
  7471. this.d.draw(pathHandler);
  7472. var shapes = pathHandler.getShapes();
  7473. if (shapes.length == 0) {
  7474. return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  7475. }
  7476. var bounds = shapes[0].getBounds();
  7477. var xMin = bounds[0].x;
  7478. var yMin = bounds[0].y;
  7479. var xMax = bounds[1].x;
  7480. var yMax = bounds[1].y;
  7481. for (var i = 1; i < shapes.length; ++i) {
  7482. bounds = shapes[i].getBounds();
  7483. if (bounds[0].x < xMin) {
  7484. xMin = bounds[0].x;
  7485. }
  7486. if (bounds[1].x > xMax) {
  7487. xMax = bounds[1].x;
  7488. }
  7489. if (bounds[0].y < yMin) {
  7490. yMin = bounds[0].y;
  7491. }
  7492. if (bounds[1].y > yMax) {
  7493. yMax = bounds[1].y;
  7494. }
  7495. }
  7496. return new com_ibm_rave_core_geom_RaveRect(xMin, yMin, xMax - xMin, yMax - yMin);
  7497. },
  7498. /** @expose */
  7499. rave_getDrawType : function() {
  7500. return 1006;
  7501. },
  7502. /** @expose */
  7503. rave_getName : function() {
  7504. return "path";
  7505. },
  7506. rave_intersects : function(rect) {
  7507. var intersection = false;
  7508. if (this.d) {
  7509. var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
  7510. this.d.draw(pathHandler);
  7511. var shapes = pathHandler.getShapes();
  7512. if (shapes.length == 0) {
  7513. return false;
  7514. }
  7515. var hasFill = com_ibm_rave_render_internal_style_RenderStyleManager.getFill(this);
  7516. for (var __i_enFor0 = 0, __exp_enFor0 = shapes, __len_enFor0 = __exp_enFor0.length;
  7517. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7518. var shape = __exp_enFor0[__i_enFor0];
  7519. if (hasFill) {
  7520. shape.setClosed();
  7521. }
  7522. if (shape.intersect$1(rect)) {
  7523. if (this.intersectsClip(rect)) {
  7524. intersection = !intersection;
  7525. }
  7526. }
  7527. }
  7528. }
  7529. return intersection;
  7530. },
  7531. paint : function(renderer) {
  7532. if (this.getPath()) {
  7533. renderer.setStrokeAndFill(this);
  7534. renderer.drawPath(this);
  7535. }
  7536. },
  7537. /**
  7538. * @return (com.ibm.rave.core.geo.PathGenerator) PathGenerator representing the current path.
  7539. */
  7540. getPath : function() {
  7541. return this.d;
  7542. },
  7543. /**
  7544. * If this path was populated via an SVG path as a string, this will return the original string. null if a PathDrawingContext was used to populate.
  7545. * @return (String) String SVG path used to originally populate this path object. null otherwise.
  7546. */
  7547. getPathString : function() {
  7548. return this.pathString;
  7549. },
  7550. /** @expose */
  7551. rave_initExtensions : function() {
  7552. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_initExtensions.call(this);
  7553. var origSetAttr = this.setAttribute;
  7554. var self = this;
  7555. this.setAttribute = function(key, value) {
  7556. origSetAttr.call(this, key, value);
  7557. if (value != null && "d" == key) {
  7558. var internalVal = self.attributes.getByIndex(16);
  7559. self.pathString = null;
  7560. if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(internalVal)) {
  7561. self.pathString = ""+(internalVal);
  7562. self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString());
  7563. } else {
  7564. self.d = new com_ibm_rave_core_internal_geo_PathActionPathGenerator();
  7565. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(internalVal, com_ibm_rave_core_internal_geo_PathActionDrawingContext)) {
  7566. self.d.context(internalVal);
  7567. }
  7568. }
  7569. } else if (value != null && "points" == key) {
  7570. var internalVal = self.attributes.getByIndex(17);
  7571. self.pathString = ""+(internalVal);
  7572. self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString());
  7573. }
  7574. };
  7575. },
  7576. doLayout : function() {}
  7577. //constructor : function(nsuri, context) {}
  7578. });
  7579. // $source: com/ibm/rave/render/internal/nodes/path/StringPathGenerator
  7580. /************************************************************************
  7581. ** IBM Confidential
  7582. **
  7583. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7584. **
  7585. ** (C) Copyright IBM Corp. 2017
  7586. **
  7587. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7588. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7589. ************************************************************************/
  7590. // GENERATED
  7591. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7592. //@import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime) // new
  7593. /**
  7594. * A PathGenerator that first parses an SVG path and then calls the Path commands on it. This is used in Path rendering to take an SVG path and create path shapes out of it.
  7595. */
  7596. var com_ibm_rave_render_internal_nodes_path_StringPathGenerator = com_ibm_rave_core_nativeImpl_Declare({
  7597. //path : null,
  7598. _$functionClassMethod : function() {
  7599. var _$self = function(data, index, groupIndex) {
  7600. return null;
  7601. };
  7602. return _$self;
  7603. },
  7604. /**
  7605. * @param (String) path The SVG Path string to parse.
  7606. */
  7607. constructor : function(path) {
  7608. this.path = path;
  7609. },
  7610. context$0 : function() {
  7611. return null;
  7612. },
  7613. context$1 : function(context) {
  7614. return this;
  7615. },
  7616. /** @expose */
  7617. draw : function(path2dHandler) {
  7618. new com_ibm_rave_render_internal_nodes_path_Path2DParser(path2dHandler).parse(this.path);
  7619. },
  7620. /** @expose */
  7621. context : function(a0) {
  7622. var args = arguments;
  7623. if (args.length == 0) {
  7624. return this.context$0();
  7625. }
  7626. return this.context$1(a0);
  7627. }
  7628. });
  7629. // $source: com/ibm/rave/render/internal/nodes/path/Path2DParser
  7630. /************************************************************************
  7631. ** IBM Confidential
  7632. **
  7633. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7634. **
  7635. ** (C) Copyright IBM Corp. 2017
  7636. **
  7637. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7638. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7639. ************************************************************************/
  7640. // GENERATED
  7641. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7642. /**
  7643. * SVG path parser.
  7644. */
  7645. var com_ibm_rave_render_internal_nodes_path_Path2DParser = com_ibm_rave_core_nativeImpl_Declare({
  7646. //path : null,
  7647. //d : null,
  7648. currentX : 0, currentY : 0, xCenter : 0, yCenter : 0,
  7649. idx : 0,
  7650. dLength : 0,
  7651. fail : false,
  7652. currentChar : 0,
  7653. currentCharIdx : -1,
  7654. constructor : function(path) {
  7655. this.path = path;
  7656. },
  7657. parse : function(pathString) {
  7658. if (pathString != null) {
  7659. this.currentX = this.currentY = this.xCenter = this.yCenter = this.idx = 0;
  7660. this.currentChar = 0;
  7661. this.currentCharIdx = -1;
  7662. this.d = pathString;
  7663. this.dLength = pathString.length;
  7664. this.path.startPath();
  7665. for (; this.idx < this.dLength;) {
  7666. this.fail = false;
  7667. this.skipWhitespace();
  7668. switch (this.getChar(this.idx++)) {
  7669. case 109:
  7670. this._moveTo(false);
  7671. break;
  7672. case 77:
  7673. this._moveTo(true);
  7674. break;
  7675. case 108:
  7676. this._lineTo(false, true, true);
  7677. break;
  7678. case 76:
  7679. this._lineTo(true, true, true);
  7680. break;
  7681. case 99:
  7682. this._bezierCurveTo(false, false);
  7683. break;
  7684. case 67:
  7685. this._bezierCurveTo(true, false);
  7686. break;
  7687. case 115:
  7688. this._bezierCurveTo(false, true);
  7689. break;
  7690. case 83:
  7691. this._bezierCurveTo(true, true);
  7692. break;
  7693. case 113:
  7694. this._quadraticCurveTo(false, false);
  7695. break;
  7696. case 81:
  7697. this._quadraticCurveTo(true, false);
  7698. break;
  7699. case 116:
  7700. this._quadraticCurveTo(false, true);
  7701. break;
  7702. case 84:
  7703. this._quadraticCurveTo(true, true);
  7704. break;
  7705. case 104:
  7706. this._lineTo(false, false, true);
  7707. break;
  7708. case 72:
  7709. this._lineTo(true, false, true);
  7710. break;
  7711. case 118:
  7712. this._lineTo(false, true, false);
  7713. break;
  7714. case 86:
  7715. this._lineTo(true, true, false);
  7716. break;
  7717. case 97:
  7718. this._arcTo(false);
  7719. break;
  7720. case 65:
  7721. this._arcTo(true);
  7722. break;
  7723. case 122:
  7724. case 90:
  7725. this.path.closePath();
  7726. break;
  7727. default:
  7728. this.path.fail(this.idx - 1);
  7729. return;
  7730. }
  7731. }
  7732. }
  7733. },
  7734. /**
  7735. * Skips 4 different types of whitespace characters: <ul> <li>space</li> <li>line feed</li> <li>tab</li> <li>carriage return</li>
  7736. */
  7737. skipWhitespace : function() {
  7738. while (this.idx < this.dLength) {
  7739. switch (this.getChar(this.idx)) {
  7740. case 32:
  7741. case 13:
  7742. case 10:
  7743. case 9:
  7744. this.idx++;
  7745. break;
  7746. default:
  7747. return;
  7748. }
  7749. }
  7750. },
  7751. /**
  7752. * Skips whitespace following by an optional comma and additional whitespace.
  7753. */
  7754. skipWhitespaceComma : function() {
  7755. this.skipWhitespace();
  7756. if (this.idx < this.dLength && this.getChar(this.idx) == 44) {
  7757. this.idx++;
  7758. this.skipWhitespace();
  7759. }
  7760. },
  7761. /**
  7762. * Increments the index if a '-' or '+' sign is identified.
  7763. */
  7764. sign : function() {
  7765. if (this.idx < this.dLength) {
  7766. var c = this.getChar(this.idx);
  7767. if (c == 45 || c == 43) {
  7768. this.idx++;
  7769. }
  7770. }
  7771. },
  7772. /**
  7773. * Increments the index for each digit found.
  7774. * @param (boolean) optional whether or not a digit sequence is optional
  7775. */
  7776. digitSequence : function(optional) {
  7777. var found = optional;
  7778. while (this.idx < this.dLength) {
  7779. switch (this.getChar(this.idx)) {
  7780. case 48:
  7781. case 49:
  7782. case 50:
  7783. case 51:
  7784. case 52:
  7785. case 53:
  7786. case 54:
  7787. case 55:
  7788. case 56:
  7789. case 57:
  7790. this.idx++;
  7791. found = true;
  7792. break;
  7793. default:
  7794. if (!optional && !found) {
  7795. this.fail = true;
  7796. }
  7797. return;
  7798. }
  7799. }
  7800. },
  7801. /**
  7802. * Increments the index if an exponent is found starting with 'e' or 'E' followed by an sign optional sign and required digits.
  7803. */
  7804. exponent : function() {
  7805. if (this.idx < this.dLength) {
  7806. var c = this.getChar(this.idx);
  7807. if (c == 101 || c == 69) {
  7808. this.idx++;
  7809. this.sign();
  7810. this.digitSequence(false);
  7811. }
  7812. }
  7813. },
  7814. /**
  7815. * Parse a number returning the value or NaN if parse failed. The starting index is provided such that other methods can consume the sign if necessary.
  7816. * @param (int) start the starting index of the number
  7817. * @return (double) the parsed number
  7818. */
  7819. parseNumber : function(start) {
  7820. this.digitSequence(true);
  7821. if (this.idx < this.dLength && this.getChar(this.idx) == 46) {
  7822. this.idx++;
  7823. this.digitSequence(false);
  7824. if (this.fail) {
  7825. return NaN;
  7826. }
  7827. }
  7828. if (this.idx < this.dLength) {
  7829. this.exponent();
  7830. }
  7831. if (this.idx == start) {
  7832. this.fail = true;
  7833. return NaN;
  7834. }
  7835. var result = parseFloat(this.d.substring(start, this.idx));
  7836. this.fail = isNaN(result);
  7837. return result;
  7838. },
  7839. /**
  7840. * Parse a number with optional sign.
  7841. * @return (double) the parsed number
  7842. */
  7843. number : function() {
  7844. var start = this.idx;
  7845. this.sign();
  7846. return this.parseNumber(start);
  7847. },
  7848. /**
  7849. * Parse a positive number with optional '+' sign.
  7850. * @return (double) the parsed number
  7851. */
  7852. nonNegativeNumber : function() {
  7853. var start = this.idx;
  7854. if (this.idx < this.dLength && this.getChar(this.idx) == 43) {
  7855. this.idx++;
  7856. }
  7857. return this.parseNumber(start);
  7858. },
  7859. /**
  7860. * Parse a number with optional preceding whitespace and comma.
  7861. * @return (double) the parsed number
  7862. */
  7863. whitespaceCommaNumber : function() {
  7864. this.skipWhitespaceComma();
  7865. return this.number();
  7866. },
  7867. /**
  7868. * Parse a number with optional preceding whitespace and comma.
  7869. * @param (boolean) noComma whether or a not a comma is allow or not
  7870. * @return (double) the parsed number
  7871. */
  7872. whitespaceOptCommaNumber : function(noComma) {
  7873. if (noComma) {
  7874. this.skipWhitespace();
  7875. } else {
  7876. this.skipWhitespaceComma();
  7877. }
  7878. return this.number();
  7879. },
  7880. /**
  7881. * Parse a positive number with optional preceding whitespace and comma.
  7882. * @return (double) the parsed number
  7883. */
  7884. whitespaceCommaNonNegativeNumber : function() {
  7885. this.skipWhitespaceComma();
  7886. return this.nonNegativeNumber();
  7887. },
  7888. /**
  7889. * Parse a positive number with optional preceding whitespace and comma.
  7890. * @param noComma whether or a not a comma is allow or not
  7891. * @return (double) the parsed number
  7892. */
  7893. whitespaceOptCommaNonNegativeNumber : function(firstNumber) {
  7894. if (firstNumber) {
  7895. this.skipWhitespace();
  7896. } else {
  7897. this.skipWhitespaceComma();
  7898. }
  7899. return this.nonNegativeNumber();
  7900. },
  7901. /**
  7902. * Parse an integer flag. A parsed value of 1 is 'true' while a parsed value of 0 is 'false'.
  7903. * @return (boolean) the parsed flag
  7904. */
  7905. flag : function() {
  7906. this.skipWhitespaceComma();
  7907. var result = true;
  7908. if (this.idx < this.dLength) {
  7909. var c = this.getChar(this.idx);
  7910. if (c == 48) {
  7911. result = false;
  7912. } else if (c != 49) {
  7913. this.fail = true;
  7914. }
  7915. } else {
  7916. this.fail = true;
  7917. }
  7918. if (!this.fail) {
  7919. this.idx++;
  7920. }
  7921. return result;
  7922. },
  7923. _moveTo : function(absolute) {
  7924. this.skipWhitespace();
  7925. var x = this.number();
  7926. if (this.fail) {
  7927. return;
  7928. }
  7929. var y = this.whitespaceCommaNumber();
  7930. if (this.fail) {
  7931. return;
  7932. }
  7933. if (!absolute) {
  7934. x += this.currentX;
  7935. y += this.currentY;
  7936. }
  7937. this.path.moveTo(x, y);
  7938. this.xCenter = this.currentX = x;
  7939. this.yCenter = this.currentY = y;
  7940. this.skipWhitespaceComma();
  7941. this._lineTo(absolute, true, true);
  7942. },
  7943. _lineTo : function(absolute, vertical, horizontal) {
  7944. var noComma = true;
  7945. for (;;) {
  7946. var x = 0, y = 0;
  7947. if (horizontal) {
  7948. x = this.whitespaceOptCommaNumber(noComma);
  7949. noComma = false;
  7950. if (this.fail) {
  7951. return;
  7952. }
  7953. if (!absolute) {
  7954. x += this.currentX;
  7955. }
  7956. } else {
  7957. x = this.currentX;
  7958. }
  7959. if (vertical) {
  7960. y = this.whitespaceOptCommaNumber(noComma);
  7961. if (this.fail) {
  7962. return;
  7963. }
  7964. if (!absolute) {
  7965. y += this.currentY;
  7966. }
  7967. } else {
  7968. y = this.currentY;
  7969. }
  7970. this.path.lineTo(x, y);
  7971. this.xCenter = this.currentX = x;
  7972. this.yCenter = this.currentY = y;
  7973. noComma = false;
  7974. }
  7975. },
  7976. _quadraticCurveTo : function(absolute, usePreviousCP) {
  7977. var noComma = true;
  7978. var cpx, cpy, x, y;
  7979. for (;;) {
  7980. if (usePreviousCP) {
  7981. cpx = 2 * this.currentX - this.xCenter;
  7982. cpy = 2 * this.currentY - this.yCenter;
  7983. } else {
  7984. cpx = this.whitespaceOptCommaNumber(noComma);
  7985. noComma = false;
  7986. if (this.fail) {
  7987. return;
  7988. }
  7989. cpy = this.whitespaceCommaNumber();
  7990. if (this.fail) {
  7991. return;
  7992. }
  7993. }
  7994. x = this.whitespaceOptCommaNumber(noComma);
  7995. if (this.fail) {
  7996. return;
  7997. }
  7998. y = this.whitespaceCommaNumber();
  7999. if (this.fail) {
  8000. return;
  8001. }
  8002. if (!absolute) {
  8003. x += this.currentX;
  8004. y += this.currentY;
  8005. }
  8006. this.path.quadraticCurveTo(cpx, cpy, x, y);
  8007. this.currentX = x;
  8008. this.currentY = y;
  8009. this.xCenter = cpx;
  8010. this.yCenter = cpy;
  8011. noComma = false;
  8012. }
  8013. },
  8014. _bezierCurveTo : function(absolute, usePreviousCP) {
  8015. var noComma = true;
  8016. var cpx1, cpy1, cpx2, cpy2, x, y;
  8017. for (;;) {
  8018. if (usePreviousCP) {
  8019. cpx1 = 2 * this.currentX - this.xCenter;
  8020. cpy1 = 2 * this.currentY - this.yCenter;
  8021. } else {
  8022. cpx1 = this.whitespaceOptCommaNumber(noComma);
  8023. noComma = false;
  8024. if (this.fail) {
  8025. return;
  8026. }
  8027. cpy1 = this.whitespaceCommaNumber();
  8028. if (this.fail) {
  8029. return;
  8030. }
  8031. }
  8032. cpx2 = this.whitespaceOptCommaNumber(noComma);
  8033. if (this.fail) {
  8034. return;
  8035. }
  8036. cpy2 = this.whitespaceCommaNumber();
  8037. if (this.fail) {
  8038. return;
  8039. }
  8040. x = this.whitespaceCommaNumber();
  8041. if (this.fail) {
  8042. return;
  8043. }
  8044. y = this.whitespaceCommaNumber();
  8045. if (this.fail) {
  8046. return;
  8047. }
  8048. if (!absolute) {
  8049. cpx1 += this.currentX;
  8050. cpy1 += this.currentY;
  8051. cpx2 += this.currentX;
  8052. cpy2 += this.currentY;
  8053. x += this.currentX;
  8054. y += this.currentY;
  8055. }
  8056. this.path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y);
  8057. this.currentX = x;
  8058. this.currentY = y;
  8059. this.xCenter = cpx2;
  8060. this.yCenter = cpy2;
  8061. noComma = false;
  8062. }
  8063. },
  8064. _arcTo : function(absolute) {
  8065. var noComma = true, largeArcFlag, sweepFlag;
  8066. var rx, ry, xAxisRotation, x, y;
  8067. for (;;) {
  8068. rx = this.whitespaceOptCommaNonNegativeNumber(noComma);
  8069. if (this.fail) {
  8070. return;
  8071. }
  8072. ry = this.whitespaceCommaNonNegativeNumber();
  8073. if (this.fail) {
  8074. return;
  8075. }
  8076. xAxisRotation = this.whitespaceCommaNumber();
  8077. if (this.fail) {
  8078. return;
  8079. }
  8080. largeArcFlag = this.flag();
  8081. if (this.fail) {
  8082. return;
  8083. }
  8084. sweepFlag = this.flag();
  8085. if (this.fail) {
  8086. return;
  8087. }
  8088. x = this.whitespaceCommaNumber();
  8089. if (this.fail) {
  8090. return;
  8091. }
  8092. y = this.whitespaceCommaNumber();
  8093. if (this.fail) {
  8094. return;
  8095. }
  8096. if (!absolute) {
  8097. x += this.currentX;
  8098. y += this.currentY;
  8099. }
  8100. if (this.currentX != x || this.currentY != y) {
  8101. if (rx == 0 || ry == 0) {
  8102. this.path.lineTo(x, y);
  8103. } else {
  8104. this.path.arcTo(this.currentX, this.currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
  8105. }
  8106. this.xCenter = this.currentX = x;
  8107. this.yCenter = this.currentY = y;
  8108. }
  8109. noComma = false;
  8110. }
  8111. },
  8112. getChar : function(i) {
  8113. if (this.currentCharIdx != i) {
  8114. this.currentCharIdx = i;
  8115. this.currentChar = this.d.charCodeAt(i);
  8116. }
  8117. return this.currentChar;
  8118. }
  8119. });
  8120. // $source: com/ibm/rave/core/internal/geo/PathActionPathGenerator
  8121. /************************************************************************
  8122. ** IBM Confidential
  8123. **
  8124. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8125. **
  8126. ** (C) Copyright IBM Corp. 2017
  8127. **
  8128. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8129. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8130. ************************************************************************/
  8131. // GENERATED
  8132. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8133. /**
  8134. * A PathGenerator that is used to create a PathAction data structure from DrawContext commands.
  8135. */
  8136. var com_ibm_rave_core_internal_geo_PathActionPathGenerator = com_ibm_rave_core_nativeImpl_Declare({
  8137. //drawingContext : null,
  8138. _$functionClassMethod : function() {
  8139. var _$self = function(data, index, groupIndex) {
  8140. return null;
  8141. };
  8142. return _$self;
  8143. },
  8144. context$0 : function() {
  8145. return this.drawingContext;
  8146. },
  8147. context$1 : function(context) {
  8148. this.drawingContext = context;
  8149. return this;
  8150. },
  8151. /** @expose */
  8152. draw : function(path2dHandler) {
  8153. var currentX = 0;
  8154. var currentY = 0;
  8155. for (var __i_enFor0 = 0, __exp_enFor0 = (this.drawingContext).actions, __len_enFor0 = __exp_enFor0.length;
  8156. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8157. var action = __exp_enFor0[__i_enFor0];
  8158. switch (action.type()) {
  8159. case 1:
  8160. currentX = action.x;
  8161. currentY = action.y;
  8162. path2dHandler.moveTo(action.x, action.y);
  8163. break;
  8164. case 2:
  8165. path2dHandler.lineTo(action.x, action.y);
  8166. break;
  8167. case 3:
  8168. var radius = (action).radius;
  8169. path2dHandler.arcTo(currentX, currentY, radius, radius, 0, false, false, action.x, action.y);
  8170. break;
  8171. }
  8172. }
  8173. },
  8174. /** @expose */
  8175. context : function(a0) {
  8176. var args = arguments;
  8177. if (args.length == 0) {
  8178. return this.context$0();
  8179. }
  8180. return this.context$1(a0);
  8181. }
  8182. });
  8183. // $source: com/ibm/rave/render/internal/nodes/PolygonSceneItem
  8184. /************************************************************************
  8185. ** IBM Confidential
  8186. **
  8187. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8188. **
  8189. ** (C) Copyright IBM Corp. 2017
  8190. **
  8191. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8192. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8193. ************************************************************************/
  8194. // GENERATED
  8195. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8196. //@import com/ibm/rave/render/internal/nodes/PathSceneItem (loadtime) // superclass
  8197. /**
  8198. * A translated implementation of an SVG polygon shape.
  8199. */
  8200. var com_ibm_rave_render_internal_nodes_PolygonSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_PathSceneItem, {
  8201. /** @expose */
  8202. rave_getDrawType : function() {
  8203. return 1010;
  8204. },
  8205. /** @expose */
  8206. rave_getName : function() {
  8207. return "polygon";
  8208. },
  8209. paint : function(renderer) {
  8210. var points = this.attributes.getByIndex(17);
  8211. if (points != null && points.length > 0) {
  8212. renderer.setStrokeAndFill(this);
  8213. renderer.drawPath(this);
  8214. }
  8215. },
  8216. getPathString : function() {
  8217. var points = this.attributes.getByIndex(17);
  8218. return 'M' + points + 'Z';
  8219. }
  8220. //constructor : function(nsuri, context) {}
  8221. });
  8222. // $source: com/ibm/rave/render/internal/nodes/PolylineSceneItem
  8223. /************************************************************************
  8224. ** IBM Confidential
  8225. **
  8226. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8227. **
  8228. ** (C) Copyright IBM Corp. 2017
  8229. **
  8230. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8231. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8232. ************************************************************************/
  8233. // GENERATED
  8234. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8235. //@import com/ibm/rave/render/internal/nodes/PathSceneItem (loadtime) // superclass
  8236. /**
  8237. * A translated implementation of an SVG polyline shape.
  8238. */
  8239. var com_ibm_rave_render_internal_nodes_PolylineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_PathSceneItem, {
  8240. /** @expose */
  8241. rave_getDrawType : function() {
  8242. return 1009;
  8243. },
  8244. /** @expose */
  8245. rave_getName : function() {
  8246. return "polyline";
  8247. },
  8248. paint : function(renderer) {
  8249. var points = this.attributes.getByIndex(17);
  8250. if (points != null && points.length > 0) {
  8251. renderer.setStrokeAndFill(this);
  8252. renderer.drawPath(this);
  8253. }
  8254. },
  8255. getPathString : function() {
  8256. var points = this.attributes.getByIndex(17);
  8257. return 'M' + points;
  8258. }
  8259. //constructor : function(nsuri, context) {}
  8260. });
  8261. // $source: com/ibm/rave/render/internal/nodes/DefsSceneItem
  8262. /************************************************************************
  8263. ** IBM Confidential
  8264. **
  8265. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8266. **
  8267. ** (C) Copyright IBM Corp. 2017
  8268. **
  8269. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8270. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8271. ************************************************************************/
  8272. // GENERATED
  8273. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8274. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  8275. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  8276. /**
  8277. * A scene node representing an SVG "defs" node. May contain other shapes, gradient declarations, clips, etc.
  8278. */
  8279. var com_ibm_rave_render_internal_nodes_DefsSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  8280. /** @expose */
  8281. rave_getName : function() {
  8282. return "defs";
  8283. },
  8284. /** @expose */
  8285. rave_getDrawType : function() {
  8286. return 1015;
  8287. },
  8288. isDrawable : function() {
  8289. return false;
  8290. },
  8291. calculateBBox : function() {
  8292. return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  8293. },
  8294. paint : function(renderer) {},
  8295. doLayout : function() {}
  8296. //constructor : function(nsuri, context) {}
  8297. });
  8298. // $source: com/ibm/rave/render/internal/nodes/GradientSceneItem
  8299. /************************************************************************
  8300. ** IBM Confidential
  8301. **
  8302. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8303. **
  8304. ** (C) Copyright IBM Corp. 2017
  8305. **
  8306. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8307. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8308. ************************************************************************/
  8309. // GENERATED
  8310. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8311. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  8312. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  8313. //@import com/ibm/rave/core/Rave (runtime) // Rave
  8314. /**
  8315. * Abstract class with code common to gradient scene items (gradient and linear)
  8316. */
  8317. var com_ibm_rave_render_internal_nodes_GradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  8318. calculateBBox : function() {
  8319. return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  8320. },
  8321. /** @expose */
  8322. rave_getSizePx : function(size) {
  8323. var value = 0;
  8324. if (size) {
  8325. value = size.value;
  8326. switch (size.unit.type) {
  8327. case 2:
  8328. value = value / 100;
  8329. break;
  8330. }
  8331. }
  8332. return value;
  8333. },
  8334. paint : function(renderer) {},
  8335. doLayout : function() {},
  8336. getLocalXValue : function(val, node) {
  8337. var rect = node.getBBox();
  8338. return (com_ibm_rave_core_Rave.scale.linear().range([rect.x, rect.x + rect.width]).call(this, val, -1, -1));
  8339. },
  8340. getLocalYValue : function(val, node) {
  8341. var rect = node.getBBox();
  8342. return (com_ibm_rave_core_Rave.scale.linear().range([rect.y, rect.y + rect.height]).call(this, val, -1, -1));
  8343. }
  8344. //constructor : function(nsuri, context) {}
  8345. });
  8346. // $source: com/ibm/rave/render/internal/nodes/LinearGradientSceneItem
  8347. /************************************************************************
  8348. ** IBM Confidential
  8349. **
  8350. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8351. **
  8352. ** (C) Copyright IBM Corp. 2017
  8353. **
  8354. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8355. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8356. ************************************************************************/
  8357. // GENERATED
  8358. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8359. //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
  8360. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  8361. var com_ibm_rave_render_internal_nodes_LinearGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
  8362. /** @expose */
  8363. rave_getName : function() {
  8364. return com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT;
  8365. },
  8366. isDrawable : function() {
  8367. return false;
  8368. },
  8369. /**
  8370. * Returns the 0->1 x1 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8371. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8372. * @return (double) user space coordinate of 0->1 x1 value.
  8373. */
  8374. getX1 : function(node) {
  8375. var x1 = this.rave_getSizePx(this.computeCSSStyle(4).value);
  8376. return this.getLocalXValue(x1, node);
  8377. },
  8378. /**
  8379. * Returns the 0->1 x2 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8380. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8381. * @return (double) user space coordinate of 0->1 x2 value.
  8382. */
  8383. getX2 : function(node) {
  8384. var x2 = this.rave_getSizePx(this.computeCSSStyle(5).value);
  8385. return this.getLocalXValue(x2, node);
  8386. },
  8387. /**
  8388. * Returns the 0->1 y1 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8389. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8390. * @return (double) user space coordinate of 0->1 y1 value.
  8391. */
  8392. getY1 : function(node) {
  8393. var y1 = this.rave_getSizePx(this.computeCSSStyle(7).value);
  8394. return this.getLocalYValue(y1, node);
  8395. },
  8396. /**
  8397. * Returns the 0->1 y2 property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8398. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8399. * @return (double) user space coordinate of 0->1 x2 value.
  8400. */
  8401. getY2 : function(node) {
  8402. var y2 = this.rave_getSizePx(this.computeCSSStyle(8).value);
  8403. return this.getLocalYValue(y2, node);
  8404. },
  8405. /** @expose */
  8406. rave_getDrawType : function() {
  8407. return 1011;
  8408. }
  8409. //constructor : function(nsuri, context) {}
  8410. });
  8411. // $source: com/ibm/rave/render/internal/nodes/RadialGradientSceneItem
  8412. /************************************************************************
  8413. ** IBM Confidential
  8414. **
  8415. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8416. **
  8417. ** (C) Copyright IBM Corp. 2017
  8418. **
  8419. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8420. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8421. ************************************************************************/
  8422. // GENERATED
  8423. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8424. //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
  8425. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  8426. //@import com/ibm/rave/core/Rave (runtime) // Rave
  8427. var com_ibm_rave_render_internal_nodes_RadialGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
  8428. /** @expose */
  8429. rave_getName : function() {
  8430. return com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT;
  8431. },
  8432. isDrawable : function() {
  8433. return false;
  8434. },
  8435. /** @expose */
  8436. rave_getDrawType : function() {
  8437. return 1012;
  8438. },
  8439. /**
  8440. * Returns the 0->1 cx (center x) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8441. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8442. * @return (double) user space coordinate of 0->1 cx value.
  8443. */
  8444. getCX : function(node) {
  8445. var cx = this.rave_getSizePx(this.computeCSSStyle(9).value);
  8446. return this.getLocalXValue(cx, node);
  8447. },
  8448. /**
  8449. * Returns the 0->1 cy (center y) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8450. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8451. * @return (double) user space coordinate of 0->1 cy value.
  8452. */
  8453. getCY : function(node) {
  8454. var cy = this.rave_getSizePx(this.computeCSSStyle(10).value);
  8455. return this.getLocalYValue(cy, node);
  8456. },
  8457. /**
  8458. * Returns the 0->1 radius property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8459. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8460. * @return (double) user space coordinate of 0->1 radius value.
  8461. */
  8462. getR : function(node) {
  8463. var r = this.rave_getSizePx(this.computeCSSStyle(6).value);
  8464. var rect = node.getBBox();
  8465. return (com_ibm_rave_core_Rave.scale.linear().range([0, rect.width]).call(this, r, -1, -1));
  8466. },
  8467. /**
  8468. * Returns the 0->1 fx (focal point x) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8469. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8470. * @return (double) user space coordinate of 0->1 fx value.
  8471. */
  8472. getFX : function(node) {
  8473. var fx = this.rave_getSizePx(this.computeCSSStyle(18).value);
  8474. return this.getLocalXValue(fx, node);
  8475. },
  8476. /**
  8477. * Returns the 0->1 fy (focal point y) property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8478. * @param (com.ibm.rave.core.scene.SceneNode) node Bounding box to determine user space coordinate.
  8479. * @return (double) user space coordinate of 0->1 fy value.
  8480. */
  8481. getFY : function(node) {
  8482. var fy = this.rave_getSizePx(this.computeCSSStyle(19).value);
  8483. return this.getLocalYValue(fy, node);
  8484. }
  8485. //constructor : function(nsuri, context) {}
  8486. });
  8487. // $source: com/ibm/rave/render/internal/nodes/StopSceneItem
  8488. /************************************************************************
  8489. ** IBM Confidential
  8490. **
  8491. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8492. **
  8493. ** (C) Copyright IBM Corp. 2017
  8494. **
  8495. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8496. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8497. ************************************************************************/
  8498. // GENERATED
  8499. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8500. //@import com/ibm/rave/render/internal/nodes/GradientSceneItem (loadtime) // superclass
  8501. //@import com/ibm/rave/core/Rave (runtime) // rgb
  8502. var com_ibm_rave_render_internal_nodes_StopSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GradientSceneItem, {
  8503. /** @expose */
  8504. rave_getName : function() {
  8505. return "stop";
  8506. },
  8507. /** @expose */
  8508. rave_getDrawType : function() {
  8509. return 1016;
  8510. },
  8511. /**
  8512. * Return the stop color as an RGB color.
  8513. * @return (com.ibm.rave.core.color.RGB) RGB representation of the stop color.
  8514. */
  8515. getColor : function() {
  8516. return com_ibm_rave_core_Rave.rgb(this.getAttribute("stop-color"));
  8517. },
  8518. /**
  8519. * Returns the 0->1 offset property in user space coordinates. Bases it on the bounding box of the passed in node. This is typically the scene node to which the gradient is being applied.
  8520. * @return (double) user space coordinate of 0->1 offset value.
  8521. */
  8522. getOffset : function() {
  8523. return this.rave_getSizePx(this.computeCSSStyle(17).value);
  8524. },
  8525. /**
  8526. * Return the opacity of this stop from 0->1. Defaults to 1 (fully opaque)
  8527. * @return (double) opacity of this stop from 0->1
  8528. */
  8529. getOpacity : function() {
  8530. return (this.getComputedStyleValue(41));
  8531. }
  8532. //constructor : function(nsuri, context) {}
  8533. });
  8534. // $source: com/ibm/rave/render/internal/nodes/ImageSceneItem
  8535. /************************************************************************
  8536. ** IBM Confidential
  8537. **
  8538. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8539. **
  8540. ** (C) Copyright IBM Corp. 2017
  8541. **
  8542. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8543. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8544. ************************************************************************/
  8545. // GENERATED
  8546. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8547. //@import com/ibm/rave/render/internal/nodes/RectSceneItem (loadtime) // superclass
  8548. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime)
  8549. /**
  8550. * An SVG-like image node. <image x="0" y="0" height="50px" width="50px" xlink:href="cat.jpg" />
  8551. */
  8552. var com_ibm_rave_render_internal_nodes_ImageSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_RectSceneItem, {
  8553. IMAGE_CACHE_KEY : "__rave__image",
  8554. href : "",
  8555. /** @expose */
  8556. getName : function() {
  8557. return "image";
  8558. },
  8559. /** @expose */
  8560. getDrawType : function() {
  8561. return 1007;
  8562. },
  8563. paint : function(renderer) {
  8564. renderer.setStrokeAndFill(this);
  8565. renderer.drawImage(this);
  8566. },
  8567. /** @expose */
  8568. setAttributeNS : function(namespace, attribute, value) {
  8569. if (attribute == "href") {
  8570. this.rave_setProperty(this.IMAGE_CACHE_KEY, null);
  8571. this.href = value == null ? "" : ""+(value);
  8572. }
  8573. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setAttributeNS.call(this, namespace, attribute, value);
  8574. },
  8575. /**
  8576. * Return the href attribute containing the URL for this image.
  8577. * @return (String) href attribute containing the image URL. Returns "" if no attribute set.
  8578. */
  8579. getHref : function() {
  8580. return this.href;
  8581. }
  8582. //constructor : function(nsuri, context) {}
  8583. });
  8584. // $source: com/ibm/rave/render/internal/nodes/EllipseSceneItem
  8585. /************************************************************************
  8586. ** IBM Confidential
  8587. **
  8588. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8589. **
  8590. ** (C) Copyright IBM Corp. 2017
  8591. **
  8592. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8593. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8594. ************************************************************************/
  8595. // GENERATED
  8596. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8597. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  8598. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  8599. //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new
  8600. /**
  8601. * Ellipse shape.
  8602. */
  8603. var com_ibm_rave_render_internal_nodes_EllipseSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  8604. cx : 0,
  8605. cy : 0,
  8606. rx : 0,
  8607. ry : 0,
  8608. calculateBBox : function() {
  8609. return new com_ibm_rave_core_geom_RaveRect(this.cx - this.rx, this.cy - this.ry, this.rx * 2, this.ry * 2);
  8610. },
  8611. /** @expose */
  8612. rave_getDrawType : function() {
  8613. return 1013;
  8614. },
  8615. /** @expose */
  8616. rave_getName : function() {
  8617. return "ellipse";
  8618. },
  8619. getCx : function() {
  8620. return this.cx;
  8621. },
  8622. getCy : function() {
  8623. return this.cy;
  8624. },
  8625. getRx : function() {
  8626. return this.rx;
  8627. },
  8628. getRy : function() {
  8629. return this.ry;
  8630. },
  8631. rave_intersects : function(rect) {
  8632. var kappa = 0.5522848;
  8633. var ox = this.rx * kappa;
  8634. var oy = this.ry * kappa;
  8635. var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler();
  8636. pathHandler.moveTo(this.cx - this.rx, this.cy);
  8637. pathHandler.bezierCurveTo(this.cx - this.rx, this.cy - oy, this.cx - ox, this.cy - this.ry, this.cx, this.cy - this.ry);
  8638. pathHandler.bezierCurveTo(this.cx + ox, this.cy - this.ry, this.cx + this.rx, this.cy - oy, this.cx + this.rx, this.cy);
  8639. pathHandler.bezierCurveTo(this.cx + this.rx, this.cy + oy, this.cx + ox, this.cy + this.ry, this.cx, this.cy + this.ry);
  8640. pathHandler.bezierCurveTo(this.cx - ox, this.cy + this.ry, this.cx - this.rx, this.cy + oy, this.cx - this.rx, this.cy);
  8641. pathHandler.closePath();
  8642. var shapes = pathHandler.getShapes();
  8643. return shapes[0].intersect$1(rect) && this.intersectsClip(rect);
  8644. },
  8645. paint : function(renderer) {
  8646. renderer.setStrokeAndFill(this);
  8647. renderer.drawEllipse(this);
  8648. },
  8649. doLayout : function() {
  8650. this.cx = this.rave_getSizePx(this.getComputedCSSStyle(9).value);
  8651. this.cy = this.rave_getSizePx(this.getComputedCSSStyle(10).value);
  8652. this.rx = this.rave_getSizePx(this.getComputedCSSStyle(12).value);
  8653. this.ry = this.rave_getSizePx(this.getComputedCSSStyle(13).value);
  8654. }
  8655. //constructor : function(nsuri, context) {}
  8656. });
  8657. // $source: com/ibm/rave/render/internal/nodes/ClipPathSceneItem
  8658. /************************************************************************
  8659. ** IBM Confidential
  8660. **
  8661. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8662. **
  8663. ** (C) Copyright IBM Corp. 2017
  8664. **
  8665. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8666. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8667. ************************************************************************/
  8668. // GENERATED
  8669. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8670. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
  8671. /**
  8672. * Clip path shape.
  8673. */
  8674. var com_ibm_rave_render_internal_nodes_ClipPathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
  8675. isDrawable : function() {
  8676. return false;
  8677. },
  8678. /** @expose */
  8679. rave_getDrawType : function() {
  8680. return 1014;
  8681. },
  8682. /** @expose */
  8683. rave_getName : function() {
  8684. return "clipPath";
  8685. },
  8686. paint : function(renderer) {
  8687. renderer.addClip(this);
  8688. },
  8689. doLayout : function() {
  8690. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  8691. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8692. var child = __exp_enFor0[__i_enFor0];
  8693. (child).doLayout();
  8694. }
  8695. },
  8696. rave_intersects : function(rect) {
  8697. if (this.rave_hasChildNodes()) {
  8698. if ("none" == this.computeStyleValue(26) || "none" == this.getComputedStyleValue(42)) {
  8699. return false;
  8700. }
  8701. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  8702. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8703. var child = __exp_enFor0[__i_enFor0];
  8704. if ((child).rave_intersects(rect)) {
  8705. return true;
  8706. }
  8707. }
  8708. }
  8709. return false;
  8710. }
  8711. //constructor : function(nsuri, context) {}
  8712. });
  8713. // $source: com/ibm/rave/render/internal/nodes/GenericSceneNode
  8714. /************************************************************************
  8715. ** IBM Confidential
  8716. **
  8717. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8718. **
  8719. ** (C) Copyright IBM Corp. 2017
  8720. **
  8721. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8722. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8723. ************************************************************************/
  8724. // GENERATED
  8725. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8726. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
  8727. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  8728. /**
  8729. * A generic node, which does not render
  8730. */
  8731. var com_ibm_rave_render_internal_nodes_GenericSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
  8732. //_name : null,
  8733. //_bBox : null,
  8734. constructor : function(nsuri, context, name) {
  8735. this._bBox = new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  8736. {
  8737. this._name = name;
  8738. }
  8739. },
  8740. /** @expose */
  8741. getName : function() {
  8742. return this._name;
  8743. },
  8744. intersects : function(rect) {
  8745. return false;
  8746. },
  8747. /** @expose */
  8748. getBBox : function() {
  8749. return this._bBox;
  8750. },
  8751. calculateBBox : function() {
  8752. return this._bBox;
  8753. }
  8754. });
  8755. // $source: com/ibm/rave/render/internal/nodes/RootSceneItem
  8756. /************************************************************************
  8757. ** IBM Confidential
  8758. **
  8759. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8760. **
  8761. ** (C) Copyright IBM Corp. 2017
  8762. **
  8763. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8764. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8765. ************************************************************************/
  8766. // GENERATED
  8767. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8768. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
  8769. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  8770. /**
  8771. * A root scene item
  8772. */
  8773. var com_ibm_rave_render_internal_nodes_RootSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
  8774. //renderer : null,
  8775. //cacheManager : null,
  8776. constructor : function(nsuri, context) {
  8777. this.setSceneTreeContext(this);
  8778. },
  8779. /** @expose */
  8780. rave_getName : function() {
  8781. return "root";
  8782. },
  8783. /** @expose */
  8784. rave_dispose : function() {
  8785. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.removeRootProviderForNode(this.rave_getOwner());
  8786. },
  8787. /** @expose */
  8788. rave_getDrawType : function() {
  8789. return -1;
  8790. },
  8791. rave_intersects : function(rect) {
  8792. return true;
  8793. },
  8794. getRenderer : function() {
  8795. return this.renderer;
  8796. },
  8797. setRenderer : function(renderer) {
  8798. this.renderer = renderer;
  8799. },
  8800. getCacheManager : function() {
  8801. return this.cacheManager;
  8802. },
  8803. setCacheManager : function(cacheManager) {
  8804. this.cacheManager = cacheManager;
  8805. }
  8806. });
  8807. // $source: com/ibm/rave/render/AbstractRenderer
  8808. /************************************************************************
  8809. ** IBM Confidential
  8810. **
  8811. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8812. **
  8813. ** (C) Copyright IBM Corp. 2017
  8814. **
  8815. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8816. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8817. ************************************************************************/
  8818. // GENERATED
  8819. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  8820. //@import com/ibm/rave/render/internal/DirtyRegionManager (runtime) // new
  8821. //@import com/ibm/rave/core/context/RaveOperationalMode (runtime) // RaveOperationalMode
  8822. //@import com/ibm/rave/core/Rave (runtime) // Rave
  8823. //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode
  8824. //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getStroke, getFill
  8825. /**
  8826. * An abstract implementation of a renderer. Takes care of a number of details so specific renderers don't have to.
  8827. */
  8828. var com_ibm_rave_render_AbstractRenderer = rave_externs["AbstractRenderer"] = com_ibm_rave_core_nativeImpl_Declare({
  8829. //dirtyManager : null,
  8830. /** @expose */
  8831. root : null,
  8832. //eventManager : null,
  8833. drawRunning : false,
  8834. lastDrawTime : 0,
  8835. lastWidth : 0,
  8836. lastHeight : 0,
  8837. /** @expose */
  8838. isDirtyRegionEnabled : function() {
  8839. return this.dirtyManager;
  8840. },
  8841. /**
  8842. * Under certain circumstances, enabling dirty region support can improve interaction performance. Consider enabling dirty regions if the following applies: <ul> <li>Interaction feedback feels lagged.</li> <li>The visualization contains many elements.</li> <li>Scene changes are contained within smaller areas where repainting the entire scene is unnecessary.</li> </ul> To enable dirty regions, set the 'rave-dirtyRegions' property to <code>true</code>.
  8843. * @return (boolean) <code>true</code> if the flag is set on the root node, <code>false</code> otherwise
  8844. */
  8845. /** @expose */
  8846. getDirtyRegionFlagFromRoot : function() {
  8847. return (this.root.rave_getProperty("rave-dirtyRegions"));
  8848. },
  8849. /** @expose */
  8850. getWidth : function() {
  8851. return + (this.root.getAttribute("width"));
  8852. },
  8853. /** @expose */
  8854. getHeight : function() {
  8855. return + (this.root.getAttribute("height"));
  8856. },
  8857. /**
  8858. * By default repaint just calls render() to re-render the whole scene.
  8859. */
  8860. /** @expose */
  8861. repaint : function() {
  8862. if (this.getDirtyRegionFlagFromRoot()) {
  8863. if (!this.dirtyManager) {
  8864. this.dirtyManager = new com_ibm_rave_render_internal_DirtyRegionManager();
  8865. }
  8866. } else {
  8867. this.dirtyManager = null;
  8868. }
  8869. var width = this.getWidth();
  8870. var height = this.getHeight();
  8871. if (this.dirtyManager && (width != this.lastWidth || height != this.lastHeight)) {
  8872. this.dirtyManager.forceRedraw();
  8873. }
  8874. this.start(!this.dirtyManager || this.dirtyManager.globalDirty);
  8875. this.render(this.root);
  8876. this.finish();
  8877. this.lastWidth = width;
  8878. this.lastHeight = height;
  8879. },
  8880. /** @expose */
  8881. constructor : function(root) {
  8882. this.root = root;
  8883. },
  8884. /**
  8885. * Makes the scene dirty due to changes in the given node. If dirty regions are enabled, updates the dirty region with the bounds of the given node.
  8886. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node the node which causes the scene to be dirty
  8887. */
  8888. /** @expose */
  8889. makeDirty : function(node) {
  8890. if (this.dirtyManager) {
  8891. this.dirtyManager.add(node);
  8892. }
  8893. },
  8894. /** @expose */
  8895. createEventManager : function() {},
  8896. /** @expose */
  8897. registerEvent : function(eventType, node) {
  8898. if (!this.eventManager) {
  8899. this.eventManager = this.createEventManager();
  8900. }
  8901. this.eventManager.registerEvent(eventType, node);
  8902. },
  8903. /** @expose */
  8904. unregisterEvent : function(eventType, node) {
  8905. if (this.eventManager) {
  8906. this.eventManager.unregisterEvent(eventType, node);
  8907. }
  8908. },
  8909. /** @expose */
  8910. handleDrawEvent : function(type, item) {
  8911. if (com_ibm_rave_core_context_RaveOperationalMode.MODE != 1) {
  8912. if (!this.drawRunning) {
  8913. this.drawRunning = true;
  8914. var renderer = this;
  8915. var event = function(elapsed) {
  8916. renderer.repaint();
  8917. renderer.lastDrawTime = Date.now();
  8918. renderer.drawRunning = false;
  8919. return true;
  8920. };
  8921. var diff = Date.now() - this.lastDrawTime;
  8922. var delay = (diff > 15) ? 0 : diff;
  8923. com_ibm_rave_core_Rave.timer(event, delay);
  8924. }
  8925. }
  8926. },
  8927. /** @expose */
  8928. render : function(node) {
  8929. var anode = node;
  8930. var parentNode = node;
  8931. while (parentNode.rave_getParentNode()) {
  8932. parentNode = parentNode.rave_getParentNode();
  8933. }
  8934. this.recursiveComputeStyles(parentNode);
  8935. var dirtyClip;
  8936. if (this.dirtyManager && !(this.dirtyManager.globalDirty)) {
  8937. dirtyClip = this.dirtyManager.getClip();
  8938. if (dirtyClip) {
  8939. this.saveGraphicsState();
  8940. this.addRectClip(dirtyClip);
  8941. this.clearRect(dirtyClip);
  8942. }
  8943. }
  8944. this.doRender(anode);
  8945. if (this.dirtyManager) {
  8946. this.dirtyManager.clear();
  8947. if (dirtyClip) {
  8948. this.restoreGraphicsState();
  8949. }
  8950. }
  8951. },
  8952. recursiveComputeStyles : function(node) {
  8953. node.computeStyles();
  8954. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  8955. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8956. var child = __exp_enFor0[__i_enFor0];
  8957. this.recursiveComputeStyles(child);
  8958. }
  8959. },
  8960. doRender : function(node) {
  8961. if (!(node.isDrawable())) {
  8962. return;
  8963. }
  8964. this.saveGraphicsState();
  8965. var matrix = node.getComputedStyleValue(11);
  8966. if (matrix) {
  8967. this.applyMatrix(matrix);
  8968. }
  8969. var clipNode = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(node, node.getComputedStyleValue(44), [1014]);
  8970. if (clipNode) {
  8971. clipNode.layout();
  8972. clipNode.paint(this);
  8973. }
  8974. this.shapeRendering(node.getComputedStyleValue(47));
  8975. var painted = false;
  8976. if (node.rave_getDrawType() != -1 && (!this.dirtyManager || node.isDirty() || this.dirtyManager.intersects(node))) {
  8977. node.layout();
  8978. if (node.isVisible()) {
  8979. node.paint(this);
  8980. painted = true;
  8981. }
  8982. }
  8983. if (node.rave_hasChildNodes()) {
  8984. for (var __i_enFor0 = 0, __exp_enFor0 = node.getChildrenArray(), __len_enFor0 = __exp_enFor0.length;
  8985. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8986. var child = __exp_enFor0[__i_enFor0];
  8987. this.doRender(child);
  8988. }
  8989. }
  8990. if (painted) {
  8991. node.postPaint(this);
  8992. }
  8993. node.setDirty(false, false);
  8994. this.restoreGraphicsState();
  8995. },
  8996. /** @expose */
  8997. start : function(renderFromScratch) {},
  8998. /** @expose */
  8999. finish : function() {},
  9000. applyMatrix : function(matrix) {
  9001. this.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
  9002. },
  9003. /**
  9004. * Takes a scene node and applies fill and stroke based on its properties.
  9005. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Abstract node to set fill and stroke for.
  9006. */
  9007. /** @expose */
  9008. setStrokeAndFill : function(node) {
  9009. var style = com_ibm_rave_render_internal_style_RenderStyleManager.getFill(node);
  9010. this.fill(style);
  9011. this.stroke(com_ibm_rave_render_internal_style_RenderStyleManager.getStroke(node));
  9012. },
  9013. /**
  9014. * Draw the path object created by {@link this.SceneItemFactory#this.create(String, String, com_ibm_rave_core_scene_SceneNode)}
  9015. * @param (com.ibm.rave.render.internal.nodes.PathSceneItem) path a path object
  9016. */
  9017. /** @expose */
  9018. drawPath : function(path) {},
  9019. /** @expose */
  9020. addClip : function(clip) {},
  9021. /** @expose */
  9022. drawEllipse : function(ellipse) {},
  9023. /** @expose */
  9024. drawRect : function(rect) {},
  9025. /** @expose */
  9026. drawLine : function(line) {},
  9027. /** @expose */
  9028. drawText : function(text) {},
  9029. /** @expose */
  9030. drawTextPath : function(textPath, paths) {},
  9031. /** @expose */
  9032. drawCircle : function(circle) {},
  9033. /** @expose */
  9034. push : function() {},
  9035. /** @expose */
  9036. pop : function(opacity) {},
  9037. /** @expose */
  9038. drawImage : function(image) {},
  9039. /** @expose */
  9040. fill : function(fill) {},
  9041. /** @expose */
  9042. stroke : function(stroke) {},
  9043. /** @expose */
  9044. transform : function(a, b, c, d, e, f) {},
  9045. /** @expose */
  9046. saveGraphicsState : function() {},
  9047. /** @expose */
  9048. restoreGraphicsState : function() {},
  9049. /** @expose */
  9050. addRectClip : function(newClip) {},
  9051. /** @expose */
  9052. clearRect : function(clip) {},
  9053. /** @expose */
  9054. shapeRendering : function(mode) {}
  9055. });
  9056. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer
  9057. /************************************************************************
  9058. ** IBM Confidential
  9059. **
  9060. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9061. **
  9062. ** (C) Copyright IBM Corp. 2014, 2016
  9063. **
  9064. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9065. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9066. ************************************************************************/
  9067. // @import com/ibm/rave/core/nativeImpl/Declare (load)
  9068. // @import com/ibm/rave/render/AbstractRenderer (load)
  9069. // @import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime)
  9070. // @import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime)
  9071. // @import com/ibm/rave/core/nativeImpl/Object (runtime)
  9072. // @import com/ibm/rave/render/event/EventManager (runtime)
  9073. // @import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime)
  9074. // @import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime)
  9075. // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing (runtime)
  9076. // @import com/ibm/rave/core/scene/SceneNodeType (runtime)
  9077. var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_AbstractRenderer, {
  9078. constructor : function() {
  9079. this._context = this._getCanvasNode().getContext('2d');
  9080. this._renderingContextStack = [];
  9081. this._transforms = [];
  9082. var ratio = this._getCanvasNode().rave_getProperty("__rave_canvas_ratio__") || 1;
  9083. this._currentTransform = new TransformMatrix(ratio, 0, 0, ratio, 0, 0);
  9084. this._hasNativeDash = typeof this._context.setLineDash == "function";
  9085. this._hasNativePath2D = !!window.Path2D;
  9086. this._crispEdges = false;
  9087. },
  9088. getWidth: function() {
  9089. return this._getCanvasNode().width;
  9090. },
  9091. getHeight: function() {
  9092. return this._getCanvasNode().height;
  9093. },
  9094. getDirtyRegionFlagFromRoot: function() {
  9095. // check the canvas node first
  9096. return !!this._getCanvasNode()["rave-dirtyRegions"]
  9097. || (this.root && this.root.rave_hasChildNodes() && !!this.root.rave_getChildNodes()[0].rave_getProperty("rave-dirtyRegions"));
  9098. },
  9099. clear: function() {
  9100. this.saveGraphicsState();
  9101. var canvas = this._getCanvasNode(), ctx = this._context;
  9102. // Clear the main rect. remove any transforms for this calculation just to be sure.
  9103. this.setTransform(1, 0, 0, 1, 0, 0);
  9104. ctx.clearRect(0, 0, canvas.width, canvas.height);
  9105. this.restoreGraphicsState();
  9106. },
  9107. fill: function (fill) {
  9108. this._fill = fill;
  9109. },
  9110. stroke: function (stroke) {
  9111. this._stroke = stroke;
  9112. this._dashArray = !this._hasNativeDash && stroke ? stroke.getDashArray() : null;
  9113. },
  9114. start: function(renderFromScratch) {
  9115. if (renderFromScratch) {
  9116. this.saveGraphicsState();
  9117. var canvas = this._getCanvasNode(), ctx = this._context;
  9118. this._renderingContextStack = [];
  9119. // Clear the main rect. remove any transforms for this calculation just to be sure.
  9120. this.setTransform(1, 0, 0, 1, 0, 0);
  9121. ctx.clearRect(0, 0, canvas.width, canvas.height);
  9122. this.restoreGraphicsState();
  9123. }
  9124. },
  9125. clearRect: function(rect) {
  9126. this._context.clearRect(rect.x, rect.y, rect.width, rect.height);
  9127. },
  9128. finish: function() {
  9129. },
  9130. transform: function(a, b, c, d, e, f) {
  9131. this._context.transform(a, b, c, d, e, f);
  9132. this._currentTransform = this._currentTransform.multiply(new TransformMatrix(a, b, c, d, e, f));
  9133. },
  9134. setTransform: function(a, b, c, d, e, f) {
  9135. this._context.setTransform(a, b, c, d, e, f);
  9136. this._currentTransform = new TransformMatrix(a, b, c, d, e, f);
  9137. },
  9138. drawEllipse: function(ellipse) {
  9139. this._drawEllipse(ellipse.getCx(), ellipse.getCy(), ellipse.getRx(), ellipse.getRy());
  9140. },
  9141. drawRect: function(rect){
  9142. var x = this._snap(rect.getX()),
  9143. y = this._snap(rect.getY()),
  9144. w = this._crispEdges ? Math.round(rect.getWidth()) : rect.getWidth(),
  9145. h = this._crispEdges ? Math.round(rect.getHeight()) : rect.getHeight(),
  9146. rx = rect.getRx(),
  9147. ry = rect.getRy(),
  9148. xe = x + w, // x-end
  9149. ye = y + h, // y-end
  9150. ctx = this._context,
  9151. da = this._dashArray,
  9152. residue;
  9153. // set the opposite radius if not set or < 0
  9154. if (rx > 0 && ry <= 0) {
  9155. ry = rx;
  9156. } else if (ry > 0 && rx <= 0) {
  9157. rx = ry;
  9158. }
  9159. // radius must <= half the width or height
  9160. rx = Math.min(rx, w / 2);
  9161. ry = Math.min(ry, h / 2);
  9162. if (rx > 0) {
  9163. var kappa = 0.5522848,
  9164. ox = rx * kappa, // control point offset horizontal
  9165. oy = ry * kappa; // control point offset vertical
  9166. }
  9167. this._preDraw();
  9168. if (!this._clipping && da) {
  9169. if (rx > 0) {
  9170. // draw rounded rectangle
  9171. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + rx, y, x + w - rx, y);
  9172. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + w - rx, y, [xe - rx + ox, y, xe, y + ry - oy, xe, y + ry], residue);
  9173. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + w, y + ry, x + w, y + h - ry, residue);
  9174. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + w, y + h - ry, [xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye], residue);
  9175. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x + w - rx, y + h, x + rx, y + h, residue);
  9176. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x + rx, y + h, [x + rx - ox, ye, x, ye - ry + oy, x, ye - ry], residue);
  9177. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, y + h - ry, x, y + ry, residue);
  9178. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, x, y + ry, [x, y + ry - oy, x + rx - ox, y, x + rx, y], residue);
  9179. } else {
  9180. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, y, xe, y);
  9181. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, xe, y, xe, ye, residue);
  9182. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, xe, endY, x, ye, residue);
  9183. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, da, x, xy, x, y, residue);
  9184. }
  9185. } else if (rx > 0) {
  9186. // draw rounded rectangle
  9187. ctx.moveTo(x + rx, y);
  9188. ctx.lineTo(x + w - rx, y);
  9189. ctx.bezierCurveTo(xe - rx + ox, y, xe, y + ry - oy, xe, y + ry);
  9190. ctx.lineTo(x + w, y + h - ry);
  9191. ctx.bezierCurveTo(xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye);
  9192. ctx.lineTo(x + rx, y + h);
  9193. ctx.bezierCurveTo(x + rx - ox, ye, x, ye - ry + oy, x, ye - ry);
  9194. ctx.lineTo(x, y + ry);
  9195. ctx.bezierCurveTo(x, y + ry - oy, x + rx - ox, y, x + rx, y);
  9196. } else {
  9197. ctx.rect(x,y,w,h);
  9198. }
  9199. this._postDraw();
  9200. },
  9201. drawLine: function(line){
  9202. var x1=this._snap(line.getX1()),
  9203. y1=this._snap(line.getY1()),
  9204. x2=this._snap(line.getX2()),
  9205. y2=this._snap(line.getY2());
  9206. this._preDraw();
  9207. var ctx = this._context;
  9208. if (this._dashArray) {
  9209. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x1, y1, x2, y2);
  9210. } else {
  9211. ctx.moveTo(x1, y1);
  9212. ctx.lineTo(x2, y2);
  9213. }
  9214. this._postDraw();
  9215. },
  9216. drawPath: function(node) {
  9217. var path, pathGenerator = node.getPath();
  9218. var pathString = node.getPathString();
  9219. var hasNativeStringParser = this._hasNativePath2D && pathString;
  9220. var useNativePath = hasNativeStringParser && !this._crispEdges;
  9221. if (!this._clipping && useNativePath) {
  9222. path = new Path2D(pathString);
  9223. } else {
  9224. path = new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler(this._crispEdges);
  9225. if (pathGenerator) {
  9226. pathGenerator.draw(path);
  9227. }
  9228. }
  9229. this._preDraw();
  9230. var ctx = this._context;
  9231. var shadow = node.getShadow();
  9232. if(shadow != null){
  9233. ctx.save();//save context before applying text shadow
  9234. ctx.shadowOffsetX = node.rave_getSizePx(shadow.offset_x);
  9235. ctx.shadowOffsetY = node.rave_getSizePx(shadow.offset_y);
  9236. ctx.shadowColor = shadow.color != null ? shadow.getColor().toString() : ctx.fillStyle ;
  9237. if(shadow.blur_radius != null){
  9238. ctx.shadowBlur = node.rave_getSizePx(shadow.blur_radius);
  9239. }
  9240. }
  9241. if (!useNativePath || this._clipping) {
  9242. path.draw(ctx, this);
  9243. }
  9244. if (!this._clipping) {
  9245. if (this._fill) {
  9246. this._applyFill(this._fill, useNativePath);
  9247. if (useNativePath) {
  9248. ctx.fill(path);
  9249. }
  9250. }
  9251. if (this._stroke) {
  9252. this._applyStroke(this._stroke, useNativePath);
  9253. if (useNativePath) {
  9254. ctx.stroke(path);
  9255. }
  9256. }
  9257. }
  9258. if(shadow != null){
  9259. ctx.restore(); // restore context after text drawing and show application
  9260. }
  9261. this._postDraw();
  9262. },
  9263. drawCircle: function(circle){
  9264. var r = circle.getR();
  9265. this._drawEllipse(circle.getCx(), circle.getCy(), r, r);
  9266. },
  9267. shapeRendering: function(mode) {
  9268. // The only supported mode (other than the default) is "crispEdges".
  9269. this._crispEdges = mode === "crispEdges";
  9270. },
  9271. _drawEllipse : function(cx, cy, rx, ry) {
  9272. this._preDraw();
  9273. var ctx = this._context, da = this._dashArray;
  9274. if (ctx['ellipse'] && !da) {
  9275. // use native ellipse function
  9276. ctx['ellipse'](cx, cy, rx, ry, 0, 0, 2 * Math.PI, false);
  9277. } else if (da) {
  9278. // use dashing library because it's implementation matches svg dashing more closely
  9279. var residue,
  9280. kappa = 0.5522848,
  9281. ox = rx * kappa, // control point offset horizontal
  9282. oy = ry * kappa; // control point offset vertical
  9283. // draw ellipse
  9284. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx - rx, cy, [cx - rx, cy - oy, cx - ox, cy - ry, cx, cy - ry], residue);
  9285. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx, cy - ry, [cx + ox, cy - ry, cx + rx, cy - oy, cx + rx, cy], residue);
  9286. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx + rx, cy, [cx + rx, cy + oy, cx + ox, cy + ry, cx, cy + ry], residue);
  9287. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(ctx, da, cx, cy + ry, [cx - ox, cy + ry, cx - rx, cy + oy, cx - rx, cy], residue);
  9288. } else {
  9289. // Draw an ellipse by scaling a full arc (unless it's just a circle)
  9290. var r = rx, twoPI = 2 * Math.PI;
  9291. if (rx != ry) {
  9292. // draw an oval
  9293. // save state due to translate and scale
  9294. this.saveGraphicsState();
  9295. // translate to center such that the ellipse can be drawn at 0,0
  9296. ctx.translate(cx, cy);
  9297. if (rx > ry) {
  9298. ctx.scale(1, ry/rx);
  9299. } else {
  9300. r = ry;
  9301. ctx.scale(rx/ry, 1);
  9302. }
  9303. ctx.arc(0, 0, r, 0, twoPI, false);
  9304. this.restoreGraphicsState();
  9305. } else {
  9306. // draw a circle
  9307. ctx.arc(cx, cy, r, 0, twoPI, false);
  9308. }
  9309. }
  9310. this._postDraw();
  9311. },
  9312. drawText: function(textItem) {
  9313. var text= textItem.getTextString();
  9314. var x= textItem.getX();
  9315. var y= textItem.getY();
  9316. this._context.font = textItem.getFontStyle().toString();
  9317. if (this._fill) {
  9318. this._applyFill(this._fill, true);
  9319. }
  9320. var shadow = textItem.getShadow();
  9321. if(shadow != null){
  9322. this._context.save();//save context before applying text shadow
  9323. this._context.shadowOffsetX = textItem.rave_getSizePx(shadow.offset_x);
  9324. this._context.shadowOffsetY = textItem.rave_getSizePx(shadow.offset_y);
  9325. this._context.shadowColor = shadow.color != null ? shadow
  9326. .getColor().toString() : this._context.fillStyle ;
  9327. if(shadow.blur_radius != null){
  9328. this._context.shadowBlur = textItem.rave_getSizePx(shadow.blur_radius);
  9329. }
  9330. }
  9331. this._context.fillText(text, x, y);
  9332. if(shadow != null){
  9333. this._context.restore(); // restore context after text drawing and show application
  9334. }
  9335. if (this._stroke) {
  9336. this._applyStroke(this._stroke,true);
  9337. this._context.strokeText(text, x, y);
  9338. }
  9339. },
  9340. // Number of images currently being loaded
  9341. _imageCount: 0,
  9342. drawImage : function (imageSceneItem) {
  9343. var href = imageSceneItem.getHref();
  9344. if (href && href.length) {
  9345. var self = this;
  9346. // Check if this item has a cached image already
  9347. var img = imageSceneItem.rave_getProperty("__rave__image");
  9348. if (! img) {
  9349. // this creates an image object and sets up callbacks to
  9350. // populate the cache when ready
  9351. self._createImage(imageSceneItem,href);
  9352. } else {
  9353. // draw from the cached version
  9354. // -1 signals an error - don't draw
  9355. if (img != -1) {
  9356. self._handleDrawImage(img,imageSceneItem);
  9357. }
  9358. }
  9359. }
  9360. },
  9361. _createImage: function(imageSceneItem, href) {
  9362. var self = this;
  9363. self._imageCount++;
  9364. // This is the first time requesting an image for this ImageSceneItem
  9365. // Create a new object
  9366. var img = new Image();
  9367. img.onload = function(){
  9368. // last render has finished and our image is now loaded.
  9369. // cache the image on the scene item for the next draw
  9370. imageSceneItem.rave_setProperty("__rave__image", img);
  9371. // Remove this image from the queue
  9372. self._imageCount--;
  9373. clearTimeout(self._imageTimeOut);
  9374. if (self._imageCount) {
  9375. // Still more images to load. give them some time to
  9376. // load before we fire a full render.
  9377. self._imageTimeOut = setTimeout(self.repaint(),50);
  9378. } else {
  9379. // no more images, repaint immediately
  9380. self.repaint();
  9381. }
  9382. };
  9383. img.onerror = function(){
  9384. // image loading failed. mark as failed with -1
  9385. imageSceneItem.rave_setProperty("__rave__image", -1);
  9386. // Remove this image from the queue
  9387. self._imageCount--;
  9388. };
  9389. img.src = href;
  9390. return img;
  9391. },
  9392. /**
  9393. * Method that gets called when an image has been loaded.
  9394. * Draws the image once all images created before it have been drawn.
  9395. */
  9396. _handleDrawImage: function(image, imageSceneItem) {
  9397. // We're next. Draw!
  9398. var x = imageSceneItem.getX();
  9399. var y = imageSceneItem.getY();
  9400. var w = imageSceneItem.getWidth();
  9401. var h = imageSceneItem.getHeight();
  9402. var gAlpha=this._context.globalAlpha;
  9403. this._context.globalAlpha=this._fill.getOpacity();
  9404. // Draw image and remove from queue
  9405. this._context.drawImage(image,x,y,w,h);
  9406. this._context.globalAlpha=gAlpha;
  9407. },
  9408. push: function() {
  9409. // save current rendering context on the stack
  9410. this._renderingContextStack.push([this._getCanvasNode(), this._context]);
  9411. // save current transform to apply on new context
  9412. var t = this._currentTransform;
  9413. this.saveGraphicsState();
  9414. // create new canvas
  9415. var canvas = document.createElement("canvas");
  9416. canvas.width = this.getWidth();
  9417. canvas.height = this.getHeight();
  9418. // make new context the current one
  9419. this._setCanvasNode(canvas);
  9420. this._context = canvas.getContext('2d');
  9421. // reset current transform
  9422. this._currentTransform = new TransformMatrix(1, 0, 0, 1, 0, 0);
  9423. // apply transform on new context
  9424. this.transform(t.matrix.a, t.matrix.b, t.matrix.c, t.matrix.d, t.matrix.e, t.matrix.f);
  9425. },
  9426. pop: function(opacity) {
  9427. // current canvas that will be drawn
  9428. var canvas = this._getCanvasNode();
  9429. // get rendering context from the stack
  9430. var renderingContext = this._renderingContextStack.pop();
  9431. // store transform before reset
  9432. var at = this._currentTransform;
  9433. // set current context
  9434. this._setCanvasNode(renderingContext[0]);
  9435. this._context = renderingContext[1];
  9436. // reset transform before drawing
  9437. this.setTransform(1, 0, 0, 1, 0, 0);
  9438. // draw image with opacity
  9439. this._drawTransparentImage(canvas, opacity);
  9440. // set transform
  9441. this.setTransform(at.matrix.a, at.matrix.b, at.matrix.c, at.matrix.d, at.matrix.e, at.matrix.f);
  9442. this.restoreGraphicsState();
  9443. },
  9444. _drawTransparentImage: function(image, opacity) {
  9445. // save current alpha
  9446. var currentAlpha = this._context.globalAlpha;
  9447. // save current composite
  9448. var currentComp = this._context.globalCompositeOperation;
  9449. // set new alpha using passed in opacity
  9450. this._context.globalAlpha = opacity;
  9451. this._context.globalCompositeOperation = "source-over";
  9452. // render image from group canvas into current context
  9453. this._context.drawImage(image, 0, 0);
  9454. // reset alpha
  9455. this._context.globalAlpha = currentAlpha;
  9456. // reset composite
  9457. this._context.globalCompositeOperation = currentComp;
  9458. },
  9459. saveGraphicsState: function() {
  9460. this._context.save();
  9461. this._transforms.push(this._currentTransform);
  9462. },
  9463. restoreGraphicsState: function() {
  9464. this._context.restore();
  9465. this._currentTransform = this._transforms.pop();
  9466. },
  9467. addClip: function(clip) {
  9468. var ctx = this._context;
  9469. ctx.beginPath();
  9470. this._clipping = 1;
  9471. var children = clip.rave_getChildNodes();
  9472. for (var i = 0; i < children.length; i++) {
  9473. var child = children[i];
  9474. switch (child.rave_getDrawType()) {
  9475. case com_ibm_rave_core_scene_SceneNodeType.CIRCLE:
  9476. this.drawCircle(child);
  9477. break;
  9478. case com_ibm_rave_core_scene_SceneNodeType.RECT:
  9479. this.drawRect(child);
  9480. break;
  9481. case com_ibm_rave_core_scene_SceneNodeType.PATH:
  9482. case com_ibm_rave_core_scene_SceneNodeType.POLYGON:
  9483. case com_ibm_rave_core_scene_SceneNodeType.POLYLINE:
  9484. this.drawPath(child);
  9485. break;
  9486. case com_ibm_rave_core_scene_SceneNodeType.ELLIPSE:
  9487. this.drawEllipse(child);
  9488. break;
  9489. }
  9490. }
  9491. delete this._clipping;
  9492. ctx.clip();
  9493. },
  9494. _getCanvasNode: function() {
  9495. return this.root._canvasNode;
  9496. },
  9497. _setCanvasNode: function(node) {
  9498. this.root._canvasNode = node;
  9499. },
  9500. _preDraw: function() {
  9501. !this._clipping && this._context.beginPath();
  9502. if (this._crispEdges) {
  9503. this.saveGraphicsState();
  9504. var m = this._currentTransform.matrix;
  9505. this.transform(1, 0, 0, 1, Math.floor(m.e) + 0.5 - m.e, Math.floor(m.f) + 0.5 - m.f);
  9506. }
  9507. },
  9508. _postDraw: function() {
  9509. !this._clipping && this._applyStyles(this._fill, this._stroke);
  9510. if (this._crispEdges) {
  9511. this.restoreGraphicsState();
  9512. }
  9513. },
  9514. // Apply all the styles defined in the passed styles object.
  9515. _applyStyles: function(fill, stroke) {
  9516. this._applyFill(fill);
  9517. this._applyStroke(stroke);
  9518. },
  9519. _applyFill: function(fill, skipFill) {
  9520. if (fill) {
  9521. var type = fill.getType();
  9522. var style = null;
  9523. if (type == 1001) {
  9524. // linear gradient
  9525. style = this._context.createLinearGradient(fill.x1, fill.y1, fill.x2, fill.y2);
  9526. var stops = fill.getStops();
  9527. for (var i = 0; i < stops.length; i++) {
  9528. style.addColorStop(stops[i].getOffset(), stops[i].calculateColor().toString());
  9529. }
  9530. } else if (type == 1002) {
  9531. // radial gradient
  9532. // I sort of eyeballed the 'r1' value which is fixed in SVG (or based somehow on the bounding box)
  9533. // This value gives a pretty good approximation.
  9534. style = this._context.createRadialGradient(fill.fx, fill.fy, fill.r/24, fill.cx, fill.cy, fill.r);
  9535. var stops = fill.getStops();
  9536. for (var i = 0; i < stops.length; i++) {
  9537. style.addColorStop(stops[i].getOffset(), stops[i].calculateColor().toString());
  9538. }
  9539. } else {
  9540. // regular color fill
  9541. style = fill.calculateColorWithOpacity().toString();
  9542. }
  9543. this._context.fillStyle = style;
  9544. if (!skipFill) {
  9545. this._context.fill();
  9546. }
  9547. }
  9548. },
  9549. _applyStroke: function(stroke, skipStroke) {
  9550. if (stroke) {
  9551. var color = stroke.calculateColorWithOpacity().toString();
  9552. if (color) {
  9553. var ctx = this._context;
  9554. ctx.strokeStyle = color;
  9555. ctx.lineWidth = stroke.getWidth();
  9556. ctx.lineCap = stroke.getLineCap();
  9557. ctx.lineJoin = stroke.getLineJoin();
  9558. ctx.miterLimit = stroke.getMiterLimit();
  9559. if (this._hasNativeDash && stroke.getDashArray()) {
  9560. ctx.setLineDash(stroke.getDashArray());
  9561. ctx.lineDashOffset = stroke.getDashOffset();
  9562. }
  9563. if (!skipStroke) {
  9564. ctx.stroke();
  9565. }
  9566. }
  9567. }
  9568. },
  9569. createEventManager : function() {
  9570. var canvas = this._getCanvasNode();
  9571. // create a native event manager
  9572. return new (com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager, {
  9573. addNativeEventListener : function(eventType, listener) {
  9574. var nativeListener = function(e) {
  9575. // create an event object
  9576. var event = wrapEvent(e);
  9577. // listener callback
  9578. listener(event);
  9579. unwrapEvent(e, event);
  9580. };
  9581. canvas.addEventListener(eventType, nativeListener);
  9582. return nativeListener;
  9583. },
  9584. removeNativeEventListener : function(eventType, nativeObject) {
  9585. canvas.removeEventListener(eventType, nativeObject);
  9586. }
  9587. }))(this);
  9588. },
  9589. _snap : function(v) {
  9590. return _doSnap(v, this._crispEdges);
  9591. }
  9592. });
  9593. // Object to track the current transform of the canvas.
  9594. // Basically a wrapper to an SVGMatrix object.
  9595. var TransformMatrix = function(a, b, c, d, e, f) {
  9596. var svgMatrix = document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGMatrix();
  9597. svgMatrix.a = a || 1;
  9598. svgMatrix.b = b || 0;
  9599. svgMatrix.c = c || 0;
  9600. svgMatrix.d = d || 1;
  9601. svgMatrix.e = e || 0;
  9602. svgMatrix.f = f || 0;
  9603. return {
  9604. matrix : svgMatrix,
  9605. multiply : function(secondTransformMatrix) {
  9606. var svgMatrix = this.matrix.multiply(secondTransformMatrix.matrix);
  9607. return new TransformMatrix(svgMatrix.a, svgMatrix.b, svgMatrix.c, svgMatrix.d, svgMatrix.e, svgMatrix.f);
  9608. },
  9609. identity : function() {
  9610. this.matrix.a = 1;
  9611. this.matrix.b = 0;
  9612. this.matrix.c = 0;
  9613. this.matrix.d = 1;
  9614. this.matrix.e = 0;
  9615. this.matrix.f = 0;
  9616. }
  9617. };
  9618. }
  9619. var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler = com_ibm_rave_core_nativeImpl_Declare({
  9620. constructor : function(crisp) {
  9621. this._cmds = [];
  9622. this._crisp = crisp;
  9623. },
  9624. draw : function(c, r) {
  9625. var cmds = this._cmds;
  9626. for (var i = 0; i < cmds.length; i++) {
  9627. cmds[i](c, r, this);
  9628. }
  9629. },
  9630. fail : function(index) {
  9631. this._cmds.push(function(c) {
  9632. c.closePath();
  9633. });
  9634. },
  9635. startPath : function() {
  9636. this._cmds.push(function(c, r, self) {
  9637. self._x = self._y = 0;
  9638. });
  9639. },
  9640. closePath : function() {
  9641. this._cmds.push(function(c) {
  9642. c.closePath();
  9643. });
  9644. },
  9645. moveTo : function(x, y) {
  9646. this._cmds.push(function(c, r, self) {
  9647. c.moveTo(self._snap(x), self._snap(y));
  9648. self._x = x;
  9649. self._y = y;
  9650. });
  9651. },
  9652. lineTo : function(x, y) {
  9653. var _x = this._snap(x),
  9654. _y = this._snap(y);
  9655. this._cmds.push(function(c, r, self) {
  9656. if (r._dashArray) {
  9657. self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(c, r._dashArray, self._x, self._y, _x, _y, self._residue);
  9658. self._x = x;
  9659. self._y = y;
  9660. } else {
  9661. c.lineTo(_x,_y);
  9662. }
  9663. });
  9664. },
  9665. bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
  9666. this._cmds.push(function(c, r , self) {
  9667. if (r._dashArray) {
  9668. self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(c, r._dashArray, self._x, self._y, [cp1x, cp1y, cp2x, cp2y, x, y], self._residue);
  9669. self._x = x;
  9670. self._y = y;
  9671. } else {
  9672. c.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
  9673. }
  9674. });
  9675. },
  9676. quadraticCurveTo : function(cpx, cpy, x, y) {
  9677. this._cmds.push(function(c, r , self) {
  9678. if (r._dashArray) {
  9679. self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedCurveTo(c, r._dashArray, self._x, self._y, [cpx, cpy, x, y], self._residue);
  9680. self._x = x;
  9681. self._y = y;
  9682. } else {
  9683. c.quadraticCurveTo(cpx, cpy, x, y);
  9684. }
  9685. });
  9686. },
  9687. arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
  9688. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this,
  9689. x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
  9690. },
  9691. _snap : function(v) {
  9692. return _doSnap(v, this._crispEdges);
  9693. }
  9694. });
  9695. function _doSnap(value, crisp) {
  9696. return crisp ? Math.round(value) : value;
  9697. }
  9698. // $source: com/ibm/rave/render/internal/DirtyRegionManager
  9699. /************************************************************************
  9700. ** IBM Confidential
  9701. **
  9702. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9703. **
  9704. ** (C) Copyright IBM Corp. 2017
  9705. **
  9706. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9707. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9708. ************************************************************************/
  9709. // GENERATED
  9710. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9711. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds
  9712. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  9713. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  9714. /**
  9715. * Manages dirty regions for a renderer.
  9716. */
  9717. var com_ibm_rave_render_internal_DirtyRegionManager = com_ibm_rave_core_nativeImpl_Declare({
  9718. //dirtyRegion : null,
  9719. //normalizedRegion : null,
  9720. //dirtyNodes : null,
  9721. globalDirty : true,
  9722. constructor : function() {
  9723. this.dirtyNodes = [];
  9724. },
  9725. /**
  9726. * If globally dirty, the entire scene should be repainted.
  9727. * @return (boolean) <code>true</code> if the dirty region is all dirty, <code>false</code> otherwise
  9728. */
  9729. isGloballyDirty : function() {
  9730. return this.globalDirty;
  9731. },
  9732. /**
  9733. * Add the scene node whose bounds to add to the current dirtyRegion.
  9734. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node the scene node whose bounds are dirty
  9735. */
  9736. add : function(node) {
  9737. if (!this.globalDirty) {
  9738. this.dirtyNodes.push(node);
  9739. this.addBounds(node, node.rave_getProperty("__drc__"));
  9740. }
  9741. },
  9742. addBounds : function(node, cache) {
  9743. var left, top, right, bottom;
  9744. if (!cache) {
  9745. var r = this.computeBounds(node);
  9746. left = r.x;
  9747. right = r.x + r.width;
  9748. top = r.y;
  9749. bottom = r.y + r.height;
  9750. } else {
  9751. left = cache.x;
  9752. right = cache.x + cache.width;
  9753. top = cache.y;
  9754. bottom = cache.y + cache.height;
  9755. }
  9756. if (!this.globalDirty) {
  9757. this.normalizedRegion = null;
  9758. if (!this.dirtyRegion) {
  9759. this.dirtyRegion = new com_ibm_rave_render_internal_DirtyRegionManager.Rect(left, right, top, bottom);
  9760. } else {
  9761. this.dirtyRegion.left = Math.min(this.dirtyRegion.left, left);
  9762. this.dirtyRegion.top = Math.min(this.dirtyRegion.top, top);
  9763. this.dirtyRegion.bottom = Math.max(this.dirtyRegion.bottom, bottom);
  9764. this.dirtyRegion.right = Math.max(this.dirtyRegion.right, right);
  9765. }
  9766. }
  9767. },
  9768. /**
  9769. * Get the cached or computed dirty bounds for the given node.
  9770. */
  9771. getDirtyBounds : function(node) {
  9772. var r = node.rave_getProperty("__drc__");
  9773. if (!r) {
  9774. r = this.computeBounds(node);
  9775. }
  9776. return r;
  9777. },
  9778. /**
  9779. * Computes the dirty bounds of the given node. Similar to bounding client rect but includes parts of the node that don't contribute to the bounding client rect such as stroke width.
  9780. */
  9781. computeBounds : function(node) {
  9782. var bBox = node.getBoundingClientRectBBox();
  9783. var left = bBox.x;
  9784. var top = bBox.y;
  9785. var right = bBox.x + bBox.width;
  9786. var bottom = bBox.y + bBox.height;
  9787. var strokeWidth = node.getComputedSizePx(31);
  9788. if (strokeWidth > 0) {
  9789. var expand = 1.5 * strokeWidth / 2.;
  9790. left -= expand;
  9791. top -= expand;
  9792. right += expand;
  9793. bottom += expand;
  9794. }
  9795. var r = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(left, top, right - left, bottom - top), node.getCTM());
  9796. node.rave_setProperty("__drc__", r);
  9797. return r;
  9798. },
  9799. /**
  9800. * Clear the current dirty region. But does not make the region globally dirty.
  9801. */
  9802. clear : function() {
  9803. this.dirtyRegion = null;
  9804. this.normalizedRegion = null;
  9805. this.globalDirty = false;
  9806. this.dirtyNodes.length = 0;
  9807. },
  9808. /**
  9809. * Like {@link this.DirtyRegionManager#this.clear()} but also makes the region globally dirty.
  9810. */
  9811. forceRedraw : function() {
  9812. for (var __i_enFor0 = 0, __exp_enFor0 = this.dirtyNodes, __len_enFor0 = __exp_enFor0.length;
  9813. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9814. var node = __exp_enFor0[__i_enFor0];
  9815. node.rave_removeProperty("__drc__");
  9816. }
  9817. this.clear();
  9818. this.globalDirty = true;
  9819. },
  9820. /**
  9821. * Completes the dirty region by rounding all coordinates.
  9822. */
  9823. normalize : function() {
  9824. for (var __i_enFor0 = 0, __exp_enFor0 = this.dirtyNodes, __len_enFor0 = __exp_enFor0.length;
  9825. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9826. var node = __exp_enFor0[__i_enFor0];
  9827. this.addBounds(node, null);
  9828. }
  9829. this.dirtyNodes.length = 0;
  9830. this.normalizedRegion = new com_ibm_rave_render_internal_DirtyRegionManager.Rect(Math.max(0, Math.floor(this.dirtyRegion.left - 2)), Math.max(0, Math.ceil(this.dirtyRegion.right + 2)), Math.max(0, Math.floor(this.dirtyRegion.top - 2)), Math.max(0, Math.ceil(this.dirtyRegion.bottom + 2)));
  9831. },
  9832. /**
  9833. * Get the clip rect based on the current dirty region.
  9834. * @return (com.ibm.rave.core.geom.RaveRect) a clip rect, or <code>null</code> if no dirty region present
  9835. */
  9836. getClip : function() {
  9837. if (this.dirtyRegion) {
  9838. if (!this.normalizedRegion) {
  9839. this.normalize();
  9840. }
  9841. return new com_ibm_rave_core_geom_RaveRect(this.normalizedRegion.left, this.normalizedRegion.top, this.normalizedRegion.right - this.normalizedRegion.left, this.normalizedRegion.bottom - this.normalizedRegion.top);
  9842. }
  9843. return null;
  9844. },
  9845. /**
  9846. * Does the passed scene item intersect with the current dirty region.
  9847. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node
  9848. * @return (boolean) true if the item intersects with the current dirty region, false otherwise.
  9849. */
  9850. intersects : function(node) {
  9851. if (this.dirtyRegion) {
  9852. if (!this.normalizedRegion) {
  9853. this.normalize();
  9854. }
  9855. var r = this.getDirtyBounds(node);
  9856. if (r.x >= this.normalizedRegion.right || r.y >= this.normalizedRegion.bottom || (r.y + r.height) <= this.normalizedRegion.top || (r.x + r.width) <= this.normalizedRegion.left) {
  9857. return false;
  9858. }
  9859. }
  9860. return true;
  9861. }
  9862. });
  9863. com_ibm_rave_render_internal_DirtyRegionManager.Rect = function(left, right, top, bottom) {
  9864. this.left = left;
  9865. this.right = right;
  9866. this.top = top;
  9867. this.bottom = bottom;
  9868. };
  9869. com_ibm_rave_render_internal_DirtyRegionManager.DIRTY_CACHE = "__drc__";
  9870. /**
  9871. * Expansion to deal with anti-aliasing.
  9872. */
  9873. com_ibm_rave_render_internal_DirtyRegionManager.EXPAND = 2;
  9874. // $source: com/ibm/rave/render/event/EventManager
  9875. /************************************************************************
  9876. ** IBM Confidential
  9877. **
  9878. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9879. **
  9880. ** (C) Copyright IBM Corp. 2017
  9881. **
  9882. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9883. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9884. ************************************************************************/
  9885. // GENERATED
  9886. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  9887. /**
  9888. * Responsible for mapping native events to Rave events. <p> The event manager will request to listen to native events and then convert these native events into Rave events which are then fired onto the scene nodes with listeners.
  9889. */
  9890. var com_ibm_rave_render_event_EventManager = rave_externs["EventManager"] = com_ibm_rave_core_nativeImpl_Declare({
  9891. //eventHandlers : null,
  9892. //renderer : null,
  9893. constructor : function(renderer) {
  9894. this.eventHandlers = {};
  9895. {
  9896. this.renderer = renderer;
  9897. }
  9898. },
  9899. /**
  9900. * Notifies the event manager that the given scene node is interested in receiving events of the given type.
  9901. * @param (String) eventType string describing the different event types
  9902. * @param (com.ibm.rave.core.scene.SceneNode) node scene node that will listen for events
  9903. */
  9904. /** @expose */
  9905. registerEvent : function(eventType, node) {
  9906. var info = this.eventHandlers[eventType];
  9907. var key = "__rave-eventmanager" + eventType;
  9908. if (!info) {
  9909. info = this.createNativeEventHandler(eventType);
  9910. if (info) {
  9911. this.eventHandlers[eventType] = info;
  9912. node.rave_setProperty(key, eventType);
  9913. info.addNode(node);
  9914. }
  9915. } else if (!(node.rave_hasProperty(key))) {
  9916. node.rave_setProperty(key, eventType);
  9917. info.addNode(node);
  9918. }
  9919. },
  9920. /**
  9921. * Notifies the event manager that the given scene node is no longer interested in receiving events of the given type.
  9922. * @param (String) eventType string describing the different event types
  9923. * @param (com.ibm.rave.core.scene.SceneNode) node scene node that was listening for events
  9924. */
  9925. /** @expose */
  9926. unregisterEvent : function(eventType, node) {
  9927. var info = this.eventHandlers[eventType];
  9928. if (info) {
  9929. var key = "__rave-eventmanager" + eventType;
  9930. if (node.rave_hasProperty(key)) {
  9931. node.rave_removeProperty(key);
  9932. info.removeNode(node);
  9933. if (info.canDispose()) {
  9934. info.dispose();
  9935. delete this.eventHandlers[eventType];
  9936. }
  9937. }
  9938. }
  9939. },
  9940. createNativeEventHandler : function(eventType) {
  9941. var result;
  9942. if ("mouseover" == eventType) {
  9943. result = this.createMouseOverListener(eventType);
  9944. } else if ("mouseout" == eventType) {
  9945. result = this.createMouseOutListener(eventType);
  9946. } else if ("mouseenter" == eventType) {
  9947. result = this.createMouseEnterListener(eventType);
  9948. } else if ("mouseleave" == eventType) {
  9949. result = this.createMouseLeaveListener(eventType);
  9950. } else if ("click" == eventType || "dblclick" == eventType || "mousemove" == eventType || "mouseup" == eventType || "mousedown" == eventType || "contextmenu" == eventType || "wheel" == eventType) {
  9951. result = this.createSimpleEventListener(eventType);
  9952. } else if ("touchmove" == eventType || "touchend" == eventType || "touchcancel" == eventType) {
  9953. result = this.createTouchEventListener(eventType);
  9954. } else if ("touchstart" == eventType) {
  9955. result = this.createTouchStartEventListener(eventType);
  9956. } else if ("keydown" == eventType || "keypress" == eventType || "keyup" == eventType) {
  9957. result = this.createKeyboardEventListener(eventType);
  9958. }
  9959. return result;
  9960. },
  9961. /**
  9962. * To track mouse over, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse over event is fired. Also tracks mouse out events to clear the cached target.
  9963. * @param (String) eventType the event type
  9964. */
  9965. createMouseOverListener : function(eventType) {
  9966. var target;
  9967. var self = this;
  9968. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  9969. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  9970. var hit = self.findHit(event.clientX, event.clientY);
  9971. if (hit && hit != target) {
  9972. event.type = eventType;
  9973. hit.dispatchEvent(event);
  9974. event.type = "mousemove";
  9975. }
  9976. target = hit;
  9977. })));
  9978. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  9979. target = null;
  9980. })));
  9981. return info;
  9982. },
  9983. /**
  9984. * To track mouse out, a native mouse move event must be tracked. When the mouse moves over a scene node, the node reference is saved. When the mouse moves off the saved node, a Rave mouse out event is fired. A native mouse out of the component is also tracked which will cause a mouse out on the saved node.
  9985. * @param (String) eventType the event type
  9986. */
  9987. createMouseOutListener : function(eventType) {
  9988. var target;
  9989. var self = this;
  9990. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  9991. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  9992. var hit = self.findHit(event.clientX, event.clientY);
  9993. if (target && hit != target) {
  9994. event.type = eventType;
  9995. target.dispatchEvent(event);
  9996. event.type = "mousemove";
  9997. }
  9998. target = hit;
  9999. })));
  10000. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  10001. if (target) {
  10002. target.dispatchEvent(event);
  10003. target = null;
  10004. }
  10005. })));
  10006. return info;
  10007. },
  10008. /**
  10009. * To track mouse enter, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse enter event is fired. Also tracks mouse out events to clear the cached target and ancestors.
  10010. * @param (String) eventType the event type
  10011. */
  10012. createMouseEnterListener : function(eventType) {
  10013. var target;
  10014. var self = this;
  10015. var ancestors = [];
  10016. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10017. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  10018. var hit = self.findHit(event.clientX, event.clientY);
  10019. if (hit) {
  10020. if (hit != target) {
  10021. var index = ancestors.indexOf(hit);
  10022. if (index >= 0) {
  10023. ancestors.length =index + 1;
  10024. } else {
  10025. event.type = eventType;
  10026. var bubbles = event.bubbles;
  10027. event.bubbles = false;
  10028. var isDescendant = false;
  10029. for (var i = ancestors.length - 1; i >= 0; --i) {
  10030. var ancestor = ancestors[i];
  10031. if (com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
  10032. ancestors.length =i + 1;
  10033. var newAncestors = [];
  10034. var parent = hit;
  10035. do {
  10036. newAncestors.push(parent);
  10037. parent.dispatchEvent(event);
  10038. } while ((parent = parent.rave_getParentNode()) != ancestor);
  10039. for (var j = newAncestors.length - 1; j >= 0; --j) {
  10040. ancestors.push(newAncestors[j]);
  10041. }
  10042. isDescendant = true;
  10043. break;
  10044. }
  10045. }
  10046. if (!isDescendant) {
  10047. ancestors.length = 0;
  10048. var parent = hit;
  10049. do {
  10050. ancestors.push(parent);
  10051. parent.dispatchEvent(event);
  10052. } while ((parent = parent.rave_getParentNode()));
  10053. ancestors.reverse();
  10054. }
  10055. event.bubbles = bubbles;
  10056. event.type = "mousemove";
  10057. }
  10058. }
  10059. } else if (target) {
  10060. ancestors.length = 0;
  10061. }
  10062. target = hit;
  10063. })));
  10064. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  10065. target = null;
  10066. ancestors.length = 0;
  10067. })));
  10068. return info;
  10069. },
  10070. /**
  10071. * To track mouse leave, a native mouse move event must be tracked. When the mouse moves over a scene node, a Rave mouse leave event is fired for the previous target. Also tracks mouse out events to clear the cached target and ancestors and dispatch an event for the previous target
  10072. * @param (String) eventType the event type
  10073. */
  10074. createMouseLeaveListener : function(eventType) {
  10075. var target;
  10076. var self = this;
  10077. var ancestors = [];
  10078. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10079. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  10080. var hit = self.findHit(event.clientX, event.clientY);
  10081. if (hit != target) {
  10082. if (!target) {
  10083. var parent = hit;
  10084. do {
  10085. ancestors.push(parent);
  10086. } while ((parent = parent.rave_getParentNode()));
  10087. ancestors.reverse();
  10088. } else {
  10089. var index = ancestors.indexOf(hit);
  10090. if (index >= 0) {
  10091. for (var i = ancestors.length - 1; i > index; --i) {
  10092. ancestors[i].dispatchEvent(event);
  10093. }
  10094. ancestors.length =index + 1;
  10095. } else {
  10096. event.type = eventType;
  10097. var bubbles = event.bubbles;
  10098. event.bubbles = false;
  10099. var isDescendant = false;
  10100. for (var i = ancestors.length - 1; i >= 0; --i) {
  10101. var ancestor = ancestors[i];
  10102. if (hit && com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
  10103. ancestors.length =i + 1;
  10104. var newAncestors = [];
  10105. var parent = hit;
  10106. do {
  10107. newAncestors.push(parent);
  10108. } while ((parent = parent.rave_getParentNode()) != ancestor);
  10109. for (var j = newAncestors.length - 1; j >= 0; --j) {
  10110. ancestors.push(newAncestors[j]);
  10111. }
  10112. isDescendant = true;
  10113. break;
  10114. }
  10115. ancestor.dispatchEvent(event);
  10116. }
  10117. if (!isDescendant && hit) {
  10118. var parent = hit;
  10119. do {
  10120. ancestors.push(parent);
  10121. } while ((parent = parent.rave_getParentNode()));
  10122. ancestors.reverse();
  10123. }
  10124. event.bubbles = bubbles;
  10125. event.type = "mousemove";
  10126. }
  10127. }
  10128. target = hit;
  10129. }
  10130. })));
  10131. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  10132. if (target) {
  10133. event.type = eventType;
  10134. target.dispatchEvent(event);
  10135. target = null;
  10136. ancestors.length = 0;
  10137. event.type = "mouseout";
  10138. }
  10139. })));
  10140. return info;
  10141. },
  10142. /**
  10143. * Adds a native event listener for the same event in the event listener info.
  10144. * @param (String) eventType the event type
  10145. */
  10146. createSimpleEventListener : function(eventType) {
  10147. var self = this;
  10148. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10149. var listener = function(event) {
  10150. var hit = self.findHit(event.clientX, event.clientY);
  10151. if (hit) {
  10152. hit.dispatchEvent(event);
  10153. }
  10154. };
  10155. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  10156. return info;
  10157. },
  10158. /**
  10159. * Add a native listener for keyboard events, which only dispatch to the root element (e.g. SVG, Canvas, AWTRavePanelSceneNode)
  10160. * @param (String) eventType Event name (e.g. "keydown").
  10161. */
  10162. createKeyboardEventListener : function(eventType) {
  10163. var self = this;
  10164. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10165. var listener = function(event) {
  10166. self.renderer.root.dispatchEvent(event);
  10167. };
  10168. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  10169. return info;
  10170. },
  10171. /**
  10172. * Adds a native event listener for the touchstart event.
  10173. * @param (String) eventType the event type
  10174. */
  10175. createTouchStartEventListener : function(eventType) {
  10176. var self = this;
  10177. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10178. var listener = function(event) {
  10179. for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
  10180. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10181. var touch = __exp_enFor0[__i_enFor0];
  10182. var hit = self.findHit(touch.clientX, touch.clientY);
  10183. if (hit) {
  10184. hit.dispatchEvent(event);
  10185. }
  10186. }
  10187. };
  10188. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  10189. return info;
  10190. },
  10191. /**
  10192. * In order to touch events other than start, the event must be dispatched to all nodes listening to that touch event. It is their responsibility to distinguish whether the event pertains to them based on the changedTouches property.
  10193. * @param (String) eventType the event type
  10194. */
  10195. createTouchEventListener : function(eventType) {
  10196. var self = this;
  10197. var touchPoints = {};
  10198. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  10199. var listener1 = function(event) {
  10200. for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
  10201. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10202. var touch = __exp_enFor0[__i_enFor0];
  10203. var node = touchPoints[touch.identifier];
  10204. if (node) {
  10205. node.dispatchEvent(event);
  10206. }
  10207. }
  10208. };
  10209. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener1)));
  10210. var listener2 = function(event) {
  10211. for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
  10212. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10213. var touch = __exp_enFor0[__i_enFor0];
  10214. var hit = self.findHit(touch.clientX, touch.clientY);
  10215. if (hit) {
  10216. touchPoints[touch.identifier] = hit;
  10217. }
  10218. }
  10219. };
  10220. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchstart", this.addNativeEventListener("touchstart", listener2)));
  10221. var listener3 = function(event) {
  10222. for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
  10223. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10224. var touch = __exp_enFor0[__i_enFor0];
  10225. delete touchPoints[touch.identifier];
  10226. }
  10227. };
  10228. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchend", this.addNativeEventListener("touchend", listener3)));
  10229. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("touchcancel", this.addNativeEventListener("touchcancel", listener3)));
  10230. return info;
  10231. },
  10232. /**
  10233. * Finds a scene node under the given coordinates.
  10234. * @param (double) x x coordinate
  10235. * @param (double) y y coordinate
  10236. * @return (com.ibm.rave.core.scene.SceneNode) the scene node under the coordinates, or <code>null</code> if none found
  10237. */
  10238. findHit : function(x, y) {
  10239. var root = this.renderer.root;
  10240. var nodeClientRect = root.rave_getOwner().getBoundingClientRect();
  10241. return root.rave_intersection(x - nodeClientRect.left, y - nodeClientRect.top);
  10242. },
  10243. /**
  10244. * Add a listener for native events.
  10245. * @param (String) eventType the event type
  10246. * @param (com.ibm.rave.render.event.NativeEventListener) listener the event listener
  10247. * @return (Object) a native object, typically the native listener, which will be used when calling {@link #this.removeNativeEventListener(String, Object)}
  10248. */
  10249. /** @expose */
  10250. addNativeEventListener : function(eventType, listener) {},
  10251. /**
  10252. * Removes a listener for native events.
  10253. * @param (String) eventType the event type
  10254. * @param (Object) nativeObject a native object received as the return value from {@link #this.addNativeEventListener(String, com_ibm_rave_render_event_NativeEventListener)}
  10255. */
  10256. /** @expose */
  10257. removeNativeEventListener : function(eventType, nativeObject) {}
  10258. });
  10259. com_ibm_rave_render_event_EventManager.isDescendant = function(ancestor, node) {
  10260. var parent = node;
  10261. while ((parent = parent.rave_getParentNode())) {
  10262. if (parent == ancestor) {
  10263. return true;
  10264. }
  10265. }
  10266. return false;
  10267. };
  10268. com_ibm_rave_render_event_EventManager.NativeListenerBundle = function(eventType, listener) {
  10269. this.eventType = eventType;
  10270. this.nativeListenerObject = listener;
  10271. };
  10272. /**
  10273. * Keeps a count of interested in a particular event type. When the count reaches 0, this event listener info can be disposed.
  10274. */
  10275. com_ibm_rave_render_event_EventManager.EventListenerInfo = com_ibm_rave_core_nativeImpl_Declare({
  10276. //bundles : null,
  10277. //eventType : null,
  10278. //em : null,
  10279. /** @expose */
  10280. nodeCount : 0,
  10281. constructor : function(em, eventType) {
  10282. this.bundles = [];
  10283. {
  10284. this.em = em;
  10285. this.eventType = eventType;
  10286. }
  10287. },
  10288. dispose : function() {
  10289. for (var __i_enFor0 = 0, __exp_enFor0 = this.bundles, __len_enFor0 = __exp_enFor0.length;
  10290. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10291. var bundle = __exp_enFor0[__i_enFor0];
  10292. this.em.removeNativeEventListener(bundle.eventType, bundle.nativeListenerObject);
  10293. }
  10294. },
  10295. addNode : function(node) {
  10296. this.nodeCount++;
  10297. },
  10298. removeNode : function(node) {
  10299. this.nodeCount--;
  10300. },
  10301. canDispose : function() {
  10302. return this.nodeCount == 0;
  10303. }
  10304. });
  10305. /**
  10306. * Property key for caching the type of event a node is listening to.
  10307. */
  10308. //com_ibm_rave_render_event_EventManager.CACHE_KEY_PREFIX = "__rave-eventmanager";
  10309. // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager
  10310. /************************************************************************
  10311. ** IBM Confidential
  10312. **
  10313. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10314. **
  10315. ** (C) Copyright IBM Corp. 2017
  10316. **
  10317. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10318. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10319. ************************************************************************/
  10320. // GENERATED
  10321. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10322. //@import com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache (runtime) // new
  10323. //@import com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache (runtime) // new
  10324. /**
  10325. * A manager for a scene node cache. Listens for events on a scene node item and updates the cache if needed.
  10326. */
  10327. var com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager = com_ibm_rave_core_nativeImpl_Declare({
  10328. //idCache : null,
  10329. //classCache : null,
  10330. constructor : function() {
  10331. this.idCache = new com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache();
  10332. this.classCache = new com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache();
  10333. },
  10334. /**
  10335. * Retrieve a single SceneNode from a cache, anywhere within this scene tree from the owner down.
  10336. * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
  10337. * @param (String) idString Unique id to search for in this entire scene tree, starting from the owner.
  10338. * @param (com.ibm.rave.core.scene.SceneNode) root root node of the DOM branch being used for lookup
  10339. * @return (com.ibm.rave.core.scene.SceneNode) SceneNode matching the passed unique id.
  10340. */
  10341. matchId : function(cacheId, idString, root) {
  10342. if (cacheId == 1000) {
  10343. var node = this.idCache.get(idString);
  10344. if (this.isDescendant(node, root)) {
  10345. return node;
  10346. }
  10347. }
  10348. return null;
  10349. },
  10350. isDescendant : function(node, root) {
  10351. if (node) {
  10352. var parent = node;
  10353. do {
  10354. if (parent == root) {
  10355. return true;
  10356. }
  10357. } while ((parent = parent.rave_getParentNode()));
  10358. }
  10359. return false;
  10360. },
  10361. /**
  10362. * Retrieve a list of SceneNodes with a particular class anywhere within this scene tree from the owner down.
  10363. * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
  10364. * @param (String) className className to search for in this entire scene tree, starting from the owner.
  10365. * @param (com.ibm.rave.core.scene.SceneNode) root Any matching node must have this node somewhere in its parent chain. May be null which will return all matching nodes.
  10366. * @return (Array) All SceneNodes matching the passed class.
  10367. */
  10368. matchClass : function(cacheId, className, root) {
  10369. var matches;
  10370. if (cacheId == 1001) {
  10371. var cached = this.classCache.get(className);
  10372. if (cached) {
  10373. for (var __i_enFor0 = 0, __exp_enFor0 = cached, __len_enFor0 = __exp_enFor0.length;
  10374. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10375. var node = __exp_enFor0[__i_enFor0];
  10376. if (this.isDescendant(node, root)) {
  10377. if (!matches) {
  10378. matches = [];
  10379. }
  10380. matches.push(node);
  10381. }
  10382. }
  10383. }
  10384. }
  10385. return matches;
  10386. },
  10387. /**
  10388. * Caching support to quickly search by ID. Add an id -> SceneNode map to this owner's cache. Dynamically creates the cache if one hasn't been created yet.
  10389. * @param value
  10390. * @param (Object) id
  10391. */
  10392. addToIDCache : function(node, id, addChildIds) {
  10393. if (id != null) {
  10394. this.idCache.add(""+(id), node);
  10395. if (addChildIds) {
  10396. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  10397. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10398. var child = __exp_enFor0[__i_enFor0];
  10399. this.addToIDCache(child, (child).getId(), true);
  10400. }
  10401. }
  10402. }
  10403. },
  10404. /**
  10405. * Add all classes on this node to the cache.
  10406. * @param (com.ibm.rave.core.scene.SceneNode) node
  10407. */
  10408. removeFromIdCache : function(node, id, removeFromChildren) {
  10409. this.idCache.remove$0(""+(id), node);
  10410. if (removeFromChildren && node.rave_hasChildNodes()) {
  10411. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  10412. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10413. var child = __exp_enFor0[__i_enFor0];
  10414. this.removeFromIdCache(child, (child).getId(), true);
  10415. }
  10416. }
  10417. },
  10418. afterUpdate : function(type, subType, key, newValue, oldValue, node) {
  10419. switch (type) {
  10420. case (1000):
  10421. if (subType == 2000) {
  10422. if ("id" == key) {
  10423. if (oldValue != null) {
  10424. this.removeFromIdCache(node, oldValue, false);
  10425. }
  10426. this.addToIDCache(node, newValue, false);
  10427. }
  10428. }
  10429. break;
  10430. case (1001):
  10431. if (subType == 2000) {
  10432. if ("id" == key) {
  10433. this.addToIDCache(node, newValue, false);
  10434. }
  10435. } else if (subType == 2001) {
  10436. } else if (subType == 3000) {
  10437. var id = node.getId();
  10438. if (id != null) {
  10439. this.addToIDCache(node, id, true);
  10440. }
  10441. }
  10442. break;
  10443. case (1002):
  10444. if (subType == 2000) {
  10445. if ("id" == key) {
  10446. this.removeFromIdCache(node, oldValue, false);
  10447. }
  10448. } else if (subType == 2001) {
  10449. } else if (subType == 3000) {
  10450. var id = node.getId();
  10451. this.removeFromIdCache(node, id, true);
  10452. }
  10453. break;
  10454. default:
  10455. break;
  10456. }
  10457. }
  10458. });
  10459. //com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager.ID = "id";
  10460. // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCache
  10461. /************************************************************************
  10462. ** IBM Confidential
  10463. **
  10464. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10465. **
  10466. ** (C) Copyright IBM Corp. 2017
  10467. **
  10468. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10469. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10470. ************************************************************************/
  10471. // GENERATED
  10472. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10473. /**
  10474. * An abstract class describing a caching mechanism for Scene Nodes. This cache is typically stored relative to the scene's root, meaning there is one cache per scene tree.
  10475. * @param < (java.lang.Object) V > The type of value that this cache is holding. Can be a single scene node or a set of scene nodes, etc.
  10476. */
  10477. var com_ibm_rave_render_internal_nodes_cache_SceneNodeCache = com_ibm_rave_core_nativeImpl_Declare({
  10478. //factory : null,
  10479. //cache : null,
  10480. _isReady : true,
  10481. constructor : function() {
  10482. this.cache = {};
  10483. },
  10484. /**
  10485. * Is this cache ready to accept nodes or not?
  10486. * @return (boolean) True if this cache is ready to accept nodes. False otherwise.
  10487. */
  10488. isReady : function() {
  10489. return this._isReady;
  10490. },
  10491. /**
  10492. * Add a node to this cache under 'key'.
  10493. * @param (String) key The key of the cache.
  10494. * @param (com.ibm.rave.core.scene.SceneNode) node The node to add
  10495. */
  10496. add : function(key, node) {
  10497. if (!(this.isReady()) || key == null) {
  10498. return null;
  10499. }
  10500. var container = this.get(key);
  10501. if (!container) {
  10502. container = this.factory(node);
  10503. this.cache[key] = container;
  10504. }
  10505. return container;
  10506. },
  10507. /**
  10508. * Add a node to the container of each 'key' in 'keys'.
  10509. * @param (Array) keys Multiple key names of the cache.
  10510. * @param (com.ibm.rave.core.scene.SceneNode) node The node to add to each key container.
  10511. */
  10512. addMany : function(keys, node) {
  10513. if (!(this.isReady()) || !keys) {
  10514. return null;
  10515. }
  10516. var setValues = keys;
  10517. for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
  10518. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10519. var key = setValues[__i_enFor0];
  10520. this.add(key, node);
  10521. }
  10522. return setValues;
  10523. },
  10524. /**
  10525. * Return the first matching node for this key from our cached set of nodes.
  10526. * @param (String) key The bucket to get a node from.
  10527. * @return (java.lang.Object) The first matching node for this key.
  10528. */
  10529. get : function(key) {
  10530. if (!(this.isReady()) || key == null) {
  10531. return null;
  10532. }
  10533. return this.cache[key];
  10534. },
  10535. /**
  10536. * Remove a node from the set of nodes under 'key' in this cache.
  10537. * @param (String) key The bucket to remove the node from.
  10538. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  10539. */
  10540. remove$0 : function(key, node) {
  10541. if (!(this.isReady()) || key == null) {
  10542. return;
  10543. }
  10544. delete this.cache[key];
  10545. },
  10546. /**
  10547. * Remove a node from multiple keys in this cache.
  10548. * @param (Array) keys The buckets to remove the node from.
  10549. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  10550. */
  10551. remove$1 : function(keys, node) {
  10552. if (!(this.isReady()) || !keys) {
  10553. return;
  10554. }
  10555. var setValues = keys;
  10556. for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
  10557. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10558. var key = setValues[__i_enFor0];
  10559. this.remove$0(key, node);
  10560. }
  10561. },
  10562. remove : function(a0, a1) {
  10563. var args = arguments;
  10564. if (args.length == 2 && (a0 == null || typeof a0 === "string")) {
  10565. return this.remove$0(a0, a1);
  10566. }
  10567. return this.remove$1(a0, a1);
  10568. }
  10569. //constructor : function() {}
  10570. });
  10571. // $source: com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache
  10572. /************************************************************************
  10573. ** IBM Confidential
  10574. **
  10575. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10576. **
  10577. ** (C) Copyright IBM Corp. 2017
  10578. **
  10579. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10580. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10581. ************************************************************************/
  10582. // GENERATED
  10583. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10584. //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
  10585. /**
  10586. * A cache that can hold only one node per key (id, for example)
  10587. */
  10588. var com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
  10589. /**
  10590. * A cache that can hold only one node per key (id, for example)
  10591. */
  10592. constructor : function() {
  10593. this.factory = function(node) {
  10594. return node;
  10595. };
  10596. }
  10597. });
  10598. // $source: com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache
  10599. /************************************************************************
  10600. ** IBM Confidential
  10601. **
  10602. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10603. **
  10604. ** (C) Copyright IBM Corp. 2017
  10605. **
  10606. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10607. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10608. ************************************************************************/
  10609. // GENERATED
  10610. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10611. //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
  10612. /**
  10613. * A cache that can hold multiple nodes per key (classes, for example)
  10614. */
  10615. var com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
  10616. /**
  10617. * A cache that can hold multiple nodes per key (classes, for example)
  10618. */
  10619. constructor : function() {
  10620. this.factory = function(node) {
  10621. return [];
  10622. };
  10623. },
  10624. add : function(className, node) {
  10625. var container = com_ibm_rave_render_internal_nodes_cache_SceneNodeCache.prototype.add.call(this, className, node);
  10626. if (className != null) {
  10627. container.push(node);
  10628. }
  10629. return container;
  10630. },
  10631. /**
  10632. * Remove a node from the set of nodes under 'key' in this cache.
  10633. * @param (String) className The bucket to remove the node from.
  10634. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  10635. */
  10636. remove$0 : function(className, node) {
  10637. var list = this.get(className);
  10638. if (list) {
  10639. var i = list.indexOf(node);
  10640. if (i >= 0) {
  10641. list.splice(i, 1);
  10642. }
  10643. }
  10644. }
  10645. });
  10646. // $source: com/ibm/rave/core/css/RaveCSSEngine
  10647. /************************************************************************
  10648. ** IBM Confidential
  10649. **
  10650. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10651. **
  10652. ** (C) Copyright IBM Corp. 2017
  10653. **
  10654. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10655. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10656. ************************************************************************/
  10657. // GENERATED
  10658. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  10659. //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parse
  10660. //@import com/ibm/rave/core/internal/css/CSSStyleSheetManager (runtime) // CSSStyleSheetManager
  10661. /**
  10662. * An implementation of the CSSEngine interface. Used to import external styles into the CSSStyleSheetManager.
  10663. * @see (com.ibm.rave.core.css.CSSEngine) CSSEngine
  10664. */
  10665. var com_ibm_rave_core_css_RaveCSSEngine = rave_externs["RaveCSSEngine"] = com_ibm_rave_core_nativeImpl_Declare({
  10666. //stylesheets : null,
  10667. constructor : function() {
  10668. this.stylesheets = [];
  10669. /**
  10670. * Creates a <code>RaveCSSEngine</code>
  10671. */
  10672. {}
  10673. },
  10674. /** @expose */
  10675. importCSS : function(cssText) {
  10676. var styleSheet = com_ibm_rave_core_internal_css_CSSParser.parse(cssText);
  10677. if (styleSheet) {
  10678. return this.importStyleSheet(styleSheet) ? styleSheet : null;
  10679. }
  10680. return null;
  10681. },
  10682. /** @expose */
  10683. importStyleSheets : function(styleSheets) {
  10684. if (styleSheets) {
  10685. var result = true;
  10686. for (var __i_enFor0 = 0, __exp_enFor0 = styleSheets, __len_enFor0 = __exp_enFor0.length;
  10687. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10688. var styleSheet = __exp_enFor0[__i_enFor0];
  10689. if (!(this.importStyleSheet(styleSheet))) {
  10690. result = false;
  10691. }
  10692. }
  10693. return result;
  10694. }
  10695. return false;
  10696. },
  10697. /** @expose */
  10698. importStyleSheet : function(styleSheet) {
  10699. if (styleSheet && !(this.stylesheets.indexOf(styleSheet)> -1)) {
  10700. com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.add(styleSheet);
  10701. this.stylesheets.push(styleSheet);
  10702. return true;
  10703. }
  10704. return false;
  10705. },
  10706. /** @expose */
  10707. styleSheets : function() {
  10708. return this.stylesheets;
  10709. },
  10710. /** @expose */
  10711. removeAllStyleSheets : function() {
  10712. this.stylesheets.length = 0;
  10713. com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.clear();
  10714. },
  10715. /** @expose */
  10716. removeStyleSheet : function(styleSheet) {
  10717. var index = this.stylesheets.indexOf(styleSheet);
  10718. if (index > -1) {
  10719. this.stylesheets.splice(index, 1);
  10720. return com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE.remove(styleSheet);
  10721. }
  10722. return false;
  10723. }
  10724. });
  10725. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/Module
  10726. /************************************************************************
  10727. ** IBM Confidential
  10728. **
  10729. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10730. **
  10731. ** (C) Copyright IBM Corp. 2014, 2016
  10732. **
  10733. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10734. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10735. ************************************************************************/
  10736. //@OnDemandLoad("rave-canvas")
  10737. //Must be the first import
  10738. //@import ./ModuleHeader
  10739. //Other module dependencies
  10740. //@import com/ibm/rave/core/internal/nativeImpl/Module
  10741. //@import com/ibm/rave/core/canvas/internal/nativeImpl/CanvasSelectionQueryEngine (static)
  10742. //@import com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine (static)
  10743. //@import com/ibm/rave/render/SceneItemFactory (static)
  10744. //@import com/ibm/rave/render/internal/nodes/RootSceneItem (static)
  10745. //@import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer (static)
  10746. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (static)
  10747. //@import com/ibm/rave/core/nativeImpl/Object (runtime)
  10748. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime)
  10749. //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager (runtime)
  10750. //@import com/ibm/rave/core/css/RaveCSSEngine (static)
  10751. function wrapEvent(e) {
  10752. if (!e) {
  10753. return null;
  10754. }
  10755. // create an event object
  10756. var event = {};
  10757. // mixin the native event properties into the new event object
  10758. com_ibm_rave_core_nativeImpl_Object.mixin(event, e);
  10759. // create new functions on the new event object because we cannot
  10760. // execute the mixin'd functions due to native constraints
  10761. // also because the generated code expects properties #immediatePropagationStopped
  10762. // and #propagationStopped
  10763. event.preventDefault = function () {
  10764. this.defaultPrevented = true;
  10765. };
  10766. event.stopImmediatePropagation = function () {
  10767. this.immediatePropagationStopped = true;
  10768. };
  10769. event.stopPropagation = function () {
  10770. this.propagationStopped = true;
  10771. };
  10772. return event;
  10773. }
  10774. function unwrapEvent(e, wrapped) {
  10775. // propagate event properties to the native event
  10776. if (wrapped.defaultPrevented) {
  10777. e.preventDefault();
  10778. }
  10779. if (wrapped.immediatePropagationStopped) {
  10780. e.stopImmediatePropagation();
  10781. }
  10782. if (wrapped.propagationStopped) {
  10783. e.stopPropagation();
  10784. }
  10785. return e;
  10786. }
  10787. (function () {
  10788. var config = rave.configuration;
  10789. // register the canvas scene item factory
  10790. var canvasFactory = new com_ibm_rave_render_SceneItemFactory();
  10791. config.setSceneNodeFactory("canvas", canvasFactory);
  10792. config.setSceneNodeFactory("http://www.w3.org/1999/xhtml:CANVAS", function (nsuri, name, context) {
  10793. var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
  10794. if (!rootProvider) {
  10795. var root = new com_ibm_rave_render_internal_nodes_RootSceneItem("canvas", context);
  10796. root.getBoundingClientRect = function () {
  10797. return context.getBoundingClientRect();
  10798. };
  10799. root._canvasNode = context;
  10800. root.rave_setOwner(context);
  10801. root.id = "__rave_canvas_root__";
  10802. context.rave_setProperty("__rave_canvas_root__", root);
  10803. // Override computeCTM so we include transformed tx (e) and ty (f) values
  10804. var _origCTM = root.computeCTM;
  10805. root.computeCTM = function (node, isScreenCTM) {
  10806. // To mimic SVG nodes in getScreenCTM() mode, append the
  10807. // canvas node's bounding left and top to the current CTM
  10808. var ctm = _origCTM(node, isScreenCTM);
  10809. if (context && isScreenCTM) {
  10810. var rect = context.getBoundingClientRect();
  10811. ctm.e += rect.left;
  10812. ctm.f += rect.top;
  10813. }
  10814. return ctm;
  10815. }
  10816. // This registers the new renderer with the root scene node.
  10817. var cacheManager = new com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager(root);
  10818. root.setRenderer(new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer(root));
  10819. root.setCacheManager(cacheManager);
  10820. rootProvider = {
  10821. getRoot: function () {
  10822. return root;
  10823. },
  10824. getCacheManager: function () {
  10825. return cacheManager;
  10826. }
  10827. };
  10828. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.addRootProvider(rootProvider);
  10829. }
  10830. var rootNode = rootProvider.getRoot();
  10831. var item = canvasFactory("canvas", name, rootNode);
  10832. return item;
  10833. });
  10834. // Query Engines
  10835. // Need to override the default query selector so we can select over multiple roots (svg and canvas)
  10836. var domQueryEngine = config.getQueryEngine(null);
  10837. var defaultCanvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine(domQueryEngine);
  10838. config.setQueryEngine(null, defaultCanvasQueryEngine);
  10839. config.setQueryEngine("http://www.w3.org/1999/xhtml", defaultCanvasQueryEngine);
  10840. var canvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CanvasSelectionQueryEngine(defaultCanvasQueryEngine);
  10841. config.setQueryEngine("canvas", canvasQueryEngine);
  10842. config.setQueryEngine("http://www.w3.org/1999/xhtml:CANVAS", canvasQueryEngine);
  10843. // For non-DOM nodes we need to wrap the event such that it can be modified by our own dispatcher
  10844. var oriDispatchEvent = com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent;
  10845. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent = function (e) {
  10846. var wrapped = wrapEvent(e),
  10847. result = oriDispatchEvent.call(this, wrapped);
  10848. unwrapEvent(e, wrapped);
  10849. return result;
  10850. };
  10851. // Override the CSS engine
  10852. rave.css = new com_ibm_rave_core_css_RaveCSSEngine();
  10853. // Add length property which calls the original length function
  10854. Object.defineProperty(com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl.prototype, 'length', {
  10855. get: function () {
  10856. return this.propNames.length;
  10857. }
  10858. });
  10859. /**
  10860. * Adjust canvas context transformation to compensate for screen and image
  10861. * buffer pixel density. This will help reduce fuzziness (anti-aliasing
  10862. * blur) in high ppi screens, e.g. Apple Retina displays, and in browsers
  10863. * that use odd pixel ratios in its backing image buffer.
  10864. *
  10865. * @param canvasSelection
  10866. * Rave selection containing the <canvas> node(s).
  10867. */
  10868. /** @expose */
  10869. rave.canvas.fixPixelDensity = function(canvasSelection) {
  10870. return canvasSelection.each(function() {
  10871. var bounds = this.getBoundingClientRect(),
  10872. ctx = this.getContext('2d'),
  10873. w = bounds.width,
  10874. h = bounds.height;
  10875. var dpr = window.devicePixelRatio || 1;
  10876. var bsr = ctx.webkitBackingStorePixelRatio ||
  10877. ctx.mozBackingStorePixelRatio ||
  10878. ctx.msBackingStorePixelRatio ||
  10879. ctx.oBackingStorePixelRatio ||
  10880. ctx.backingStorePixelRatio || 1;
  10881. var ratio = dpr / bsr;
  10882. this.width = w * ratio;
  10883. this.height = h * ratio;
  10884. this.style.width = w + "px";
  10885. this.style.height = h + "px";
  10886. ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
  10887. ctx.save();
  10888. this.rave_setProperty("__rave_canvas_ratio__", ratio);
  10889. });
  10890. }
  10891. })();
  10892. // This is the end of the factory method defined in the header. Added only during a full compiled JS build.
  10893. return rave;
  10894. }));})();