rave-canvas.js 297 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010
  1. (function() {
  2. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/ModuleHeader
  3. /************************************************************************
  4. ** IBM Confidential
  5. **
  6. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7. **
  8. ** (C) Copyright IBM Corp. 2014, 2015
  9. **
  10. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12. ************************************************************************/
  13. // setup
  14. var rave = window["rave"], rave_externs={},
  15. com_ibm_rave_core_Rave = rave,
  16. com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
  17. com_ibm_rave_core_nativeImpl_Object = rave["_"]["com_ibm_rave_core_nativeImpl_Object"],
  18. com_ibm_rave_core_geom_RectStruct = rave["internal"]["RectStruct"],
  19. com_ibm_rave_core_geom_RaveRect = rave["internal"]["RaveRect"],
  20. com_ibm_rave_core_transform_MatrixUtil = rave["internal"]["MatrixUtil"],
  21. rave_document = rave["_"]["rave_document"];
  22. // $source: com/ibm/rave/core/internal/util/CollectionsUtil
  23. /************************************************************************
  24. ** IBM Confidential
  25. **
  26. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  27. **
  28. ** (C) Copyright IBM Corp. 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. // GENERATED
  34. var com_ibm_rave_core_internal_util_CollectionsUtil = {
  35. //constructor : function() {}
  36. };
  37. /**
  38. * Removes the value from the list.
  39. * @param (Array) list the list to remove the value from
  40. * @param (Object) value the value to remove
  41. * @return (boolean) <code>true</code> if the value was found in the list, <code>false</code> otherwise
  42. */
  43. com_ibm_rave_core_internal_util_CollectionsUtil.remove = function(list, value) {
  44. var i = list.indexOf(value);
  45. if (i >= 0) {
  46. list.splice(i, 1);
  47. return true;
  48. }
  49. return false;
  50. };
  51. // $source: com/ibm/rave/core/internal/svg/SVGConstants
  52. /************************************************************************
  53. ** IBM Confidential
  54. **
  55. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  56. **
  57. ** (C) Copyright IBM Corp. 2015
  58. **
  59. ** The source code for this program is not published or otherwise divested of its trade secrets,
  60. ** irrespective of what has been deposited with the U.S. Copyright Office.
  61. ************************************************************************/
  62. // GENERATED
  63. var com_ibm_rave_core_internal_svg_SVGConstants = {
  64. };
  65. com_ibm_rave_core_internal_svg_SVGConstants.RECT = "rect";
  66. com_ibm_rave_core_internal_svg_SVGConstants.CIRCLE = "circle";
  67. com_ibm_rave_core_internal_svg_SVGConstants.LINE = "line";
  68. com_ibm_rave_core_internal_svg_SVGConstants.TEXT = "text";
  69. com_ibm_rave_core_internal_svg_SVGConstants.G = "g";
  70. com_ibm_rave_core_internal_svg_SVGConstants.PATH = "path";
  71. com_ibm_rave_core_internal_svg_SVGConstants.POLYGON = "polygon";
  72. com_ibm_rave_core_internal_svg_SVGConstants.POLYLINE = "polyline";
  73. com_ibm_rave_core_internal_svg_SVGConstants.DEFS = "defs";
  74. com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT = "linearGradient";
  75. com_ibm_rave_core_internal_svg_SVGConstants.STOP = "stop";
  76. com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT = "radialGradient";
  77. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing
  78. /************************************************************************
  79. ** IBM Confidential
  80. **
  81. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  82. **
  83. ** (C) Copyright IBM Corp. 2015
  84. **
  85. ** The source code for this program is not published or otherwise divested of its trade secrets,
  86. ** irrespective of what has been deposited with the U.S. Copyright Office.
  87. ************************************************************************/
  88. // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils (runtime)
  89. var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing = {
  90. /**
  91. * Split the points into curve segments.
  92. *
  93. * @param ctx
  94. * the canvas context
  95. * @param dash
  96. * the dash array
  97. * @param newPoints
  98. * an array to be filled with curve info
  99. * @param prevResidue
  100. * optional object containing previous dash info
  101. */
  102. splitToDashedBezier : function(points, dash, newPoints, prevResidue) {
  103. var residue = 0, t = 0, da, i = 0;
  104. if (prevResidue) {
  105. da = prevResidue.l;
  106. i = prevResidue.i;
  107. } else {
  108. da = dash[0];
  109. }
  110. while (t < 1) {
  111. // get the 't' corresponding to the given dash value.
  112. t = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.tAtLength(points, da);
  113. if (t == 1) {
  114. var rl = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.computeLength(points);
  115. residue = {
  116. l : da - rl,
  117. i : i
  118. };
  119. }
  120. // split bezier at t: left part is the "dash" curve, right part is the remaining bezier points
  121. var curves = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.splitBezierAtT(points, t);
  122. if (!(i % 2)) {
  123. // only keep the "dash" curve
  124. newPoints.push(curves[0]);
  125. }
  126. points = curves[1];
  127. ++i;
  128. da = dash[i % dash.length];
  129. }
  130. return residue;
  131. },
  132. /**
  133. * Builds a set of bezier (cubic || quadratic)CurveTo' canvas instructions
  134. * that represents a dashed stroke of the specified bezier geometry.
  135. *
  136. * @param ctx
  137. * the canvas context
  138. * @param dash
  139. * the dash array
  140. * @param x
  141. * the start x coordinate
  142. * @param y
  143. * the start y coordinate
  144. * @param points
  145. * the control points
  146. * @param prevResidue
  147. * optional object containing previous dash info
  148. */
  149. toDashedCurveTo : function(ctx, dash, x, y, points, prevResidue) {
  150. var pts = [x, y].concat(points), quadratic = points.length === 4, api = quadratic ? "quadraticCurveTo"
  151. : "bezierCurveTo", curves = [];
  152. var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.splitToDashedBezier(pts, dash, curves, prevResidue);
  153. for (var c = 0; c < curves.length; ++c) {
  154. var curve = curves[c];
  155. ctx.moveTo(curve[0], curve[1]);
  156. ctx[api].apply(ctx, curve.slice(2));
  157. }
  158. return residue;
  159. },
  160. /**
  161. * Builds a set of moveTo/lineTo' canvas instructions that represents a
  162. * dashed stroke of the specified line geometry.
  163. *
  164. * @param ctx
  165. * the canvas context
  166. * @param dash
  167. * the dash array
  168. * @param x1
  169. * the start x coordinate
  170. * @param y1
  171. * the start y coordinate
  172. * @param x2
  173. * the end x coordinate
  174. * @param y2
  175. * the end y coordinate
  176. * @param prevResidue
  177. * optional object containing previous dash info
  178. */
  179. toDashedLineTo : function(ctx, dash, x1, y1, x2, y2, prevResidue) {
  180. 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;
  181. if (prevResidue) {
  182. da = prevResidue.l;
  183. i = prevResidue.i;
  184. } else {
  185. da += dash[0];
  186. }
  187. while (Math.abs(1 - r) > 0) {
  188. if (da > tlength) {
  189. residue = {
  190. l : da - tlength,
  191. i : i
  192. };
  193. da = tlength;
  194. }
  195. r = da / tlength;
  196. x = x1 + (x2 - x1) * r;
  197. y = y1 + (y2 - y1) * r;
  198. if (!(i++ % 2)) {
  199. ctx.moveTo(prevx, prevy);
  200. ctx.lineTo(x, y);
  201. }
  202. prevx = x;
  203. prevy = y;
  204. da += dash[i % dash.length];
  205. }
  206. if (!residue && i) {
  207. residue = {l: dash[i % dash.length], i: i};
  208. }
  209. return residue;
  210. }
  211. };
  212. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils
  213. /************************************************************************
  214. ** IBM Confidential
  215. **
  216. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  217. **
  218. ** (C) Copyright IBM Corp. 2015
  219. **
  220. ** The source code for this program is not published or otherwise divested of its trade secrets,
  221. ** irrespective of what has been deposited with the U.S. Copyright Office.
  222. ************************************************************************/
  223. // From dojo without the gfx dependency.
  224. // Required to support non-native dashing.
  225. var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils = (function() {
  226. var bu = {},
  227. error = 0.1;
  228. bu.tAtLength = function(points, length){
  229. // summary:
  230. // Returns the t corresponding to the given length for the specified bezier curve.
  231. // points: Number[]
  232. // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
  233. // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
  234. // length: Number
  235. // The length.
  236. var t = 0,
  237. quadratic = points.length == 6,
  238. currentLen = 0,
  239. splitCount = 0,
  240. splitFunc = quadratic ? splitQBezierAtT : splitBezierAtT;
  241. var _compute = function(p, error){
  242. // control points polygon length
  243. var pLen = 0;
  244. for(var i = 0; i < p.length-2; i+=2)
  245. pLen += distance(p[i],p[i+1],p[i+2],p[i+3]);
  246. // chord length
  247. var chord = quadratic ?
  248. distance(points[0],points[1],points[4],points[5]) :
  249. distance(points[0],points[1],points[6],points[7]);
  250. // if needs more approx. or if currentLen is greater than the target length,
  251. // split the curve one more time
  252. if(pLen - chord > error || currentLen + pLen > length + error){
  253. ++splitCount;
  254. var newbezier = splitFunc(p, .5);
  255. // check 1st subpath
  256. _compute(newbezier[0], error);
  257. // the 1st subcurve was the good one, we stop
  258. if(Math.abs(currentLen - length) <= error){
  259. return;
  260. }
  261. // need to continue with the 2nde subcurve
  262. _compute(newbezier[1], error);
  263. return ;
  264. }
  265. currentLen += pLen;
  266. t += 1.0 / (1 << splitCount);
  267. };
  268. if(length)
  269. _compute(points, 0.5);
  270. return t;
  271. };
  272. var computeLength = bu.computeLength = function(/*Array*/points){
  273. // summary:
  274. // Returns the length of the given bezier curve.
  275. // points: Number[]
  276. // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
  277. // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
  278. var quadratic = points.length == 6, pLen=0;
  279. // control points polygon length
  280. for(var i = 0; i < points.length-2; i+=2)
  281. pLen += distance(points[i],points[i+1],points[i+2],points[i+3]);
  282. // chord length
  283. var chord = quadratic ?
  284. distance(points[0],points[1],points[4],points[5]) :
  285. distance(points[0],points[1],points[6],points[7]);
  286. // split polygons until the polygon and the chord are "the same"
  287. if(pLen-chord>error){
  288. var newBeziers = quadratic ? splitQBezierAtT(points,.5) : splitCBezierAtT(points,.5);
  289. var length = computeLength(newBeziers[0], quadratic);
  290. length += computeLength(newBeziers[1], quadratic);
  291. return length;
  292. }
  293. // pLen is close enough, done.
  294. return pLen;
  295. };
  296. var distance = bu.distance = function(x1, y1, x2, y2){
  297. // summary:
  298. // Returns the distance between the specified points.
  299. return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
  300. };
  301. var splitQBezierAtT = function(points, t){
  302. // summary:
  303. // Split a quadratic bezier curve into 2 sub-quadratic beziers at the specified t.
  304. // de Casteljau
  305. var r = 1-t,
  306. r2 = r*r,
  307. t2 = t*t,
  308. p1x = points[0],
  309. p1y = points[1],
  310. cx = points[2],
  311. cy = points[3],
  312. p2x = points[4],
  313. p2y = points[5],
  314. ax = r*p1x + t*cx,
  315. ay = r*p1y + t*cy,
  316. bx = r*cx + t*p2x,
  317. by = r*cy + t*p2y,
  318. px = r2*p1x + 2*r*t*cx + t2*p2x,
  319. py = r2*p1y + 2*r*t*cy + t2*p2y;
  320. return [
  321. [
  322. p1x, p1y,
  323. ax, ay,
  324. px, py
  325. ],
  326. [
  327. px, py,
  328. bx, by,
  329. p2x, p2y
  330. ]
  331. ];
  332. };
  333. var splitCBezierAtT = function(points, t){
  334. // summary:
  335. // Split a cubic bezier curve into 2 sub-cubic beziers at the specified t.
  336. // de Casteljau
  337. var r = 1-t,
  338. r2 = r*r,
  339. r3 = r2*r,
  340. t2 = t*t,
  341. t3 = t2*t,
  342. p1x = points[0],
  343. p1y = points[1],
  344. c1x = points[2],
  345. c1y = points[3],
  346. c2x = points[4],
  347. c2y = points[5],
  348. p2x = points[6],
  349. p2y = points[7],
  350. ax = r*p1x + t*c1x,
  351. ay = r*p1y + t*c1y,
  352. cx = r*c2x + t*p2x,
  353. cy = r*c2y + t*p2y,
  354. mx = r2*p1x + 2*r*t*c1x + t2*c2x,
  355. my = r2*p1y + 2*r*t*c1y + t2*c2y,
  356. nx = r2*c1x + 2*r*t*c2x + t2*p2x,
  357. ny = r2*c1y + 2*r*t*c2y + t2*p2y,
  358. px = r3*p1x + 3*r2*t*c1x + 3*r*t2*c2x+t3*p2x,
  359. py = r3*p1y + 3*r2*t*c1y + 3*r*t2*c2y+t3*p2y;
  360. return [
  361. [
  362. p1x, p1y,
  363. ax, ay,
  364. mx, my,
  365. px, py
  366. ],
  367. [
  368. px, py,
  369. nx, ny,
  370. cx, cy,
  371. p2x, p2y
  372. ]
  373. ];
  374. };
  375. var splitBezierAtT = bu.splitBezierAtT = function(points, t){
  376. return points.length == 6 ? splitQBezierAtT(points, t) : splitCBezierAtT(points, t);
  377. };
  378. return bu;
  379. })();
  380. // $source: com/ibm/rave/render/internal/RendererConfiguration
  381. /************************************************************************
  382. ** IBM Confidential
  383. **
  384. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  385. **
  386. ** (C) Copyright IBM Corp. 2015
  387. **
  388. ** The source code for this program is not published or otherwise divested of its trade secrets,
  389. ** irrespective of what has been deposited with the U.S. Copyright Office.
  390. ************************************************************************/
  391. // GENERATED
  392. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  393. /**
  394. * Configuration specific to native renderers and scene nodes.
  395. */
  396. var com_ibm_rave_render_internal_RendererConfiguration = com_ibm_rave_core_nativeImpl_Declare({
  397. //roots : null,
  398. constructor : function() {
  399. this.roots = [];
  400. },
  401. /**
  402. * Return all registered root providers.
  403. * @return (Array) A list of all registered root providers.
  404. */
  405. getRootProviders : function() {
  406. return this.roots;
  407. },
  408. /**
  409. * Return the root provider that contains a specific node.
  410. * @param (com.ibm.rave.core.scene.SceneNode) node Return the provider that contains this node.
  411. * @return (com.ibm.rave.render.internal.nodes.RootProvider) Matching root provider, or null if none found.
  412. */
  413. getRootProviderForNode : function(node) {
  414. for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
  415. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  416. var root = __exp_enFor0[__i_enFor0];
  417. if (node == root.getRoot().rave_getOwner()) {
  418. return root;
  419. }
  420. }
  421. return null;
  422. },
  423. /**
  424. * 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.
  425. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to add to the system.
  426. */
  427. addRootProvider : function(rootProvider) {
  428. this.roots.push(rootProvider);
  429. },
  430. /**
  431. * 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.
  432. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to remove from the system.
  433. */
  434. removeRootProvider : function(rootProvider) {
  435. var i = this.roots.indexOf(rootProvider);
  436. if (i >= 0) {
  437. this.roots.splice(i, 1);
  438. }
  439. },
  440. /**
  441. * Remove the root provider that contains a specific node.
  442. * @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.
  443. */
  444. removeRootProviderForNode : function(node) {
  445. var i = -1;
  446. var found = false;
  447. for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
  448. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  449. var root = __exp_enFor0[__i_enFor0];
  450. i++;
  451. if (node == root.getRoot().rave_getOwner()) {
  452. found = true;
  453. break;
  454. }
  455. }
  456. if (found) {
  457. this.roots.splice(i, 1);
  458. }
  459. }
  460. //constructor : function() {}
  461. });
  462. /**
  463. * Singleton instance of this renderer configuration.
  464. */
  465. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE = new com_ibm_rave_render_internal_RendererConfiguration();
  466. // $source: com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector
  467. /************************************************************************
  468. ** IBM Confidential
  469. **
  470. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  471. **
  472. ** (C) Copyright IBM Corp. 2015
  473. **
  474. ** The source code for this program is not published or otherwise divested of its trade secrets,
  475. ** irrespective of what has been deposited with the U.S. Copyright Office.
  476. ************************************************************************/
  477. // GENERATED
  478. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  479. //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
  480. //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
  481. /**
  482. * 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 {@link this.Elements#this.not()} </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>
  483. * @author Jonathan Hedley, jonathan@hedley.net
  484. * @see this.Element#this.select()
  485. */
  486. var com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector = com_ibm_rave_core_nativeImpl_Declare({
  487. //evaluator : null,
  488. //root : null,
  489. //cache : null,
  490. constructor : function(query, root, cache) {
  491. query = query.trim();
  492. this.evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(query);
  493. this.root = root;
  494. this.cache = cache;
  495. },
  496. select$1 : function() {
  497. return com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(this.evaluator, this.root, this.cache);
  498. },
  499. select : function() {
  500. var args = arguments;
  501. return this.select$1();
  502. }
  503. });
  504. /**
  505. * Find elements matching selector.
  506. * @param (String) query CSS selector
  507. * @param (com.ibm.rave.core.scene.SceneNode) root root element to descend into
  508. * @return (Array) matching elements, empty if not
  509. */
  510. com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0 = function(query, root, cache) {
  511. return new com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector(query, root, cache).select$1();
  512. };
  513. /**
  514. * Find elements matching selector.
  515. * @param (String) query CSS selector
  516. * @param (Array) roots root elements to descend into
  517. * @return (Array) matching elements, empty if not
  518. */
  519. com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$2 = function(query, roots, cache) {
  520. var elements = [];
  521. for (var __i_enFor0 = 0, __exp_enFor0 = roots, __len_enFor0 = __exp_enFor0.length;
  522. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  523. var root = __exp_enFor0[__i_enFor0];
  524. for (var __i_enFor1 = 0, __exp_enFor1 = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0(query, root, cache), __len_enFor1 = __exp_enFor1.length;
  525. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  526. var node = __exp_enFor1[__i_enFor1];
  527. if (elements.indexOf(node) < 0) {
  528. elements.push(node);
  529. }
  530. }
  531. }
  532. return elements;
  533. };
  534. com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select = function(a0, a1, a2) {
  535. var args = arguments;
  536. if (args.length == 3 && (a1 == null || Object.prototype.toString.call(a1) === "[object Array]")) {
  537. return com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$2(a0, a1, a2);
  538. }
  539. return com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0(a0, a1, a2);
  540. };
  541. // $source: com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine
  542. /************************************************************************
  543. ** IBM Confidential
  544. **
  545. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  546. **
  547. ** (C) Copyright IBM Corp. 2015
  548. **
  549. ** The source code for this program is not published or otherwise divested of its trade secrets,
  550. ** irrespective of what has been deposited with the U.S. Copyright Office.
  551. ************************************************************************/
  552. // GENERATED
  553. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  554. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  555. //@import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (static) // select
  556. /**
  557. * A CSS3 selection query engine for abstract scene tree/node type scene nodes.
  558. */
  559. var com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
  560. matches : function(context, selectorString) {
  561. return this.querySelector$0(selectorString, context);
  562. },
  563. querySelector$0 : function(match, rootNode) {
  564. if (match != null) {
  565. var results = this.querySelectorAll$1(match, rootNode);
  566. if (results.length > 0) {
  567. return results[0];
  568. }
  569. }
  570. return null;
  571. },
  572. querySelector$1 : function(match) {
  573. if (match != null) {
  574. var matches = this.querySelectorAll$0(match);
  575. if (matches && matches.length > 0) {
  576. return matches[0];
  577. }
  578. }
  579. return null;
  580. },
  581. querySelectorAll$0 : function(match) {
  582. return this.querySelectorAll$1(match, null);
  583. },
  584. querySelectorAll$1 : function(match, rootNode) {
  585. var results = [];
  586. if (match != null) {
  587. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, rootNode);
  588. }
  589. return results;
  590. },
  591. querySelector : function(a0, a1) {
  592. var args = arguments;
  593. if (args.length == 1) {
  594. return this.querySelector$1(a0);
  595. }
  596. return this.querySelector$0(a0, a1);
  597. },
  598. querySelectorAll : function(a0, a1) {
  599. var args = arguments;
  600. if (args.length == 1) {
  601. return this.querySelectorAll$0(a0);
  602. }
  603. return this.querySelectorAll$1(a0, a1);
  604. }
  605. });
  606. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll = function(results, match, rootNode) {
  607. if (rootNode) {
  608. var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(rootNode);
  609. var realRoot = rootNode;
  610. var cache = null;
  611. if (rootProvider) {
  612. cache = rootProvider.getCacheManager();
  613. realRoot = rootProvider.getRoot();
  614. }
  615. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0(match, realRoot, cache), __len_enFor0 = __exp_enFor0.length;
  616. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  617. var node = __exp_enFor0[__i_enFor0];
  618. results.push(node);
  619. }
  620. } else {
  621. var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.roots;
  622. for (var __i_enFor1 = 0, __exp_enFor1 = providers, __len_enFor1 = __exp_enFor1.length;
  623. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  624. var provider = __exp_enFor1[__i_enFor1];
  625. com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, provider.getRoot());
  626. }
  627. }
  628. };
  629. // $source: com/ibm/rave/render/internal/select/jsoup/select/QueryParser
  630. /************************************************************************
  631. ** IBM Confidential
  632. **
  633. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  634. **
  635. ** (C) Copyright IBM Corp. 2015
  636. **
  637. ** The source code for this program is not published or otherwise divested of its trade secrets,
  638. ** irrespective of what has been deposited with the U.S. Copyright Office.
  639. ************************************************************************/
  640. // GENERATED
  641. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  642. //@import com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator (runtime) // new
  643. //@import com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator (runtime) // new
  644. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (runtime) // new
  645. //@import com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue (runtime) // new, unescape
  646. /**
  647. * Parses a CSS selector into an Evaluator tree.
  648. */
  649. var com_ibm_rave_render_internal_select_jsoup_select_QueryParser = com_ibm_rave_core_nativeImpl_Declare({
  650. //tq : null,
  651. //evals : null,
  652. constructor : function(query) {
  653. this.evals = [];
  654. /**
  655. * Create a new QueryParser.
  656. * @param (String) query CSS query
  657. */
  658. {
  659. this.tq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(query);
  660. }
  661. },
  662. /**
  663. * Parse the query
  664. * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
  665. */
  666. parse$1 : function() {
  667. this.tq.consumeWhitespace();
  668. if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  669. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root());
  670. this.combinator(this.tq.consume$0());
  671. } else {
  672. if (!(this.findElements())) {
  673. return null;
  674. }
  675. }
  676. while (!(this.tq.isEmpty())) {
  677. var seenWhite = this.tq.consumeWhitespace();
  678. if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  679. this.combinator(this.tq.consume$0());
  680. } else if (seenWhite) {
  681. this.combinator(32);
  682. } else {
  683. if (!(this.findElements())) {
  684. return null;
  685. }
  686. }
  687. }
  688. if (this.evals.length == 1) {
  689. return this.evals[0];
  690. }
  691. return new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
  692. },
  693. combinator : function(combinator) {
  694. this.tq.consumeWhitespace();
  695. var subQuery = this.consumeSubQuery();
  696. var rootEval;
  697. var currentEval;
  698. var newEval = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery);
  699. var replaceRightMost = false;
  700. if (this.evals.length == 1) {
  701. rootEval = currentEval = this.evals[0];
  702. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(rootEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or) && combinator != 44) {
  703. currentEval = (currentEval).rightMostEvaluator();
  704. replaceRightMost = true;
  705. }
  706. } else {
  707. rootEval = currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
  708. }
  709. this.evals = [];
  710. if (combinator == 62) {
  711. 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)]);
  712. } else if (combinator == 32) {
  713. 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)]);
  714. } else if (combinator == 43) {
  715. 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)]);
  716. } else if (combinator == 126) {
  717. 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)]);
  718. } else if (combinator == 44) {
  719. var or;
  720. if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(currentEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or)) {
  721. or = currentEval;
  722. or.add(newEval);
  723. } else {
  724. or = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or(null);
  725. or.add(currentEval);
  726. or.add(newEval);
  727. }
  728. currentEval = or;
  729. } else {
  730. return;
  731. }
  732. if (replaceRightMost) {
  733. (rootEval).replaceRightMostEvaluator(currentEval);
  734. } else {
  735. rootEval = currentEval;
  736. }
  737. this.evals.push(rootEval);
  738. },
  739. consumeSubQuery : function() {
  740. var sq = "";
  741. while (!(this.tq.isEmpty())) {
  742. if (this.tq.matches("(")) {
  743. sq += "(" + this.tq.chompBalanced(40, 41) + ")";
  744. } else if (this.tq.matches("[")) {
  745. sq += "[" + this.tq.chompBalanced(91, 93) + "]";
  746. } else if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
  747. break;
  748. } else {
  749. sq += String.fromCharCode(this.tq.consume$0());
  750. }
  751. }
  752. return sq;
  753. },
  754. findElements : function() {
  755. if (this.tq.matchChomp("#")) {
  756. this.byId();
  757. } else if (this.tq.matchChomp(".")) {
  758. this.byClass();
  759. } else if (this.tq.matchesWord()) {
  760. this.byTag();
  761. } else if (this.tq.matches("[")) {
  762. this.byAttribute();
  763. } else if (this.tq.matchChomp("*")) {
  764. this.allElements();
  765. } else if (this.tq.matchChomp(":lt(")) {
  766. this.indexLessThan();
  767. } else if (this.tq.matchChomp(":gt(")) {
  768. this.indexGreaterThan();
  769. } else if (this.tq.matchChomp(":eq(")) {
  770. this.indexEquals();
  771. } else if (this.tq.matches(":has(")) {
  772. this.has();
  773. } else if (this.tq.matches(":contains(")) {
  774. this.contains(false);
  775. } else if (this.tq.matches(":containsOwn(")) {
  776. this.contains(true);
  777. } else if (this.tq.matches(":matches(")) {
  778. this.matches(false);
  779. } else if (this.tq.matches(":matchesOwn(")) {
  780. this.matches(true);
  781. } else if (this.tq.matches(":not(")) {
  782. this.not();
  783. } else if (this.tq.matchChomp(":nth-child(")) {
  784. this.cssNthChild(false, false);
  785. } else if (this.tq.matchChomp(":nth-last-child(")) {
  786. this.cssNthChild(true, false);
  787. } else if (this.tq.matchChomp(":nth-of-type(")) {
  788. this.cssNthChild(false, true);
  789. } else if (this.tq.matchChomp(":nth-last-of-type(")) {
  790. this.cssNthChild(true, true);
  791. } else if (this.tq.matchChomp(":first-child")) {
  792. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild());
  793. } else if (this.tq.matchChomp(":last-child")) {
  794. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild());
  795. } else if (this.tq.matchChomp(":first-of-type")) {
  796. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(0, 1));
  797. } else if (this.tq.matchChomp(":last-of-type")) {
  798. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(0, 1));
  799. } else if (this.tq.matchChomp(":only-child")) {
  800. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild());
  801. } else if (this.tq.matchChomp(":only-of-type")) {
  802. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType());
  803. } else if (this.tq.matchChomp(":empty")) {
  804. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty());
  805. } else if (this.tq.matchChomp(":root")) {
  806. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot());
  807. } else {
  808. return false;
  809. }
  810. return true;
  811. },
  812. byId : function() {
  813. var id = this.tq.consumeCssIdentifier();
  814. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id(id));
  815. },
  816. byClass : function() {
  817. var className = this.tq.consumeCssIdentifier();
  818. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class(className.trim()));
  819. },
  820. byTag : function() {
  821. var tagName = this.tq.consumeElementSelector();
  822. if (0 <= tagName.indexOf("|")) {
  823. tagName = tagName.replace("|", ":");
  824. }
  825. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag(tagName.trim().toLowerCase()));
  826. },
  827. byAttribute : function() {
  828. var cq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(this.tq.chompBalanced(91, 93));
  829. var key = cq.consumeToAny.apply(cq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals);
  830. cq.consumeWhitespace();
  831. if (cq.isEmpty()) {
  832. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute(key));
  833. } else {
  834. if (cq.matchChomp("=")) {
  835. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue(key, cq.remainder()));
  836. } else if (cq.matchChomp("!=")) {
  837. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot(key, cq.remainder()));
  838. } else if (cq.matchChomp("^=")) {
  839. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting(key, cq.remainder()));
  840. } else if (cq.matchChomp("$=")) {
  841. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding(key, cq.remainder()));
  842. } else if (cq.matchChomp("*=")) {
  843. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining(key, cq.remainder()));
  844. } else if (cq.matchChomp("~=")) {
  845. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching(key, new RegExp(cq.remainder(), "i")));
  846. } else {
  847. return;
  848. }
  849. }
  850. },
  851. allElements : function() {
  852. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements());
  853. },
  854. indexLessThan : function() {
  855. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan(this.consumeIndex()));
  856. },
  857. indexGreaterThan : function() {
  858. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan(this.consumeIndex()));
  859. },
  860. indexEquals : function() {
  861. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals(this.consumeIndex()));
  862. },
  863. cssNthChild : function(backwards, ofType) {
  864. var argS = this.tq.chompTo(")").trim().toLowerCase();
  865. var mAB = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_AB.exec(argS);
  866. var mB = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_B.exec(argS);
  867. var a, b;
  868. if ("odd" == argS) {
  869. a = 2;
  870. b = 1;
  871. } else if ("even" == argS) {
  872. a = 2;
  873. b = 0;
  874. } else if (mAB && mAB.length > 0) {
  875. a = mAB[3] != null ? ~~ (mAB[1].replace("^\\+", "")) : 1;
  876. b = mAB[4] != null ? ~~ (mAB[4].replace("^\\+", "")) : 1;
  877. } else if (mB && mB.length > 0) {
  878. a = 0;
  879. b = ~~ (mB[0].replace("^\\+", ""));
  880. } else {
  881. return;
  882. }
  883. if (ofType) {
  884. if (backwards) {
  885. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(a, b));
  886. } else {
  887. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(a, b));
  888. }
  889. } else {
  890. if (backwards) {
  891. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild(a, b));
  892. } else {
  893. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild(a, b));
  894. }
  895. }
  896. },
  897. consumeIndex : function() {
  898. var indexS = this.tq.chompTo(")").trim();
  899. return parseInt(indexS);
  900. },
  901. has : function() {
  902. this.tq.consume$1(":has");
  903. var subQuery = this.tq.chompBalanced(40, 41);
  904. 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)));
  905. },
  906. contains : function(own) {
  907. this.tq.consume$1(own ? ":containsOwn" : ":contains");
  908. var searchText = com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape(this.tq.chompBalanced(40, 41));
  909. if (own) {
  910. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText(searchText));
  911. } else {
  912. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText(searchText));
  913. }
  914. },
  915. matches : function(own) {
  916. this.tq.consume$1(own ? ":matchesOwn" : ":matches");
  917. var regex = this.tq.chompBalanced(40, 41);
  918. if (own) {
  919. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn(new RegExp(regex, "")));
  920. } else {
  921. this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches(new RegExp(regex, "")));
  922. }
  923. },
  924. not : function() {
  925. this.tq.consume$1(":not");
  926. var subQuery = this.tq.chompBalanced(40, 41);
  927. 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)));
  928. },
  929. parse : function() {
  930. var args = arguments;
  931. return this.parse$1();
  932. }
  933. });
  934. /**
  935. * Parse a CSS query into an Evaluator.
  936. * @param (String) query CSS query
  937. * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
  938. */
  939. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0 = function(query) {
  940. var p = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser(query);
  941. return p.parse$1();
  942. };
  943. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse = function(a0) {
  944. var args = arguments;
  945. return com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(a0);
  946. };
  947. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators = [",", ">", "+", "~", " "];
  948. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals = ["=", "!=", "^=", "$=", "*=", "~="];
  949. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_AB = new RegExp("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d*)?", "i");
  950. com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_B = new RegExp("(\\+|-)?(\\d+)", "");
  951. // $source: com/ibm/rave/render/internal/select/jsoup/select/Evaluator
  952. /************************************************************************
  953. ** IBM Confidential
  954. **
  955. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  956. **
  957. ** (C) Copyright IBM Corp. 2015
  958. **
  959. ** The source code for this program is not published or otherwise divested of its trade secrets,
  960. ** irrespective of what has been deposited with the U.S. Copyright Office.
  961. ************************************************************************/
  962. // GENERATED
  963. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  964. /**
  965. * Evaluates that an SceneNode matches the selector.
  966. */
  967. var com_ibm_rave_render_internal_select_jsoup_select_Evaluator = com_ibm_rave_core_nativeImpl_Declare({
  968. /**
  969. * Test if a SceneNode has been cached for this evaluator.
  970. * @param element The element being tested
  971. * @return (Array) list of cached scene nodes.
  972. */
  973. cached : function(manager) {
  974. return null;
  975. }
  976. //constructor : function() {},
  977. /**
  978. * Test if the SceneNode meets the evaluator's requirements.
  979. * @param (com.ibm.rave.core.scene.SceneNode) root Root of the matching subtree
  980. * @param SceneNode tested SceneNode
  981. */
  982. //matches : function(root, element) {}
  983. });
  984. /**
  985. * Evaluator for tag name
  986. */
  987. 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, {
  988. //tagName : null,
  989. constructor : function(tagName) {
  990. this.tagName = tagName;
  991. },
  992. matches : function(root, element) {
  993. if (root == element) {
  994. return false;
  995. }
  996. return (element.rave_getName() == this.tagName);
  997. }
  998. });
  999. /**
  1000. * Evaluator for SceneNode id
  1001. */
  1002. 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, {
  1003. //id : null,
  1004. constructor : function(id) {
  1005. this.id = id;
  1006. },
  1007. matches : function(root, element) {
  1008. return (this.id == (element).id);
  1009. },
  1010. cached : function(cache) {
  1011. if (!cache) {
  1012. return null;
  1013. }
  1014. var cached = cache.getOne(1000, this.id);
  1015. return !cached ? null : [cached];
  1016. }
  1017. });
  1018. /**
  1019. * Evaluator for SceneNode class
  1020. */
  1021. 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, {
  1022. //className : null,
  1023. constructor : function(className) {
  1024. this.className = className;
  1025. },
  1026. cached : function(cache) {
  1027. if (!cache) {
  1028. return null;
  1029. }
  1030. return cache.getMany(1001, this.className);
  1031. },
  1032. matches : function(root, element) {
  1033. return (element.rave_containsClass(this.className));
  1034. }
  1035. });
  1036. /**
  1037. * Abstract evaluator for attribute name/value matching
  1038. */
  1039. 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, {
  1040. //key : null,
  1041. //value : null,
  1042. isIdKey : false,
  1043. isClassKey : false,
  1044. constructor : function(key, value) {
  1045. this.key = key.trim().toLowerCase();
  1046. if (value != null) {
  1047. if ((value.match("^[\"'].*") && value.match(".*[\"']$"))) {
  1048. value = value.substring(1, value.length - 1);
  1049. }
  1050. this.value = value.trim();
  1051. }
  1052. if (this.key == "id") {
  1053. this.isIdKey = true;
  1054. } else if (this.key == "class") {
  1055. this.isClassKey = true;
  1056. }
  1057. },
  1058. cached : function(node) {
  1059. return null;
  1060. }
  1061. });
  1062. /**
  1063. * Evaluator for attribute name matching
  1064. */
  1065. 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, {
  1066. matches : function(root, element) {
  1067. if (root == element) {
  1068. return false;
  1069. }
  1070. if (this.isIdKey) {
  1071. return (element).id != null;
  1072. }
  1073. return element.getAttribute(this.key) != null;
  1074. },
  1075. cached : function(node) {
  1076. return null;
  1077. }
  1078. //constructor : function(key) {}
  1079. });
  1080. /**
  1081. * Evaluator for attribute name/value matching
  1082. */
  1083. 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, {
  1084. cached : function(cache) {
  1085. if (!cache) {
  1086. return null;
  1087. }
  1088. if (this.isIdKey) {
  1089. var cached = cache.getOne(1000, this.value);
  1090. return !cached ? null : [cached];
  1091. } else if (this.isClassKey) {
  1092. return cache.getMany(1001, this.value);
  1093. }
  1094. return null;
  1095. },
  1096. matches : function(root, element) {
  1097. if (root == element) {
  1098. return false;
  1099. }
  1100. if (this.isIdKey) {
  1101. return this.value == (element).id;
  1102. }
  1103. var val = element.getAttribute(this.key);
  1104. var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
  1105. return this.value.toUpperCase() == attributeValue.toUpperCase();
  1106. }
  1107. //constructor : function(key, value) {}
  1108. });
  1109. /**
  1110. * Evaluator for attribute name != value matching
  1111. */
  1112. 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, {
  1113. matches : function(root, element) {
  1114. var val = element.getAttribute(this.key);
  1115. var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
  1116. return !(this.value.toUpperCase() == attributeValue.toUpperCase());
  1117. }
  1118. //constructor : function(key, value) {}
  1119. });
  1120. /**
  1121. * Evaluator for attribute name/value matching (value prefix)
  1122. */
  1123. 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, {
  1124. matches : function(root, element) {
  1125. var attributeValue = element.getAttribute(this.key);
  1126. if (attributeValue == null) {
  1127. return false;
  1128. }
  1129. var elementValue = ""+(attributeValue);
  1130. return elementValue.match("^" + this.value + ".*");
  1131. }
  1132. //constructor : function(key, value) {}
  1133. });
  1134. /**
  1135. * Evaluator for attribute name/value matching (value ending)
  1136. */
  1137. 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, {
  1138. matches : function(root, element) {
  1139. var attributeVal = element.getAttribute(this.key);
  1140. if (attributeVal == null) {
  1141. return false;
  1142. }
  1143. var elementValue = ""+(attributeVal);
  1144. return elementValue.match(".*" + this.value + "$");
  1145. }
  1146. //constructor : function(key, value) {}
  1147. });
  1148. /**
  1149. * Evaluator for attribute name/value matching (value containing)
  1150. */
  1151. 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, {
  1152. matches : function(root, element) {
  1153. var attributeValue = element.getAttribute(this.key);
  1154. if (attributeValue == null) {
  1155. return false;
  1156. }
  1157. var elementValue = ""+(attributeValue);
  1158. return 0 <= elementValue.indexOf(this.value);
  1159. }
  1160. //constructor : function(key, value) {}
  1161. });
  1162. /**
  1163. * Evaluator for attribute name/value matching (value regex matching)
  1164. */
  1165. 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, {
  1166. //key : null,
  1167. //pattern : null,
  1168. constructor : function(key, pattern) {
  1169. this.key = key.trim().toLowerCase();
  1170. this.pattern = pattern;
  1171. },
  1172. matches : function(root, element) {
  1173. return element.getAttribute(this.key) != null && this.pattern.test(""+(element.getAttribute(this.key)));
  1174. }
  1175. });
  1176. /**
  1177. * Evaluator for any / all SceneNode matching
  1178. */
  1179. 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, {
  1180. matches : function(root, element) {
  1181. return element != root;
  1182. }
  1183. });
  1184. /**
  1185. * Abstract evaluator for sibling index matching
  1186. * @author ant
  1187. */
  1188. 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, {
  1189. index : 0,
  1190. constructor : function(index) {
  1191. this.index = index;
  1192. }
  1193. });
  1194. /**
  1195. * Evaluator for matching by sibling index number (e < idx)
  1196. */
  1197. 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, {
  1198. matches : function(root, element) {
  1199. return (element).getSiblingIndex() < this.index;
  1200. }
  1201. //constructor : function(index) {}
  1202. });
  1203. /**
  1204. * Evaluator for matching by sibling index number (e > idx)
  1205. */
  1206. 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, {
  1207. matches : function(root, element) {
  1208. return (element).getSiblingIndex() > this.index;
  1209. }
  1210. //constructor : function(index) {}
  1211. });
  1212. /**
  1213. * Evaluator for matching by sibling index number (e = idx)
  1214. */
  1215. 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, {
  1216. matches : function(root, element) {
  1217. return (element).getSiblingIndex() == this.index;
  1218. }
  1219. //constructor : function(index) {}
  1220. });
  1221. /**
  1222. * Evaluator for matching the last sibling (css :last-child)
  1223. */
  1224. 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, {
  1225. matches : function(root, element) {
  1226. var p = element.rave_getParentNode();
  1227. return element != root && p && ((element).getSiblingIndex() == p.rave_getChildNodes().length - 1);
  1228. }
  1229. });
  1230. 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, {
  1231. a : 0, b : 0,
  1232. constructor : function(a, b) {
  1233. this.a = a;
  1234. this.b = b;
  1235. },
  1236. matches : function(root, element) {
  1237. var p = element.rave_getParentNode();
  1238. if (!p) {
  1239. return false;
  1240. }
  1241. var pos = this.calculatePosition(root, element);
  1242. if (this.a == 0) {
  1243. return pos == this.b;
  1244. }
  1245. return (pos - this.b) * this.a >= 0 && (pos - this.b) % this.a == 0;
  1246. }
  1247. //calculatePosition : function(root, element) {}
  1248. });
  1249. 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, {
  1250. calculatePosition : function(root, element) {
  1251. var pos = 0;
  1252. var family = element.rave_getParentNode().rave_getChildNodes();
  1253. for (var i = (element).getSiblingIndex(); i < family.length; ++i) {
  1254. if (family[i].rave_getName() == element.rave_getName()) {
  1255. pos++;
  1256. }
  1257. }
  1258. return pos;
  1259. }
  1260. //constructor : function(a, b) {}
  1261. });
  1262. /**
  1263. * css pseudo class nth-of-type
  1264. */
  1265. 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, {
  1266. calculatePosition : function(root, element) {
  1267. var pos = 0;
  1268. var family = element.rave_getParentNode().rave_getChildNodes();
  1269. for (var i = 0; i < family.length; ++i) {
  1270. if (family[i].rave_getName() == element.rave_getName()) {
  1271. pos++;
  1272. }
  1273. if (family[i] == element) {
  1274. break;
  1275. }
  1276. }
  1277. return pos;
  1278. }
  1279. //constructor : function(a, b) {}
  1280. });
  1281. /**
  1282. * css-compatible Evaluator for :eq (css :nth-child)
  1283. * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
  1284. */
  1285. 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, {
  1286. calculatePosition : function(root, element) {
  1287. return (element).getSiblingIndex() + 1;
  1288. }
  1289. //constructor : function(a, b) {}
  1290. });
  1291. /**
  1292. * css pseudo class :nth-last-child)
  1293. * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
  1294. */
  1295. 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, {
  1296. calculatePosition : function(root, element) {
  1297. return element.rave_getParentNode().rave_getChildNodes().length - (element).getSiblingIndex();
  1298. }
  1299. //constructor : function(a, b) {}
  1300. });
  1301. /**
  1302. * Evaluator for matching the first sibling (css :first-child)
  1303. */
  1304. 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, {
  1305. matches : function(root, element) {
  1306. var p = element.rave_getParentNode();
  1307. return p && (element).getSiblingIndex() == 0;
  1308. }
  1309. });
  1310. /**
  1311. * css3 pseudo-class :root
  1312. * @see <a href="http://www.w3.org/TR/selectors/#root-pseudo">:root
  1313. * selector</a>
  1314. */
  1315. 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, {
  1316. matches : function(root, element) {
  1317. return !element.rave_getParentNode();
  1318. }
  1319. });
  1320. 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, {
  1321. matches : function(root, element) {
  1322. var p = element.rave_getParentNode();
  1323. return p && !element.rave_getPreviousSibling() && !element.rave_getNextSibling();
  1324. }
  1325. });
  1326. 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, {
  1327. matches : function(root, element) {
  1328. var p = element.rave_getParentNode();
  1329. if (!p) {
  1330. return false;
  1331. }
  1332. var pos = 0;
  1333. var family = p.rave_getChildNodes();
  1334. for (var i = 0; i < family.length; ++i) {
  1335. if (family[i].rave_getName() == element.rave_getName()) {
  1336. pos++;
  1337. }
  1338. }
  1339. return pos == 1;
  1340. }
  1341. });
  1342. 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, {
  1343. matches : function(root, element) {
  1344. return !(element.rave_hasChildNodes());
  1345. }
  1346. });
  1347. /**
  1348. * Evaluator for matching SceneNode (and its descendants) text
  1349. */
  1350. 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, {
  1351. //searchText : null,
  1352. constructor : function(searchText) {
  1353. this.searchText = searchText.toLowerCase();
  1354. },
  1355. matches : function(root, element) {
  1356. if (root == element) {
  1357. return false;
  1358. }
  1359. if (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)) {
  1360. return true;
  1361. }
  1362. for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1363. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1364. var child = __exp_enFor0[__i_enFor0];
  1365. if (this.matches(element, child)) {
  1366. return true;
  1367. }
  1368. }
  1369. return false;
  1370. }
  1371. });
  1372. /**
  1373. * Evaluator for matching SceneNode's own text
  1374. */
  1375. 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, {
  1376. //searchText : null,
  1377. constructor : function(searchText) {
  1378. this.searchText = searchText.toLowerCase();
  1379. },
  1380. matches : function(root, element) {
  1381. return (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText));
  1382. }
  1383. });
  1384. /**
  1385. * Evaluator for matching SceneNode (and its descendants) text with regex
  1386. */
  1387. 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, {
  1388. //pattern : null,
  1389. constructor : function(pattern) {
  1390. this.pattern = pattern;
  1391. },
  1392. matches : function(root, element) {
  1393. if (this.pattern.test(element.rave_getText())) {
  1394. return true;
  1395. }
  1396. for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1397. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1398. var child = __exp_enFor0[__i_enFor0];
  1399. if (this.matches(element, child)) {
  1400. return true;
  1401. }
  1402. }
  1403. return false;
  1404. }
  1405. });
  1406. /**
  1407. * Evaluator for matching SceneNode's own text with regex
  1408. */
  1409. 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, {
  1410. //pattern : null,
  1411. constructor : function(pattern) {
  1412. this.pattern = pattern;
  1413. },
  1414. matches : function(root, element) {
  1415. return this.pattern.test(element.rave_getText());
  1416. }
  1417. });
  1418. // $source: com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator
  1419. /************************************************************************
  1420. ** IBM Confidential
  1421. **
  1422. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1423. **
  1424. ** (C) Copyright IBM Corp. 2015
  1425. **
  1426. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1427. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1428. ************************************************************************/
  1429. // GENERATED
  1430. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1431. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // new, superclass
  1432. //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
  1433. /**
  1434. * Base structural evaluator.
  1435. */
  1436. 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, {
  1437. //evaluator : null
  1438. });
  1439. 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, {
  1440. matches : function(root, element) {
  1441. return root == element;
  1442. }
  1443. });
  1444. 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, {
  1445. constructor : function(evaluator) {
  1446. this.evaluator = evaluator;
  1447. },
  1448. matches : function(root, element) {
  1449. 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;
  1450. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1451. var e = __exp_enFor0[__i_enFor0];
  1452. if (e != element && this.evaluator.matches(root, e)) {
  1453. return true;
  1454. }
  1455. }
  1456. return false;
  1457. }
  1458. });
  1459. 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, {
  1460. constructor : function(evaluator) {
  1461. this.evaluator = evaluator;
  1462. },
  1463. matches : function(root, node) {
  1464. return !(this.evaluator.matches(root, node));
  1465. }
  1466. });
  1467. 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, {
  1468. constructor : function(evaluator) {
  1469. this.evaluator = evaluator;
  1470. },
  1471. matches : function(root, element) {
  1472. if (root == element) {
  1473. return false;
  1474. }
  1475. var parent = element.rave_getParentNode();
  1476. while (parent != root) {
  1477. if (this.evaluator.matches(root, parent)) {
  1478. return true;
  1479. }
  1480. parent = parent.rave_getParentNode();
  1481. }
  1482. return false;
  1483. }
  1484. });
  1485. 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, {
  1486. constructor : function(evaluator) {
  1487. this.evaluator = evaluator;
  1488. },
  1489. matches : function(root, element) {
  1490. if (root == element) {
  1491. return false;
  1492. }
  1493. var parent = element.rave_getParentNode();
  1494. return parent && this.evaluator.matches(root, parent);
  1495. }
  1496. });
  1497. 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, {
  1498. constructor : function(evaluator) {
  1499. this.evaluator = evaluator;
  1500. },
  1501. matches : function(root, element) {
  1502. if (root == element) {
  1503. return false;
  1504. }
  1505. var prev = element.rave_getPreviousSibling();
  1506. while (prev) {
  1507. if (this.evaluator.matches(root, prev)) {
  1508. return true;
  1509. }
  1510. prev = prev.rave_getPreviousSibling();
  1511. }
  1512. return false;
  1513. }
  1514. });
  1515. 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, {
  1516. constructor : function(evaluator) {
  1517. this.evaluator = evaluator;
  1518. },
  1519. matches : function(root, element) {
  1520. if (root == element) {
  1521. return false;
  1522. }
  1523. var prev = element.rave_getPreviousSibling();
  1524. return prev && this.evaluator.matches(root, prev);
  1525. }
  1526. });
  1527. // $source: com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor
  1528. /************************************************************************
  1529. ** IBM Confidential
  1530. **
  1531. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1532. **
  1533. ** (C) Copyright IBM Corp. 2015
  1534. **
  1535. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1536. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1537. ************************************************************************/
  1538. // GENERATED
  1539. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1540. /**
  1541. * Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.
  1542. */
  1543. var com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor = com_ibm_rave_core_nativeImpl_Declare({
  1544. //visitor : null,
  1545. /**
  1546. * Create a new traversor.
  1547. * @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.
  1548. */
  1549. constructor : function(visitor) {
  1550. this.visitor = visitor;
  1551. },
  1552. /**
  1553. * Start a depth-first traverse of the root and all of its descendants.
  1554. * @param (com.ibm.rave.core.scene.SceneNode) root the root node point to traverse.
  1555. */
  1556. traverse : function(root) {
  1557. if (!root) {
  1558. return;
  1559. }
  1560. var node = root;
  1561. var depth = 0;
  1562. this.visit(node, depth);
  1563. },
  1564. visit : function(node, depth) {
  1565. if (!node) {
  1566. return;
  1567. }
  1568. this.visitor.head(node, depth);
  1569. for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  1570. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1571. var child = __exp_enFor0[__i_enFor0];
  1572. this.visit(child, depth + 1);
  1573. }
  1574. this.visitor.tail(node, depth);
  1575. }
  1576. });
  1577. // $source: com/ibm/rave/render/internal/select/jsoup/select/Collector
  1578. /************************************************************************
  1579. ** IBM Confidential
  1580. **
  1581. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1582. **
  1583. ** (C) Copyright IBM Corp. 2015
  1584. **
  1585. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1586. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1587. ************************************************************************/
  1588. // GENERATED
  1589. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1590. //@import com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor (static) // new
  1591. /**
  1592. * Collects a list of elements that match the supplied criteria.
  1593. * @author Jonathan Hedley
  1594. */
  1595. var com_ibm_rave_render_internal_select_jsoup_select_Collector = com_ibm_rave_core_nativeImpl_Declare({
  1596. //constructor : function() {}
  1597. });
  1598. /**
  1599. * Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.
  1600. * @param (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) evaluator Evaluator to test elements against
  1601. * @param (com.ibm.rave.core.scene.SceneNode) root root of tree to descend
  1602. * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache
  1603. * @return (Array) list of matches; empty if none
  1604. */
  1605. com_ibm_rave_render_internal_select_jsoup_select_Collector.collect = function(evaluator, root, cache) {
  1606. var elements = [];
  1607. if (evaluator) {
  1608. var cachedVals = evaluator.cached(cache);
  1609. if (cachedVals) {
  1610. for (var __i_enFor0 = 0, __exp_enFor0 = cachedVals, __len_enFor0 = __exp_enFor0.length;
  1611. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1612. var node = __exp_enFor0[__i_enFor0];
  1613. elements.push(node);
  1614. }
  1615. } else {
  1616. 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);
  1617. }
  1618. }
  1619. return elements;
  1620. };
  1621. com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator = com_ibm_rave_core_nativeImpl_Declare({
  1622. //root : null,
  1623. //elements : null,
  1624. //evaluator : null,
  1625. constructor : function(root, elements, evaluator) {
  1626. this.root = root;
  1627. this.elements = elements;
  1628. this.evaluator = evaluator;
  1629. },
  1630. head : function(node, depth) {
  1631. if (this.evaluator && this.evaluator.matches(this.root, node)) {
  1632. this.elements.push(node);
  1633. }
  1634. },
  1635. tail : function(node, depth) {}
  1636. });
  1637. // $source: com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator
  1638. /************************************************************************
  1639. ** IBM Confidential
  1640. **
  1641. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1642. **
  1643. ** (C) Copyright IBM Corp. 2015
  1644. **
  1645. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1646. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1647. ************************************************************************/
  1648. // GENERATED
  1649. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1650. //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // superclass
  1651. /**
  1652. * Base combining (and, or) evaluator.
  1653. */
  1654. 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, {
  1655. //evaluators : null,
  1656. num : 0,
  1657. constructor : function(evaluators) {
  1658. this.evaluators = [];
  1659. {
  1660. if (evaluators) {
  1661. for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
  1662. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1663. var evaluator = __exp_enFor0[__i_enFor0];
  1664. this.evaluators.push(evaluator);
  1665. }
  1666. }
  1667. this.updateNumEvaluators();
  1668. }
  1669. },
  1670. rightMostEvaluator : function() {
  1671. return this.num > 0 ? this.evaluators[this.num - 1] : null;
  1672. },
  1673. replaceRightMostEvaluator : function(replacement) {
  1674. this.evaluators[this.num - 1] = replacement;
  1675. },
  1676. updateNumEvaluators : function() {
  1677. this.num = this.evaluators.length;
  1678. }
  1679. });
  1680. 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, {
  1681. matches : function(root, node) {
  1682. for (var i = 0; i < this.num; ++i) {
  1683. var s = this.evaluators[i];
  1684. if (!(s.matches(root, node))) {
  1685. return false;
  1686. }
  1687. }
  1688. return true;
  1689. }
  1690. //constructor : function(evaluators) {}
  1691. });
  1692. 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, {
  1693. /**
  1694. * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR.
  1695. * @param (Array) evaluators initial OR clause (these are wrapped into an AND evaluator).
  1696. */
  1697. constructor : function(evaluators) {
  1698. if (this.num > 1) {
  1699. this.evaluators.push(new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(evaluators));
  1700. } else if (evaluators) {
  1701. for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
  1702. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1703. var evaluator = __exp_enFor0[__i_enFor0];
  1704. this.evaluators.push(evaluator);
  1705. }
  1706. }
  1707. this.updateNumEvaluators();
  1708. },
  1709. add : function(e) {
  1710. this.evaluators.push(e);
  1711. this.updateNumEvaluators();
  1712. },
  1713. matches : function(root, node) {
  1714. for (var i = 0; i < this.num; ++i) {
  1715. var s = this.evaluators[i];
  1716. if (s.matches(root, node)) {
  1717. return true;
  1718. }
  1719. }
  1720. return false;
  1721. }
  1722. });
  1723. // $source: com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue
  1724. /************************************************************************
  1725. ** IBM Confidential
  1726. **
  1727. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1728. **
  1729. ** (C) Copyright IBM Corp. 2015
  1730. **
  1731. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1732. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1733. ************************************************************************/
  1734. // GENERATED
  1735. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  1736. //@import com/ibm/rave/render/internal/select/jsoup/helper/StringUtil (runtime) // isWhitespace, startsWith, regionMatches
  1737. /**
  1738. * A character queue with parsing helpers.
  1739. * @author Jonathan Hedley
  1740. */
  1741. var com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue = com_ibm_rave_core_nativeImpl_Declare({
  1742. //queue : null,
  1743. pos : 0,
  1744. /**
  1745. * Create a new TokenQueue.
  1746. * @param (String) data string of data to back queue.
  1747. */
  1748. constructor : function(data) {
  1749. this.queue = data;
  1750. },
  1751. /**
  1752. * Is the queue empty?
  1753. * @return (boolean) true if no data left in queue.
  1754. */
  1755. isEmpty : function() {
  1756. return this.remainingLength() == 0;
  1757. },
  1758. remainingLength : function() {
  1759. return this.queue.length - this.pos;
  1760. },
  1761. /**
  1762. * Tests if the next characters on the queue match the sequence. Case insensitive.
  1763. * @param (String) seq String to check queue for.
  1764. * @return (boolean) true if the next characters match.
  1765. */
  1766. matches : function(seq) {
  1767. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(this.queue, true, this.pos, seq, 0, seq.length);
  1768. },
  1769. /**
  1770. * Case sensitive match test.
  1771. * @param (String) seq string to case sensitively check for
  1772. * @return (boolean) true if matched, false if not
  1773. */
  1774. matchesCS : function(seq) {
  1775. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith(this.queue, seq, this.pos);
  1776. },
  1777. /**
  1778. * Tests if the next characters match any of the sequences. Case insensitive.
  1779. * @param (java.lang.String[]) seq list of strings to case insensitively check for
  1780. * @return (boolean) true of any matched, false if none did
  1781. */
  1782. matchesAny : function(seq) {
  1783. if (seq !== null || arguments.length > 1){
  1784. seq = Array.prototype.slice.call(arguments);
  1785. }
  1786. {
  1787. for (var __i_enFor0 = 0, __len_enFor0 = seq.length;
  1788. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1789. var s = seq[__i_enFor0];
  1790. if (this.matches(s)) {
  1791. return true;
  1792. }
  1793. }
  1794. return false;
  1795. }
  1796. },
  1797. /**
  1798. * Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue.
  1799. * @param (String) seq String to search for, and if found, remove from queue.
  1800. * @return (boolean) true if found and removed, false if not found.
  1801. */
  1802. matchChomp : function(seq) {
  1803. if (this.matches(seq)) {
  1804. this.pos += seq.length;
  1805. return true;
  1806. }
  1807. return false;
  1808. },
  1809. /**
  1810. * Tests if queue starts with a whitespace character.
  1811. * @return (boolean) if starts with whitespace
  1812. */
  1813. matchesWhitespace : function() {
  1814. return !(this.isEmpty()) && com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace(this.queue.charCodeAt(this.pos));
  1815. },
  1816. /**
  1817. * Test if the queue matches a word character (letter or digit).
  1818. * @return (boolean) if matches a word character
  1819. */
  1820. matchesWord : function() {
  1821. var t = new RegExp("[:#\\.\\*\\[ \\,\\(\\)\\~\\=\\$\\^\\-\\']+", "");
  1822. return !(t.test(this.queue.substring(this.pos, this.pos + 1)));
  1823. },
  1824. /**
  1825. * Consume one character off queue.
  1826. * @return (char) first character on queue.
  1827. */
  1828. consume$0 : function() {
  1829. return this.queue.charCodeAt(this.pos++);
  1830. },
  1831. /**
  1832. * 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.
  1833. * @param (String) seq sequence to remove from head of queue.
  1834. */
  1835. consume$1 : function(seq) {
  1836. var len = seq.length;
  1837. this.pos += len;
  1838. },
  1839. /**
  1840. * Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out.
  1841. * @param (String) seq String to end on (and not include in return, but leave on queue). <b>Case sensitive.</b>
  1842. * @return (String) The matched data consumed from queue.
  1843. */
  1844. consumeTo : function(seq) {
  1845. var offset = this.queue.indexOf(seq, this.pos);
  1846. if (offset != -1) {
  1847. var consumed = this.queue.substring(this.pos, offset);
  1848. this.pos += consumed.length;
  1849. return consumed;
  1850. }
  1851. return this.remainder();
  1852. },
  1853. /**
  1854. * Consumes to the first sequence provided, or to the end of the queue. Leaves the terminator on the queue.
  1855. * @param (java.lang.String[]) seq any number of terminators to consume to. <b>Case insensitive.</b>
  1856. * @return (String) consumed string
  1857. */
  1858. consumeToAny : function(seq) {
  1859. if (seq !== null || arguments.length > 1){
  1860. seq = Array.prototype.slice.call(arguments);
  1861. }
  1862. {
  1863. var start = this.pos;
  1864. while (!(this.isEmpty()) && !(this.matchesAny.apply(this, seq))) {
  1865. this.pos++;
  1866. }
  1867. var data = this.queue.substring(start, this.pos);
  1868. return data;
  1869. }
  1870. },
  1871. /**
  1872. * 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).
  1873. * @param (String) seq String to match up to, and not include in return, and to pull off queue. <b>Case sensitive.</b>
  1874. * @return (String) Data matched from queue.
  1875. */
  1876. chompTo : function(seq) {
  1877. var data = this.consumeTo(seq);
  1878. this.matchChomp(seq);
  1879. return data;
  1880. },
  1881. /**
  1882. * 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.
  1883. * @param (char) open opener
  1884. * @param (char) close closer
  1885. * @return (String) data matched from the queue
  1886. */
  1887. chompBalanced : function(open, close) {
  1888. var start = -1;
  1889. var end = -1;
  1890. var depth = 0;
  1891. var last = 0;
  1892. do {
  1893. if (this.isEmpty()) {
  1894. break;
  1895. }
  1896. var c = this.consume$0();
  1897. if (last == 0 || last != 92) {
  1898. if (c == open) {
  1899. depth++;
  1900. if (start == -1) {
  1901. start = this.pos;
  1902. }
  1903. } else if (c == close) {
  1904. depth--;
  1905. }
  1906. }
  1907. if (depth > 0 && last != 0) {
  1908. end = this.pos;
  1909. }
  1910. last = c;
  1911. } while (depth > 0);
  1912. return (end >= 0) ? this.queue.substring(start, end) : "";
  1913. },
  1914. /**
  1915. * Pulls the next run of whitespace characters of the queue.
  1916. */
  1917. consumeWhitespace : function() {
  1918. var seen = false;
  1919. while (this.matchesWhitespace()) {
  1920. this.pos++;
  1921. seen = true;
  1922. }
  1923. return seen;
  1924. },
  1925. /**
  1926. * Retrieves the next run of word type (letter or digit) off the queue.
  1927. * @return (String) String of word characters from queue, or empty string if none.
  1928. */
  1929. consumeWord : function() {
  1930. var start = this.pos;
  1931. while (this.matchesWord()) {
  1932. this.pos++;
  1933. }
  1934. return this.queue.substring(start, this.pos);
  1935. },
  1936. /**
  1937. * Consume an tag name off the queue (word or :, _, -)
  1938. * @return (String) tag name
  1939. */
  1940. consumeTagName : function() {
  1941. var start = this.pos;
  1942. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny(":", "_", "-"))) {
  1943. this.pos++;
  1944. }
  1945. return this.queue.substring(start, this.pos);
  1946. },
  1947. /**
  1948. * Consume a CSS element selector (tag name, but | instead of : for namespaces, to not conflict with :pseudo selects).
  1949. * @return (String) tag name
  1950. */
  1951. consumeElementSelector : function() {
  1952. var start = this.pos;
  1953. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("|", "_", "-"))) {
  1954. this.pos++;
  1955. }
  1956. return this.queue.substring(start, this.pos);
  1957. },
  1958. /**
  1959. * Consume a CSS identifier (ID or class) off the queue (letter, digit, -, _) http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
  1960. * @return (String) identifier
  1961. */
  1962. consumeCssIdentifier : function() {
  1963. var start = this.pos;
  1964. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("-", "_"))) {
  1965. this.pos++;
  1966. }
  1967. return this.queue.substring(start, this.pos);
  1968. },
  1969. /**
  1970. * Consume an attribute key off the queue (letter, digit, -, _, :")
  1971. * @return (String) attribute key
  1972. */
  1973. consumeAttributeKey : function() {
  1974. var start = this.pos;
  1975. while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("-", "_", ":"))) {
  1976. this.pos++;
  1977. }
  1978. return this.queue.substring(start, this.pos);
  1979. },
  1980. /**
  1981. * Consume and return whatever is left on the queue.
  1982. * @return (String) remained of queue.
  1983. */
  1984. remainder : function() {
  1985. var remainder = this.queue.substring(this.pos, this.queue.length);
  1986. this.pos = this.queue.length;
  1987. return remainder;
  1988. },
  1989. consume : function(a0) {
  1990. var args = arguments;
  1991. if (args.length == 0) {
  1992. return this.consume$0();
  1993. }
  1994. return this.consume$1(a0);
  1995. }
  1996. });
  1997. /**
  1998. * Unescaped a \ escaped string.
  1999. * @param (String) text backslash escaped string
  2000. * @return (String) unescaped string
  2001. */
  2002. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape = function(text) {
  2003. var out = "";
  2004. var last = 0;
  2005. for (var i = 0; i < text.length; ++i) {
  2006. var c = text.charCodeAt(i);
  2007. if (c == 92) {
  2008. if (last != 0 && last == 92) {
  2009. out += String.fromCharCode(c);
  2010. }
  2011. } else {
  2012. out += String.fromCharCode(c);
  2013. }
  2014. last = c;
  2015. }
  2016. return out.valueOf();
  2017. };
  2018. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.ESC = 92;
  2019. com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.NIL = 0;
  2020. // $source: com/ibm/rave/render/internal/select/jsoup/helper/StringUtil
  2021. /************************************************************************
  2022. ** IBM Confidential
  2023. **
  2024. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2025. **
  2026. ** (C) Copyright IBM Corp. 2015
  2027. **
  2028. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2029. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2030. ************************************************************************/
  2031. // GENERATED
  2032. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2033. /**
  2034. * A minimal String utility class. Designed for internal jsoup use only.
  2035. */
  2036. var com_ibm_rave_render_internal_select_jsoup_helper_StringUtil = com_ibm_rave_core_nativeImpl_Declare({
  2037. });
  2038. /**
  2039. * Tests if a code point is "whitespace" as defined in the HTML spec.
  2040. * @param (int) c code point to test
  2041. * @return (boolean) true if code point is whitespace, false otherwise
  2042. */
  2043. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace = function(c) {
  2044. return c == 32 || c == 9 || c == 10 || c == 12 || c == 13;
  2045. };
  2046. /**
  2047. * Translatable version of Java String#regionMaches().
  2048. * @param (String) original String to
  2049. * @param (boolean) ignoreCase ignore case or not
  2050. * @param (int) toffset starting offset of the original string
  2051. * @param (String) other the string to compare
  2052. * @param (int) ooffset starting offset of the subregion in the string
  2053. * @param (int) len number of chars to compare
  2054. * @return (boolean) true if regions match.
  2055. */
  2056. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches = function(original, ignoreCase, toffset, other, ooffset, len) {
  2057. if (original.length < toffset + len || original.length < ooffset + len) {
  2058. return false;
  2059. }
  2060. var substring1 = original.substring(toffset, toffset + len);
  2061. var substring2 = other.substring(ooffset, ooffset + len);
  2062. if (ignoreCase) {
  2063. return substring1.toLowerCase() == substring2.toLowerCase();
  2064. }
  2065. return substring1 == substring2;
  2066. };
  2067. /**
  2068. * @param (String) queue
  2069. * @param (String) seq
  2070. * @param (int) pos
  2071. * @return (boolean)
  2072. */
  2073. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith = function(queue, seq, pos) {
  2074. return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(queue, false, 0, seq, 0, pos);
  2075. };
  2076. com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.padding = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "];
  2077. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine
  2078. /************************************************************************
  2079. ** IBM Confidential
  2080. **
  2081. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2082. **
  2083. ** (C) Copyright IBM Corp. 2014, 2015
  2084. **
  2085. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2086. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2087. ************************************************************************/
  2088. // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2089. // @import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  2090. // @import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (runtime) // select
  2091. // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (runtime)
  2092. /*
  2093. * This class provides query support at the DOM level and into the canvas scene tree allowing
  2094. * query selectors to cross the boundary from DOM to non-DOM.
  2095. *
  2096. * Example:
  2097. * "body .visualization .axis text"
  2098. *
  2099. * Lets assume that ".axis text" is within a canvas.
  2100. *
  2101. * Start by executing this query against the DOM. No matches.
  2102. * Then for each root provider, execute the same query. No matches.
  2103. *
  2104. * Breakdown the query into parts: ['body', '.visualization', '.axis', 'text']
  2105. *
  2106. * Remove the last part and execute the query on the DOM, ".body .visualization .axis". No matches.
  2107. * Remove the last part again and execute the query on the DOM, ".body .visualization". We have a match.
  2108. *
  2109. * Now that we have a match reconstruct a query from the removed parts: ".axis text"
  2110. * Find all root providers which are descendants of the DOM query matches.
  2111. *
  2112. * For all root providers which are descendants, execute the query ".axis text". We have a match.
  2113. * Add the matches to the result.
  2114. *
  2115. * Keep breaking down the original query and performing the above steps until the query is empty.
  2116. *
  2117. * All the while making sure not to add duplicates to the results.
  2118. *
  2119. */
  2120. var com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine = (function() {
  2121. return com_ibm_rave_core_nativeImpl_Declare({
  2122. constructor : function(domQueryEngine) {
  2123. this._domQueryEngine = domQueryEngine;
  2124. this._renderQueryEngine = new com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine();
  2125. },
  2126. matches : function(context, query) {
  2127. return this._domQueryEngine.matches(context, query) || this.querySelector(query, context) != null;
  2128. },
  2129. querySelector : function(query, rootNode) {
  2130. var result = this._domQueryEngine.querySelector(query, rootNode);
  2131. if (result) {
  2132. return result;
  2133. }
  2134. // TODO optimize
  2135. var result = this.querySelectorAll(query, rootNode);
  2136. if (result && result.length) {
  2137. return result[0];
  2138. }
  2139. },
  2140. querySelectorAll : function(query, rootNode) {
  2141. rootNode = rootNode || rave_document;
  2142. var results = this._domQueryEngine.querySelectorAll(query, rootNode);
  2143. if (!results.concat) {
  2144. // since results from the DOM query engine is a NodeList,
  2145. // convert it to an array such that we can use the Array#concat method
  2146. results = Array.prototype.slice.call(results, 0)
  2147. }
  2148. var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
  2149. for (var i = 0; i < providers.length; i++) {
  2150. // Add jsoup selection to results
  2151. var matches = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(query, providers[i].getRoot(), providers[i].getCacheManager());
  2152. if (matches && matches.length) {
  2153. results = results.concat(matches);
  2154. }
  2155. }
  2156. // break up the original query into parts
  2157. var queryParts = query.split(' ');
  2158. if (queryParts.length > 1) {
  2159. // this array holds all the query parts we pop
  2160. var endParts = [];
  2161. while (queryParts.length > 1) {
  2162. // remove a query part and insert it at the start of the endParts
  2163. endParts.unshift(queryParts.pop());
  2164. // construct the inner query from the end parts
  2165. var innerQuery = endParts.join(' ');
  2166. // execute the broken down query on the DOM
  2167. var partialFind = this._domQueryEngine.querySelectorAll(queryParts.join(' '), rootNode);
  2168. if (partialFind && partialFind.length) {
  2169. // if we have matches we need to identify root providers were are descendants of the matches
  2170. for (var i = 0; i < providers.length; i++) {
  2171. var provider = providers[i];
  2172. for (var j = 0; j < partialFind.length; j++) {
  2173. // check if the root node is a child of any partial find
  2174. var nodeToCompare = partialFind[j],
  2175. parent = provider.getRoot().rave_getOwner();
  2176. do {
  2177. if (parent == nodeToCompare) {
  2178. break;
  2179. }
  2180. } while (parent = parent.parentNode);
  2181. if (parent) {
  2182. // we have a match
  2183. // now perform the remainder of the query on the provider's root node
  2184. var innerResults = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(innerQuery, provider.getRoot(), provider.getCacheManager())
  2185. if (innerResults && innerResults.length) {
  2186. for (var k = 0; k < innerResults.length; k++) {
  2187. // don't add duplicates
  2188. if (results.indexOf(innerResults[k]) == -1) {
  2189. results.push(innerResults[k]);
  2190. }
  2191. }
  2192. }
  2193. break;
  2194. }
  2195. }
  2196. }
  2197. }
  2198. }
  2199. }
  2200. return results;
  2201. }
  2202. });
  2203. })();
  2204. // $source: com/ibm/rave/render/internal/SceneItemFactory
  2205. /************************************************************************
  2206. ** IBM Confidential
  2207. **
  2208. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2209. **
  2210. ** (C) Copyright IBM Corp. 2015
  2211. **
  2212. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2213. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2214. ************************************************************************/
  2215. // GENERATED
  2216. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2217. //@import com/ibm/rave/render/internal/nodes/RectSceneItem (runtime) // new
  2218. //@import com/ibm/rave/render/internal/nodes/CircleSceneItem (runtime) // new
  2219. //@import com/ibm/rave/render/internal/nodes/LineSceneItem (runtime) // new
  2220. //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
  2221. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (runtime) // new
  2222. //@import com/ibm/rave/render/internal/nodes/PathSceneItem (runtime) // new
  2223. //@import com/ibm/rave/render/internal/nodes/PolygonSceneItem (runtime) // new
  2224. //@import com/ibm/rave/render/internal/nodes/PolylineSceneItem (runtime) // new
  2225. //@import com/ibm/rave/render/internal/DefsSceneItem (runtime) // new
  2226. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  2227. //@import com/ibm/rave/render/internal/nodes/LinearGradientSceneItem (runtime) // new
  2228. //@import com/ibm/rave/render/internal/nodes/RadialGradientSceneItem (runtime) // new
  2229. //@import com/ibm/rave/render/internal/nodes/StopSceneItem (runtime) // new
  2230. var com_ibm_rave_render_internal_SceneItemFactory = com_ibm_rave_core_nativeImpl_Declare({
  2231. _$functionClassMethod : function() {
  2232. var _$self = function(nsuri, name, parentContext) {
  2233. if ("rect" == name) {
  2234. return new com_ibm_rave_render_internal_nodes_RectSceneItem(nsuri, parentContext);
  2235. } else if ("circle" == name) {
  2236. return new com_ibm_rave_render_internal_nodes_CircleSceneItem(nsuri, parentContext);
  2237. } else if ("line" == name) {
  2238. return new com_ibm_rave_render_internal_nodes_LineSceneItem(nsuri, parentContext);
  2239. } else if ("text" == name) {
  2240. return new com_ibm_rave_render_internal_nodes_TextSceneItem(nsuri, parentContext);
  2241. } else if ("g" == name) {
  2242. return new com_ibm_rave_render_internal_nodes_GroupSceneItem(nsuri, parentContext);
  2243. } else if ("path" == name) {
  2244. return new com_ibm_rave_render_internal_nodes_PathSceneItem(nsuri, parentContext);
  2245. } else if ("polygon" == name) {
  2246. return new com_ibm_rave_render_internal_nodes_PolygonSceneItem(nsuri, parentContext);
  2247. } else if ("polyline" == name) {
  2248. return new com_ibm_rave_render_internal_nodes_PolylineSceneItem(nsuri, parentContext);
  2249. } else if ("defs" == name) {
  2250. return new com_ibm_rave_render_internal_DefsSceneItem(nsuri, parentContext);
  2251. } else if (com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT == name) {
  2252. return new com_ibm_rave_render_internal_nodes_LinearGradientSceneItem(nsuri, parentContext);
  2253. } else if (com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT == name) {
  2254. return new com_ibm_rave_render_internal_nodes_RadialGradientSceneItem(nsuri, parentContext);
  2255. } else if ("stop" == name) {
  2256. return new com_ibm_rave_render_internal_nodes_StopSceneItem(nsuri, parentContext);
  2257. }
  2258. return null;
  2259. };
  2260. return _$self;
  2261. }
  2262. });
  2263. // $source: com/ibm/rave/core/scene/SceneNode
  2264. /************************************************************************
  2265. ** IBM Confidential
  2266. **
  2267. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2268. **
  2269. ** (C) Copyright IBM Corp. 2015
  2270. **
  2271. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2272. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2273. ************************************************************************/
  2274. // GENERATED
  2275. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2276. //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
  2277. /**
  2278. * The base type for all nodes.
  2279. */
  2280. var com_ibm_rave_core_scene_SceneNode = rave_externs["SceneNode"] = com_ibm_rave_core_nativeImpl_Declare({
  2281. /**
  2282. * Get the parent of this node.
  2283. * @return (com.ibm.rave.core.scene.SceneNode) the parent of this node, or <code>null</code> if this node has no parent.
  2284. */
  2285. /** @expose */
  2286. rave_getParentNode : function() {
  2287. return this.rave_getParentNode.call(this);
  2288. },
  2289. /**
  2290. * 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.
  2291. * @return (com.ibm.rave.core.scene.SceneNode) the owner node
  2292. */
  2293. /** @expose */
  2294. rave_getOwner : function() {},
  2295. /**
  2296. * Set the node's owner node.
  2297. * @param (com.ibm.rave.core.scene.SceneNode) owner the owner node
  2298. * @see #this.getOwner()
  2299. */
  2300. /** @expose */
  2301. rave_setOwner : function(owner) {},
  2302. /**
  2303. * Set this node's parent. Clients should not call this method directly.
  2304. * @param (com.ibm.rave.core.scene.SceneNode) parent the parent node, may be <code>null</code>
  2305. */
  2306. /** @expose */
  2307. rave_setParentNode : function(parent) {},
  2308. /**
  2309. * Appends the given node to the end of the children.
  2310. * @param (com.ibm.rave.core.scene.SceneNode) node the node to append
  2311. */
  2312. /** @expose */
  2313. rave_appendChild : function(node) {
  2314. this.appendChild.call(this, node);
  2315. },
  2316. /**
  2317. * Does this node have children.
  2318. * @return (boolean) <code>true</code> if this node has children, <code>false</code> otherwise
  2319. */
  2320. /** @expose */
  2321. rave_hasChildNodes : function() {
  2322. return this.rave_hasChildNodes.call(this);
  2323. },
  2324. /**
  2325. * Get the children of this node.
  2326. * @return (Array) a list of child nodes
  2327. */
  2328. /** @expose */
  2329. rave_getChildNodes : function() {
  2330. return this.rave_getChildNodes.call(this);
  2331. },
  2332. /**
  2333. * Get this node's next sibling.
  2334. * @return (com.ibm.rave.core.scene.SceneNode) The next sibling node, or <code>null</code> if the parent contains no more nodes.
  2335. */
  2336. /** @expose */
  2337. rave_getNextSibling : function() {
  2338. return this.rave_getNextSibling.call(this);
  2339. },
  2340. /**
  2341. * Get this node's first child.
  2342. * @return (com.ibm.rave.core.scene.SceneNode) The first child node, or <code>null</code> if this node has no children.
  2343. */
  2344. /** @expose */
  2345. rave_getFirstChild : function() {
  2346. return this.rave_getFirstChild.call(this);
  2347. },
  2348. /**
  2349. * Get this node's previous sibling.
  2350. * @return (com.ibm.rave.core.scene.SceneNode) The previous sibling node, or <code>null</code> if the parent contains no more nodes.
  2351. */
  2352. /** @expose */
  2353. rave_getPreviousSibling : function() {
  2354. return this.rave_getPreviousSibling.call(this);
  2355. },
  2356. /**
  2357. * Insert the given node before the other specified node.
  2358. * @param (com.ibm.rave.core.scene.SceneNode) node the node to insert
  2359. * @param (com.ibm.rave.core.scene.SceneNode) before the node to insert before
  2360. */
  2361. /** @expose */
  2362. rave_insertBefore : function(node, before) {
  2363. this.insertBefore.call(this, node, before);
  2364. },
  2365. /**
  2366. * Set the text content.
  2367. * @param (String) text the text content
  2368. */
  2369. /** @expose */
  2370. rave_setText : function(text) {
  2371. this.rave_setText.call(this, text);
  2372. },
  2373. /**
  2374. * Removes the node from the list of children.
  2375. * @param (com.ibm.rave.core.scene.SceneNode) node the node to remove
  2376. * @return (boolean) <code>true</code> if the node was a child node and removed, <code>false</code> otherwise
  2377. */
  2378. /** @expose */
  2379. removeChild : function(node) {
  2380. return this.removeChild.call(this, node);
  2381. },
  2382. /**
  2383. * Set the style for the given name.
  2384. * @param (String) styleName the style name
  2385. * @param (Object) value the style value
  2386. * @param (String) priority the style priority (ie, "important")
  2387. */
  2388. /** @expose */
  2389. rave_setStyle : function(styleName, value, priority) {
  2390. this.rave_setStyle.call(this, styleName, value, priority);
  2391. },
  2392. /**
  2393. * Dispatches an event on this node.
  2394. * @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event the triggering event
  2395. * @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
  2396. */
  2397. /** @expose */
  2398. dispatchEvent : function(event) {},
  2399. /**
  2400. * Retrieve the event listener for the given event type.
  2401. * @param (String) eventType the event type
  2402. * @return (com.ibm.rave.core.event.EventListener) the event listener, may be <code>null</code>
  2403. */
  2404. /** @expose */
  2405. rave_getEventListener : function(eventType) {},
  2406. /**
  2407. * Removes all event listeners for the given qualifier.
  2408. * @param (String) group a qualifier to the event type for grouping like events
  2409. */
  2410. /** @expose */
  2411. rave_removeEventListeners : function(group) {},
  2412. /**
  2413. * Get the attribute value for the given attribute name.
  2414. * @param (String) attribute the attribute name
  2415. * @return (Object) the attribute value
  2416. */
  2417. /** @expose */
  2418. getAttribute : function(attribute) {},
  2419. /**
  2420. * Get the attribute value for the given attribute name.
  2421. * @param (String) namespace the namespace
  2422. * @param (String) attribute the attribute name
  2423. * @return (Object) the attribute value
  2424. */
  2425. /** @expose */
  2426. getAttributeNS : function(namespace, attribute) {},
  2427. /**
  2428. * Set the attribute value for the given attribute.
  2429. * @param (String) namespace the namespace
  2430. * @param (String) attribute the attribute name
  2431. * @param (Object) value the attribute value
  2432. */
  2433. /** @expose */
  2434. setAttributeNS : function(namespace, attribute, value) {},
  2435. /**
  2436. * Remove the attribute for the given attribute name.
  2437. * @param (String) attribute the attribute name
  2438. */
  2439. /** @expose */
  2440. removeAttribute : function(attribute) {},
  2441. /**
  2442. * Remove the attribute for the given attribute name.
  2443. * @param (String) namespace the namespace
  2444. * @param (String) attribute the attribute name
  2445. */
  2446. /** @expose */
  2447. removeAttributeNS : function(namespace, attribute) {},
  2448. /**
  2449. * Get the style for the given name.
  2450. * @param (String) styleName the style name
  2451. * @return (Object) the style value
  2452. */
  2453. /** @expose */
  2454. rave_getStyle : function(styleName) {},
  2455. /**
  2456. * Get the computed style for the given name.
  2457. * @param (String) styleName the style name
  2458. * @return (Object) the computed style value
  2459. */
  2460. /** @expose */
  2461. rave_getComputedStyle : function(styleName) {},
  2462. /**
  2463. * Remove the style for the given name.
  2464. * @param (String) styleName the style name
  2465. */
  2466. /** @expose */
  2467. rave_removeStyle : function(styleName) {},
  2468. /**
  2469. * Get the text content.
  2470. * @return (String) the text content
  2471. */
  2472. /** @expose */
  2473. rave_getText : function() {},
  2474. /**
  2475. * Get the html content.
  2476. * @return (String) the html content
  2477. */
  2478. /** @expose */
  2479. rave_getHtml : function() {},
  2480. /**
  2481. * Set the html content.
  2482. * @param (String) html the html content
  2483. */
  2484. /** @expose */
  2485. rave_setHtml : function(html) {},
  2486. /**
  2487. * Query whether the CSS class is set on the node.
  2488. * @param (String) className the class to query
  2489. * @return (boolean) <code>true</code> if the class is set, <code>false</code> otherwise
  2490. */
  2491. /** @expose */
  2492. rave_containsClass : function(className) {},
  2493. /**
  2494. * Set or unset the CSS class on the node.
  2495. * @param (String) className the class to query
  2496. * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
  2497. */
  2498. /** @expose */
  2499. rave_addClass : function(className) {},
  2500. /**
  2501. * Remove the CSS class on the node.
  2502. * @param (String) className the class to query
  2503. * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
  2504. */
  2505. /** @expose */
  2506. rave_removeClass : function(className) {},
  2507. /**
  2508. * Get the data associated with this node.
  2509. * @return (Object) the associated data
  2510. */
  2511. /** @expose */
  2512. rave_getData : function() {
  2513. return this.rave_getProperty("__data__");
  2514. },
  2515. /**
  2516. * Set the data for this node.
  2517. * @param (Object) value the data value
  2518. */
  2519. /** @expose */
  2520. rave_setData : function(value) {
  2521. this.rave_setProperty("__data__", value);
  2522. },
  2523. /**
  2524. * Returns true if the data had been set on this element
  2525. * @return (boolean) true if data has been set otherwise false
  2526. */
  2527. /** @expose */
  2528. rave_hasData : function() {
  2529. return this.rave_hasProperty("__data__");
  2530. },
  2531. /**
  2532. * Store a value on this node for a given key.
  2533. * @param (String) key the property key
  2534. * @param (Object) value the property value
  2535. */
  2536. /** @expose */
  2537. rave_setProperty : function(key, value) {
  2538. this.rave_setProperty.call(this, key, value);
  2539. },
  2540. /**
  2541. * Set the attribute value for the given attribute.
  2542. * @param (String) key the attribute key
  2543. * @param (Object) value the attribute value
  2544. */
  2545. /** @expose */
  2546. setAttribute : function(key, value) {
  2547. this.setAttribute.call(this, key, value);
  2548. },
  2549. /**
  2550. * Get a stored value from this node for a given key.
  2551. * @param (String) key the property key
  2552. * @return (Object) the property value
  2553. */
  2554. /** @expose */
  2555. rave_getProperty : function(key) {},
  2556. /**
  2557. * Returns true if this element has a property with the same name as the string passed in
  2558. * @param (String) proName property name to check
  2559. * @return (boolean) true if the property exist otherwise false
  2560. */
  2561. /** @expose */
  2562. rave_hasProperty : function(proName) {},
  2563. /**
  2564. * Get the name of this node.
  2565. * @return (String) the name of this node
  2566. */
  2567. /** @expose */
  2568. rave_getName : function() {},
  2569. /**
  2570. * Get the namespace URI of this node.
  2571. * @return (String) the namespace URI, may be <code>null</code>
  2572. */
  2573. /** @expose */
  2574. rave_getNamespaceURI : function() {},
  2575. /**
  2576. * Get the qualified name of this node. The qualified name is a concatenation of the namespace URI and the name with a colon delimiter.
  2577. * @return (String) the qualified name
  2578. */
  2579. /** @expose */
  2580. rave_getQualifiedName : function() {},
  2581. /**
  2582. * 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.
  2583. */
  2584. /** @expose */
  2585. getBoundingClientRect : function() {
  2586. var onr = this.rave_getOwner().getBoundingClientRect();
  2587. var bb = this.getBBox();
  2588. return new com_ibm_rave_core_geom_NodeRect(onr.left + bb.x, onr.left + bb.x + bb.width, onr.top + bb.y + bb.height, onr.top + bb.y, bb.width, bb.height);
  2589. },
  2590. /**
  2591. * 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.
  2592. * @return (com.ibm.rave.core.geom.RaveRect) Bounding box of this shape. Must never return null.
  2593. */
  2594. /** @expose */
  2595. getBBox : function() {},
  2596. /**
  2597. * Returns the draw type of node as an int.
  2598. * @return (int) The integer representation of the type of drawable shape of this node.
  2599. */
  2600. /** @expose */
  2601. rave_getDrawType : function() {
  2602. return 0;
  2603. },
  2604. /**
  2605. * Returns the computed transform matrix of this node in screen coordinates.
  2606. * @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.
  2607. */
  2608. /** @expose */
  2609. getScreenCTM : function() {
  2610. return this.getScreenCTM.call(this);
  2611. },
  2612. /**
  2613. * Returns the computed transform matrix of this node in local coordinates.
  2614. * @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.
  2615. */
  2616. /** @expose */
  2617. getCTM : function() {
  2618. return this.getCTM.call(this);
  2619. },
  2620. /**
  2621. * Dispose of this node; allow any clean up to be performed.
  2622. */
  2623. /** @expose */
  2624. rave_dispose : function() {},
  2625. /** @expose */
  2626. rave_intersection : function(x, y) {},
  2627. /** @expose */
  2628. rave_initExtensions : function() {},
  2629. /** @expose */
  2630. rave_addEventListener : function(a0, a1, a2, a3) {
  2631. var args = arguments;
  2632. if (args.length == 2) {
  2633. return this.rave_addEventListener$1(a0, a1);
  2634. }
  2635. if (args.length == 3) {
  2636. return this.rave_addEventListener$2(a0, a1, a2);
  2637. }
  2638. return this.rave_addEventListener$0(a0, a1, a2, a3);
  2639. },
  2640. /** @expose */
  2641. rave_removeEventListener : function(a0, a1) {
  2642. var args = arguments;
  2643. if (args.length == 1) {
  2644. return this.rave_removeEventListener$0(a0);
  2645. }
  2646. return this.rave_removeEventListener$1(a0, a1);
  2647. },
  2648. /** @expose */
  2649. rave_intersects : function(a0, a1) {
  2650. var args = arguments;
  2651. if (args.length == 1) {
  2652. return this.rave_intersects$1(a0);
  2653. }
  2654. return this.rave_intersects$0(a0, a1);
  2655. },
  2656. /** @expose */
  2657. rave_intersectionList : function(a0, a1) {
  2658. var args = arguments;
  2659. if (args.length == 1) {
  2660. return this.rave_intersectionList$1(a0);
  2661. }
  2662. return this.rave_intersectionList$0(a0, a1);
  2663. }
  2664. /**
  2665. * Adds an event listener for the given qualifier and event type.
  2666. * @param (String) eventType the event type
  2667. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  2668. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  2669. * @param (String) group a qualified to the event type for grouping like events
  2670. */
  2671. //rave_addEventListener$0 : function(eventType, listener, useCapture, group) {},
  2672. /**
  2673. * Adds an event listener for the given event type.
  2674. * @param (String) eventType the event type
  2675. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  2676. */
  2677. //rave_addEventListener$1 : function(eventType, listener) {},
  2678. /**
  2679. * Adds an event listener for the given event type.
  2680. * @param (String) eventType the event type
  2681. * @param (com.ibm.rave.core.event.EventListener) listener the event listener
  2682. * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
  2683. */
  2684. //rave_addEventListener$2 : function(eventType, listener, useCapture) {},
  2685. /**
  2686. * Removes an event listener for the given type.
  2687. * @param (String) eventType the event type
  2688. */
  2689. //rave_removeEventListener$0 : function(eventType) {},
  2690. /**
  2691. * Removes an event listener for the given qualifier and type.
  2692. * @param (String) eventType the event type
  2693. * @param (String) group a qualifier to the event type for grouping like events
  2694. */
  2695. //rave_removeEventListener$1 : function(eventType, group) {},
  2696. //rave_intersects$0 : function(x, y) {},
  2697. //rave_intersects$1 : function(rect) {},
  2698. //rave_intersectionList$0 : function(x, y) {},
  2699. //rave_intersectionList$1 : function(rect) {}
  2700. });
  2701. /** @expose */
  2702. com_ibm_rave_core_scene_SceneNode.DATA_PROPERTY = "__data__";
  2703. // $source: com/ibm/rave/core/geom/NodeRect
  2704. /************************************************************************
  2705. ** IBM Confidential
  2706. **
  2707. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2708. **
  2709. ** (C) Copyright IBM Corp. 2015
  2710. **
  2711. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2712. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2713. ************************************************************************/
  2714. // GENERATED
  2715. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2716. /**
  2717. * An implementation of a DOMRect-like interface. Typically the values in this are relative to the viewport.
  2718. * @author jim
  2719. */
  2720. var com_ibm_rave_core_geom_NodeRect = rave_externs["NodeRect"] = com_ibm_rave_core_nativeImpl_Declare({
  2721. /** @expose */
  2722. left : 0,
  2723. /** @expose */
  2724. right : 0,
  2725. /** @expose */
  2726. top : 0,
  2727. /** @expose */
  2728. bottom : 0,
  2729. /** @expose */
  2730. width : 0,
  2731. /** @expose */
  2732. height : 0,
  2733. /** @expose */
  2734. constructor : function(left, right, bottom, top, width, height) {
  2735. this.left = left;
  2736. this.right = right;
  2737. this.top = top;
  2738. this.bottom = bottom;
  2739. this.width = width;
  2740. this.height = height;
  2741. }
  2742. });
  2743. // $source: com/ibm/rave/render/internal/properties/DynamicAttributesCollection
  2744. /************************************************************************
  2745. ** IBM Confidential
  2746. **
  2747. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2748. **
  2749. ** (C) Copyright IBM Corp. 2015
  2750. **
  2751. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2752. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2753. ************************************************************************/
  2754. // GENERATED
  2755. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2756. /**
  2757. * 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.
  2758. */
  2759. var com_ibm_rave_render_internal_properties_DynamicAttributesCollection = com_ibm_rave_core_nativeImpl_Declare({
  2760. //propNames : null,
  2761. //propValues : null,
  2762. //dynamicMap : null,
  2763. getByIndex : function(i) {
  2764. return this.propValues[i];
  2765. },
  2766. setPropertyValue : function(index, value) {
  2767. this.propValues[index] = value;
  2768. },
  2769. get : function(attribute) {
  2770. var i = this.findProperty(attribute);
  2771. if (i >= this.propNames.length) {
  2772. return this.dynamicMap ? this.dynamicMap[attribute] : null;
  2773. }
  2774. return this.propValues[i];
  2775. },
  2776. put : function(attribute, value) {
  2777. var i = this.findProperty(attribute);
  2778. if (i >= this.propNames.length) {
  2779. if (!this.dynamicMap) {
  2780. this.dynamicMap = {};
  2781. }
  2782. this.dynamicMap[attribute] = value;
  2783. } else {
  2784. this.setPropertyValue(i, value);
  2785. }
  2786. },
  2787. findProperty : function(attribute) {
  2788. var i = 0;
  2789. for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
  2790. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2791. var e = __exp_enFor0[__i_enFor0];
  2792. if (e == attribute) {
  2793. break;
  2794. }
  2795. i++;
  2796. }
  2797. return i;
  2798. },
  2799. /**
  2800. * returns how many attributes exist in this attribute collection
  2801. * @return (int) Number of properties in this collection.
  2802. */
  2803. size : function() {
  2804. return this.propNames.length + ((!this.dynamicMap) ? 0 : Object.keys(this.dynamicMap).size());
  2805. },
  2806. /**
  2807. * 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
  2808. * @param (String) propName property to check
  2809. * @return (boolean) true if there is a property with the same name otherwise false
  2810. */
  2811. containsProperty : function(propName) {
  2812. var props = this.propNames;
  2813. for (var index = 0; index < props.length; ++index) {
  2814. if (props[index] == propName) {
  2815. return true;
  2816. }
  2817. }
  2818. return this.dynamicMap ? this.dynamicMap.hasOwnProperty(propName) : false;
  2819. }
  2820. });
  2821. // $source: com/ibm/rave/render/internal/properties/SceneNodeAttributes
  2822. /************************************************************************
  2823. ** IBM Confidential
  2824. **
  2825. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2826. **
  2827. ** (C) Copyright IBM Corp. 2015
  2828. **
  2829. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2830. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2831. ************************************************************************/
  2832. // GENERATED
  2833. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2834. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  2835. /**
  2836. * A list of public attribute properties for scene nodes. Typically only used by renderers for quick access to properties.
  2837. */
  2838. var com_ibm_rave_render_internal_properties_SceneNodeAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  2839. constructor : function() {
  2840. this.propNames = com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames;
  2841. this.propValues = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", ""];
  2842. }
  2843. });
  2844. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x = 0;
  2845. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y = 1;
  2846. com_ibm_rave_render_internal_properties_SceneNodeAttributes.width = 2;
  2847. com_ibm_rave_render_internal_properties_SceneNodeAttributes.height = 3;
  2848. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x1 = 4;
  2849. com_ibm_rave_render_internal_properties_SceneNodeAttributes.x2 = 5;
  2850. com_ibm_rave_render_internal_properties_SceneNodeAttributes.r = 6;
  2851. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y1 = 7;
  2852. com_ibm_rave_render_internal_properties_SceneNodeAttributes.y2 = 8;
  2853. com_ibm_rave_render_internal_properties_SceneNodeAttributes.cx = 9;
  2854. com_ibm_rave_render_internal_properties_SceneNodeAttributes.cy = 10;
  2855. com_ibm_rave_render_internal_properties_SceneNodeAttributes.class_attr = 11;
  2856. com_ibm_rave_render_internal_properties_SceneNodeAttributes.text = 12;
  2857. com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames = ["x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "class", "text"];
  2858. // $source: com/ibm/rave/render/internal/properties/SceneNodeStyles
  2859. /************************************************************************
  2860. ** IBM Confidential
  2861. **
  2862. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2863. **
  2864. ** (C) Copyright IBM Corp. 2015
  2865. **
  2866. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2867. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2868. ************************************************************************/
  2869. // GENERATED
  2870. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2871. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  2872. /**
  2873. * 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").
  2874. */
  2875. var com_ibm_rave_render_internal_properties_SceneNodeStyles = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  2876. constructor : function() {
  2877. this.propNames = com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames;
  2878. this.propValues = ["black", null, 1, 1, 1, 1, "block", "sans-serif", "10", "normal", "normal", "normal", null, 1, null, "miter", 4, null, null, "visible", "black", 1];
  2879. }
  2880. });
  2881. com_ibm_rave_render_internal_properties_SceneNodeStyles.fill = 0;
  2882. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke = 1;
  2883. com_ibm_rave_render_internal_properties_SceneNodeStyles.opacity = 2;
  2884. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_width = 3;
  2885. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_opacity = 4;
  2886. com_ibm_rave_render_internal_properties_SceneNodeStyles.fill_opacity = 5;
  2887. com_ibm_rave_render_internal_properties_SceneNodeStyles.display = 6;
  2888. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_family = 7;
  2889. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_size = 8;
  2890. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_style = 9;
  2891. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_weight = 10;
  2892. com_ibm_rave_render_internal_properties_SceneNodeStyles.font_variant = 11;
  2893. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dasharray = 12;
  2894. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dashoffset = 13;
  2895. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linecap = 14;
  2896. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linejoin = 15;
  2897. com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_miterlimit = 16;
  2898. com_ibm_rave_render_internal_properties_SceneNodeStyles.text_anchor = 17;
  2899. com_ibm_rave_render_internal_properties_SceneNodeStyles.text_decoration = 18;
  2900. com_ibm_rave_render_internal_properties_SceneNodeStyles.visibility = 19;
  2901. com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_color = 20;
  2902. com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_opacity = 21;
  2903. com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames = ["fill", "stroke", "opacity", "stroke-width", "stroke-opacity", "fill-opacity", "display", "font-family", "font-size", "font-style", "font-weight", "font-variant", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "text-anchor", "text-decoration", "visibility", "stop-color", "stop-opacity"];
  2904. // $source: com/ibm/rave/render/internal/nodes/AttributesListener
  2905. /************************************************************************
  2906. ** IBM Confidential
  2907. **
  2908. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2909. **
  2910. ** (C) Copyright IBM Corp. 2015
  2911. **
  2912. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2913. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2914. ************************************************************************/
  2915. // GENERATED
  2916. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2917. /**
  2918. * A class responsible for handling attribute changes on scene nodes. Listens for changes to specific attributes and performs modifications to the scene node.
  2919. */
  2920. var com_ibm_rave_render_internal_nodes_AttributesListener = com_ibm_rave_core_nativeImpl_Declare({
  2921. //handlers : null,
  2922. constructor : function() {
  2923. this.handlers = {};
  2924. },
  2925. beforeUpdate : function(type, subType, key, value, node) {},
  2926. afterUpdate : function(type, subType, key, value, node) {
  2927. if (key != null) {
  2928. var handler = this.handlers[key];
  2929. if (handler) {
  2930. handler.handle(value, node);
  2931. }
  2932. }
  2933. }
  2934. //constructor : function() {}
  2935. });
  2936. // $source: com/ibm/rave/render/internal/nodes/listeners/IdAttributeHandler
  2937. /************************************************************************
  2938. ** IBM Confidential
  2939. **
  2940. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2941. **
  2942. ** (C) Copyright IBM Corp. 2015
  2943. **
  2944. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2945. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2946. ************************************************************************/
  2947. // GENERATED
  2948. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2949. /**
  2950. * An AttributeHandler that gets called on changes to "id" attributes.
  2951. */
  2952. var com_ibm_rave_render_internal_nodes_listeners_IdAttributeHandler = com_ibm_rave_core_nativeImpl_Declare({
  2953. handle : function(value, node) {
  2954. node.setId(value != null ? ""+(value) : null);
  2955. }
  2956. });
  2957. // $source: com/ibm/rave/render/internal/nodes/listeners/TransformAttributeHandler
  2958. /************************************************************************
  2959. ** IBM Confidential
  2960. **
  2961. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2962. **
  2963. ** (C) Copyright IBM Corp. 2015
  2964. **
  2965. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2966. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2967. ************************************************************************/
  2968. // GENERATED
  2969. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2970. //@import com/ibm/rave/render/internal/css/TransformParser (runtime) // parse
  2971. /**
  2972. * A handler that listens for "transform" changes to a scene node. Parses the style and updates the matrix on the node.
  2973. */
  2974. var com_ibm_rave_render_internal_nodes_listeners_TransformAttributeHandler = com_ibm_rave_core_nativeImpl_Declare({
  2975. handle : function(value, node) {
  2976. node.transformMatrix = value == null ? null : com_ibm_rave_render_internal_css_TransformParser.parse(""+(value));
  2977. }
  2978. });
  2979. // $source: com/ibm/rave/render/internal/nodes/AbstractSceneNode
  2980. /************************************************************************
  2981. ** IBM Confidential
  2982. **
  2983. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2984. **
  2985. ** (C) Copyright IBM Corp. 2015
  2986. **
  2987. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2988. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2989. ************************************************************************/
  2990. // GENERATED
  2991. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  2992. //@import com/ibm/rave/core/scene/SceneNode (loadtime) // superclass
  2993. //@import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime) // new
  2994. //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime) // new
  2995. //@import com/ibm/rave/core/internal/util/CollectionsUtil (runtime) // remove
  2996. //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
  2997. //@import com/ibm/rave/render/internal/nodes/AttributesListener (runtime) // new
  2998. //@import com/ibm/rave/render/internal/nodes/listeners/IdAttributeHandler (static) // new
  2999. //@import com/ibm/rave/render/internal/nodes/listeners/TransformAttributeHandler (static) // new
  3000. //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds, identity
  3001. /**
  3002. * A base type for scene nodes.
  3003. */
  3004. var com_ibm_rave_render_internal_nodes_AbstractSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scene_SceneNode, {
  3005. //parent : null,
  3006. //owner : null,
  3007. //children : null,
  3008. //namespaceURI : null,
  3009. //attributes : null,
  3010. //styles : null,
  3011. //propertyBag : null,
  3012. //classSet : null,
  3013. //eventListeners : null,
  3014. //listenersByGroup : null,
  3015. //listenersByType : null,
  3016. //renderer : null,
  3017. //qname : null,
  3018. //id : null,
  3019. /**
  3020. * Root node cache. Note that this may be different from the owner - it's the root abstract node of this node.
  3021. */
  3022. //root : null,
  3023. /**
  3024. * Combined transform of all transforms applied to this scene node.
  3025. */
  3026. //transformMatrix : null,
  3027. constructor : function(nsuri, context) {
  3028. this.attributes = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
  3029. this.styles = new com_ibm_rave_render_internal_properties_SceneNodeStyles();
  3030. {
  3031. this.rave_initExtensions();
  3032. this.namespaceURI = nsuri;
  3033. if (context) {
  3034. this.renderer = (context).renderer;
  3035. }
  3036. }
  3037. },
  3038. /**
  3039. * Return this node's 'id' attribute. Must return the same value as getAttribute('id');
  3040. * @return (String) String representation of this node's ID value.
  3041. */
  3042. getId : function() {
  3043. return this.id;
  3044. },
  3045. /**
  3046. * Sets this node's "id" attribute.
  3047. * @param (String) id Unique identifier for this node.
  3048. */
  3049. setId : function(id) {
  3050. this.id = id;
  3051. this.attributes.put("id", id);
  3052. },
  3053. /** @expose */
  3054. rave_hasProperty : function(propName) {
  3055. return this.propertyBag ? this.propertyBag.containsProperty(propName) : false;
  3056. },
  3057. /**
  3058. * Create an instance of our children list using a synchronized backing.
  3059. */
  3060. createChildren : function() {
  3061. this.children = ([]);
  3062. },
  3063. /** @expose */
  3064. rave_getEventListener : function(eventType) {
  3065. var info = this.eventListeners ? this.eventListeners[eventType] : null;
  3066. return info ? info.listener : null;
  3067. },
  3068. rave_addEventListener$1 : function(eventType, listener) {
  3069. this.rave_addEventListener$0(eventType, listener, false, null);
  3070. },
  3071. rave_addEventListener$2 : function(eventType, listener, useCapture) {
  3072. this.rave_addEventListener$0(eventType, listener, useCapture, null);
  3073. },
  3074. rave_addEventListener$0 : function(eventType, listener, useCapture, group) {
  3075. var id = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
  3076. if (!this.eventListeners) {
  3077. this.eventListeners = {};
  3078. this.listenersByGroup = {};
  3079. this.listenersByType = {};
  3080. } else if (this.eventListeners.hasOwnProperty(id)) {
  3081. this.rave_removeEventListener$1(eventType, group);
  3082. }
  3083. var info = new com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo(id, eventType, listener, useCapture);
  3084. this.eventListeners[id] = info;
  3085. var groupList = this.listenersByGroup[group];
  3086. if (!groupList) {
  3087. groupList = [];
  3088. this.listenersByGroup[group] = groupList;
  3089. }
  3090. groupList.push(info);
  3091. var typeList = this.listenersByType[eventType];
  3092. if (!typeList) {
  3093. typeList = [];
  3094. this.listenersByType[eventType] = typeList;
  3095. if (this.renderer) {
  3096. this.renderer.registerEvent(eventType, this);
  3097. }
  3098. }
  3099. typeList.push(info);
  3100. },
  3101. rave_removeEventListener$0 : function(eventType) {
  3102. if (this.eventListeners) {
  3103. this.rave_removeEventListener$1(eventType, null);
  3104. }
  3105. },
  3106. rave_removeEventListener$1 : function(eventType, group) {
  3107. if (this.eventListeners) {
  3108. var id = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
  3109. var info = this.eventListeners[id];
  3110. if (info) {
  3111. delete this.eventListeners[id];
  3112. info.isRemoved = true;
  3113. var byGroupList = this.listenersByGroup[group];
  3114. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byGroupList, info) && byGroupList.length == 0) {
  3115. delete this.listenersByGroup[group];
  3116. }
  3117. var byTypeList = this.listenersByType[eventType];
  3118. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info) && byTypeList.length == 0) {
  3119. delete this.listenersByType[eventType];
  3120. if (this.renderer) {
  3121. this.renderer.unregisterEvent(eventType, this);
  3122. }
  3123. }
  3124. }
  3125. }
  3126. },
  3127. /** @expose */
  3128. rave_removeEventListeners : function(group) {
  3129. if (this.listenersByGroup) {
  3130. var list = this.listenersByGroup[group];
  3131. if (list) {
  3132. for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
  3133. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3134. var info = __exp_enFor0[__i_enFor0];
  3135. delete this.eventListeners[info.id];
  3136. info.isRemoved = true;
  3137. var byTypeList = this.listenersByType[info.type];
  3138. if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info)) {
  3139. if (byTypeList.length == 0) {
  3140. delete this.listenersByType[info.type];
  3141. if (this.renderer) {
  3142. this.renderer.unregisterEvent(info.type, this);
  3143. }
  3144. }
  3145. }
  3146. }
  3147. delete this.listenersByGroup[group];
  3148. }
  3149. }
  3150. },
  3151. /** @expose */
  3152. dispatchEvent : function(event) {
  3153. if (!event) {
  3154. throw new Error("Null event");
  3155. }
  3156. if (event.type == null || event.type.length == 0) {
  3157. throw new Error("Uninitialized event");
  3158. }
  3159. var targetList = [];
  3160. event.target = this;
  3161. var targetParent = this.rave_getParentNode();
  3162. while (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(targetParent, com_ibm_rave_render_internal_nodes_AbstractSceneNode)) {
  3163. targetList.push(targetParent);
  3164. targetParent = targetParent.rave_getParentNode();
  3165. }
  3166. event.eventPhase = 1;
  3167. if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, true, false)) {
  3168. event.eventPhase = 2;
  3169. if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, this, false, true)) {
  3170. if (event.bubbles && !event.propagationStopped) {
  3171. event.eventPhase = 3;
  3172. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, false, false);
  3173. }
  3174. }
  3175. }
  3176. event.currentTarget = null;
  3177. event.eventPhase = 0;
  3178. return event.defaultPrevented;
  3179. },
  3180. /** @expose */
  3181. getAttribute : function(attribute) {
  3182. return attribute == null ? null : this.attributes.get(attribute);
  3183. },
  3184. setRenderer : function(renderer) {
  3185. this.renderer = renderer;
  3186. if (this.children) {
  3187. for (var __i_enFor0 = 0, __exp_enFor0 = this.children, __len_enFor0 = __exp_enFor0.length;
  3188. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3189. var child = __exp_enFor0[__i_enFor0];
  3190. (child).setRenderer(renderer);
  3191. }
  3192. }
  3193. },
  3194. /**
  3195. * Notify listeners of a 'type' notification change on this node. Happens after the change has been made.
  3196. * @param (int) type The SceneItemModificationType to notify listeners about.
  3197. * @param (int) subType Optional SceneItemModificationType to notify listeners about.
  3198. * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
  3199. * @param (Object) value The value that the key is being updated to.
  3200. */
  3201. notifyAfterUpdate : function(type, subType, key, value) {
  3202. if (!com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners) {
  3203. return;
  3204. }
  3205. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners, __len_enFor0 = __exp_enFor0.length;
  3206. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3207. var listener = __exp_enFor0[__i_enFor0];
  3208. listener.afterUpdate(type, subType, key, value, this);
  3209. }
  3210. },
  3211. /**
  3212. * Notify listeners of a 'type' notification change on this node. Happens before the change has been made.
  3213. * @param (int) type The SceneItemModificationType to notify listeners about.
  3214. * @param (int) subType Optional SceneItemModificationType to notify listeners about.
  3215. * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
  3216. * @param (Object) value The value that the key is being updated to.
  3217. */
  3218. notifyBeforeUpdate : function(type, subType, key, value) {
  3219. if (!com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners) {
  3220. return;
  3221. }
  3222. for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners, __len_enFor0 = __exp_enFor0.length;
  3223. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3224. var listener = __exp_enFor0[__i_enFor0];
  3225. listener.beforeUpdate(type, subType, key, value, this);
  3226. }
  3227. },
  3228. /** @expose */
  3229. rave_getStyle : function(attribute) {
  3230. return this.styles.get(attribute);
  3231. },
  3232. /** @expose */
  3233. rave_getComputedStyle : function(attribute) {
  3234. return this.rave_getStyle(attribute);
  3235. },
  3236. /** @expose */
  3237. rave_getText : function() {
  3238. return this.attributes.get("text");
  3239. },
  3240. /** @expose */
  3241. rave_getHtml : function() {
  3242. return this.attributes.get("html");
  3243. },
  3244. /** @expose */
  3245. rave_setHtml : function(html) {
  3246. this.notifyBeforeUpdate(1000, 2003, "html", this.rave_getHtml());
  3247. this.attributes.put("html", html);
  3248. this.notifyAfterUpdate(1000, 2003, "html", html);
  3249. },
  3250. /** @expose */
  3251. rave_addClass : function(className) {
  3252. var added = true;
  3253. if (!this.classSet) {
  3254. this.classSet = {};
  3255. } else {
  3256. added = !(this.classSet.hasOwnProperty(className));
  3257. }
  3258. if (added) {
  3259. this.notifyBeforeUpdate(1000, 2001, "class", null);
  3260. this.classSet[className] = 1;
  3261. this.notifyAfterUpdate(1000, 2001, "class", className);
  3262. }
  3263. return added;
  3264. },
  3265. /** @expose */
  3266. rave_removeClass : function(className) {
  3267. var wasRemoved = this.classSet && this.classSet.hasOwnProperty(className);
  3268. if (wasRemoved) {
  3269. this.notifyBeforeUpdate(1000, 2001, "class", className);
  3270. delete this.classSet[className];
  3271. this.notifyAfterUpdate(1000, 2001, "class", null);
  3272. }
  3273. return wasRemoved;
  3274. },
  3275. /** @expose */
  3276. rave_containsClass : function(className) {
  3277. return this.classSet ? this.classSet.hasOwnProperty(className) : false;
  3278. },
  3279. /** @expose */
  3280. rave_getNamespaceURI : function() {
  3281. return this.namespaceURI;
  3282. },
  3283. /** @expose */
  3284. rave_getQualifiedName : function() {
  3285. if (this.qname == null) {
  3286. this.qname = this.namespaceURI + ":" + this.rave_getName();
  3287. }
  3288. return this.qname;
  3289. },
  3290. /** @expose */
  3291. getAttributeNS : function(namespace, attribute) {
  3292. return null;
  3293. },
  3294. /** @expose */
  3295. setAttributeNS : function(namespace, attribute, value) {},
  3296. /** @expose */
  3297. removeAttribute : function(attribute) {
  3298. this.notifyAfterUpdate(1000, 2000, attribute, this.getAttribute(attribute));
  3299. this.attributes.put(attribute, null);
  3300. this.notifyAfterUpdate(1000, 2000, attribute, null);
  3301. },
  3302. /** @expose */
  3303. removeAttributeNS : function(namespace, attribute) {},
  3304. /** @expose */
  3305. rave_removeStyle : function(styleName) {
  3306. this.styles.put(styleName, null);
  3307. },
  3308. /** @expose */
  3309. rave_getProperty : function(key) {
  3310. return this.getPropertyBag().get(key);
  3311. },
  3312. /**
  3313. * @return (Object) Set of class names on this node.
  3314. */
  3315. getClassSet : function() {
  3316. if (!this.classSet) {
  3317. this.classSet = {};
  3318. }
  3319. return this.classSet;
  3320. },
  3321. getPropertyBag : function() {
  3322. if (!this.propertyBag) {
  3323. this.propertyBag = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
  3324. }
  3325. return this.propertyBag;
  3326. },
  3327. /** @expose */
  3328. rave_setParentNode : function(parent) {
  3329. var rendererSet = false;
  3330. if (!this.renderer && parent) {
  3331. var r = (parent).renderer;
  3332. if (r) {
  3333. this.setRenderer(r);
  3334. rendererSet = true;
  3335. }
  3336. }
  3337. if (this.renderer) {
  3338. if ((!this.parent && parent) || rendererSet) {
  3339. this.recursiveRegisterEventListeners();
  3340. } else if (this.parent && !parent) {
  3341. this.recursiveUnregisterEventListeners();
  3342. }
  3343. if (!parent) {
  3344. this.setRenderer(null);
  3345. }
  3346. }
  3347. this.parent = parent;
  3348. this.root = null;
  3349. },
  3350. /** @expose */
  3351. rave_getOwner : function() {
  3352. if (this.owner) {
  3353. return this.owner;
  3354. }
  3355. var p = this.rave_getParentNode();
  3356. return !p ? null : p.rave_getOwner();
  3357. },
  3358. /** @expose */
  3359. rave_setOwner : function(owner) {
  3360. this.owner = owner;
  3361. },
  3362. recursiveRegisterEventListeners : function() {
  3363. if (this.eventListeners) {
  3364. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
  3365. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3366. var type = __exp_enFor0[__i_enFor0];
  3367. this.renderer.registerEvent(type, this);
  3368. }
  3369. }
  3370. if (this.children) {
  3371. for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
  3372. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3373. var child = __exp_enFor1[__i_enFor1];
  3374. (child).recursiveRegisterEventListeners();
  3375. }
  3376. }
  3377. },
  3378. recursiveUnregisterEventListeners : function() {
  3379. if (this.eventListeners) {
  3380. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
  3381. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3382. var type = __exp_enFor0[__i_enFor0];
  3383. this.renderer.unregisterEvent(type, this);
  3384. }
  3385. }
  3386. if (this.children) {
  3387. for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
  3388. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3389. var child = __exp_enFor1[__i_enFor1];
  3390. (child).recursiveUnregisterEventListeners();
  3391. }
  3392. }
  3393. },
  3394. /**
  3395. * Removes the child from this parent but does not update the parent node of the child.
  3396. * @param (com.ibm.rave.core.scene.SceneNode) child
  3397. */
  3398. internalRemoveChild : function(child) {
  3399. var p = child.rave_getParentNode();
  3400. if (p == this) {
  3401. var idx = this.children.indexOf(child);
  3402. if (idx >= 0) {
  3403. this.children.splice(idx, 1);
  3404. }
  3405. }
  3406. },
  3407. /**
  3408. * Helper method to append a child item.
  3409. * @param (com.ibm.rave.core.scene.SceneNode) item the child item to append
  3410. * @return (int) the index of the appended item
  3411. */
  3412. internalAppendChild : function(item) {
  3413. if (!this.children) {
  3414. this.createChildren();
  3415. }
  3416. this.internalRemoveChild(item);
  3417. this.children.push(item);
  3418. item.rave_setParentNode(this);
  3419. return this.children.length - 1;
  3420. },
  3421. /**
  3422. * 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.
  3423. * @param (com.ibm.rave.core.scene.SceneNode) item the item to insert
  3424. * @param (com.ibm.rave.core.scene.SceneNode) before the item to insert before
  3425. * @return (int) the index of the inserted item.
  3426. */
  3427. insertChildBefore : function(item, before) {
  3428. if (!this.children) {
  3429. this.createChildren();
  3430. }
  3431. if (before && before.rave_getParentNode() == this) {
  3432. var bidx = this.children.indexOf(before);
  3433. if (item == before) {
  3434. return bidx;
  3435. }
  3436. this.internalRemoveChild(item);
  3437. item.rave_setParentNode(this);
  3438. this.children.splice(bidx, 0, item);
  3439. return bidx;
  3440. }
  3441. this.children.push(item);
  3442. item.rave_setParentNode(this);
  3443. return this.children.length - 1;
  3444. },
  3445. /**
  3446. * 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.
  3447. * @param (int) offset Integer index offset.
  3448. * @return (com.ibm.rave.core.scene.SceneNode) This item's sibling at the specified index offset.
  3449. */
  3450. getSibling : function(offset) {
  3451. var sibling;
  3452. if (this.parent) {
  3453. var c = this.parent.rave_getChildNodes();
  3454. var idx = c.indexOf(this);
  3455. var idxOffset = idx + offset;
  3456. if (idx > -1 && (idxOffset >= 0 && idxOffset < c.length)) {
  3457. sibling = c[idxOffset];
  3458. }
  3459. }
  3460. return sibling;
  3461. },
  3462. rave_intersects$0 : function(x, y) {
  3463. return this.rave_intersects$1(new com_ibm_rave_core_geom_RectStruct(x, y, 0, 0));
  3464. },
  3465. rave_intersects$1 : function(rect) {
  3466. var r = this.getBBox();
  3467. return r.x <= (rect.x + rect.width) && (r.x + r.width) >= rect.x && r.y <= (rect.y + rect.height) && (r.y + r.height) >= rect.y;
  3468. },
  3469. rave_intersectionList$0 : function(x, y) {
  3470. return this.rave_intersectionList$1(new com_ibm_rave_core_geom_RectStruct(x, y, 1, 1));
  3471. },
  3472. rave_intersectionList$1 : function(rect) {
  3473. var result = [];
  3474. if (this.rave_hasChildNodes()) {
  3475. com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(result, this, rect);
  3476. }
  3477. return result;
  3478. },
  3479. /** @expose */
  3480. rave_intersection : function(x, y) {
  3481. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(null, this, new com_ibm_rave_core_geom_RectStruct(x, y, 0, 0));
  3482. },
  3483. /** @expose */
  3484. rave_initExtensions : function() {
  3485. this.rave_setProperty = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT;
  3486. this.appendChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT;
  3487. this.rave_getParentNode = com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT;
  3488. this.insertBefore = com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT;
  3489. this.rave_getNextSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT;
  3490. this.rave_getPreviousSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT;
  3491. this.rave_getFirstChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD;
  3492. this.rave_hasChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT;
  3493. this.rave_getChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT;
  3494. this.removeChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT;
  3495. this.rave_setStyle = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT;
  3496. this.setAttribute = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT;
  3497. this.rave_setText = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT;
  3498. this.getCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT;
  3499. this.getScreenCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT;
  3500. },
  3501. /**
  3502. * Return the index of this node relative to its siblings.
  3503. * @return (int) The index of this node relative to its siblings.
  3504. */
  3505. getSiblingIndex : function() {
  3506. return this.parent.rave_getChildNodes().indexOf(this);
  3507. },
  3508. /**
  3509. * Retrieve the root node of the node's scene tree. Note that this is the root abstract node, not necessarily the owner. For instance, in Canvas, the owner is the canvas DOM object, while the root is an instance of ContainerSceneNode.
  3510. * @return (com.ibm.rave.render.internal.nodes.AbstractSceneNode) The root node of this node.
  3511. */
  3512. getRoot : function() {
  3513. if (!this.root) {
  3514. var parentNode = this;
  3515. while (parentNode) {
  3516. this.root = parentNode;
  3517. parentNode = parentNode.rave_getParentNode();
  3518. }
  3519. }
  3520. return this.root;
  3521. },
  3522. /**
  3523. * 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.
  3524. * @return (boolean) <code>true</code> if this is a drawable node, <code>false</code> otherwise.
  3525. */
  3526. isDrawable : function() {
  3527. return true;
  3528. },
  3529. getTransforms : function() {
  3530. return this.transformMatrix;
  3531. },
  3532. /** @expose */
  3533. rave_addEventListener : function(a0, a1, a2, a3) {
  3534. var args = arguments;
  3535. if (args.length == 2) {
  3536. return this.rave_addEventListener$1(a0, a1);
  3537. }
  3538. if (args.length == 3) {
  3539. return this.rave_addEventListener$2(a0, a1, a2);
  3540. }
  3541. return this.rave_addEventListener$0(a0, a1, a2, a3);
  3542. },
  3543. /** @expose */
  3544. rave_removeEventListener : function(a0, a1) {
  3545. var args = arguments;
  3546. if (args.length == 1) {
  3547. return this.rave_removeEventListener$0(a0);
  3548. }
  3549. return this.rave_removeEventListener$1(a0, a1);
  3550. },
  3551. /** @expose */
  3552. rave_intersects : function(a0, a1) {
  3553. var args = arguments;
  3554. if (args.length == 1) {
  3555. return this.rave_intersects$1(a0);
  3556. }
  3557. return this.rave_intersects$0(a0, a1);
  3558. },
  3559. /** @expose */
  3560. rave_intersectionList : function(a0, a1) {
  3561. var args = arguments;
  3562. if (args.length == 1) {
  3563. return this.rave_intersectionList$1(a0);
  3564. }
  3565. return this.rave_intersectionList$0(a0, a1);
  3566. }
  3567. });
  3568. com_ibm_rave_render_internal_nodes_AbstractSceneNode.initListeners = function() {
  3569. var listeners = [];
  3570. var listener = new com_ibm_rave_render_internal_nodes_AttributesListener();
  3571. listener.handlers["id"] = new com_ibm_rave_render_internal_nodes_listeners_IdAttributeHandler();
  3572. listener.handlers["transform"] = new com_ibm_rave_render_internal_nodes_listeners_TransformAttributeHandler();
  3573. listeners.push(listener);
  3574. return listeners;
  3575. };
  3576. /**
  3577. * Add a new update listener to this node. Will receive notifications on any changes.
  3578. */
  3579. com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener = function(listener) {
  3580. com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners.push(listener);
  3581. };
  3582. /**
  3583. * Remove an update listener from this node. This is used by Swift code to remove a 'parent' listener that causes a circular reference.
  3584. * @param (com.ibm.rave.render.internal.query.SceneNodeNotificationListener) listener listener to be removed
  3585. */
  3586. com_ibm_rave_render_internal_nodes_AbstractSceneNode.removeNotificationListener = function(listener) {
  3587. com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners.remove(listener);
  3588. };
  3589. com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId = function(eventType, group) {
  3590. return eventType + (group != null ? "." + group : "");
  3591. };
  3592. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets = function(event, targetList, capturing, atTargetPhase) {
  3593. var start = 0, inc = 1, end = targetList.length;
  3594. if (capturing) {
  3595. start = targetList.length - 1;
  3596. inc = end = -1;
  3597. }
  3598. for (var i = start; i != end && !event.propagationStopped && !event.immediatePropagationStopped; i += inc) {
  3599. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, targetList[i], capturing, atTargetPhase);
  3600. }
  3601. return !event.propagationStopped;
  3602. };
  3603. com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget = function(event, currentTarget, capturing, atTargetPhase) {
  3604. if (currentTarget.listenersByType) {
  3605. var list = currentTarget.listenersByType[event.type];
  3606. if (list) {
  3607. list = list.slice();
  3608. var currentListener = list.length;
  3609. while (--currentListener >= 0) {
  3610. var info = list[currentListener];
  3611. if (!info.isRemoved && (atTargetPhase || info.capture == capturing)) {
  3612. event.currentTarget = currentTarget;
  3613. info.listener.call(currentTarget, event);
  3614. }
  3615. }
  3616. }
  3617. }
  3618. return !event.propagationStopped;
  3619. };
  3620. com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM = function(context, matchOwner) {
  3621. var ctm = com_ibm_rave_core_transform_MatrixUtil.identity();
  3622. var abstractContext = context;
  3623. if (abstractContext.transformMatrix) {
  3624. ctm = abstractContext.transformMatrix;
  3625. }
  3626. for (var current = context.rave_getParentNode(); current; current = current.rave_getParentNode()) {
  3627. if (matchOwner && context.rave_getOwner() == current) {
  3628. break;
  3629. }
  3630. ctm = ctm.multiply(current.getCTM());
  3631. }
  3632. return ctm;
  3633. };
  3634. com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection = function(list, node, r) {
  3635. if (node.rave_hasChildNodes()) {
  3636. var childNodes = node.rave_getChildNodes();
  3637. for (var i = childNodes.length - 1; i >= 0; --i) {
  3638. var child = childNodes[i];
  3639. var ctm = child.getCTM();
  3640. var hit = com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(list, child, ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(r, ctm.inverse()) : r);
  3641. if (hit) {
  3642. return hit;
  3643. }
  3644. }
  3645. }
  3646. if (node.rave_intersects$1(r)) {
  3647. if (list) {
  3648. list.push(node);
  3649. } else {
  3650. return node;
  3651. }
  3652. }
  3653. return null;
  3654. };
  3655. com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo = function(id, type, listener, capture) {
  3656. this.id = id;
  3657. this.type = type;
  3658. this.listener = listener;
  3659. this.capture = capture;
  3660. };
  3661. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT = function(key, value) {
  3662. (this).getPropertyBag().put(key, value);
  3663. };
  3664. com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT = function(node) {
  3665. (node).notifyBeforeUpdate(1001, 3000, null, null);
  3666. (this).internalAppendChild(node);
  3667. (node).notifyAfterUpdate(1001, 3000, null, null);
  3668. };
  3669. com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT = function(node, before) {
  3670. (node).notifyBeforeUpdate(1001, 3000, null, null);
  3671. (this).insertChildBefore(node, before);
  3672. (this).notifyAfterUpdate(1001, 3000, null, null);
  3673. };
  3674. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT = function() {
  3675. return (this).getSibling(1);
  3676. };
  3677. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT = function() {
  3678. return (this).getSibling(-1);
  3679. };
  3680. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD = function() {
  3681. var asc = this;
  3682. if (asc.children && asc.children.length > 0) {
  3683. return asc.children[0];
  3684. }
  3685. return asc.getSibling(1);
  3686. };
  3687. com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT = function() {
  3688. var asc = this;
  3689. return asc.children && asc.children.length > 0;
  3690. };
  3691. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT = function() {
  3692. var asc = this;
  3693. if (!asc.children) {
  3694. asc.createChildren();
  3695. }
  3696. return asc.children;
  3697. };
  3698. com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT = function(node) {
  3699. (node).notifyBeforeUpdate(1002, 3000, null, null);
  3700. var asc = this;
  3701. var p = node.rave_getParentNode();
  3702. var removed = false;
  3703. if (p == this) {
  3704. var idx = asc.children.indexOf(node);
  3705. if (idx >= 0) {
  3706. asc.children.splice(idx, 1);
  3707. node.rave_setParentNode(null);
  3708. removed = true;
  3709. }
  3710. } else if (p) {
  3711. removed = p.removeChild(node);
  3712. }
  3713. (node).root = null;
  3714. (node).notifyAfterUpdate(1002, 3000, null, null);
  3715. return removed;
  3716. };
  3717. com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT = function() {
  3718. return (this).parent;
  3719. };
  3720. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT = function(text) {
  3721. (this).notifyBeforeUpdate(1000, 2004, "text", this.rave_getText());
  3722. (this).attributes.put("text", text);
  3723. (this).notifyAfterUpdate(1000, 2004, "text", text);
  3724. };
  3725. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT = function(key, value) {
  3726. if (key != null) {
  3727. var k = key.toLowerCase();
  3728. (this).notifyBeforeUpdate(1000, 2000, k, this.getAttribute(key));
  3729. (this).attributes.put(k, value);
  3730. (this).notifyAfterUpdate(1000, 2000, k, value);
  3731. }
  3732. };
  3733. com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT = function(styleName, value, priority) {
  3734. (this).notifyBeforeUpdate(1000, 2002, styleName, this.rave_getStyle(styleName));
  3735. (this).styles.put(styleName, value);
  3736. (this).notifyAfterUpdate(1000, 2002, styleName, value);
  3737. };
  3738. /**
  3739. * List of listeners for updates on this scene node.
  3740. */
  3741. com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners = com_ibm_rave_render_internal_nodes_AbstractSceneNode.initListeners();
  3742. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT = function() {
  3743. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM(this, false);
  3744. };
  3745. com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT = function() {
  3746. return com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM(this, true);
  3747. };
  3748. // $source: com/ibm/rave/render/internal/nodes/RectSceneItem
  3749. /************************************************************************
  3750. ** IBM Confidential
  3751. **
  3752. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3753. **
  3754. ** (C) Copyright IBM Corp. 2015
  3755. **
  3756. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3757. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3758. ************************************************************************/
  3759. // GENERATED
  3760. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3761. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  3762. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  3763. /**
  3764. * An AWT Rectangle shape as a SceneNode.
  3765. * @author sproulja
  3766. */
  3767. var com_ibm_rave_render_internal_nodes_RectSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  3768. /** @expose */
  3769. getBBox : function() {
  3770. var x = + (this.attributes.get("x"));
  3771. var y = + (this.attributes.get("y"));
  3772. var width = + (this.attributes.get("width"));
  3773. var height = + (this.attributes.get("height"));
  3774. return new com_ibm_rave_core_geom_RaveRect(x, y, width, height);
  3775. },
  3776. /** @expose */
  3777. rave_getDrawType : function() {
  3778. return 1000;
  3779. },
  3780. /** @expose */
  3781. rave_getName : function() {
  3782. return "rect";
  3783. }
  3784. //constructor : function(nsuri, context) {}
  3785. });
  3786. // $source: com/ibm/rave/render/internal/css/TransformParser
  3787. /************************************************************************
  3788. ** IBM Confidential
  3789. **
  3790. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3791. **
  3792. ** (C) Copyright IBM Corp. 2015
  3793. **
  3794. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3795. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3796. ************************************************************************/
  3797. // GENERATED
  3798. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3799. //@import com/ibm/rave/render/internal/css/CSSParser (runtime) // parseStyle
  3800. //@import com/ibm/rave/core/transform/MatrixUtil (static) // create, identity
  3801. //@import com/ibm/rave/render/internal/css/om/CSSTransformValue (runtime) // determineType
  3802. /**
  3803. * Responsible for taking a list of CSS transform declarations and converting them into a single multiplied matrix.
  3804. */
  3805. var com_ibm_rave_render_internal_css_TransformParser = com_ibm_rave_core_nativeImpl_Declare({
  3806. });
  3807. /**
  3808. * Parse a transform string and return a multiplied matrix containing all values.
  3809. * @param (String) style CSS transform style string.
  3810. * @return (com.ibm.rave.core.transform.Matrix) Matrix combining all styles. Will return null if parsing returns no transforms.
  3811. */
  3812. com_ibm_rave_render_internal_css_TransformParser.parse = function(style) {
  3813. var matrix;
  3814. var declaration = com_ibm_rave_render_internal_css_CSSParser.parseStyle("transform", style);
  3815. if (declaration) {
  3816. declaration.each(function(name, value, i) {
  3817. var valueList = value;
  3818. if (valueList) {
  3819. valueList.each(function(name, value, index) {
  3820. var transformValue = value;
  3821. var newMatrix = com_ibm_rave_render_internal_css_TransformParser.create(name, transformValue);
  3822. if (matrix) {
  3823. newMatrix = matrix.multiply(newMatrix);
  3824. }
  3825. matrix = newMatrix;
  3826. });
  3827. }
  3828. });
  3829. }
  3830. return matrix;
  3831. };
  3832. com_ibm_rave_render_internal_css_TransformParser.create = function(operator, transformValue) {
  3833. var result = com_ibm_rave_core_transform_MatrixUtil.identity();
  3834. var values = [];
  3835. transformValue.each(function(name, value, index) {
  3836. values.push(value);
  3837. });
  3838. if (values.length > 0) {
  3839. var firstValue = com_ibm_rave_render_internal_css_TransformParser.convert(values, 0);
  3840. var type = com_ibm_rave_render_internal_css_om_CSSTransformValue.determineType(operator);
  3841. switch (type) {
  3842. case 5:
  3843. if (values.length == 1) {
  3844. result = result.scale(firstValue);
  3845. } else if (values.length == 2) {
  3846. result = result.scaleNonUniform(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
  3847. }
  3848. break;
  3849. case 6:
  3850. result = result.scaleNonUniform(firstValue, 1);
  3851. break;
  3852. case 7:
  3853. result = result.scaleNonUniform(1, firstValue);
  3854. break;
  3855. case 4:
  3856. if (values.length > 2) {
  3857. result = result.rotate(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1), com_ibm_rave_render_internal_css_TransformParser.convert(values, 2));
  3858. } else if (values.length == 1) {
  3859. result = result.rotate(firstValue);
  3860. }
  3861. break;
  3862. case 8:
  3863. if (values.length > 1) {
  3864. result = result.skewX(firstValue).skewY(com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
  3865. }
  3866. break;
  3867. case 9:
  3868. result = result.skewX(firstValue);
  3869. break;
  3870. case 10:
  3871. result = result.skewY(firstValue);
  3872. break;
  3873. case 1:
  3874. if (values.length > 1) {
  3875. result = result.translate(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
  3876. break;
  3877. }
  3878. case 2:
  3879. result = result.translate(firstValue, 0);
  3880. break;
  3881. case 3:
  3882. result = result.translate(0, firstValue);
  3883. break;
  3884. case 11:
  3885. if (values.length == 6) {
  3886. result = com_ibm_rave_core_transform_MatrixUtil.create(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1), com_ibm_rave_render_internal_css_TransformParser.convert(values, 2), com_ibm_rave_render_internal_css_TransformParser.convert(values, 3), com_ibm_rave_render_internal_css_TransformParser.convert(values, 4), com_ibm_rave_render_internal_css_TransformParser.convert(values, 5));
  3887. }
  3888. break;
  3889. default:
  3890. break;
  3891. }
  3892. }
  3893. return result;
  3894. };
  3895. com_ibm_rave_render_internal_css_TransformParser.convert = function(values, index) {
  3896. return + (values[index].value);
  3897. };
  3898. // $source: com/ibm/rave/render/internal/css/rules/CSSRule
  3899. /************************************************************************
  3900. ** IBM Confidential
  3901. **
  3902. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3903. **
  3904. ** (C) Copyright IBM Corp. 2015
  3905. **
  3906. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3907. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3908. ************************************************************************/
  3909. // GENERATED
  3910. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3911. var com_ibm_rave_render_internal_css_rules_CSSRule = com_ibm_rave_core_nativeImpl_Declare({
  3912. //cssText : null,
  3913. //parentRule : null,
  3914. //parentStyleSheet : null,
  3915. __starts : 0,
  3916. __ends : 0
  3917. //getType : function() {}
  3918. });
  3919. com_ibm_rave_render_internal_css_rules_CSSRule.UNKNOWN_RULE = 0;
  3920. com_ibm_rave_render_internal_css_rules_CSSRule.STYLE_RULE = 1;
  3921. com_ibm_rave_render_internal_css_rules_CSSRule.CHARSET_RULE = 2;
  3922. com_ibm_rave_render_internal_css_rules_CSSRule.IMPORT_RULE = 3;
  3923. com_ibm_rave_render_internal_css_rules_CSSRule.MEDIA_RULE = 4;
  3924. com_ibm_rave_render_internal_css_rules_CSSRule.FONT_FACE_RULE = 5;
  3925. com_ibm_rave_render_internal_css_rules_CSSRule.PAGE_RULE = 6;
  3926. com_ibm_rave_render_internal_css_rules_CSSRule.KEYFRAMES_RULE = 7;
  3927. com_ibm_rave_render_internal_css_rules_CSSRule.KEYFRAME_RULE = 8;
  3928. com_ibm_rave_render_internal_css_rules_CSSRule.SUPPORTS_RULE = 12;
  3929. com_ibm_rave_render_internal_css_rules_CSSRule.VIEWPORT_RULE = 15;
  3930. com_ibm_rave_render_internal_css_rules_CSSRule.WEBKIT_FILTER_RULE = 17;
  3931. com_ibm_rave_render_internal_css_rules_CSSRule.DOCUMENT_RULE = 20;
  3932. com_ibm_rave_render_internal_css_rules_CSSRule.STYLESHEET_RULE = 21;
  3933. // $source: com/ibm/rave/render/internal/css/rules/CSSRuleList
  3934. /************************************************************************
  3935. ** IBM Confidential
  3936. **
  3937. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3938. **
  3939. ** (C) Copyright IBM Corp. 2015
  3940. **
  3941. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3942. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3943. ************************************************************************/
  3944. // GENERATED
  3945. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3946. //@import com/ibm/rave/render/internal/css/rules/CSSRule (loadtime) // superclass
  3947. /**
  3948. * An abstract CSSRule that contains a list of rules.
  3949. */
  3950. var com_ibm_rave_render_internal_css_rules_CSSRuleList = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRule, {
  3951. /**
  3952. * Public list of rules.
  3953. */
  3954. //cssRules : null,
  3955. constructor : function() {
  3956. this.cssRules = [];
  3957. }
  3958. });
  3959. // $source: com/ibm/rave/render/internal/css/om/CSSStyleSheet
  3960. /************************************************************************
  3961. ** IBM Confidential
  3962. **
  3963. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3964. **
  3965. ** (C) Copyright IBM Corp. 2015
  3966. **
  3967. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3968. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3969. ************************************************************************/
  3970. // GENERATED
  3971. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3972. //@import com/ibm/rave/render/internal/css/rules/CSSRuleList (loadtime) // superclass
  3973. /**
  3974. * A model representing a CSS style sheet.
  3975. */
  3976. var com_ibm_rave_render_internal_css_om_CSSStyleSheet = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRuleList, {
  3977. getType : function() {
  3978. return 21;
  3979. }
  3980. });
  3981. // $source: com/ibm/rave/render/internal/css/rules/CSSStyleRule
  3982. /************************************************************************
  3983. ** IBM Confidential
  3984. **
  3985. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3986. **
  3987. ** (C) Copyright IBM Corp. 2015
  3988. **
  3989. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3990. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3991. ************************************************************************/
  3992. // GENERATED
  3993. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  3994. //@import com/ibm/rave/render/internal/css/rules/CSSRule (loadtime) // superclass
  3995. var com_ibm_rave_render_internal_css_rules_CSSStyleRule = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRule, {
  3996. //selectorText : null,
  3997. //style : null,
  3998. getType : function() {
  3999. return 1;
  4000. }
  4001. });
  4002. // $source: com/ibm/rave/render/internal/css/om/CSSStyleDeclaration
  4003. /************************************************************************
  4004. ** IBM Confidential
  4005. **
  4006. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4007. **
  4008. ** (C) Copyright IBM Corp. 2015
  4009. **
  4010. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4011. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4012. ************************************************************************/
  4013. // GENERATED
  4014. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4015. var com_ibm_rave_render_internal_css_om_CSSStyleDeclaration = com_ibm_rave_core_nativeImpl_Declare({
  4016. //propNames : null,
  4017. //propValues : null,
  4018. __starts : 0,
  4019. constructor : function() {
  4020. this.propNames = [];
  4021. this.propValues = [];
  4022. },
  4023. /**
  4024. * Return the property as a string - as it was set in the CSS originally.
  4025. * @param (String) propertyName The name to retrieve value for.
  4026. * @return (String) The property value as a string.
  4027. */
  4028. getPropertyValue : function(propertyName) {
  4029. var index = this.propNames.indexOf(propertyName);
  4030. return (index >= 0) ? this.propValues[index].value : null;
  4031. },
  4032. getPropertyCSSValue : function(propertyName) {
  4033. return null;
  4034. },
  4035. /**
  4036. * Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
  4037. * @param (String) propertyName Name of the style to look up.
  4038. * @return (String) Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
  4039. */
  4040. getPropertyPriority : function(propertyName) {
  4041. var index = this.propNames.indexOf(propertyName);
  4042. if (index == -1) {
  4043. return null;
  4044. }
  4045. return (this.propValues[index].priority) ? "important" : "";
  4046. },
  4047. setProperty : function(propertyName, value, priority) {
  4048. var property = this.findOrCreateProperty(propertyName);
  4049. property.value = value;
  4050. property.priority = "important" == priority;
  4051. },
  4052. setPropertyValue : function(propertyName, value) {
  4053. var property = this.findOrCreateProperty(propertyName);
  4054. property.value = value;
  4055. },
  4056. setPropertyPriority : function(propertyName, priority) {
  4057. var property = this.findOrCreateProperty(propertyName);
  4058. property.priority = "important" == priority;
  4059. },
  4060. findOrCreateProperty : function(propertyName) {
  4061. var index = this.propNames.indexOf(propertyName);
  4062. var property;
  4063. if (index >= 0) {
  4064. property = this.propValues[index];
  4065. } else {
  4066. this.propNames.push(propertyName);
  4067. property = new com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.PropertyValueStruct();
  4068. this.propValues.push(property);
  4069. }
  4070. return property;
  4071. },
  4072. /**
  4073. * Return the 1-index size of the list of properties.
  4074. * @return (int) Size of the list of properties. 1 indexed.
  4075. */
  4076. length : function() {
  4077. return this.propNames.length;
  4078. },
  4079. /**
  4080. * Return the property name at a certain index. Returns null if the index doesn't exist.
  4081. * @param (int) index Index to retreive property name for.
  4082. * @return (String) Property name at this index. Null if index doesn't exist.
  4083. */
  4084. item : function(index) {
  4085. return this.propNames[index];
  4086. },
  4087. /**
  4088. * Helper method to go through each style in this declaration and return the CSSValue of it.
  4089. * @param (com.ibm.rave.render.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
  4090. */
  4091. each : function(cssValueHandler) {
  4092. var i = 0;
  4093. for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
  4094. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4095. var name = __exp_enFor0[__i_enFor0];
  4096. cssValueHandler(name, this.getPropertyCSSValue(name), i++);
  4097. }
  4098. }
  4099. });
  4100. com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.PropertyValueStruct = function(){};
  4101. com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.IMPORTANT = "important";
  4102. // $source: com/ibm/rave/render/internal/css/om/StyleDeclaration
  4103. /************************************************************************
  4104. ** IBM Confidential
  4105. **
  4106. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4107. **
  4108. ** (C) Copyright IBM Corp. 2015
  4109. **
  4110. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4111. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4112. ************************************************************************/
  4113. // GENERATED
  4114. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4115. //@import com/ibm/rave/render/internal/css/om/CSSStyleDeclaration (loadtime) // superclass
  4116. /**
  4117. * Internal representation of a CSSStyleDeclaration.
  4118. */
  4119. var com_ibm_rave_render_internal_css_om_StyleDeclaration = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSStyleDeclaration, {
  4120. //cssValues : null,
  4121. constructor : function() {
  4122. this.cssValues = {};
  4123. },
  4124. /**
  4125. * Set the internal CSSValue for a property to 'value'.
  4126. * @param (String) propertyName Name of property to set.
  4127. * @param (com.ibm.rave.render.internal.css.om.CSSValue) value CSSValue to assign to property.
  4128. */
  4129. setPropertyCSSValue : function(propertyName, value) {
  4130. this.cssValues[propertyName] = value;
  4131. },
  4132. getPropertyCSSValue : function(propertyName) {
  4133. return this.cssValues[propertyName];
  4134. }
  4135. });
  4136. // $source: com/ibm/rave/render/internal/css/rules/CSSKeyframeRule
  4137. /************************************************************************
  4138. ** IBM Confidential
  4139. **
  4140. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4141. **
  4142. ** (C) Copyright IBM Corp. 2015
  4143. **
  4144. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4145. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4146. ************************************************************************/
  4147. // GENERATED
  4148. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4149. //@import com/ibm/rave/render/internal/css/rules/CSSStyleRule (loadtime) // superclass
  4150. var com_ibm_rave_render_internal_css_rules_CSSKeyframeRule = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSStyleRule, {
  4151. //keyText : null,
  4152. getType : function() {
  4153. return 8;
  4154. }
  4155. });
  4156. // $source: com/ibm/rave/render/internal/css/om/CSSValue
  4157. /************************************************************************
  4158. ** IBM Confidential
  4159. **
  4160. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4161. **
  4162. ** (C) Copyright IBM Corp. 2015
  4163. **
  4164. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4165. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4166. ************************************************************************/
  4167. // GENERATED
  4168. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4169. var com_ibm_rave_render_internal_css_om_CSSValue = com_ibm_rave_core_nativeImpl_Declare({
  4170. //getType : function() {},
  4171. //cssText : function() {},
  4172. //getName : function() {}
  4173. });
  4174. com_ibm_rave_render_internal_css_om_CSSValue.CSS_INHERIT = 0;
  4175. com_ibm_rave_render_internal_css_om_CSSValue.CSS_PRIMITIVE_VALUE = 1;
  4176. com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST = 2;
  4177. com_ibm_rave_render_internal_css_om_CSSValue.CSS_CUSTOM = 3;
  4178. // $source: com/ibm/rave/render/internal/css/om/CSSValueList
  4179. /************************************************************************
  4180. ** IBM Confidential
  4181. **
  4182. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4183. **
  4184. ** (C) Copyright IBM Corp. 2015
  4185. **
  4186. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4187. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4188. ************************************************************************/
  4189. // GENERATED
  4190. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4191. //@import com/ibm/rave/render/internal/css/om/CSSValue (loadtime) // CSS_VALUE_LIST, superclass
  4192. /**
  4193. * A list of values parsed from a CSS value declaration. IE - the declaration "scale(10,20)" has two values - 10 and 20.
  4194. */
  4195. var com_ibm_rave_render_internal_css_om_CSSValueList = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValue, {
  4196. //objects : null,
  4197. constructor : function() {
  4198. this.objects = [];
  4199. },
  4200. /**
  4201. * Append a single value to this list.
  4202. * @param (com.ibm.rave.render.internal.css.om.CSSValue) value Value to append to value list.
  4203. */
  4204. append : function(value) {
  4205. this.objects.push(value);
  4206. },
  4207. /**
  4208. * Remove all values from this list.
  4209. */
  4210. removeAll : function() {
  4211. this.objects.length = 0;
  4212. },
  4213. /**
  4214. * Return CSSValue at index.
  4215. * @param (int) index
  4216. * @return (com.ibm.rave.render.internal.css.om.CSSValue) CSSValue
  4217. */
  4218. item : function(index) {
  4219. if (this.objects.length > index) {
  4220. return this.objects[index];
  4221. }
  4222. return null;
  4223. },
  4224. cssText : function() {
  4225. var results = "";
  4226. for (var i = 0; i < this.objects.length; ++i) {
  4227. results += this.objects[i].cssText();
  4228. if (i < this.objects.length - 1) {
  4229. results += ",";
  4230. }
  4231. }
  4232. return results;
  4233. },
  4234. /**
  4235. * @return (int) Number of values in this list.
  4236. */
  4237. length : function() {
  4238. return this.objects.length;
  4239. },
  4240. getType : function() {
  4241. return com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST;
  4242. },
  4243. /**
  4244. * Helper method to go through each style in this valueList and return the CSSValue of it.
  4245. * @param (com.ibm.rave.render.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
  4246. */
  4247. each : function(cssValueHandler) {
  4248. var i = 0;
  4249. for (var __i_enFor0 = 0, __exp_enFor0 = this.objects, __len_enFor0 = __exp_enFor0.length;
  4250. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4251. var object = __exp_enFor0[__i_enFor0];
  4252. cssValueHandler(object.getName(), object, i++);
  4253. }
  4254. },
  4255. getName : function() {
  4256. return null;
  4257. }
  4258. /**
  4259. * Create a new list of CSSValues.
  4260. */
  4261. //constructor : function() {}
  4262. });
  4263. // $source: com/ibm/rave/render/internal/css/CSSParser
  4264. /************************************************************************
  4265. ** IBM Confidential
  4266. **
  4267. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4268. **
  4269. ** (C) Copyright IBM Corp. 2015
  4270. **
  4271. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4272. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4273. ************************************************************************/
  4274. // GENERATED
  4275. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4276. //@import com/ibm/rave/render/internal/css/om/CSSStyleSheet (runtime) // new
  4277. //@import com/ibm/rave/render/internal/css/rules/CSSStyleRule (static) // new
  4278. //@import com/ibm/rave/render/internal/css/om/StyleDeclaration (static) // new
  4279. //@import com/ibm/rave/render/internal/css/rules/CSSKeyframeRule (static) // new
  4280. //@import com/ibm/rave/render/internal/css/om/CSSValue (static) // CSSValue
  4281. //@import com/ibm/rave/render/internal/css/om/CSSValueList (static) // new
  4282. //@import com/ibm/rave/render/internal/css/CSSValueParser (runtime) // new
  4283. /**
  4284. * A java port of CSSOM. Contains custom modifications to support more value types.
  4285. */
  4286. var com_ibm_rave_render_internal_css_CSSParser = com_ibm_rave_core_nativeImpl_Declare({
  4287. });
  4288. /**
  4289. * Parse the contents of a style block of CSS. This can be used for parsing a single style attribute. Wraps 'token' inside a wildcard block and parses the resulting token.
  4290. * @param (String) styleName The name of the style.
  4291. * @param (String) token The CSS block contents.
  4292. * @return (com.ibm.rave.render.internal.css.om.CSSStyleDeclaration) CSSStyleSheet with the model. Returns null if a parsing error occured.
  4293. */
  4294. com_ibm_rave_render_internal_css_CSSParser.parseStyle = function(styleName, token) {
  4295. var sheet = com_ibm_rave_render_internal_css_CSSParser.parse("*{" + styleName + ":" + token + "}");
  4296. if (sheet) {
  4297. if (sheet && sheet.cssRules.length > 0) {
  4298. return (sheet.cssRules[0]).style;
  4299. }
  4300. }
  4301. return null;
  4302. };
  4303. /**
  4304. * Parse a CSS stylesheet string into a CSSStyleSheet object.
  4305. * @param (String) token The css stylesheet string.
  4306. * @return (com.ibm.rave.render.internal.css.om.CSSStyleSheet) CSSStyleSheet. Will return null on a parsing error.
  4307. */
  4308. com_ibm_rave_render_internal_css_CSSParser.parse = function(token) {
  4309. var state = 1001;
  4310. var index;
  4311. var buffer = "";
  4312. var SIGNIFICANT_WHITESPACE = {};
  4313. SIGNIFICANT_WHITESPACE[1003] = 1;
  4314. SIGNIFICANT_WHITESPACE[1006] = 1;
  4315. SIGNIFICANT_WHITESPACE[1013] = 1;
  4316. SIGNIFICANT_WHITESPACE[1007] = 1;
  4317. SIGNIFICANT_WHITESPACE[1008] = 1;
  4318. SIGNIFICANT_WHITESPACE[1010] = 1;
  4319. SIGNIFICANT_WHITESPACE[1009] = 1;
  4320. var styleSheet = new com_ibm_rave_render_internal_css_om_CSSStyleSheet();
  4321. var currentScope = styleSheet;
  4322. var parentRule;
  4323. var name;
  4324. var priority = "";
  4325. var styleRule = new com_ibm_rave_render_internal_css_rules_CSSStyleRule();
  4326. var character;
  4327. var cssValue;
  4328. var currentOperation = "";
  4329. for (var i = 0; i < token.length; ++i) {
  4330. character = token.charCodeAt(i);
  4331. switch (character) {
  4332. case 32:
  4333. case 9:
  4334. case 13:
  4335. case 10:
  4336. case 12:
  4337. if (SIGNIFICANT_WHITESPACE.hasOwnProperty(state)) {
  4338. buffer += String.fromCharCode(character);
  4339. }
  4340. break;
  4341. case 34:
  4342. index = i + 1;
  4343. do {
  4344. index = token.indexOfCharCode(34, index) + 1;
  4345. if (index == 0) {
  4346. return null;
  4347. }
  4348. } while (token.substring(index - 2, 1) == "\\");
  4349. buffer += token.substring(i, index);
  4350. i = index - 1;
  4351. if (state == 1002) {
  4352. state = 1006;
  4353. } else if (state == 1007) {
  4354. state = 1008;
  4355. }
  4356. break;
  4357. case 39:
  4358. index = i + 1;
  4359. do {
  4360. index = token.indexOf("'", index) + 1;
  4361. if (index == 0) {
  4362. return null;
  4363. }
  4364. } while (token.substring(index - 2, 1) == "\\");
  4365. buffer += token.substring(i, index);
  4366. i = index - 1;
  4367. switch (state) {
  4368. case 1002:
  4369. {
  4370. state = 1006;
  4371. break;
  4372. } case 1007:
  4373. state = 1008;
  4374. break;
  4375. default:
  4376. break;
  4377. }
  4378. break;
  4379. case 47:
  4380. if (token.charCodeAt(i + 1) == 42) {
  4381. i += 2;
  4382. index = token.indexOf("*/", i);
  4383. if (index == -1) {
  4384. return null;
  4385. }
  4386. i = index + 1;
  4387. } else {
  4388. buffer += String.fromCharCode(character);
  4389. }
  4390. if (state == 1007) {
  4391. buffer += " ";
  4392. state = 1008;
  4393. }
  4394. break;
  4395. case 64:
  4396. if (token.indexOf("@-moz-document", i) == i) {
  4397. state = 1009;
  4398. i += "-moz-document".length;
  4399. buffer = "";
  4400. break;
  4401. } else if (token.indexOf("@media", i) == i) {
  4402. state = 1010;
  4403. i += "media".length;
  4404. buffer = "";
  4405. break;
  4406. } else if (token.indexOf("@import", i) == i) {
  4407. state = 1007;
  4408. i += "import".length;
  4409. buffer += "@import";
  4410. break;
  4411. } else if (token.indexOf("@font-face", i) == i) {
  4412. state = 1011;
  4413. i += "font-face".length;
  4414. buffer = "";
  4415. break;
  4416. } else {
  4417. com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp["lastIndex"] = i;
  4418. var matchKeyframes = com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp.exec(token);
  4419. if (matchKeyframes && matchKeyframes.index == i) {
  4420. state = 1012;
  4421. i += matchKeyframes[0].length - 1;
  4422. buffer = "";
  4423. break;
  4424. } else if (state == 1003) {
  4425. state = 1013;
  4426. }
  4427. }
  4428. buffer += String.fromCharCode(character);
  4429. break;
  4430. case 123:
  4431. if (state == 1003 || state == 1013) {
  4432. styleRule.selectorText = buffer.trim();
  4433. styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
  4434. styleRule.style.__starts = i;
  4435. buffer = "";
  4436. state = 1000;
  4437. } else if (state == 1010) {
  4438. buffer = "";
  4439. state = 1001;
  4440. } else if (state == 1011) {
  4441. buffer = "";
  4442. state = 1000;
  4443. } else if (state == 1012) {
  4444. buffer = "";
  4445. state = 1004;
  4446. } else if (state == 1004) {
  4447. styleRule = new com_ibm_rave_render_internal_css_rules_CSSKeyframeRule();
  4448. (styleRule).keyText = buffer.trim();
  4449. styleRule.__starts = i;
  4450. buffer = "";
  4451. state = 1000;
  4452. } else if (state == 1009) {
  4453. buffer = "";
  4454. state = 1001;
  4455. }
  4456. break;
  4457. case 58:
  4458. if (state == 1005) {
  4459. name = buffer.trim();
  4460. buffer = "";
  4461. state = 1002;
  4462. } else {
  4463. buffer += String.fromCharCode(character);
  4464. }
  4465. break;
  4466. case 40:
  4467. if (state == 1006) {
  4468. var propertyType = com_ibm_rave_render_internal_css_CSSParser.determinePropertyType(name);
  4469. if (!cssValue) {
  4470. cssValue = com_ibm_rave_render_internal_css_CSSParser.createValueContainer(propertyType);
  4471. }
  4472. var info = com_ibm_rave_render_internal_css_CSSParser.parseValues(propertyType, currentOperation, token, i);
  4473. i = info.idx;
  4474. if (info.error == 0) {
  4475. buffer += info.expression;
  4476. if (cssValue && cssValue.getType() == com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST) {
  4477. (cssValue).append(info.cssValue);
  4478. } else {
  4479. cssValue = info.cssValue;
  4480. }
  4481. } else {
  4482. buffer = "";
  4483. }
  4484. currentOperation = "";
  4485. } else {
  4486. buffer += String.fromCharCode(character);
  4487. }
  4488. break;
  4489. case 33:
  4490. if (state == 1006 && token.indexOf("!" + "important", i) == i) {
  4491. priority = "important";
  4492. i += "important".length;
  4493. } else {
  4494. buffer += String.fromCharCode(character);
  4495. }
  4496. break;
  4497. case 59:
  4498. switch (state) {
  4499. case 1006:
  4500. styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
  4501. styleRule.style.setProperty(name, buffer.trim(), priority);
  4502. (styleRule.style).setPropertyCSSValue(name, cssValue);
  4503. priority = "";
  4504. buffer = "";
  4505. state = 1000;
  4506. cssValue = null;
  4507. break;
  4508. case 1013:
  4509. buffer = "";
  4510. state = 1001;
  4511. break;
  4512. case 1008:
  4513. buffer = "";
  4514. state = 1001;
  4515. break;
  4516. default:
  4517. buffer += String.fromCharCode(character);
  4518. }
  4519. break;
  4520. case 125:
  4521. switch (state) {
  4522. case 1006:
  4523. styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
  4524. styleRule.style.setProperty(name, buffer.trim(), priority);
  4525. (styleRule.style).setPropertyCSSValue(name, cssValue);
  4526. priority = "";
  4527. cssValue = null;
  4528. case 1000:
  4529. case 1005:
  4530. styleRule.__ends = i + 1;
  4531. if (parentRule) {
  4532. styleRule.parentRule = parentRule;
  4533. }
  4534. styleRule.parentStyleSheet = styleSheet;
  4535. currentScope.cssRules.push(styleRule);
  4536. buffer = "";
  4537. if (currentScope.getType() == 7) {
  4538. state = 1004;
  4539. } else {
  4540. state = 1001;
  4541. }
  4542. break;
  4543. case 1004:
  4544. case 1001:
  4545. case 1003:
  4546. if (parentRule) {
  4547. currentScope.__ends = i + 1;
  4548. styleSheet.cssRules.push(currentScope);
  4549. }
  4550. currentScope = styleSheet;
  4551. parentRule = null;
  4552. buffer = "";
  4553. state = 1001;
  4554. break;
  4555. }
  4556. break;
  4557. default:
  4558. switch (state) {
  4559. case 1001:
  4560. state = 1003;
  4561. styleRule = new com_ibm_rave_render_internal_css_rules_CSSStyleRule();
  4562. styleRule.__starts = i;
  4563. break;
  4564. case 1000:
  4565. state = 1005;
  4566. break;
  4567. case 1002:
  4568. state = 1006;
  4569. case 1006:
  4570. currentOperation += String.fromCharCode(character);
  4571. break;
  4572. case 1007:
  4573. state = 1008;
  4574. break;
  4575. }
  4576. buffer += String.fromCharCode(character);
  4577. break;
  4578. }
  4579. }
  4580. return styleSheet;
  4581. };
  4582. /**
  4583. * Create a CSSValue that holds values for propertyType. For instance, a TransformValue requires a CSSValueList.
  4584. * @param (int) propertyType
  4585. * @return (com.ibm.rave.render.internal.css.om.CSSValue)
  4586. */
  4587. com_ibm_rave_render_internal_css_CSSParser.createValueContainer = function(propertyType) {
  4588. var cssValue;
  4589. if (propertyType == 0) {
  4590. cssValue = new com_ibm_rave_render_internal_css_om_CSSValueList();
  4591. }
  4592. return cssValue;
  4593. };
  4594. com_ibm_rave_render_internal_css_CSSParser.parseValues = function(propertyType, buffer, token, i) {
  4595. var valueExpression = new com_ibm_rave_render_internal_css_CSSValueParser(propertyType, buffer, token, i);
  4596. return valueExpression.parse();
  4597. };
  4598. com_ibm_rave_render_internal_css_CSSParser.determinePropertyType = function(type) {
  4599. if (type == "transform") {
  4600. return 0;
  4601. }
  4602. return -1;
  4603. };
  4604. com_ibm_rave_render_internal_css_CSSParser.BEFORE_NAME = 1000;
  4605. com_ibm_rave_render_internal_css_CSSParser.BEFORE_SELECTOR = 1001;
  4606. com_ibm_rave_render_internal_css_CSSParser.BEFORE_VALUE = 1002;
  4607. com_ibm_rave_render_internal_css_CSSParser.SELECTOR = 1003;
  4608. com_ibm_rave_render_internal_css_CSSParser.KEYFRAMERULE_BEGIN = 1004;
  4609. com_ibm_rave_render_internal_css_CSSParser.NAME = 1005;
  4610. com_ibm_rave_render_internal_css_CSSParser.VALUE = 1006;
  4611. com_ibm_rave_render_internal_css_CSSParser.IMPORTRULE_BEGIN = 1007;
  4612. com_ibm_rave_render_internal_css_CSSParser.IMPORTRULE = 1008;
  4613. com_ibm_rave_render_internal_css_CSSParser.DOCUMENTRULE_BEGIN = 1009;
  4614. com_ibm_rave_render_internal_css_CSSParser.ATBLOCK = 1010;
  4615. com_ibm_rave_render_internal_css_CSSParser.FONTFACERULE_BEGIN = 1011;
  4616. com_ibm_rave_render_internal_css_CSSParser.KEYFRAMESRULE_BEGIN = 1012;
  4617. com_ibm_rave_render_internal_css_CSSParser.ATRULE = 1013;
  4618. com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp = new RegExp("@(-(?:\\w+-)+)?keyframes", "g");
  4619. // $source: com/ibm/rave/render/internal/css/CSSValueParser
  4620. /************************************************************************
  4621. ** IBM Confidential
  4622. **
  4623. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4624. **
  4625. ** (C) Copyright IBM Corp. 2015
  4626. **
  4627. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4628. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4629. ************************************************************************/
  4630. // GENERATED
  4631. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4632. //@import com/ibm/rave/render/internal/css/om/CSSTransformValue (runtime) // new
  4633. //@import com/ibm/rave/render/internal/css/om/CSSValueList (runtime) // new
  4634. //@import com/ibm/rave/render/internal/css/om/CSSPrimitiveValue (runtime) // new
  4635. /**
  4636. * Parses a 'value' inside a CSS style declaration. For instance, 'scale(20,20)' would be a value inside a transform and would be parsed through here.
  4637. */
  4638. var com_ibm_rave_render_internal_css_CSSValueParser = com_ibm_rave_core_nativeImpl_Declare({
  4639. //_token : null,
  4640. //name : null,
  4641. //valueList : null,
  4642. type : 0,
  4643. _idx : 0,
  4644. UNDEF : 0,
  4645. INSIDE_FUNCTION : 1,
  4646. constructor : function(type, name, token, index) {
  4647. this.type = type;
  4648. this._token = token;
  4649. this._idx = index;
  4650. this.name = name;
  4651. this.valueList = this.createArgumentContainer();
  4652. },
  4653. parse : function() {
  4654. var token = this._token;
  4655. var idx = this._idx;
  4656. var character;
  4657. var expression = "";
  4658. var error = 0;
  4659. var info;
  4660. var paren = [];
  4661. var state = this.UNDEF;
  4662. var currentArg = "";
  4663. for (;; ++idx) {
  4664. if (idx == token.length) {
  4665. error = -1;
  4666. break;
  4667. }
  4668. character = token.charCodeAt(idx);
  4669. switch (character) {
  4670. case 40:
  4671. state = this.INSIDE_FUNCTION;
  4672. paren.push(character);
  4673. expression += String.fromCharCode(character);
  4674. break;
  4675. case 41:
  4676. if (state == this.INSIDE_FUNCTION) {
  4677. this.valueList.append(this.createValue(currentArg));
  4678. currentArg = "";
  4679. }
  4680. state = this.UNDEF;
  4681. paren.pop();
  4682. expression += String.fromCharCode(character);
  4683. break;
  4684. case 44:
  4685. if (state == this.INSIDE_FUNCTION) {
  4686. this.valueList.append(this.createValue(currentArg));
  4687. currentArg = "";
  4688. }
  4689. expression += String.fromCharCode(character);
  4690. break;
  4691. case 47:
  4692. if ((info = this._parseJSComment(token, idx))) {
  4693. if (info.error != 0) {
  4694. error = -2;
  4695. } else {
  4696. idx = info.idx;
  4697. }
  4698. } else {
  4699. expression += String.fromCharCode(character);
  4700. }
  4701. break;
  4702. case 39:
  4703. case 34:
  4704. info = this._parseJSString(token, idx, String.fromCharCode(character) + "");
  4705. if (info) {
  4706. idx = info.idx;
  4707. expression += info.text;
  4708. } else {
  4709. expression += String.fromCharCode(character);
  4710. }
  4711. break;
  4712. case 32:
  4713. case 9:
  4714. case 13:
  4715. case 10:
  4716. case 12:
  4717. break;
  4718. default:
  4719. switch (state) {
  4720. case this.UNDEF:
  4721. break;
  4722. case this.INSIDE_FUNCTION:
  4723. currentArg += String.fromCharCode(character);
  4724. }
  4725. expression += String.fromCharCode(character);
  4726. break;
  4727. }
  4728. if (error != 0) {
  4729. break;
  4730. }
  4731. if (paren.length == 0) {
  4732. break;
  4733. }
  4734. }
  4735. var ret = new com_ibm_rave_render_internal_css_CSSValueParser.CSSValueExpressionInfo();
  4736. ret.error = error;
  4737. ret.idx = idx;
  4738. ret.expression = expression;
  4739. ret.cssValue = this.valueList;
  4740. return ret;
  4741. },
  4742. _parseJSComment : function(token, idx) {
  4743. var nextChar = token.charCodeAt(idx + 1);
  4744. var text;
  4745. if (nextChar == 47 || nextChar == 42) {
  4746. var startIdx = idx;
  4747. var endIdx;
  4748. var commentEndChar = null;
  4749. if (nextChar == 47) {
  4750. commentEndChar = "\n";
  4751. } else if (nextChar == 42) {
  4752. commentEndChar = "*/";
  4753. }
  4754. endIdx = commentEndChar != null ? token.indexOf(commentEndChar, startIdx + 1 + 1) : -1;
  4755. var struct = new com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct();
  4756. if (endIdx != -1) {
  4757. endIdx = endIdx + commentEndChar.length - 1;
  4758. text = token.substring(idx, endIdx + 1);
  4759. struct.idx = endIdx;
  4760. struct.text = text;
  4761. } else {
  4762. struct.error = -1;
  4763. }
  4764. return struct;
  4765. }
  4766. return null;
  4767. },
  4768. /**
  4769. * @return (com.ibm.rave.render.internal.css.CSSValueParser.JSCommentStruct) {Object|false} - idx: - text: or false
  4770. */
  4771. _parseJSString : function(token, idx, sep) {
  4772. var endIdx = com_ibm_rave_render_internal_css_CSSValueParser._findMatchedIdx(token, idx, sep);
  4773. var text;
  4774. if (endIdx == -1) {
  4775. return null;
  4776. }
  4777. text = token.substring(idx, endIdx + sep.length);
  4778. var struct = new com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct();
  4779. struct.idx = endIdx;
  4780. struct.text = text;
  4781. return struct;
  4782. },
  4783. /**
  4784. * Create a new CSS Value "container" for the current type of css operation. This will contain the argument CSS Values inside it.
  4785. * @param value
  4786. * @return (com.ibm.rave.render.internal.css.om.CSSValueList)
  4787. */
  4788. createArgumentContainer : function() {
  4789. switch (this.type) {
  4790. case (0):
  4791. return new com_ibm_rave_render_internal_css_om_CSSTransformValue(this.name);
  4792. default:
  4793. return new com_ibm_rave_render_internal_css_om_CSSValueList();
  4794. }
  4795. },
  4796. /**
  4797. * Create a CSS Value from the current type of operation.
  4798. * @param argumentContainer
  4799. * @param (String) value
  4800. * @return (com.ibm.rave.render.internal.css.om.CSSValue)
  4801. */
  4802. createValue : function(value) {
  4803. var val;
  4804. switch (this.type) {
  4805. case (0):
  4806. default:
  4807. val = new com_ibm_rave_render_internal_css_om_CSSPrimitiveValue(value);
  4808. break;
  4809. }
  4810. return val;
  4811. }
  4812. });
  4813. /**
  4814. * find next sep(same line) index in `token`
  4815. * @return (int) {Number}
  4816. */
  4817. com_ibm_rave_render_internal_css_CSSValueParser._findMatchedIdx = function(token, idx, sep) {
  4818. var startIdx = idx;
  4819. var endIdx;
  4820. var NOT_FOUND = -1;
  4821. var result = new RegExp("\\+$", "");
  4822. while (true) {
  4823. endIdx = token.indexOf(sep, startIdx + 1);
  4824. if (endIdx == -1) {
  4825. endIdx = NOT_FOUND;
  4826. break;
  4827. }
  4828. var text = token.substring(idx + 1, endIdx);
  4829. var matched = result.exec(text);
  4830. if (!matched || matched.length == 1) {
  4831. break;
  4832. }
  4833. startIdx = endIdx;
  4834. }
  4835. var nextNewLineIdx = token.indexOfCharCode(10, idx + 1);
  4836. if (nextNewLineIdx < endIdx) {
  4837. endIdx = NOT_FOUND;
  4838. }
  4839. return endIdx;
  4840. };
  4841. com_ibm_rave_render_internal_css_CSSValueParser.CSSValueExpressionInfo = function(){};
  4842. /**
  4843. * @return {Object|false} - idx: - text: or - error: or false
  4844. */
  4845. com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct = function(){};
  4846. // $source: com/ibm/rave/render/internal/css/om/CSSTransformValue
  4847. /************************************************************************
  4848. ** IBM Confidential
  4849. **
  4850. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4851. **
  4852. ** (C) Copyright IBM Corp. 2015
  4853. **
  4854. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4855. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4856. ************************************************************************/
  4857. // GENERATED
  4858. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4859. //@import com/ibm/rave/render/internal/css/om/CSSValueList (loadtime) // superclass
  4860. var com_ibm_rave_render_internal_css_om_CSSTransformValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValueList, {
  4861. //operationType : null,
  4862. constructor : function(operationType) {
  4863. this.operationType = operationType;
  4864. },
  4865. cssText : function() {
  4866. return this.operationType + "(" + com_ibm_rave_render_internal_css_om_CSSValueList.prototype.cssText.call(this) + ")";
  4867. },
  4868. getName : function() {
  4869. return this.operationType;
  4870. }
  4871. });
  4872. /**
  4873. * Returns a transform operation type based on the string representation.
  4874. * @param (String) type String representation of the type.
  4875. * @return (int) One of the transform operation types. -1 if undefined.
  4876. */
  4877. com_ibm_rave_render_internal_css_om_CSSTransformValue.determineType = function(type) {
  4878. if (type.indexOf("translate") == 0) {
  4879. if (type.length == 10) {
  4880. if (type.charCodeAt(9) == 88) {
  4881. return 2;
  4882. }
  4883. return 3;
  4884. }
  4885. return 1;
  4886. }
  4887. if (type.indexOf("rotate") == 0) {
  4888. return 4;
  4889. }
  4890. if (type.indexOf("scale") == 0) {
  4891. if (type.length == 6) {
  4892. if (type.charCodeAt(5) == 88) {
  4893. return 6;
  4894. }
  4895. return 7;
  4896. }
  4897. return 5;
  4898. }
  4899. if (type.indexOf("skew") == 0) {
  4900. if (type.length == 5) {
  4901. if (type.charCodeAt(4) == 88) {
  4902. return 9;
  4903. }
  4904. return 10;
  4905. }
  4906. return 8;
  4907. }
  4908. if (type.indexOf("matrix") == 0) {
  4909. return 11;
  4910. }
  4911. return -1;
  4912. };
  4913. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATE = 1;
  4914. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATEX = 2;
  4915. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATEY = 3;
  4916. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_ROTATE = 4;
  4917. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALE = 5;
  4918. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALEX = 6;
  4919. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALEY = 7;
  4920. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEW = 8;
  4921. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEWX = 9;
  4922. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEWY = 10;
  4923. com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_MATRIX = 11;
  4924. com_ibm_rave_render_internal_css_om_CSSTransformValue.transformNames = ["translate", "translateX", "translateY", "rotate", "rotateX", "rotateY", "scale", "scaleX", "scaleY", "skew", "skewX", "skewY", "matrix"];
  4925. // $source: com/ibm/rave/render/internal/css/om/CSSPrimitiveValue
  4926. /************************************************************************
  4927. ** IBM Confidential
  4928. **
  4929. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4930. **
  4931. ** (C) Copyright IBM Corp. 2015
  4932. **
  4933. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4934. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4935. ************************************************************************/
  4936. // GENERATED
  4937. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4938. //@import com/ibm/rave/render/internal/css/om/CSSValue (loadtime) // CSS_PRIMITIVE_VALUE, superclass
  4939. var com_ibm_rave_render_internal_css_om_CSSPrimitiveValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValue, {
  4940. //value : null,
  4941. constructor : function(value) {
  4942. this.value = value;
  4943. },
  4944. cssText : function() {
  4945. return ""+(this.value);
  4946. },
  4947. getType : function() {
  4948. return com_ibm_rave_render_internal_css_om_CSSValue.CSS_PRIMITIVE_VALUE;
  4949. },
  4950. getName : function() {
  4951. return null;
  4952. }
  4953. });
  4954. // $source: com/ibm/rave/core/geom/RaveRect
  4955. /************************************************************************
  4956. ** IBM Confidential
  4957. **
  4958. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4959. **
  4960. ** (C) Copyright IBM Corp. 2015
  4961. **
  4962. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4963. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4964. ************************************************************************/
  4965. // GENERATED
  4966. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  4967. /**
  4968. * A class that describes a Rectangular shape in a non-native way. Immutable. Uses doubles as coordinates.
  4969. * @author jim
  4970. */
  4971. var com_ibm_rave_core_geom_RaveRect = rave_externs["RaveRect"] = com_ibm_rave_core_nativeImpl_Declare({
  4972. /** @expose */
  4973. x : 0,
  4974. /** @expose */
  4975. y : 0,
  4976. /** @expose */
  4977. width : 0,
  4978. /** @expose */
  4979. height : 0,
  4980. /** @expose */
  4981. constructor : function(x, y, width, height) {
  4982. this.x = x;
  4983. this.y = y;
  4984. this.width = width;
  4985. this.height = height;
  4986. },
  4987. /** @expose */
  4988. getX : function() {
  4989. return this.x;
  4990. },
  4991. /** @expose */
  4992. getX2 : function() {
  4993. return this.x + this.width;
  4994. },
  4995. /** @expose */
  4996. getY : function() {
  4997. return this.y;
  4998. },
  4999. /** @expose */
  5000. getY2 : function() {
  5001. return this.y + this.height;
  5002. },
  5003. /** @expose */
  5004. getWidth : function() {
  5005. return this.width;
  5006. },
  5007. /** @expose */
  5008. getHeight : function() {
  5009. return this.height;
  5010. },
  5011. /**
  5012. * Create new intersection between this rect and the passed in rect2.
  5013. * @param (com.ibm.rave.core.geom.RaveRect) rect2 Rectangle to intersect with this rectangle.
  5014. * @return (com.ibm.rave.core.geom.RaveRect) New RaveRect shape that contains the new bounds.
  5015. */
  5016. /** @expose */
  5017. createIntersect : function(rect2) {
  5018. var newX = Math.min(this.x, rect2.x);
  5019. var newY = Math.min(this.y, rect2.y);
  5020. var newWidth = Math.max(this.getX2(), rect2.getX2()) - newX;
  5021. var newHeight = Math.max(this.getY2(), rect2.getY2()) - newY;
  5022. return new com_ibm_rave_core_geom_RaveRect(newX, newY, newWidth, newHeight);
  5023. },
  5024. /**
  5025. * Does this rect intersect the passed in rect.
  5026. * @param (com.ibm.rave.core.geom.RaveRect) rect
  5027. * @return (boolean) true if the rect intersect the passed rect, false otherwise <code>true</code> if this RaveRect has a point inside rect. <code>false</code> otherwise.
  5028. */
  5029. /** @expose */
  5030. intersects : function(rect) {
  5031. return (this.x <= this.getX2() && this.getX2() >= rect.x && this.y <= rect.getY2() && this.getY2() >= rect.y);
  5032. },
  5033. /** @expose */
  5034. hasSize : function() {
  5035. return this.width > 0 && this.height > 0;
  5036. },
  5037. /** @expose */
  5038. add : function(x, y) {
  5039. var rectx = 0, rectwidth = 0, recty = 0, rectheight = 0;
  5040. if (this.x > x) {
  5041. rectx = x;
  5042. rectwidth += (this.x - x);
  5043. } else if (this.getX2() < x) {
  5044. rectwidth += (x - this.getX2());
  5045. }
  5046. if (this.y > y) {
  5047. recty = y;
  5048. rectheight += (this.x - x);
  5049. } else if (this.getY2() < y) {
  5050. rectwidth += (y - this.getY2());
  5051. }
  5052. return new com_ibm_rave_core_geom_RaveRect(rectx, recty, rectwidth, rectheight);
  5053. }
  5054. });
  5055. // $source: com/ibm/rave/render/internal/nodes/CircleSceneItem
  5056. /************************************************************************
  5057. ** IBM Confidential
  5058. **
  5059. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5060. **
  5061. ** (C) Copyright IBM Corp. 2015
  5062. **
  5063. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5064. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5065. ************************************************************************/
  5066. // GENERATED
  5067. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5068. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5069. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  5070. //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
  5071. /**
  5072. * Circle shape.
  5073. * @author sproulja
  5074. */
  5075. var com_ibm_rave_render_internal_nodes_CircleSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5076. /** @expose */
  5077. getBBox : function() {
  5078. var cx = + (this.attributes.get("cx"));
  5079. var cy = + (this.attributes.get("cy"));
  5080. var r = + (this.attributes.get("r"));
  5081. return new com_ibm_rave_core_geom_RaveRect(cx - r, cy - r, r * 2, r * 2);
  5082. },
  5083. /** @expose */
  5084. getBoundingClientRect : function() {
  5085. var rb = this.rave_getOwner().getBBox();
  5086. var cx = + (this.attributes.get("cx"));
  5087. var cy = + (this.attributes.get("cy"));
  5088. var r = + (this.attributes.get("r"));
  5089. return new com_ibm_rave_core_geom_NodeRect(cx - r, rb.width - cx - r, rb.height - cy - r, cy - r, r * 2, r * 2);
  5090. },
  5091. /** @expose */
  5092. rave_getDrawType : function() {
  5093. return 1002;
  5094. },
  5095. /** @expose */
  5096. rave_getName : function() {
  5097. return "circle";
  5098. }
  5099. //constructor : function(nsuri, context) {}
  5100. });
  5101. // $source: com/ibm/rave/render/internal/nodes/LineSceneItem
  5102. /************************************************************************
  5103. ** IBM Confidential
  5104. **
  5105. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5106. **
  5107. ** (C) Copyright IBM Corp. 2015
  5108. **
  5109. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5110. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5111. ************************************************************************/
  5112. // GENERATED
  5113. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5114. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5115. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  5116. /**
  5117. * Circle shape.
  5118. * @author sproulja
  5119. */
  5120. var com_ibm_rave_render_internal_nodes_LineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5121. /** @expose */
  5122. getBBox : function() {
  5123. var x1 = + (this.attributes.get("x1"));
  5124. var x2 = + (this.attributes.get("x2"));
  5125. var y1 = + (this.attributes.get("y1"));
  5126. var y2 = + (this.attributes.get("y2"));
  5127. var tmp;
  5128. if (x1 > x2) {
  5129. tmp = x1;
  5130. x1 = x2;
  5131. x2 = tmp;
  5132. }
  5133. if (y1 > y2) {
  5134. tmp = y1;
  5135. y1 = y2;
  5136. y2 = tmp;
  5137. }
  5138. return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
  5139. },
  5140. /** @expose */
  5141. rave_getDrawType : function() {
  5142. return 1001;
  5143. },
  5144. /** @expose */
  5145. rave_getName : function() {
  5146. return "line";
  5147. }
  5148. //constructor : function(nsuri, context) {}
  5149. });
  5150. // $source: com/ibm/rave/render/internal/nodes/TextSceneItem
  5151. /************************************************************************
  5152. ** IBM Confidential
  5153. **
  5154. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5155. **
  5156. ** (C) Copyright IBM Corp. 2015
  5157. **
  5158. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5159. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5160. ************************************************************************/
  5161. // GENERATED
  5162. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5163. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5164. /**
  5165. * Text shape.
  5166. * @author sproulja
  5167. */
  5168. var com_ibm_rave_render_internal_nodes_TextSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5169. /** @expose */
  5170. getBoundingClientRect : function() {
  5171. return null;
  5172. },
  5173. /** @expose */
  5174. rave_getDrawType : function() {
  5175. return 1003;
  5176. },
  5177. /** @expose */
  5178. rave_getName : function() {
  5179. return "text";
  5180. },
  5181. /** @expose */
  5182. getBBox : function() {
  5183. return null;
  5184. }
  5185. //constructor : function(nsuri, context) {}
  5186. });
  5187. // $source: com/ibm/rave/render/internal/nodes/GroupSceneItem
  5188. /************************************************************************
  5189. ** IBM Confidential
  5190. **
  5191. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5192. **
  5193. ** (C) Copyright IBM Corp. 2015
  5194. **
  5195. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5196. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5197. ************************************************************************/
  5198. // GENERATED
  5199. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5200. //@import com/ibm/rave/render/internal/nodes/RectSceneItem (loadtime) // superclass
  5201. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  5202. var com_ibm_rave_render_internal_nodes_GroupSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_RectSceneItem, {
  5203. /** @expose */
  5204. rave_getName : function() {
  5205. return "g";
  5206. },
  5207. rave_intersects$0 : function(x, y) {
  5208. return false;
  5209. },
  5210. rave_intersects$1 : function(rect) {
  5211. return false;
  5212. },
  5213. /** @expose */
  5214. getBBox : function() {
  5215. var x1, y1, x2, y2, cx2, cy2;
  5216. x1 = y1 = Infinity;
  5217. x2 = y2 = 0;
  5218. if (this.rave_hasChildNodes()) {
  5219. for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  5220. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5221. var child = __exp_enFor0[__i_enFor0];
  5222. var bb = child.getBBox();
  5223. cx2 = bb.x + bb.width;
  5224. cy2 = bb.y + bb.height;
  5225. if (bb.x < x1) {
  5226. x1 = bb.x;
  5227. }
  5228. if (bb.y < y1) {
  5229. y1 = bb.y;
  5230. }
  5231. if (cx2 > x2) {
  5232. x2 = cx2;
  5233. }
  5234. if (cy2 > y2) {
  5235. y2 = cy2;
  5236. }
  5237. }
  5238. }
  5239. return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
  5240. },
  5241. /** @expose */
  5242. rave_intersects : function(a0, a1) {
  5243. var args = arguments;
  5244. if (args.length == 1) {
  5245. return this.rave_intersects$1(a0);
  5246. }
  5247. return this.rave_intersects$0(a0, a1);
  5248. }
  5249. //constructor : function(nsuri, context) {}
  5250. });
  5251. // $source: com/ibm/rave/render/internal/nodes/PathSceneItem
  5252. /************************************************************************
  5253. ** IBM Confidential
  5254. **
  5255. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5256. **
  5257. ** (C) Copyright IBM Corp. 2015
  5258. **
  5259. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5260. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5261. ************************************************************************/
  5262. // GENERATED
  5263. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5264. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5265. /**
  5266. * A translated implementation of an SVG path shape.
  5267. * @author jim
  5268. */
  5269. var com_ibm_rave_render_internal_nodes_PathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5270. /** @expose */
  5271. getBoundingClientRect : function() {
  5272. return null;
  5273. },
  5274. /** @expose */
  5275. getBBox : function() {
  5276. return null;
  5277. },
  5278. /** @expose */
  5279. rave_getDrawType : function() {
  5280. return 1006;
  5281. },
  5282. /** @expose */
  5283. rave_getName : function() {
  5284. return "path";
  5285. }
  5286. //constructor : function(nsuri, context) {}
  5287. });
  5288. // $source: com/ibm/rave/render/internal/nodes/PolygonSceneItem
  5289. /************************************************************************
  5290. ** IBM Confidential
  5291. **
  5292. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5293. **
  5294. ** (C) Copyright IBM Corp. 2015
  5295. **
  5296. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5297. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5298. ************************************************************************/
  5299. // GENERATED
  5300. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5301. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5302. /**
  5303. * A translated implementation of an SVG polygon shape.
  5304. */
  5305. var com_ibm_rave_render_internal_nodes_PolygonSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5306. /** @expose */
  5307. getBoundingClientRect : function() {
  5308. return null;
  5309. },
  5310. /** @expose */
  5311. getBBox : function() {
  5312. return null;
  5313. },
  5314. /** @expose */
  5315. rave_getDrawType : function() {
  5316. return 1010;
  5317. },
  5318. /** @expose */
  5319. rave_getName : function() {
  5320. return "polygon";
  5321. }
  5322. //constructor : function(nsuri, context) {}
  5323. });
  5324. // $source: com/ibm/rave/render/internal/nodes/PolylineSceneItem
  5325. /************************************************************************
  5326. ** IBM Confidential
  5327. **
  5328. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5329. **
  5330. ** (C) Copyright IBM Corp. 2015
  5331. **
  5332. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5333. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5334. ************************************************************************/
  5335. // GENERATED
  5336. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5337. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5338. /**
  5339. * A translated implementation of an SVG polyline shape.
  5340. */
  5341. var com_ibm_rave_render_internal_nodes_PolylineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5342. /** @expose */
  5343. getBoundingClientRect : function() {
  5344. return null;
  5345. },
  5346. /** @expose */
  5347. getBBox : function() {
  5348. return null;
  5349. },
  5350. /** @expose */
  5351. rave_getDrawType : function() {
  5352. return 1009;
  5353. },
  5354. /** @expose */
  5355. rave_getName : function() {
  5356. return "polyline";
  5357. }
  5358. //constructor : function(nsuri, context) {}
  5359. });
  5360. // $source: com/ibm/rave/render/internal/DefsSceneItem
  5361. /************************************************************************
  5362. ** IBM Confidential
  5363. **
  5364. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5365. **
  5366. ** (C) Copyright IBM Corp. 2015
  5367. **
  5368. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5369. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5370. ************************************************************************/
  5371. // GENERATED
  5372. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5373. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
  5374. /**
  5375. * A scene node representing an SVG "defs" node. May contain other shapes, gradient declarations, clips, etc.
  5376. */
  5377. var com_ibm_rave_render_internal_DefsSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
  5378. /** @expose */
  5379. getName : function() {
  5380. return "defs";
  5381. },
  5382. isDrawable : function() {
  5383. return false;
  5384. }
  5385. //constructor : function(nsuri, context) {}
  5386. });
  5387. // $source: com/ibm/rave/render/internal/nodes/LinearGradientSceneItem
  5388. /************************************************************************
  5389. ** IBM Confidential
  5390. **
  5391. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5392. **
  5393. ** (C) Copyright IBM Corp. 2015
  5394. **
  5395. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5396. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5397. ************************************************************************/
  5398. // GENERATED
  5399. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5400. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5401. //@import com/ibm/rave/render/internal/properties/LinearGradientAttributes (runtime) // new
  5402. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  5403. var com_ibm_rave_render_internal_nodes_LinearGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5404. constructor : function(nsuri, context) {
  5405. this.attributes = new com_ibm_rave_render_internal_properties_LinearGradientAttributes();
  5406. },
  5407. /** @expose */
  5408. getName : function() {
  5409. return com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT;
  5410. },
  5411. isDrawable : function() {
  5412. return false;
  5413. },
  5414. /** @expose */
  5415. getBBox : function() {
  5416. return null;
  5417. },
  5418. /** @expose */
  5419. getDrawType : function() {
  5420. return 1011;
  5421. }
  5422. });
  5423. // $source: com/ibm/rave/render/internal/properties/LinearGradientAttributes
  5424. /************************************************************************
  5425. ** IBM Confidential
  5426. **
  5427. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5428. **
  5429. ** (C) Copyright IBM Corp. 2015
  5430. **
  5431. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5432. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5433. ************************************************************************/
  5434. // GENERATED
  5435. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5436. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  5437. var com_ibm_rave_render_internal_properties_LinearGradientAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  5438. constructor : function() {
  5439. this.propNames = com_ibm_rave_render_internal_properties_LinearGradientAttributes.propertyNames;
  5440. this.propValues = [0, 0, 0, 0];
  5441. }
  5442. });
  5443. com_ibm_rave_render_internal_properties_LinearGradientAttributes.x1 = 0;
  5444. com_ibm_rave_render_internal_properties_LinearGradientAttributes.y1 = 1;
  5445. com_ibm_rave_render_internal_properties_LinearGradientAttributes.x2 = 2;
  5446. com_ibm_rave_render_internal_properties_LinearGradientAttributes.y2 = 3;
  5447. com_ibm_rave_render_internal_properties_LinearGradientAttributes.propertyNames = ["x1", "x2", "y1", "y2"];
  5448. // $source: com/ibm/rave/render/internal/nodes/RadialGradientSceneItem
  5449. /************************************************************************
  5450. ** IBM Confidential
  5451. **
  5452. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5453. **
  5454. ** (C) Copyright IBM Corp. 2015
  5455. **
  5456. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5457. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5458. ************************************************************************/
  5459. // GENERATED
  5460. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5461. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
  5462. //@import com/ibm/rave/render/internal/properties/RadialGradientAttributes (runtime) // new
  5463. //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
  5464. var com_ibm_rave_render_internal_nodes_RadialGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
  5465. constructor : function(nsuri, context) {
  5466. this.attributes = new com_ibm_rave_render_internal_properties_RadialGradientAttributes();
  5467. },
  5468. /** @expose */
  5469. getName : function() {
  5470. return com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT;
  5471. },
  5472. isDrawable : function() {
  5473. return false;
  5474. },
  5475. /** @expose */
  5476. getBBox : function() {
  5477. return null;
  5478. },
  5479. /** @expose */
  5480. getDrawType : function() {
  5481. return 1012;
  5482. }
  5483. });
  5484. // $source: com/ibm/rave/render/internal/properties/RadialGradientAttributes
  5485. /************************************************************************
  5486. ** IBM Confidential
  5487. **
  5488. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5489. **
  5490. ** (C) Copyright IBM Corp. 2015
  5491. **
  5492. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5493. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5494. ************************************************************************/
  5495. // GENERATED
  5496. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5497. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  5498. var com_ibm_rave_render_internal_properties_RadialGradientAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  5499. constructor : function() {
  5500. this.propNames = com_ibm_rave_render_internal_properties_RadialGradientAttributes.propertyNames;
  5501. this.propValues = [0, 0, 0, 0, 0];
  5502. }
  5503. });
  5504. com_ibm_rave_render_internal_properties_RadialGradientAttributes.cx = 0;
  5505. com_ibm_rave_render_internal_properties_RadialGradientAttributes.cy = 1;
  5506. com_ibm_rave_render_internal_properties_RadialGradientAttributes.r = 2;
  5507. com_ibm_rave_render_internal_properties_RadialGradientAttributes.fx = 3;
  5508. com_ibm_rave_render_internal_properties_RadialGradientAttributes.fy = 4;
  5509. com_ibm_rave_render_internal_properties_RadialGradientAttributes.propertyNames = ["cx", "cy", "r", "fx", "fy"];
  5510. // $source: com/ibm/rave/render/internal/nodes/StopSceneItem
  5511. /************************************************************************
  5512. ** IBM Confidential
  5513. **
  5514. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5515. **
  5516. ** (C) Copyright IBM Corp. 2015
  5517. **
  5518. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5519. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5520. ************************************************************************/
  5521. // GENERATED
  5522. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5523. //@import com/ibm/rave/render/internal/DefsSceneItem (loadtime) // superclass
  5524. //@import com/ibm/rave/render/internal/properties/StopAttributes (runtime) // new
  5525. var com_ibm_rave_render_internal_nodes_StopSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_DefsSceneItem, {
  5526. constructor : function(nsuri, context) {
  5527. this.attributes = new com_ibm_rave_render_internal_properties_StopAttributes();
  5528. },
  5529. /** @expose */
  5530. getName : function() {
  5531. return "stop";
  5532. }
  5533. });
  5534. // $source: com/ibm/rave/render/internal/properties/StopAttributes
  5535. /************************************************************************
  5536. ** IBM Confidential
  5537. **
  5538. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5539. **
  5540. ** (C) Copyright IBM Corp. 2015
  5541. **
  5542. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5543. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5544. ************************************************************************/
  5545. // GENERATED
  5546. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5547. //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
  5548. var com_ibm_rave_render_internal_properties_StopAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
  5549. constructor : function() {
  5550. this.propNames = com_ibm_rave_render_internal_properties_StopAttributes.propertyNames;
  5551. this.propValues = [0, 0, 1];
  5552. }
  5553. });
  5554. com_ibm_rave_render_internal_properties_StopAttributes.offset = 0;
  5555. com_ibm_rave_render_internal_properties_StopAttributes.propertyNames = ["offset", "stop-color", "stop-opacity"];
  5556. // $source: com/ibm/rave/render/internal/nodes/RootSceneItem
  5557. /************************************************************************
  5558. ** IBM Confidential
  5559. **
  5560. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5561. **
  5562. ** (C) Copyright IBM Corp. 2015
  5563. **
  5564. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5565. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5566. ************************************************************************/
  5567. // GENERATED
  5568. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5569. //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
  5570. //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
  5571. /**
  5572. * A root scene item
  5573. */
  5574. var com_ibm_rave_render_internal_nodes_RootSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
  5575. /** @expose */
  5576. dispose : function() {
  5577. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.removeRootProviderForNode(this.rave_getOwner());
  5578. }
  5579. //constructor : function(nsuri, context) {}
  5580. });
  5581. // $source: com/ibm/rave/render/AbstractRenderer
  5582. /************************************************************************
  5583. ** IBM Confidential
  5584. **
  5585. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5586. **
  5587. ** (C) Copyright IBM Corp. 2015
  5588. **
  5589. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5590. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5591. ************************************************************************/
  5592. // GENERATED
  5593. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  5594. //@import com/ibm/rave/render/internal/DirtyRegionManager (runtime) // new
  5595. //@import com/ibm/rave/core/Rave (runtime) // Rave
  5596. //@import com/ibm/rave/render/internal/style/StyleManager (runtime) // getFont, getFill, getStroke
  5597. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime) // addNotificationListener
  5598. var com_ibm_rave_render_AbstractRenderer = rave_externs["AbstractRenderer"] = com_ibm_rave_core_nativeImpl_Declare({
  5599. //dirtyRegion : null,
  5600. /** @expose */
  5601. root : null,
  5602. //event : null,
  5603. //eventManager : null,
  5604. /**
  5605. * An abstract implementation of a renderer. Takes care of a number of details so specific renderers don't have to. <p> dirty regions scene node property parsing handling events from
  5606. */
  5607. drawRunning : false,
  5608. constructor : function(root) {
  5609. this.dirtyRegion = new com_ibm_rave_render_internal_DirtyRegionManager();
  5610. {
  5611. this.root = root;
  5612. com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener(this);
  5613. (root).setRenderer(this);
  5614. var renderer = this;
  5615. this.event = function(elapsed) {
  5616. renderer.repaint();
  5617. renderer.drawRunning = false;
  5618. return true;
  5619. };
  5620. }
  5621. },
  5622. /**
  5623. * By default repaint just calls render() to re-render the whole scene.
  5624. */
  5625. /** @expose */
  5626. repaint : function() {
  5627. this.start();
  5628. this.render(this.root);
  5629. this.finish();
  5630. },
  5631. /** @expose */
  5632. createEventManager : function() {},
  5633. /** @expose */
  5634. registerEvent : function(eventType, node) {
  5635. if (!this.eventManager) {
  5636. this.eventManager = this.createEventManager();
  5637. }
  5638. this.eventManager.registerEvent(eventType, node);
  5639. },
  5640. /** @expose */
  5641. unregisterEvent : function(eventType, node) {
  5642. if (this.eventManager) {
  5643. this.eventManager.unregisterEvent(eventType, node);
  5644. }
  5645. },
  5646. /** @expose */
  5647. handleDrawEvent : function(type, item) {
  5648. if (!this.drawRunning) {
  5649. this.drawRunning = true;
  5650. com_ibm_rave_core_Rave.timer(this.event, 0, 0);
  5651. }
  5652. },
  5653. /** @expose */
  5654. beforeUpdate : function(type, subType, key, value, item) {},
  5655. /** @expose */
  5656. afterUpdate : function(type, subType, key, value, item) {
  5657. this.handleDrawEvent(type, item);
  5658. },
  5659. /** @expose */
  5660. render : function(item) {
  5661. var matrix = (item).transformMatrix;
  5662. if (matrix) {
  5663. this.saveGraphicsState();
  5664. this.applyMatrix(matrix);
  5665. }
  5666. if (this.dirtyRegion.intersects(item)) {
  5667. var newClip = this.dirtyRegion.getClip();
  5668. if (newClip.hasSize()) {
  5669. this.setClip(newClip);
  5670. }
  5671. this.drawShape(item);
  5672. }
  5673. {
  5674. for (var __i_enFor0 = 0, __exp_enFor0 = item.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
  5675. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5676. var child = __exp_enFor0[__i_enFor0];
  5677. this.render(child);
  5678. }
  5679. }
  5680. if (matrix) {
  5681. this.restoreGraphicsState();
  5682. }
  5683. },
  5684. /** @expose */
  5685. start : function() {},
  5686. /** @expose */
  5687. finish : function() {},
  5688. drawShape : function(sceneItem) {
  5689. var x, y;
  5690. var text, points;
  5691. var attributes = sceneItem.attributes;
  5692. switch (sceneItem.rave_getDrawType()) {
  5693. case (1000):
  5694. this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(sceneItem));
  5695. this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
  5696. x = + (attributes.getByIndex(0));
  5697. y = + (attributes.getByIndex(1));
  5698. var width = + (attributes.getByIndex(2));
  5699. var height = + (attributes.getByIndex(3));
  5700. this.drawRect(x, y, width, height);
  5701. break;
  5702. case (1001):
  5703. this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
  5704. var x1 = + (attributes.getByIndex(4));
  5705. var y1 = + (attributes.getByIndex(7));
  5706. var x2 = + (attributes.getByIndex(5));
  5707. var y2 = + (attributes.getByIndex(8));
  5708. this.drawLine(x1, y1, x2, y2);
  5709. break;
  5710. case (1003):
  5711. this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
  5712. text = attributes.getByIndex(12);
  5713. x = + (attributes.getByIndex(0));
  5714. y = + (attributes.getByIndex(1));
  5715. this.drawText(text, com_ibm_rave_render_internal_style_StyleManager.getFont(sceneItem), x, y);
  5716. break;
  5717. case (1002):
  5718. this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(sceneItem));
  5719. this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
  5720. var cx = + (attributes.getByIndex(9));
  5721. var cy = + (attributes.getByIndex(10));
  5722. var r = + (attributes.getByIndex(6)) * 2;
  5723. this.drawEllipse(cx, cy, r, r);
  5724. break;
  5725. case (1009):
  5726. points = sceneItem.getAttribute("points");
  5727. if (points.length > 0) {
  5728. this.prepPath(sceneItem, "points", 'M' + points);
  5729. }
  5730. break;
  5731. case (1010):
  5732. points = sceneItem.getAttribute("points");
  5733. if (points.length > 0) {
  5734. this.prepPath(sceneItem, "points", 'M' + points + 'Z');
  5735. }
  5736. break;
  5737. case (1006):
  5738. this.prepPath(sceneItem, "d", sceneItem.getAttribute("d"));
  5739. break;
  5740. default:
  5741. break;
  5742. }
  5743. },
  5744. prepPath : function(node, attr, d) {
  5745. this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(node));
  5746. this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(node));
  5747. this.drawPath(this.createPath2D(node, attr, d));
  5748. },
  5749. applyMatrix : function(matrix) {
  5750. this.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
  5751. },
  5752. /**
  5753. * Create a path object understood by this renderer to be used in the {@link #this.drawPath(Object)} method.
  5754. * @param (com.ibm.rave.core.scene.SceneNode) node the scene node owning the path
  5755. * @param (String) attr the attribute of the scene node containing the original path
  5756. * @param (String) d the path string to parse
  5757. * @return (Object) a path object
  5758. */
  5759. /** @expose */
  5760. createPath2D : function(node, attr, d) {},
  5761. /**
  5762. * Draw the path object created by {@link #this.createPath2D(com_ibm_rave_core_scene_SceneNode, String)} .
  5763. * @param (Object) path a path object
  5764. */
  5765. /** @expose */
  5766. drawPath : function(path) {},
  5767. /** @expose */
  5768. drawRect : function(x, y, width, height) {},
  5769. /** @expose */
  5770. drawLine : function(x1, y1, x2, y2) {},
  5771. /** @expose */
  5772. drawText : function(text, style, x, y) {},
  5773. /** @expose */
  5774. drawEllipse : function(centerX, centerY, width, height) {},
  5775. /** @expose */
  5776. drawImage : function(url, height, width) {},
  5777. /** @expose */
  5778. fill : function(fill) {},
  5779. /** @expose */
  5780. stroke : function(stroke) {},
  5781. /** @expose */
  5782. transform : function(a, b, c, d, e, f) {},
  5783. /** @expose */
  5784. saveGraphicsState : function() {},
  5785. /** @expose */
  5786. restoreGraphicsState : function() {},
  5787. /** @expose */
  5788. setClip : function(newClip) {},
  5789. /** @expose */
  5790. clearRect : function(clip) {}
  5791. });
  5792. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer
  5793. /************************************************************************
  5794. ** IBM Confidential
  5795. **
  5796. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5797. **
  5798. ** (C) Copyright IBM Corp. 2014, 2015
  5799. **
  5800. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5801. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5802. ************************************************************************/
  5803. // @import com/ibm/rave/core/nativeImpl/Declare (load)
  5804. // @import com/ibm/rave/render/AbstractRenderer (load)
  5805. // @import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime)
  5806. // @import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime)
  5807. // @import com/ibm/rave/core/nativeImpl/Object (runtime)
  5808. // @import com/ibm/rave/render/event/EventManager (runtime)
  5809. // @import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime)
  5810. // @import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime)
  5811. // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing (runtime)
  5812. var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_AbstractRenderer, {
  5813. constructor : function() {
  5814. this._context = this._getCanvasNode().getContext('2d');
  5815. this._hasNativeDash = typeof this._context.setLineDash == "function";
  5816. this._hasNativePath2D = !!window.Path2D;
  5817. },
  5818. clear: function() {
  5819. this.saveGraphicsState();
  5820. var canvas = this._getCanvasNode(), ctx = this._context;
  5821. // Clear the main rect. remove any transforms for this calculation just to be sure.
  5822. ctx.setTransform(1, 0, 0, 1, 0, 0);
  5823. ctx.clearRect(0, 0, canvas.width, canvas.height);
  5824. this.restoreGraphicsState();
  5825. },
  5826. fill: function (fill) {
  5827. this._fill = fill;
  5828. },
  5829. stroke: function (stroke) {
  5830. this._stroke = stroke;
  5831. this._dashArray = !this._hasNativeDash && stroke ? stroke.getDashArray() : null;
  5832. },
  5833. start: function() {
  5834. this.clear();
  5835. },
  5836. finish: function() {
  5837. },
  5838. transform: function(a,b,c,d,e,f) {
  5839. this._context.transform(a,b,c,d,e,f);
  5840. },
  5841. drawRect: function(x,y,width,height){
  5842. this._preDraw();
  5843. var ctx = this._context;
  5844. if (this._dashArray) {
  5845. var endX = x + width, endY = y + height;
  5846. var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x, y, endX, y);
  5847. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, endX, y, endX, endY, residue);
  5848. residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, endX, endY, x, endY, residue);
  5849. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x, endY, x, y, residue);
  5850. } else {
  5851. ctx.rect(x,y,width,height);
  5852. }
  5853. this._postDraw();
  5854. },
  5855. drawLine: function(x1, y1, x2, y2){
  5856. this._preDraw();
  5857. var ctx = this._context;
  5858. if (this._dashArray) {
  5859. com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x1, y1, x2, y2);
  5860. } else {
  5861. ctx.moveTo(x1, y1);
  5862. ctx.lineTo(x2, y2);
  5863. }
  5864. this._postDraw();
  5865. },
  5866. createPath2D : function(node, attr, d) {
  5867. var oriPath = node.getAttribute(attr);
  5868. if (!oriPath.__d) {
  5869. // cache the path on the string object itself until caching is done in common code
  5870. oriPath = new String(oriPath);
  5871. node.setAttribute(attr, oriPath);
  5872. if (this._hasNativePath2D) {
  5873. oriPath.__d = new Path2D(d);
  5874. } else {
  5875. oriPath.__d = new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler();
  5876. new com_ibm_rave_render_internal_nodes_path_Path2DParser(oriPath.__d).parse(d);
  5877. }
  5878. }
  5879. return oriPath.__d;
  5880. },
  5881. drawPath: function(path) {
  5882. this._preDraw();
  5883. var ctx = this._context;
  5884. if (!this._hasNativePath2D) {
  5885. path.draw(ctx, this);
  5886. }
  5887. if (this._fill) {
  5888. this._applyFill(this._fill, this._hasNativePath2D);
  5889. if (this._hasNativePath2D) {
  5890. ctx.fill(path);
  5891. }
  5892. }
  5893. if (this._stroke) {
  5894. this._applyStroke(this._stroke, this._hasNativePath2D);
  5895. if (this._hasNativePath2D) {
  5896. ctx.stroke(path);
  5897. }
  5898. }
  5899. this._postDraw();
  5900. },
  5901. drawEllipse: function(cx, cy, width, height){
  5902. this._preDraw();
  5903. // Draw an ellipse by scaling a full arc (unless it's just a circle)
  5904. var r = width / 2, ctx = this._context, twoPI = 2 * Math.PI;
  5905. if (width != height) {
  5906. this.saveGraphicsState();
  5907. if (width > height) {
  5908. ctx.scale(1, height/width);
  5909. } else {
  5910. r = height / 2;
  5911. ctx.scale(width/height, 1);
  5912. }
  5913. }
  5914. if (this._dashArray) {
  5915. var startAngle = 0, angle;
  5916. for (var i = 0, l = this._dashArray.length; startAngle < twoPI; ++i) {
  5917. angle = this._dashArray[i % l] / r;
  5918. if (!(i % 2)) {
  5919. ctx.moveTo(cx + (r * Math.cos(startAngle)), cy + (r * Math.sin(startAngle)));
  5920. ctx.arc(cx, cy, r, startAngle, startAngle + angle, false);
  5921. }
  5922. startAngle += angle;
  5923. }
  5924. } else {
  5925. ctx.arc(cx, cy, r, 0, twoPI, false);
  5926. }
  5927. if (width != height) {
  5928. this.restoreGraphicsState();
  5929. }
  5930. this._postDraw();
  5931. },
  5932. drawText: function(text, style, x, y) {
  5933. this._preDraw();
  5934. if (this._fill) {
  5935. this._context.fillText(text, x, y);
  5936. }
  5937. if (this._stroke) {
  5938. this._context.strokeText(text, x, y, this._stroke.width);
  5939. }
  5940. this._postDraw();
  5941. },
  5942. saveGraphicsState: function() {
  5943. this._context.save();
  5944. },
  5945. restoreGraphicsState: function() {
  5946. this._context.restore();
  5947. },
  5948. setClip: function(clip) {
  5949. },
  5950. _getCanvasNode: function() {
  5951. return this.root._canvasNode;
  5952. },
  5953. _preDraw: function() {
  5954. this._context.beginPath();
  5955. },
  5956. _postDraw: function() {
  5957. this._applyStyles(this._fill, this._stroke);
  5958. },
  5959. // Apply all the styles defined in the passed styles object.
  5960. _applyStyles: function(fill, stroke) {
  5961. this._applyFill(fill);
  5962. this._applyStroke(stroke);
  5963. },
  5964. _applyFill: function(fill, skipFill) {
  5965. if (fill) {
  5966. this._context.fillStyle = fill.getColor().toString();
  5967. if (!skipFill) {
  5968. this._context.fill();
  5969. }
  5970. }
  5971. },
  5972. _applyStroke: function(stroke, skipStroke) {
  5973. if (stroke) {
  5974. var color = stroke.getColor().toString();
  5975. if (color) {
  5976. var ctx = this._context;
  5977. ctx.strokeStyle = color;
  5978. ctx.lineWidth = stroke.getWidth();
  5979. ctx.lineCap = stroke.getLineCap();
  5980. ctx.lineJoin = stroke.getLineJoin();
  5981. ctx.miterLimit = stroke.getMiterLimit();
  5982. if (this._hasNativeDash && stroke.getDashArray()) {
  5983. ctx.setLineDash(stroke.getDashArray());
  5984. ctx.lineDashOffset = stroke.getDashOffset();
  5985. }
  5986. if (!skipStroke) {
  5987. ctx.stroke();
  5988. }
  5989. }
  5990. }
  5991. },
  5992. createEventManager : function() {
  5993. var canvas = this._getCanvasNode();
  5994. // create a native event manager
  5995. return new (com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager, {
  5996. addNativeEventListener : function(eventType, listener) {
  5997. var nativeListener = function(e) {
  5998. // create an event object
  5999. var event = wrapEvent(e);
  6000. // listener callback
  6001. listener(event);
  6002. unwrapEvent(e, event);
  6003. };
  6004. canvas.addEventListener(eventType, nativeListener);
  6005. return nativeListener;
  6006. },
  6007. removeNativeEventListener : function(eventType, nativeObject) {
  6008. canvas.removeEventListener(eventType, nativeObject);
  6009. }
  6010. }))(this);
  6011. }
  6012. });
  6013. var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler = com_ibm_rave_core_nativeImpl_Declare({
  6014. constructor : function() {
  6015. this._cmds = [];
  6016. },
  6017. draw : function(c, r) {
  6018. var cmds = this._cmds;
  6019. for (var i = 0; i < cmds.length; i++) {
  6020. cmds[i](c, r, this);
  6021. }
  6022. },
  6023. fail : function(index) {
  6024. this._cmds.push(function(c) {
  6025. c.closePath();
  6026. });
  6027. },
  6028. startPath : function() {
  6029. this._cmds.push(function(c, r, self) {
  6030. c.beginPath();
  6031. self._x = self._y = 0;
  6032. });
  6033. },
  6034. closePath : function() {
  6035. this._cmds.push(function(c) {
  6036. c.closePath();
  6037. });
  6038. },
  6039. moveTo : function(x, y) {
  6040. this._cmds.push(function(c, r, self) {
  6041. c.moveTo(x,y);
  6042. self._x = x;
  6043. self._y = y;
  6044. });
  6045. },
  6046. lineTo : function(x, y) {
  6047. this._cmds.push(function(c, r, self) {
  6048. if (r._dashArray) {
  6049. self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(c, r._dashArray, self._x, self._y, x, y, self._residue);
  6050. self._x = x;
  6051. self._y = y;
  6052. } else {
  6053. c.lineTo(x,y);
  6054. }
  6055. });
  6056. },
  6057. bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
  6058. this._cmds.push(function(c, r , self) {
  6059. if (r._dashArray) {
  6060. 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);
  6061. self._x = x;
  6062. self._y = y;
  6063. } else {
  6064. c.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
  6065. }
  6066. });
  6067. },
  6068. quadraticCurveTo : function(cpx, cpy, x, y) {
  6069. this._cmds.push(function(c, r , self) {
  6070. if (r._dashArray) {
  6071. 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);
  6072. self._x = x;
  6073. self._y = y;
  6074. } else {
  6075. c.quadraticCurveTo(cpx, cpy, x, y);
  6076. }
  6077. });
  6078. },
  6079. arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
  6080. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this,
  6081. x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
  6082. }
  6083. });
  6084. // $source: com/ibm/rave/core/canvas/internal/nativeImpl/Module
  6085. /************************************************************************
  6086. ** IBM Confidential
  6087. **
  6088. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6089. **
  6090. ** (C) Copyright IBM Corp. 2014
  6091. **
  6092. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6093. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6094. ************************************************************************/
  6095. // @OnDemandLoad("rave-canvas")
  6096. // Must be the first import
  6097. // @import ./ModuleHeader
  6098. // Other module dependencies
  6099. // @import com/ibm/rave/core/internal/nativeImpl/Module
  6100. // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (static)
  6101. // @import com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine (static)
  6102. // @import com/ibm/rave/render/internal/SceneItemFactory (static)
  6103. // @import com/ibm/rave/render/internal/nodes/RootSceneItem (static)
  6104. // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer (static)
  6105. // @import com/ibm/rave/render/internal/nodes/AbstractSceneNode (static)
  6106. // @import com/ibm/rave/core/nativeImpl/Object (runtime)
  6107. // @import com/ibm/rave/render/internal/RendererConfiguration (runtime)
  6108. // @import com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager (runtime)
  6109. function wrapEvent(e) {
  6110. if (!e) {
  6111. return null;
  6112. }
  6113. // create an event object
  6114. var event = {};
  6115. // mixin the native event properties into the new event object
  6116. com_ibm_rave_core_nativeImpl_Object.mixin(event, e);
  6117. // create new functions on the new event object because we cannot
  6118. // execute the mixin'd functions due to native constraints
  6119. // also because the generated code expects properties #immediatePropagationStopped
  6120. // and #propagationStopped
  6121. event.preventDefault = function() {
  6122. this.defaultPrevented = true;
  6123. };
  6124. event.stopImmediatePropagation = function() {
  6125. this.immediatePropagationStopped = true;
  6126. };
  6127. event.stopPropagation = function() {
  6128. this.propagationStopped = true;
  6129. };
  6130. return event;
  6131. }
  6132. function unwrapEvent(e, wrapped) {
  6133. // propagate event properties to the native event
  6134. if (wrapped.defaultPrevented) {
  6135. e.preventDefault();
  6136. }
  6137. if (wrapped.immediatePropagationStopped) {
  6138. e.stopImmediatePropagation();
  6139. }
  6140. if (wrapped.propagationStopped) {
  6141. e.stopPropagation();
  6142. }
  6143. return e;
  6144. }
  6145. (function() {
  6146. var config = rave.configuration;
  6147. // register the canvas scene item factory
  6148. var canvasFactory = new com_ibm_rave_render_internal_SceneItemFactory();
  6149. config.setSceneNodeFactory("canvas", canvasFactory);
  6150. config.setSceneNodeFactory("http://www.w3.org/1999/xhtml:CANVAS", function(nsuri, name, context) {
  6151. var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
  6152. if (!rootProvider) {
  6153. var root = new com_ibm_rave_render_internal_nodes_RootSceneItem();
  6154. root.getBoundingClientRect = function() {
  6155. return context.getBoundingClientRect();
  6156. };
  6157. root._canvasNode = context;
  6158. root.rave_setOwner(context);
  6159. context.rave_setProperty("__rave_canvas_root__", root);
  6160. // This registers the new renderer with the root scene node.
  6161. root.setRenderer(new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer(root));
  6162. var cacheManager = new com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager(root);
  6163. rootProvider = {
  6164. getRoot: function() {
  6165. return root;
  6166. },
  6167. getCacheManager: function() {
  6168. return cacheManager;
  6169. }
  6170. };
  6171. com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.addRootProvider(rootProvider);
  6172. }
  6173. var rootNode = rootProvider.getRoot();
  6174. var item = canvasFactory("canvas", name, rootNode);
  6175. rootNode.rave_appendChild(item);
  6176. return item;
  6177. });
  6178. // Query Engines
  6179. var canvasQueryEngine = new com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine();
  6180. config.setQueryEngine("canvas", canvasQueryEngine);
  6181. config.setQueryEngine("http://www.w3.org/1999/xhtml:CANVAS", canvasQueryEngine);
  6182. // Need to override the default query selector so we can select over multiple roots (svg and canvas)
  6183. var domQueryEngine = config.getQueryEngine(null);
  6184. var defaultCanvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine(domQueryEngine);
  6185. config.setQueryEngine(null, defaultCanvasQueryEngine);
  6186. config.setQueryEngine("http://www.w3.org/1999/xhtml", defaultCanvasQueryEngine);
  6187. // For non-DOM nodes we need to wrap the event such that it can be modified by our own dispatcher
  6188. var oriDispatchEvent = com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent;
  6189. com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent = function(e) {
  6190. var wrapped = wrapEvent(e),
  6191. result = oriDispatchEvent.call(this, wrapped);
  6192. unwrapEvent(e, wrapped);
  6193. return result;
  6194. };
  6195. })();
  6196. // $source: com/ibm/rave/render/internal/DirtyRegionManager
  6197. /************************************************************************
  6198. ** IBM Confidential
  6199. **
  6200. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6201. **
  6202. ** (C) Copyright IBM Corp. 2015
  6203. **
  6204. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6205. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6206. ************************************************************************/
  6207. // GENERATED
  6208. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6209. //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
  6210. /**
  6211. * Manages dirty regions for a renderer.
  6212. * @author jim
  6213. */
  6214. var com_ibm_rave_render_internal_DirtyRegionManager = com_ibm_rave_core_nativeImpl_Declare({
  6215. //dirtyRegion : null,
  6216. constructor : function() {
  6217. this.dirtyRegion = new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
  6218. },
  6219. /**
  6220. * Add a sceneItem's bounds to the current dirtyRegion.
  6221. * @param (com.ibm.rave.core.scene.SceneNode) sceneItem
  6222. */
  6223. add : function(sceneItem) {
  6224. if (!this.dirtyRegion || !(this.dirtyRegion.hasSize())) {
  6225. this.dirtyRegion = sceneItem.getBBox();
  6226. } else {
  6227. this.dirtyRegion = this.dirtyRegion.createIntersect(sceneItem.getBBox());
  6228. }
  6229. },
  6230. /**
  6231. * Clear all dirty regions.
  6232. */
  6233. clear : function() {
  6234. this.dirtyRegion = null;
  6235. },
  6236. getClip : function() {
  6237. return this.dirtyRegion;
  6238. },
  6239. /**
  6240. * Does the passed scene item intersect with the current dirty region.
  6241. * @param (com.ibm.rave.core.scene.SceneNode) item
  6242. * @return (boolean) true if the item intersects with the current dirty region, false otherwise.
  6243. */
  6244. intersects : function(item) {
  6245. if (!this.dirtyRegion || !(this.dirtyRegion.hasSize())) {
  6246. return true;
  6247. }
  6248. return this.dirtyRegion.intersects(item.getBBox());
  6249. }
  6250. });
  6251. // $source: com/ibm/rave/render/internal/style/AbstractStyle
  6252. /************************************************************************
  6253. ** IBM Confidential
  6254. **
  6255. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6256. **
  6257. ** (C) Copyright IBM Corp. 2015
  6258. **
  6259. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6260. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6261. ************************************************************************/
  6262. // GENERATED
  6263. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6264. /**
  6265. * An abstract implementation of a style. Includes things typically required in a style class like color, opacity, etc.
  6266. * @author jim
  6267. */
  6268. var com_ibm_rave_render_internal_style_AbstractStyle = com_ibm_rave_core_nativeImpl_Declare({
  6269. opacity : 0,
  6270. constructor : function(opacity) {
  6271. this.opacity = opacity;
  6272. },
  6273. /**
  6274. * Return opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
  6275. * @return (double) opacity of this style between 0-1.
  6276. */
  6277. getOpacity : function() {
  6278. return this.opacity;
  6279. },
  6280. /**
  6281. * Does this style produce a style that is visible and should be drawn.
  6282. * @return (boolean) <code>true</code> if this style is visible <code>false</code> otherwise.
  6283. */
  6284. isVisible : function() {
  6285. return this.opacity > 0;
  6286. }
  6287. });
  6288. // $source: com/ibm/rave/render/internal/style/FillStyle
  6289. /************************************************************************
  6290. ** IBM Confidential
  6291. **
  6292. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6293. **
  6294. ** (C) Copyright IBM Corp. 2015
  6295. **
  6296. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6297. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6298. ************************************************************************/
  6299. // GENERATED
  6300. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6301. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  6302. //@import com/ibm/rave/core/Rave (runtime) // rgb
  6303. var com_ibm_rave_render_internal_style_FillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  6304. //color : null,
  6305. /**
  6306. * 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.
  6307. * @param (String) color A color style to apply as a fill in a CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc).
  6308. * @param (double) opacity The amount of opacity to apply from 0 (transparent) to 1 (opaque).
  6309. * @see <a
  6310. * href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>
  6311. */
  6312. constructor : function(color, opacity) {
  6313. this.color = com_ibm_rave_core_Rave.rgb(color);
  6314. },
  6315. /**
  6316. * Parses the value of getColor() as an RGB string and returns a new RGB object.
  6317. * @return (com.ibm.rave.core.color.RGB) RGB object representing color.
  6318. */
  6319. getColor : function() {
  6320. return this.color;
  6321. },
  6322. isVisible : function() {
  6323. return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.color;
  6324. }
  6325. });
  6326. // $source: com/ibm/rave/render/internal/style/StrokeStyle
  6327. /************************************************************************
  6328. ** IBM Confidential
  6329. **
  6330. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6331. **
  6332. ** (C) Copyright IBM Corp. 2015
  6333. **
  6334. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6335. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6336. ************************************************************************/
  6337. // GENERATED
  6338. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6339. //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
  6340. //@import com/ibm/rave/core/Rave (runtime) // rgb
  6341. var com_ibm_rave_render_internal_style_StrokeStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
  6342. //lineJoin : null,
  6343. //lineCap : null,
  6344. //dashArray : null,
  6345. //strokeColor : null,
  6346. width : 0,
  6347. miterLimit : 0,
  6348. dashOffset : 0,
  6349. /**
  6350. * A class that holds information about stroke styling.
  6351. * @param (String) strokeColor A string representation of a color in CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc)
  6352. * @param (double) width the pixel stroke width
  6353. * @param (double) opacity the opacity between 0 and 1 inclusive
  6354. * @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'.
  6355. * @param (String) lineJoin the type of corner created when two lines meet. Valid values: bevel, round, miter
  6356. * @param (String) lineCap the style of end caps for a line. Valid values: butt, round, square
  6357. * @param (float[]) dashArray the pattern of dashes and gaps (positive numbers) used to stroke paths
  6358. * @param (double) dashOffset the distance into the dash pattern to start the dash
  6359. */
  6360. constructor : function(strokeColor, width, opacity, miterLimit, lineJoin, lineCap, dashArray, dashOffset) {
  6361. this.strokeColor = com_ibm_rave_core_Rave.rgb(strokeColor);
  6362. this.width = width;
  6363. this.miterLimit = miterLimit;
  6364. this.lineJoin = lineJoin;
  6365. this.lineCap = lineCap;
  6366. this.dashArray = dashArray;
  6367. this.dashOffset = dashOffset;
  6368. },
  6369. isVisible : function() {
  6370. return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.width > 0;
  6371. },
  6372. /**
  6373. * Return the stroke width.
  6374. * @return (double) Stroke width.
  6375. */
  6376. getWidth : function() {
  6377. return this.width;
  6378. },
  6379. /**
  6380. * Return the line cap.
  6381. * @return (String) line cap
  6382. */
  6383. getLineCap : function() {
  6384. return this.lineCap;
  6385. },
  6386. /**
  6387. * Return the line join
  6388. * @return (String) line join
  6389. */
  6390. getLineJoin : function() {
  6391. return this.lineJoin;
  6392. },
  6393. /**
  6394. * Return the miter limit.
  6395. * @return (double) the miter limit
  6396. */
  6397. getMiterLimit : function() {
  6398. return this.miterLimit;
  6399. },
  6400. /**
  6401. * Return the stroke color as RGB. May return null.
  6402. * @return (com.ibm.rave.core.color.RGB) Set stroke color. Returns 'black' if the defined color is not valid.
  6403. */
  6404. getColor : function() {
  6405. return this.strokeColor;
  6406. },
  6407. /**
  6408. * Return the dash array.
  6409. * @return (float[]) the dash array
  6410. */
  6411. getDashArray : function() {
  6412. return this.dashArray;
  6413. },
  6414. /**
  6415. * Return the dash offset.
  6416. * @return (double) the dash offset
  6417. */
  6418. getDashOffset : function() {
  6419. return this.dashOffset;
  6420. }
  6421. });
  6422. // $source: com/ibm/rave/render/internal/style/FontStyle
  6423. /************************************************************************
  6424. ** IBM Confidential
  6425. **
  6426. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6427. **
  6428. ** (C) Copyright IBM Corp. 2015
  6429. **
  6430. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6431. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6432. ************************************************************************/
  6433. // GENERATED
  6434. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6435. var com_ibm_rave_render_internal_style_FontStyle = com_ibm_rave_core_nativeImpl_Declare({
  6436. //style : null,
  6437. //family : null,
  6438. size : 0,
  6439. unit : 0,
  6440. weight : 0,
  6441. /**
  6442. * 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.
  6443. * @param (String) style The style in which the font is displayed. Valid values are "normal", "italic", "oblique".
  6444. * @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.
  6445. * @param (String) size The font size in 'unit' measurements.
  6446. * @param (String) unit The measurement unit to draw the shape in (pixels, points, etc). Gets converted into a {@link (com.ibm.rave.render.internal.style.FontUnitType) FontUnitType} .
  6447. * @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. <p> Can be specified as a numeric value between 100-900 with the values rounded to the nearest 100. Or can be a string value of "normal" or "bold".
  6448. */
  6449. constructor : function(style, family, size, unit, weight) {
  6450. if (style == null) {
  6451. style = "";
  6452. }
  6453. this.style = style;
  6454. this.size = com_ibm_rave_render_internal_style_FontStyle.parseFontSize(size);
  6455. this.unit = com_ibm_rave_render_internal_style_FontStyle.parseFontUnit(unit);
  6456. if (family == null) {
  6457. family = "";
  6458. }
  6459. this.family = family;
  6460. this.weight = com_ibm_rave_render_internal_style_FontStyle.parseWeight(weight);
  6461. },
  6462. getStyle : function() {
  6463. return this.style;
  6464. },
  6465. /**
  6466. * Returns the current size of the font in the set unit.
  6467. * @return (double) The size of the font in the current unit measurement.
  6468. */
  6469. getSize : function() {
  6470. return this.size;
  6471. },
  6472. /**
  6473. * 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.
  6474. * @return (String) Font family as a comma separated (CSS-style) list.
  6475. */
  6476. getFamily : function() {
  6477. return this.family;
  6478. },
  6479. /**
  6480. * Return the unit type set for this style. {@link (com.ibm.rave.render.internal.style.FontUnitType) FontUnitType}
  6481. * @return (int) int representing a FontUnitType c-style enum.
  6482. */
  6483. getUnit : function() {
  6484. return this.unit;
  6485. },
  6486. /**
  6487. * Return the weight type set for this style. {@link (com.ibm.rave.render.internal.style.FontWeightType) FontWeightType}
  6488. * @return (int) int representing a FontUnitType c-style enum.
  6489. */
  6490. getWeight : function() {
  6491. return this.weight;
  6492. }
  6493. });
  6494. /**
  6495. * Parse out the unit type from a 'font-size' CSS style. Defaults to 'FontUnitType.PX' (pixels). Valid values are: <p> px
  6496. * @param (String) style Full font-size property (ie- 12px, 21 pt, etc)
  6497. * @return (int) FontUnitType enum value that represents the type of unit.
  6498. */
  6499. com_ibm_rave_render_internal_style_FontStyle.parseFontUnit = function(style) {
  6500. return 1000;
  6501. };
  6502. com_ibm_rave_render_internal_style_FontStyle.parseFontSize = function(size) {
  6503. if (size == null || size.length == 0) {
  6504. return 12.0;
  6505. }
  6506. return + (size);
  6507. };
  6508. com_ibm_rave_render_internal_style_FontStyle.parseWeight = function(weight2) {
  6509. var type = 1000;
  6510. if (weight2 != null) {
  6511. if (weight2 == "normal") {
  6512. type = 1000;
  6513. } else if (weight2 == "bold") {
  6514. type = 1001;
  6515. } else {
  6516. var value = + (weight2);
  6517. value = Math.floor((value + 50) / 100) * 100;
  6518. if (value <= 100) {
  6519. type = 100;
  6520. } else if (value == 200) {
  6521. type = 200;
  6522. } else if (value == 300) {
  6523. type = 300;
  6524. } else if (value == 400) {
  6525. type = 400;
  6526. } else if (value == 500) {
  6527. type = 500;
  6528. } else if (value == 600) {
  6529. type = 600;
  6530. } else if (value == 700) {
  6531. type = 700;
  6532. } else if (value == 800) {
  6533. type = 800;
  6534. } else if (value >= 900) {
  6535. type = 900;
  6536. }
  6537. }
  6538. }
  6539. return type;
  6540. };
  6541. com_ibm_rave_render_internal_style_FontStyle.DEFAULT_FONT_SIZE = 12;
  6542. com_ibm_rave_render_internal_style_FontStyle.DEFAULT_FONT_UNIT = 1000;
  6543. // $source: com/ibm/rave/render/internal/style/StyleManager
  6544. /************************************************************************
  6545. ** IBM Confidential
  6546. **
  6547. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6548. **
  6549. ** (C) Copyright IBM Corp. 2015
  6550. **
  6551. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6552. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6553. ************************************************************************/
  6554. // GENERATED
  6555. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6556. //@import com/ibm/rave/render/internal/style/FillStyle (static) // new
  6557. //@import com/ibm/rave/render/internal/style/StrokeStyle (static) // new
  6558. //@import com/ibm/rave/render/internal/style/FontStyle (static) // new
  6559. /**
  6560. * An internal helper class that converts styles on a SceneNode to internal style classes (FillStyle, FontStyle, etc).
  6561. */
  6562. var com_ibm_rave_render_internal_style_StyleManager = com_ibm_rave_core_nativeImpl_Declare({
  6563. });
  6564. /**
  6565. * 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.
  6566. * @return (com.ibm.rave.render.internal.style.FillStyle) FillStyle object representing styles set on the node.
  6567. */
  6568. com_ibm_rave_render_internal_style_StyleManager.getFill = function(node) {
  6569. var fill = node.rave_getStyle("fill");
  6570. if (fill == null || fill.length == 0) {
  6571. fill = "#000000";
  6572. } else if ("transparent" == fill || "none" == fill) {
  6573. return null;
  6574. }
  6575. var opacity = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "fill-opacity", 1);
  6576. if (opacity > 0) {
  6577. var gradient = null;
  6578. return new com_ibm_rave_render_internal_style_FillStyle(fill, Math.max(opacity, 1));
  6579. }
  6580. return null;
  6581. };
  6582. /**
  6583. * 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.
  6584. * @return (com.ibm.rave.render.internal.style.StrokeStyle) FillStyle object representing styles set on the node.
  6585. */
  6586. com_ibm_rave_render_internal_style_StyleManager.getStroke = function(node) {
  6587. var stroke = node.rave_getStyle("stroke");
  6588. if (stroke == null || stroke.length == 0 || "transparent" == stroke || "none" == stroke) {
  6589. return null;
  6590. }
  6591. var strokeWidth = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-width", 1);
  6592. if (strokeWidth > 0) {
  6593. var opacity = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-opacity", 1);
  6594. if (opacity > 0) {
  6595. var miterLimit = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-miterlimit", 4);
  6596. var lineJoin = node.rave_getStyle("stroke-linejoin");
  6597. if (lineJoin == null) {
  6598. lineJoin = "miter";
  6599. }
  6600. var lineCap = node.rave_getStyle("stroke-linecap");
  6601. if (lineCap == null) {
  6602. lineCap = "butt";
  6603. }
  6604. var dashArray = com_ibm_rave_render_internal_style_StyleManager.getDashArray(node);
  6605. var dashOffset = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-dashoffset", 1);
  6606. return new com_ibm_rave_render_internal_style_StrokeStyle(stroke, strokeWidth, Math.max(opacity, 1), miterLimit, lineJoin, lineCap, dashArray, dashOffset);
  6607. }
  6608. }
  6609. return null;
  6610. };
  6611. /**
  6612. * 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>
  6613. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node with styles set.
  6614. * @return (com.ibm.rave.render.internal.style.FontStyle) FontStyle object that holds font information for drawing.
  6615. */
  6616. com_ibm_rave_render_internal_style_StyleManager.getFont = function(node) {
  6617. var style = node.rave_getStyle("font-style");
  6618. var family = node.rave_getStyle("font-family");
  6619. var unit = node.rave_getStyle("font-size");
  6620. var size = unit;
  6621. var weight = node.rave_getStyle("font-weight");
  6622. return new com_ibm_rave_render_internal_style_FontStyle(style, family, size, unit, weight);
  6623. };
  6624. com_ibm_rave_render_internal_style_StyleManager.getDoubleValue = function(node, style, def) {
  6625. var result = def;
  6626. var o = node.rave_getStyle(style);
  6627. if (o != null) {
  6628. result = + (o);
  6629. if (isNaN(result)) {
  6630. result = def;
  6631. }
  6632. }
  6633. return result;
  6634. };
  6635. com_ibm_rave_render_internal_style_StyleManager.getDashArray = function(node) {
  6636. var dashArray;
  6637. var o = node.rave_getStyle("stroke-dasharray");
  6638. if (o != null) {
  6639. var parts = o.split(",");
  6640. var odd = (parts.length % 2) == 1;
  6641. dashArray = [];
  6642. var i = 0;
  6643. for (var __i_enFor0 = 0, __len_enFor0 = parts.length;
  6644. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6645. var part = parts[__i_enFor0];
  6646. part = part.trim();
  6647. dashArray[i++] = + (part);
  6648. }
  6649. if (odd) {
  6650. for (var j = 0; j < parts.length; ++j) {
  6651. dashArray[i++] = dashArray[j];
  6652. }
  6653. }
  6654. }
  6655. return dashArray;
  6656. };
  6657. //com_ibm_rave_render_internal_style_StyleManager.TRANSPARENT = "transparent";
  6658. //com_ibm_rave_render_internal_style_StyleManager.NONE = "none";
  6659. //com_ibm_rave_render_internal_style_StyleManager.BLACK = "#000000";
  6660. //com_ibm_rave_render_internal_style_StyleManager.FILL = "fill";
  6661. //com_ibm_rave_render_internal_style_StyleManager.FILL_OPACITY = "fill-opacity";
  6662. //com_ibm_rave_render_internal_style_StyleManager.STROKE = "stroke";
  6663. //com_ibm_rave_render_internal_style_StyleManager.STROKE_WIDTH = "stroke-width";
  6664. //com_ibm_rave_render_internal_style_StyleManager.STROKE_OPACITY = "stroke-opacity";
  6665. //com_ibm_rave_render_internal_style_StyleManager.FONT_STYLE = "font-style";
  6666. //com_ibm_rave_render_internal_style_StyleManager.FONT_FAMILY = "font-family";
  6667. //com_ibm_rave_render_internal_style_StyleManager.FONT_SIZE = "font-size";
  6668. //com_ibm_rave_render_internal_style_StyleManager.FONT_WEIGHT = "font-weight";
  6669. //com_ibm_rave_render_internal_style_StyleManager.STROKE_LINECAP = "stroke-linecap";
  6670. //com_ibm_rave_render_internal_style_StyleManager.STROKE_LINEJOIN = "stroke-linejoin";
  6671. //com_ibm_rave_render_internal_style_StyleManager.STROKE_MITERLIMIT = "stroke-miterlimit";
  6672. //com_ibm_rave_render_internal_style_StyleManager.BUTT = "butt";
  6673. //com_ibm_rave_render_internal_style_StyleManager.MITER = "miter";
  6674. //com_ibm_rave_render_internal_style_StyleManager.STROKE_DASHARRAY = "stroke-dasharray";
  6675. //com_ibm_rave_render_internal_style_StyleManager.STROKE_DASHOFFSET = "stroke-dashoffset";
  6676. // $source: com/ibm/rave/render/event/EventManager
  6677. /************************************************************************
  6678. ** IBM Confidential
  6679. **
  6680. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6681. **
  6682. ** (C) Copyright IBM Corp. 2015
  6683. **
  6684. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6685. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6686. ************************************************************************/
  6687. // GENERATED
  6688. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  6689. /**
  6690. * 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.
  6691. */
  6692. var com_ibm_rave_render_event_EventManager = rave_externs["EventManager"] = com_ibm_rave_core_nativeImpl_Declare({
  6693. //eventHandlers : null,
  6694. //renderer : null,
  6695. constructor : function(renderer) {
  6696. this.eventHandlers = {};
  6697. {
  6698. this.renderer = renderer;
  6699. }
  6700. },
  6701. /**
  6702. * Notifies the event manager that the given scene node is interested in receiving events of the given type.
  6703. * @param (String) eventType string describing the different event types
  6704. * @param (com.ibm.rave.core.scene.SceneNode) node scene node that will listen for events
  6705. */
  6706. /** @expose */
  6707. registerEvent : function(eventType, node) {
  6708. var info = this.eventHandlers[eventType];
  6709. var key = "__rave-eventmanager-" + eventType;
  6710. if (!info) {
  6711. info = this.createNativeEventHandler(eventType);
  6712. if (info) {
  6713. this.eventHandlers[eventType] = info;
  6714. node.rave_setProperty(key, eventType);
  6715. info.addNode(node);
  6716. }
  6717. } else if (!(node.rave_hasProperty(key))) {
  6718. node.rave_setProperty(key, eventType);
  6719. info.addNode(node);
  6720. }
  6721. },
  6722. /**
  6723. * Notifies the event manager that the given scene node is no longer interested in receiving events of the given type.
  6724. * @param (String) eventType string describing the different event types
  6725. * @param (com.ibm.rave.core.scene.SceneNode) node scene node that was listening for events
  6726. */
  6727. /** @expose */
  6728. unregisterEvent : function(eventType, node) {
  6729. var info = this.eventHandlers[eventType];
  6730. if (info) {
  6731. var key = "__rave-eventmanager-" + eventType;
  6732. if (node.rave_hasProperty(key)) {
  6733. node.rave_setProperty(key, null);
  6734. info.removeNode(node);
  6735. if (info.canDispose()) {
  6736. info.dispose();
  6737. delete this.eventHandlers[eventType];
  6738. }
  6739. }
  6740. }
  6741. },
  6742. createNativeEventHandler : function(eventType) {
  6743. var result;
  6744. if ("mouseover" == eventType) {
  6745. result = this.createMouseOverListener(eventType);
  6746. } else if ("mouseout" == eventType) {
  6747. result = this.createMouseOutListener(eventType);
  6748. } else if ("mouseenter" == eventType) {
  6749. result = this.createMouseEnterListener(eventType);
  6750. } else if ("mouseleave" == eventType) {
  6751. result = this.createMouseLeaveListener(eventType);
  6752. } else if ("click" == eventType || "dblclick" == eventType || "mousemove" == eventType || "mouseup" == eventType || "mousedown" == eventType || "contextmenu" == eventType || "wheel" == eventType) {
  6753. result = this.createSimpleEventListener(eventType);
  6754. } else if ("touchmove" == eventType || "touchend" == eventType || "touchcancel" == eventType) {
  6755. result = this.createTouchEventListener(eventType);
  6756. } else if ("touchstart" == eventType) {
  6757. result = this.createTouchStartEventListener(eventType);
  6758. }
  6759. return result;
  6760. },
  6761. /**
  6762. * 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.
  6763. * @param (String) eventType the event type
  6764. */
  6765. createMouseOverListener : function(eventType) {
  6766. var target;
  6767. var self = this;
  6768. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6769. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  6770. var hit = self.findHit(event.clientX, event.clientY);
  6771. if (hit && hit != target) {
  6772. event.type = eventType;
  6773. hit.dispatchEvent(event);
  6774. event.type = "mousemove";
  6775. }
  6776. target = hit;
  6777. })));
  6778. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  6779. target = null;
  6780. })));
  6781. return info;
  6782. },
  6783. /**
  6784. * 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.
  6785. * @param (String) eventType the event type
  6786. */
  6787. createMouseOutListener : function(eventType) {
  6788. var target;
  6789. var self = this;
  6790. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6791. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  6792. var hit = self.findHit(event.clientX, event.clientY);
  6793. if (target && hit != target) {
  6794. event.type = eventType;
  6795. target.dispatchEvent(event);
  6796. event.type = "mousemove";
  6797. }
  6798. target = hit;
  6799. })));
  6800. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  6801. if (target) {
  6802. target.dispatchEvent(event);
  6803. target = null;
  6804. }
  6805. })));
  6806. return info;
  6807. },
  6808. /**
  6809. * 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.
  6810. * @param (String) eventType the event type
  6811. */
  6812. createMouseEnterListener : function(eventType) {
  6813. var target;
  6814. var self = this;
  6815. var ancestors = [];
  6816. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6817. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  6818. var hit = self.findHit(event.clientX, event.clientY);
  6819. if (hit) {
  6820. if (hit != target) {
  6821. var index = ancestors.indexOf(hit);
  6822. if (index >= 0) {
  6823. ancestors.length =index + 1;
  6824. } else {
  6825. event.type = eventType;
  6826. var bubbles = event.bubbles;
  6827. event.bubbles = false;
  6828. var isDescendant = false;
  6829. for (var i = ancestors.length - 1; i >= 0; --i) {
  6830. var ancestor = ancestors[i];
  6831. if (com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
  6832. ancestors.length =i + 1;
  6833. var newAncestors = [];
  6834. var parent = hit;
  6835. do {
  6836. newAncestors.push(parent);
  6837. parent.dispatchEvent(event);
  6838. } while ((parent = parent.rave_getParentNode()) != ancestor);
  6839. for (var j = newAncestors.length - 1; j >= 0; --j) {
  6840. ancestors.push(newAncestors[j]);
  6841. }
  6842. isDescendant = true;
  6843. break;
  6844. }
  6845. }
  6846. if (!isDescendant) {
  6847. ancestors.length = 0;
  6848. var parent = hit;
  6849. do {
  6850. ancestors.push(parent);
  6851. parent.dispatchEvent(event);
  6852. } while ((parent = parent.rave_getParentNode()));
  6853. ancestors.reverse();
  6854. }
  6855. event.bubbles = bubbles;
  6856. event.type = "mousemove";
  6857. }
  6858. }
  6859. } else if (target) {
  6860. ancestors.length = 0;
  6861. }
  6862. target = hit;
  6863. })));
  6864. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  6865. target = null;
  6866. ancestors.length = 0;
  6867. })));
  6868. return info;
  6869. },
  6870. /**
  6871. * 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
  6872. * @param (String) eventType the event type
  6873. */
  6874. createMouseLeaveListener : function(eventType) {
  6875. var target;
  6876. var self = this;
  6877. var ancestors = [];
  6878. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6879. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
  6880. var hit = self.findHit(event.clientX, event.clientY);
  6881. if (hit != target) {
  6882. if (!target) {
  6883. var parent = hit;
  6884. do {
  6885. ancestors.push(parent);
  6886. } while ((parent = parent.rave_getParentNode()));
  6887. ancestors.reverse();
  6888. } else {
  6889. var index = ancestors.indexOf(hit);
  6890. if (index >= 0) {
  6891. for (var i = ancestors.length - 1; i > index; --i) {
  6892. ancestors[i].dispatchEvent(event);
  6893. }
  6894. ancestors.length =index + 1;
  6895. } else {
  6896. event.type = eventType;
  6897. var bubbles = event.bubbles;
  6898. event.bubbles = false;
  6899. var isDescendant = false;
  6900. for (var i = ancestors.length - 1; i >= 0; --i) {
  6901. var ancestor = ancestors[i];
  6902. if (hit && com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
  6903. ancestors.length =i + 1;
  6904. var newAncestors = [];
  6905. var parent = hit;
  6906. do {
  6907. newAncestors.push(parent);
  6908. } while ((parent = parent.rave_getParentNode()) != ancestor);
  6909. for (var j = newAncestors.length - 1; j >= 0; --j) {
  6910. ancestors.push(newAncestors[j]);
  6911. }
  6912. isDescendant = true;
  6913. break;
  6914. }
  6915. ancestor.dispatchEvent(event);
  6916. }
  6917. if (!isDescendant && hit) {
  6918. var parent = hit;
  6919. do {
  6920. ancestors.push(parent);
  6921. } while ((parent = parent.rave_getParentNode()));
  6922. ancestors.reverse();
  6923. }
  6924. event.bubbles = bubbles;
  6925. event.type = "mousemove";
  6926. }
  6927. }
  6928. target = hit;
  6929. }
  6930. })));
  6931. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
  6932. if (target) {
  6933. event.type = eventType;
  6934. target.dispatchEvent(event);
  6935. target = null;
  6936. ancestors.length = 0;
  6937. event.type = "mouseout";
  6938. }
  6939. })));
  6940. return info;
  6941. },
  6942. /**
  6943. * Adds a native event listener for the same event in the event listener info.
  6944. * @param (String) eventType the event type
  6945. */
  6946. createSimpleEventListener : function(eventType) {
  6947. var self = this;
  6948. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6949. var listener = function(event) {
  6950. var hit = self.findHit(event.clientX, event.clientY);
  6951. if (hit) {
  6952. hit.dispatchEvent(event);
  6953. }
  6954. };
  6955. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  6956. return info;
  6957. },
  6958. /**
  6959. * Adds a native event listener for the touchstart event.
  6960. * @param (String) eventType the event type
  6961. */
  6962. createTouchStartEventListener : function(eventType) {
  6963. var self = this;
  6964. var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
  6965. var listener = function(event) {
  6966. for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
  6967. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6968. var touch = __exp_enFor0[__i_enFor0];
  6969. var hit = self.findHit(touch.clientX, touch.clientY);
  6970. if (hit) {
  6971. hit.dispatchEvent(event);
  6972. }
  6973. }
  6974. };
  6975. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  6976. return info;
  6977. },
  6978. /**
  6979. * 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.
  6980. * @param (String) eventType the event type
  6981. */
  6982. createTouchEventListener : function(eventType) {
  6983. var info = new com_ibm_rave_render_event_EventManager.NodeCapturingEventListenerInfo(this, eventType);
  6984. var listener = function(event) {
  6985. for (var __i_enFor0 = 0, __exp_enFor0 = info.nodes, __len_enFor0 = __exp_enFor0.length;
  6986. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6987. var node = __exp_enFor0[__i_enFor0];
  6988. node.dispatchEvent(event);
  6989. }
  6990. };
  6991. info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
  6992. return info;
  6993. },
  6994. /**
  6995. * Finds a scene node under the given coordinates.
  6996. * @param (double) x x coordinate
  6997. * @param (double) y y coordinate
  6998. * @return (com.ibm.rave.core.scene.SceneNode) the scene node under the coordinates, or <code>null</code> if none found
  6999. */
  7000. findHit : function(x, y) {
  7001. var root = this.renderer.root;
  7002. var nodeClientRect = root.rave_getOwner().getBoundingClientRect();
  7003. return root.rave_intersection(x - nodeClientRect.left, y - nodeClientRect.top);
  7004. },
  7005. /**
  7006. * Add a listener for native events.
  7007. * @param (String) eventType the event type
  7008. * @param (com.ibm.rave.render.event.NativeEventListener) listener the event listener
  7009. * @return (Object) a native object, typically the native listener, which will be used when calling {@link #this.removeNativeEventListener(String, Object)}
  7010. */
  7011. /** @expose */
  7012. addNativeEventListener : function(eventType, listener) {},
  7013. /**
  7014. * Removes a listener for native events.
  7015. * @param (String) eventType the event type
  7016. * @param (Object) nativeObject a native object received as the return value from {@link #this.addNativeEventListener(String, com_ibm_rave_core_event_EventListener)}
  7017. */
  7018. /** @expose */
  7019. removeNativeEventListener : function(eventType, nativeObject) {}
  7020. });
  7021. com_ibm_rave_render_event_EventManager.isDescendant = function(ancestor, node) {
  7022. var parent = node;
  7023. while ((parent = parent.rave_getParentNode())) {
  7024. if (parent == ancestor) {
  7025. return true;
  7026. }
  7027. }
  7028. return false;
  7029. };
  7030. com_ibm_rave_render_event_EventManager.NativeListenerBundle = function(eventType, listener) {
  7031. this.eventType = eventType;
  7032. this.nativeListenerObject = listener;
  7033. };
  7034. /**
  7035. * Keeps a count of interested in a particular event type. When the count reaches 0, this event listener info can be disposed.
  7036. */
  7037. com_ibm_rave_render_event_EventManager.EventListenerInfo = com_ibm_rave_core_nativeImpl_Declare({
  7038. //bundles : null,
  7039. //eventType : null,
  7040. //em : null,
  7041. /** @expose */
  7042. nodeCount : 0,
  7043. constructor : function(em, eventType) {
  7044. this.bundles = [];
  7045. {
  7046. this.em = em;
  7047. this.eventType = eventType;
  7048. }
  7049. },
  7050. dispose : function() {
  7051. for (var __i_enFor0 = 0, __exp_enFor0 = this.bundles, __len_enFor0 = __exp_enFor0.length;
  7052. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7053. var bundle = __exp_enFor0[__i_enFor0];
  7054. this.em.removeNativeEventListener(bundle.eventType, bundle.nativeListenerObject);
  7055. }
  7056. },
  7057. addNode : function(node) {
  7058. this.nodeCount++;
  7059. },
  7060. removeNode : function(node) {
  7061. this.nodeCount--;
  7062. },
  7063. canDispose : function() {
  7064. return this.nodeCount == 0;
  7065. }
  7066. });
  7067. /**
  7068. * Captures addition and removal of nodes in conjunction with the count such that the listening nodes can be referenced later on for dispatching events.
  7069. */
  7070. com_ibm_rave_render_event_EventManager.NodeCapturingEventListenerInfo = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager.EventListenerInfo, {
  7071. //nodes : null,
  7072. constructor : function() {
  7073. this.nodes = [];
  7074. },
  7075. addNode : function(node) {
  7076. this.nodeCount++;
  7077. this.nodes.push(node);
  7078. },
  7079. removeNode : function(node) {
  7080. this.nodeCount--;
  7081. this.nodes.splice(this.nodes.indexOf(node), 1);
  7082. }
  7083. //constructor : function(em, eventType) {}
  7084. });
  7085. /**
  7086. * Property key for caching the type of event a node is listening to.
  7087. */
  7088. //com_ibm_rave_render_event_EventManager.CACHE_KEY_PREFIX = "__rave-eventmanager-";
  7089. // $source: com/ibm/rave/render/internal/nodes/path/Path2DParser
  7090. /************************************************************************
  7091. ** IBM Confidential
  7092. **
  7093. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7094. **
  7095. ** (C) Copyright IBM Corp. 2015
  7096. **
  7097. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7098. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7099. ************************************************************************/
  7100. // GENERATED
  7101. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7102. /**
  7103. * SVG path parser.
  7104. */
  7105. var com_ibm_rave_render_internal_nodes_path_Path2DParser = com_ibm_rave_core_nativeImpl_Declare({
  7106. //path : null,
  7107. //d : null,
  7108. currentX : 0, currentY : 0, xCenter : 0, yCenter : 0,
  7109. idx : 0,
  7110. dLength : 0,
  7111. fail : false,
  7112. constructor : function(path) {
  7113. this.path = path;
  7114. },
  7115. parse : function(pathString) {
  7116. this.currentX = this.currentY = this.xCenter = this.yCenter = this.idx = 0;
  7117. this.d = pathString;
  7118. this.dLength = pathString.length;
  7119. this.path.startPath();
  7120. for (; this.idx < this.dLength;) {
  7121. this.fail = false;
  7122. this.skipWhitespace();
  7123. switch (this.d.charCodeAt(this.idx++)) {
  7124. case 109:
  7125. this._moveTo(false);
  7126. break;
  7127. case 77:
  7128. this._moveTo(true);
  7129. break;
  7130. case 108:
  7131. this._lineTo(false, true, true);
  7132. break;
  7133. case 76:
  7134. this._lineTo(true, true, true);
  7135. break;
  7136. case 99:
  7137. this._bezierCurveTo(false, false);
  7138. break;
  7139. case 67:
  7140. this._bezierCurveTo(true, false);
  7141. break;
  7142. case 115:
  7143. this._bezierCurveTo(false, true);
  7144. break;
  7145. case 83:
  7146. this._bezierCurveTo(true, true);
  7147. break;
  7148. case 113:
  7149. this._quadraticCurveTo(false, false);
  7150. break;
  7151. case 81:
  7152. this._quadraticCurveTo(true, false);
  7153. break;
  7154. case 116:
  7155. this._quadraticCurveTo(false, true);
  7156. break;
  7157. case 84:
  7158. this._quadraticCurveTo(true, true);
  7159. break;
  7160. case 104:
  7161. this._lineTo(false, false, true);
  7162. break;
  7163. case 72:
  7164. this._lineTo(true, false, true);
  7165. break;
  7166. case 118:
  7167. this._lineTo(false, true, false);
  7168. break;
  7169. case 86:
  7170. this._lineTo(true, true, false);
  7171. break;
  7172. case 97:
  7173. this._arcTo(false);
  7174. break;
  7175. case 65:
  7176. this._arcTo(true);
  7177. break;
  7178. case 122:
  7179. case 90:
  7180. this.path.closePath();
  7181. break;
  7182. default:
  7183. this.path.fail(this.idx - 1);
  7184. return;
  7185. }
  7186. }
  7187. },
  7188. /**
  7189. * Skips 4 different types of whitespace characters: <ul> <li>space</li> <li>line feed</li> <li>tab</li> <li>carriage return</li>
  7190. */
  7191. skipWhitespace : function() {
  7192. while (this.idx < this.dLength) {
  7193. switch (this.d.charCodeAt(this.idx)) {
  7194. case 32:
  7195. case 13:
  7196. case 10:
  7197. case 9:
  7198. this.idx++;
  7199. break;
  7200. default:
  7201. return;
  7202. }
  7203. }
  7204. },
  7205. /**
  7206. * Skips whitespace following by an optional comma and additional whitespace.
  7207. */
  7208. skipWhitespaceComma : function() {
  7209. this.skipWhitespace();
  7210. if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 44) {
  7211. this.idx++;
  7212. this.skipWhitespace();
  7213. }
  7214. },
  7215. /**
  7216. * Increments the index if a '-' or '+' sign is identified.
  7217. */
  7218. sign : function() {
  7219. if (this.idx < this.dLength) {
  7220. var c = this.d.charCodeAt(this.idx);
  7221. if (c == 45 || c == 43) {
  7222. this.idx++;
  7223. }
  7224. }
  7225. },
  7226. /**
  7227. * Increments the index for each digit found.
  7228. * @param (boolean) optional whether or not a digit sequence is optional
  7229. */
  7230. digitSequence : function(optional) {
  7231. var found = optional;
  7232. while (this.idx < this.dLength) {
  7233. switch (this.d.charCodeAt(this.idx)) {
  7234. case 48:
  7235. case 49:
  7236. case 50:
  7237. case 51:
  7238. case 52:
  7239. case 53:
  7240. case 54:
  7241. case 55:
  7242. case 56:
  7243. case 57:
  7244. this.idx++;
  7245. found = true;
  7246. break;
  7247. default:
  7248. if (!optional && !found) {
  7249. this.fail = true;
  7250. }
  7251. return;
  7252. }
  7253. }
  7254. },
  7255. /**
  7256. * Increments the index if an exponent is found starting with 'e' or 'E' followed by an sign optional sign and required digits.
  7257. */
  7258. exponent : function() {
  7259. if (this.idx < this.dLength) {
  7260. var c = this.d.charCodeAt(this.idx);
  7261. if (c == 101 || c == 69) {
  7262. this.idx++;
  7263. this.sign();
  7264. this.digitSequence(false);
  7265. }
  7266. }
  7267. },
  7268. /**
  7269. * 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.
  7270. * @param (int) start the starting index of the number
  7271. * @return (double) the parsed number
  7272. */
  7273. parseNumber : function(start) {
  7274. this.digitSequence(true);
  7275. if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 46) {
  7276. this.idx++;
  7277. this.digitSequence(false);
  7278. if (this.fail) {
  7279. return NaN;
  7280. }
  7281. }
  7282. if (this.idx < this.dLength) {
  7283. this.exponent();
  7284. }
  7285. if (this.idx == start) {
  7286. this.fail = true;
  7287. return NaN;
  7288. }
  7289. var result = parseFloat(this.d.substring(start, this.idx));
  7290. this.fail = isNaN(result);
  7291. return result;
  7292. },
  7293. /**
  7294. * Parse a number with optional sign.
  7295. * @return (double) the parsed number
  7296. */
  7297. number : function() {
  7298. var start = this.idx;
  7299. this.sign();
  7300. return this.parseNumber(start);
  7301. },
  7302. /**
  7303. * Parse a positive number with optional '+' sign.
  7304. * @return (double) the parsed number
  7305. */
  7306. nonNegativeNumber : function() {
  7307. var start = this.idx;
  7308. if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 43) {
  7309. this.idx++;
  7310. }
  7311. return this.parseNumber(start);
  7312. },
  7313. /**
  7314. * Parse a number with optional preceding whitespace and comma.
  7315. * @return (double) the parsed number
  7316. */
  7317. whitespaceCommaNumber : function() {
  7318. this.skipWhitespaceComma();
  7319. return this.number();
  7320. },
  7321. /**
  7322. * Parse a number with optional preceding whitespace and comma.
  7323. * @param (boolean) noComma whether or a not a comma is allow or not
  7324. * @return (double) the parsed number
  7325. */
  7326. whitespaceOptCommaNumber : function(noComma) {
  7327. if (noComma) {
  7328. this.skipWhitespace();
  7329. } else {
  7330. this.skipWhitespaceComma();
  7331. }
  7332. return this.number();
  7333. },
  7334. /**
  7335. * Parse a positive number with optional preceding whitespace and comma.
  7336. * @return (double) the parsed number
  7337. */
  7338. whitespaceCommaNonNegativeNumber : function() {
  7339. this.skipWhitespaceComma();
  7340. return this.nonNegativeNumber();
  7341. },
  7342. /**
  7343. * Parse a positive number with optional preceding whitespace and comma.
  7344. * @param noComma whether or a not a comma is allow or not
  7345. * @return (double) the parsed number
  7346. */
  7347. whitespaceOptCommaNonNegativeNumber : function(firstNumber) {
  7348. if (firstNumber) {
  7349. this.skipWhitespace();
  7350. } else {
  7351. this.skipWhitespaceComma();
  7352. }
  7353. return this.nonNegativeNumber();
  7354. },
  7355. /**
  7356. * Parse an integer flag. A parsed value of 1 is 'true' while a parsed value of 0 is 'false'.
  7357. * @return (boolean) the parsed flag
  7358. */
  7359. flag : function() {
  7360. this.skipWhitespaceComma();
  7361. var result = true;
  7362. if (this.idx < this.dLength) {
  7363. var c = this.d.charCodeAt(this.idx);
  7364. if (c == 48) {
  7365. result = false;
  7366. } else if (c != 49) {
  7367. this.fail = true;
  7368. }
  7369. } else {
  7370. this.fail = true;
  7371. }
  7372. if (!this.fail) {
  7373. this.idx++;
  7374. }
  7375. return result;
  7376. },
  7377. _moveTo : function(absolute) {
  7378. this.skipWhitespace();
  7379. var x = this.number();
  7380. if (this.fail) {
  7381. return;
  7382. }
  7383. var y = this.whitespaceCommaNumber();
  7384. if (this.fail) {
  7385. return;
  7386. }
  7387. if (!absolute) {
  7388. x += this.currentX;
  7389. y += this.currentY;
  7390. }
  7391. this.path.moveTo(x, y);
  7392. this.xCenter = this.currentX = x;
  7393. this.yCenter = this.currentY = y;
  7394. this.skipWhitespaceComma();
  7395. this._lineTo(absolute, true, true);
  7396. },
  7397. _lineTo : function(absolute, vertical, horizontal) {
  7398. var noComma = true;
  7399. for (;;) {
  7400. var x = 0, y = 0;
  7401. if (horizontal) {
  7402. x = this.whitespaceOptCommaNumber(noComma);
  7403. noComma = false;
  7404. if (this.fail) {
  7405. return;
  7406. }
  7407. if (!absolute) {
  7408. x += this.currentX;
  7409. }
  7410. } else {
  7411. x = this.currentX;
  7412. }
  7413. if (vertical) {
  7414. y = this.whitespaceOptCommaNumber(noComma);
  7415. if (this.fail) {
  7416. return;
  7417. }
  7418. if (!absolute) {
  7419. y += this.currentY;
  7420. }
  7421. } else {
  7422. y = this.currentY;
  7423. }
  7424. this.path.lineTo(x, y);
  7425. this.xCenter = this.currentX = x;
  7426. this.yCenter = this.currentY = y;
  7427. noComma = false;
  7428. }
  7429. },
  7430. _quadraticCurveTo : function(absolute, usePreviousCP) {
  7431. var noComma = true;
  7432. var cpx, cpy, x, y;
  7433. for (;;) {
  7434. if (usePreviousCP) {
  7435. cpx = 2 * this.currentX - this.xCenter;
  7436. cpy = 2 * this.currentY - this.yCenter;
  7437. } else {
  7438. cpx = this.whitespaceOptCommaNumber(noComma);
  7439. noComma = false;
  7440. if (this.fail) {
  7441. return;
  7442. }
  7443. cpy = this.whitespaceCommaNumber();
  7444. if (this.fail) {
  7445. return;
  7446. }
  7447. }
  7448. x = this.whitespaceOptCommaNumber(noComma);
  7449. if (this.fail) {
  7450. return;
  7451. }
  7452. y = this.whitespaceCommaNumber();
  7453. if (this.fail) {
  7454. return;
  7455. }
  7456. if (!absolute) {
  7457. x += this.currentX;
  7458. y += this.currentY;
  7459. }
  7460. this.path.quadraticCurveTo(cpx, cpy, x, y);
  7461. this.currentX = x;
  7462. this.currentY = y;
  7463. this.xCenter = cpx;
  7464. this.yCenter = cpy;
  7465. noComma = false;
  7466. }
  7467. },
  7468. _bezierCurveTo : function(absolute, usePreviousCP) {
  7469. var noComma = true;
  7470. var cpx1, cpy1, cpx2, cpy2, x, y;
  7471. for (;;) {
  7472. if (usePreviousCP) {
  7473. cpx1 = 2 * this.currentX - this.xCenter;
  7474. cpy1 = 2 * this.currentY - this.yCenter;
  7475. } else {
  7476. cpx1 = this.whitespaceOptCommaNumber(noComma);
  7477. noComma = false;
  7478. if (this.fail) {
  7479. return;
  7480. }
  7481. cpy1 = this.whitespaceCommaNumber();
  7482. if (this.fail) {
  7483. return;
  7484. }
  7485. }
  7486. cpx2 = this.whitespaceOptCommaNumber(noComma);
  7487. if (this.fail) {
  7488. return;
  7489. }
  7490. cpy2 = this.whitespaceCommaNumber();
  7491. if (this.fail) {
  7492. return;
  7493. }
  7494. x = this.whitespaceCommaNumber();
  7495. if (this.fail) {
  7496. return;
  7497. }
  7498. y = this.whitespaceCommaNumber();
  7499. if (this.fail) {
  7500. return;
  7501. }
  7502. if (!absolute) {
  7503. cpx1 += this.currentX;
  7504. cpy1 += this.currentY;
  7505. cpx2 += this.currentX;
  7506. cpy2 += this.currentY;
  7507. x += this.currentX;
  7508. y += this.currentY;
  7509. }
  7510. this.path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y);
  7511. this.currentX = x;
  7512. this.currentY = y;
  7513. this.xCenter = cpx2;
  7514. this.yCenter = cpy2;
  7515. noComma = false;
  7516. }
  7517. },
  7518. _arcTo : function(absolute) {
  7519. var noComma = true, largeArcFlag, sweepFlag;
  7520. var rx, ry, xAxisRotation, x, y;
  7521. for (;;) {
  7522. rx = this.whitespaceOptCommaNonNegativeNumber(noComma);
  7523. if (this.fail) {
  7524. return;
  7525. }
  7526. ry = this.whitespaceCommaNonNegativeNumber();
  7527. if (this.fail) {
  7528. return;
  7529. }
  7530. xAxisRotation = this.whitespaceCommaNumber();
  7531. if (this.fail) {
  7532. return;
  7533. }
  7534. largeArcFlag = this.flag();
  7535. if (this.fail) {
  7536. return;
  7537. }
  7538. sweepFlag = this.flag();
  7539. if (this.fail) {
  7540. return;
  7541. }
  7542. x = this.whitespaceCommaNumber();
  7543. if (this.fail) {
  7544. return;
  7545. }
  7546. y = this.whitespaceCommaNumber();
  7547. if (this.fail) {
  7548. return;
  7549. }
  7550. if (!absolute) {
  7551. x += this.currentX;
  7552. y += this.currentY;
  7553. }
  7554. if (this.currentX != x || this.currentY != y) {
  7555. if (rx == 0 || ry == 0) {
  7556. this.path.lineTo(x, y);
  7557. } else {
  7558. this.path.arcTo(this.currentX, this.currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
  7559. }
  7560. this.xCenter = this.currentX = x;
  7561. this.yCenter = this.currentY = y;
  7562. }
  7563. noComma = false;
  7564. }
  7565. }
  7566. });
  7567. // $source: com/ibm/rave/render/internal/nodes/path/Path2DUtil
  7568. /************************************************************************
  7569. ** IBM Confidential
  7570. **
  7571. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7572. **
  7573. ** (C) Copyright IBM Corp. 2015
  7574. **
  7575. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7576. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7577. ************************************************************************/
  7578. // GENERATED
  7579. //@import com/ibm/rave/core/transform/MatrixUtil (static) // identity, mapPoints
  7580. var com_ibm_rave_render_internal_nodes_path_Path2DUtil = {
  7581. //constructor : function() {}
  7582. };
  7583. /**
  7584. * Utility for converting an SVG arc to bezier curves. Useful for platforms that do not support the SVG arc in the same way.
  7585. */
  7586. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier = function(path, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
  7587. var angle = xAxisRotation % 360;
  7588. var dx2 = (x0 - x) / 2.0;
  7589. var dy2 = (y0 - y) / 2.0;
  7590. var angleRad = angle / 180.0 * Math.PI;
  7591. var cosAngle = Math.cos(angleRad);
  7592. var sinAngle = Math.sin(angleRad);
  7593. var x1 = (cosAngle * dx2 + sinAngle * dy2);
  7594. var y1 = (-sinAngle * dx2 + cosAngle * dy2);
  7595. var rxAbs = Math.abs(rx);
  7596. var ryAbs = Math.abs(ry);
  7597. var Prx = rxAbs * rxAbs;
  7598. var Pry = ryAbs * ryAbs;
  7599. var Px1 = x1 * x1;
  7600. var Py1 = y1 * y1;
  7601. var radiiCheck = Px1 / Prx + Py1 / Pry;
  7602. if (radiiCheck > 1) {
  7603. rxAbs = Math.sqrt(radiiCheck) * rxAbs;
  7604. ryAbs = Math.sqrt(radiiCheck) * ryAbs;
  7605. Prx = rxAbs * rxAbs;
  7606. Pry = ryAbs * ryAbs;
  7607. }
  7608. var sign = (largeArcFlag == sweepFlag) ? -1 : 1;
  7609. var sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1));
  7610. sq = (sq < 0) ? 0 : sq;
  7611. var coef = (sign * Math.sqrt(sq));
  7612. var cx1 = coef * ((rxAbs * y1) / ryAbs);
  7613. var cy1 = coef * -((ryAbs * x1) / rxAbs);
  7614. var sx2 = (x0 + x) / 2.0;
  7615. var sy2 = (y0 + y) / 2.0;
  7616. var cx = sx2 + (cosAngle * cx1 - sinAngle * cy1);
  7617. var cy = sy2 + (sinAngle * cx1 + cosAngle * cy1);
  7618. var ux = (x1 - cx1) / rxAbs;
  7619. var uy = (y1 - cy1) / ryAbs;
  7620. var vx = (-x1 - cx1) / rxAbs;
  7621. var vy = (-y1 - cy1) / ryAbs;
  7622. var p, n;
  7623. n = Math.sqrt((ux * ux) + (uy * uy));
  7624. p = ux;
  7625. sign = (uy < 0) ? -1 : 1;
  7626. var angleStart = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
  7627. n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
  7628. p = ux * vx + uy * vy;
  7629. sign = (ux * vy - uy * vx < 0) ? -1 : 1;
  7630. var angleExtent = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
  7631. if (!sweepFlag && angleExtent > 0) {
  7632. angleExtent -= 360;
  7633. } else if (sweepFlag && angleExtent < 0) {
  7634. angleExtent += 360;
  7635. }
  7636. angleExtent %= 360;
  7637. angleStart %= 360;
  7638. var bezierPoints = com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers(angleStart, angleExtent);
  7639. var m = com_ibm_rave_core_transform_MatrixUtil.identity();
  7640. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.scaleNonUniform(rxAbs, ryAbs));
  7641. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.rotate(angle));
  7642. com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.translate(cx, cy));
  7643. bezierPoints[bezierPoints.length - 2] = x;
  7644. bezierPoints[bezierPoints.length - 1] = y;
  7645. for (var i = 0; i < bezierPoints.length; i += 6) {
  7646. path.bezierCurveTo(bezierPoints[i], bezierPoints[i + 1], bezierPoints[i + 2], bezierPoints[i + 3], bezierPoints[i + 4], bezierPoints[i + 5]);
  7647. }
  7648. };
  7649. com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers = function(angleStart, angleExtent) {
  7650. var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0);
  7651. var angleStartRad = angleStart / 180.0 * Math.PI;
  7652. var angleExtentRad = angleExtent / 180.0 * Math.PI;
  7653. var angleIncrement = (angleExtentRad / numSegments);
  7654. var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));
  7655. var coords = [];
  7656. var pos = 0;
  7657. for (var i = 0; i < numSegments; ++i) {
  7658. var angle = angleStartRad + i * angleIncrement;
  7659. var dx = Math.cos(angle);
  7660. var dy = Math.sin(angle);
  7661. coords[pos++] = (dx - controlLength * dy);
  7662. coords[pos++] = (dy + controlLength * dx);
  7663. angle += angleIncrement;
  7664. dx = Math.cos(angle);
  7665. dy = Math.sin(angle);
  7666. coords[pos++] = (dx + controlLength * dy);
  7667. coords[pos++] = (dy - controlLength * dx);
  7668. coords[pos++] = dx;
  7669. coords[pos++] = dy;
  7670. }
  7671. return coords;
  7672. };
  7673. // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager
  7674. /************************************************************************
  7675. ** IBM Confidential
  7676. **
  7677. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7678. **
  7679. ** (C) Copyright IBM Corp. 2015
  7680. **
  7681. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7682. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7683. ************************************************************************/
  7684. // GENERATED
  7685. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7686. //@import com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache (runtime) // new
  7687. //@import com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache (runtime) // new
  7688. //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime) // addNotificationListener
  7689. /**
  7690. * A manager for a scene node cache. Listens for events on a scene node item and updates the cache if needed.
  7691. */
  7692. var com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager = com_ibm_rave_core_nativeImpl_Declare({
  7693. //idCache : null,
  7694. //classCache : null,
  7695. constructor : function() {
  7696. this.idCache = new com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache();
  7697. this.classCache = new com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache();
  7698. /**
  7699. * Create a new cache manager that handles caching for 'root' node.
  7700. * @param root The root node of this scene tree.
  7701. */
  7702. {
  7703. com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener(this);
  7704. }
  7705. },
  7706. /**
  7707. * Retrieve a single SceneNode from a cache, anywhere within this scene tree from the owner down.
  7708. * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
  7709. * @param (String) idString Unique id to search for in this entire scene tree, starting from the owner.
  7710. * @return (com.ibm.rave.core.scene.SceneNode) SceneNode matching the passed unique id.
  7711. */
  7712. getOne : function(cacheId, idString) {
  7713. if (cacheId == 1000) {
  7714. return this.idCache.get(idString);
  7715. }
  7716. return null;
  7717. },
  7718. /**
  7719. * Retrieve a list of SceneNodes with a particular class anywhere within this scene tree from the owner down.
  7720. * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
  7721. * @param (String) className className to search for in this entire scene tree, starting from the owner.
  7722. * @return (Array) All SceneNodes matching the passed class.
  7723. */
  7724. getMany : function(cacheId, className) {
  7725. if (cacheId == 1001) {
  7726. return this.classCache.get(className);
  7727. }
  7728. return null;
  7729. },
  7730. /**
  7731. * 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.
  7732. * @param value
  7733. * @param context
  7734. */
  7735. addToIDCache : function(node) {
  7736. this.idCache.add(node.id, node);
  7737. },
  7738. /**
  7739. * Caching support to quickly search by class. Add a node to a set that is indexed by 'className' to the cache. Dynamically creates the cache if one hasn't been created yet.
  7740. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node The node to add
  7741. * @param (String) className The key of the set of nodes.
  7742. */
  7743. addToClassCache : function(node, className) {
  7744. if (className == null) {
  7745. return;
  7746. }
  7747. this.classCache.add(className, node);
  7748. },
  7749. /**
  7750. * Add all classes on this node to the cache.
  7751. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node
  7752. */
  7753. addAllClassesToClassCache : function(node) {
  7754. this.classCache.addMany(node.getClassSet(), node);
  7755. },
  7756. removeFromIdCache : function(node) {
  7757. if (node.id != null) {
  7758. this.idCache.remove$0(node.id, node);
  7759. }
  7760. },
  7761. removeFromClassCache : function(node, value) {
  7762. if (value != null) {
  7763. this.classCache.remove$0(""+(value), node);
  7764. }
  7765. },
  7766. removeAllClassesFromClassCache : function(node) {
  7767. this.classCache.remove$1(node.getClassSet(), node);
  7768. },
  7769. beforeUpdate : function(type, subType, key, value, node) {
  7770. switch (type) {
  7771. case (1000):
  7772. if (subType == 2000) {
  7773. if ("id" == key) {
  7774. this.removeFromIdCache(node);
  7775. }
  7776. } else if (subType == 2001) {
  7777. this.removeFromClassCache(node, value);
  7778. }
  7779. break;
  7780. default:
  7781. break;
  7782. }
  7783. },
  7784. afterUpdate : function(type, subType, key, value, node) {
  7785. switch (type) {
  7786. case (1000):
  7787. if (subType == 2000) {
  7788. if ("id" == key) {
  7789. this.addToIDCache(node);
  7790. }
  7791. } else if (subType == 2001 && value != null) {
  7792. this.addToClassCache(node, ""+(value));
  7793. }
  7794. break;
  7795. case (1001):
  7796. this.addToIDCache(node);
  7797. this.addAllClassesToClassCache(node);
  7798. break;
  7799. case (1002):
  7800. this.removeFromIdCache(node);
  7801. this.removeAllClassesFromClassCache(node);
  7802. break;
  7803. default:
  7804. break;
  7805. }
  7806. }
  7807. });
  7808. //com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager.ID = "id";
  7809. // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCache
  7810. /************************************************************************
  7811. ** IBM Confidential
  7812. **
  7813. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7814. **
  7815. ** (C) Copyright IBM Corp. 2015
  7816. **
  7817. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7818. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7819. ************************************************************************/
  7820. // GENERATED
  7821. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7822. /**
  7823. * 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.
  7824. * @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.
  7825. */
  7826. var com_ibm_rave_render_internal_nodes_cache_SceneNodeCache = com_ibm_rave_core_nativeImpl_Declare({
  7827. //factory : null,
  7828. //cache : null,
  7829. _isReady : true,
  7830. constructor : function() {
  7831. this.cache = {};
  7832. },
  7833. /**
  7834. * Is this cache ready to accept nodes or not?
  7835. * @return (boolean) True if this cache is ready to accept nodes. False otherwise.
  7836. */
  7837. isReady : function() {
  7838. return this._isReady;
  7839. },
  7840. /**
  7841. * Add a node to this cache under 'key'.
  7842. * @param (String) key The key of the cache.
  7843. * @param (com.ibm.rave.core.scene.SceneNode) node The node to add
  7844. */
  7845. add : function(key, node) {
  7846. if (!(this.isReady()) || key == null) {
  7847. return null;
  7848. }
  7849. var container = this.get(key);
  7850. if (!container) {
  7851. container = this.factory(node);
  7852. this.cache[key] = container;
  7853. }
  7854. return container;
  7855. },
  7856. /**
  7857. * Add a node to the container of each 'key' in 'keys'.
  7858. * @param (Object) keys Multiple key names of the cache.
  7859. * @param (com.ibm.rave.core.scene.SceneNode) node The node to add to each key container.
  7860. */
  7861. addMany : function(keys, node) {
  7862. if (!(this.isReady()) || !keys) {
  7863. return null;
  7864. }
  7865. var setValues = Object.keys(keys);
  7866. for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
  7867. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7868. var key = setValues[__i_enFor0];
  7869. this.add(key, node);
  7870. }
  7871. return setValues;
  7872. },
  7873. /**
  7874. * Return the first matching node for this key from our cached set of nodes.
  7875. * @param (String) key The bucket to get a node from.
  7876. * @return (java.lang.Object) The first matching node for this key.
  7877. */
  7878. get : function(key) {
  7879. if (!(this.isReady()) || key == null) {
  7880. return null;
  7881. }
  7882. return this.cache[key];
  7883. },
  7884. /**
  7885. * Remove a node from the set of nodes under 'key' in this cache.
  7886. * @param (String) key The bucket to remove the node from.
  7887. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  7888. */
  7889. remove$0 : function(key, node) {
  7890. if (!(this.isReady()) || key == null) {
  7891. return;
  7892. }
  7893. delete this.cache[key];
  7894. },
  7895. /**
  7896. * Remove a node from multiple keys in this cache.
  7897. * @param (Object) keys The buckets to remove the node from.
  7898. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  7899. */
  7900. remove$1 : function(keys, node) {
  7901. if (!(this.isReady()) || !keys) {
  7902. return;
  7903. }
  7904. var setValues = Object.keys(keys);
  7905. for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
  7906. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7907. var key = setValues[__i_enFor0];
  7908. this.remove$0(key, node);
  7909. }
  7910. },
  7911. remove : function(a0, a1) {
  7912. var args = arguments;
  7913. if (args.length == 2 && (a0 == null || typeof a0 === "string")) {
  7914. return this.remove$0(a0, a1);
  7915. }
  7916. return this.remove$1(a0, a1);
  7917. }
  7918. //constructor : function() {}
  7919. });
  7920. // $source: com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache
  7921. /************************************************************************
  7922. ** IBM Confidential
  7923. **
  7924. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7925. **
  7926. ** (C) Copyright IBM Corp. 2015
  7927. **
  7928. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7929. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7930. ************************************************************************/
  7931. // GENERATED
  7932. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7933. //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
  7934. /**
  7935. * A cache that can hold only one node per key (id, for example)
  7936. */
  7937. var com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
  7938. /**
  7939. * A cache that can hold only one node per key (id, for example)
  7940. */
  7941. constructor : function() {
  7942. this.factory = function(node) {
  7943. return node;
  7944. };
  7945. }
  7946. });
  7947. // $source: com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache
  7948. /************************************************************************
  7949. ** IBM Confidential
  7950. **
  7951. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7952. **
  7953. ** (C) Copyright IBM Corp. 2015
  7954. **
  7955. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7956. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7957. ************************************************************************/
  7958. // GENERATED
  7959. //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
  7960. //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
  7961. /**
  7962. * A cache that can hold multiple nodes per key (classes, for example)
  7963. */
  7964. var com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
  7965. /**
  7966. * A cache that can hold multiple nodes per key (classes, for example)
  7967. */
  7968. constructor : function() {
  7969. this.factory = function(node) {
  7970. return [];
  7971. };
  7972. },
  7973. add : function(className, node) {
  7974. this.remove$0(className, node);
  7975. var container = com_ibm_rave_render_internal_nodes_cache_SceneNodeCache.prototype.add.call(this, className, node);
  7976. if (className != null) {
  7977. container.push(node);
  7978. }
  7979. return container;
  7980. },
  7981. /**
  7982. * Remove a node from the set of nodes under 'key' in this cache.
  7983. * @param (String) className The bucket to remove the node from.
  7984. * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
  7985. */
  7986. remove$0 : function(className, node) {
  7987. var list = this.get(className);
  7988. if (list) {
  7989. var i = list.indexOf(node);
  7990. if (i >= 0) {
  7991. list.splice(i, 1);
  7992. }
  7993. }
  7994. }
  7995. });
  7996. })();