1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010 |
- (function() {
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/ModuleHeader
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // setup
- var rave = window["rave"], rave_externs={},
- com_ibm_rave_core_Rave = rave,
- com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
- com_ibm_rave_core_nativeImpl_Object = rave["_"]["com_ibm_rave_core_nativeImpl_Object"],
- com_ibm_rave_core_geom_RectStruct = rave["internal"]["RectStruct"],
- com_ibm_rave_core_geom_RaveRect = rave["internal"]["RaveRect"],
- com_ibm_rave_core_transform_MatrixUtil = rave["internal"]["MatrixUtil"],
- rave_document = rave["_"]["rave_document"];
- // $source: com/ibm/rave/core/internal/util/CollectionsUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_util_CollectionsUtil = {
- //constructor : function() {}
- };
- /**
- * Removes the value from the list.
- * @param (Array) list the list to remove the value from
- * @param (Object) value the value to remove
- * @return (boolean) <code>true</code> if the value was found in the list, <code>false</code> otherwise
- */
- com_ibm_rave_core_internal_util_CollectionsUtil.remove = function(list, value) {
- var i = list.indexOf(value);
- if (i >= 0) {
- list.splice(i, 1);
- return true;
- }
- return false;
- };
- // $source: com/ibm/rave/core/internal/svg/SVGConstants
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_core_internal_svg_SVGConstants = {
- };
- com_ibm_rave_core_internal_svg_SVGConstants.RECT = "rect";
- com_ibm_rave_core_internal_svg_SVGConstants.CIRCLE = "circle";
- com_ibm_rave_core_internal_svg_SVGConstants.LINE = "line";
- com_ibm_rave_core_internal_svg_SVGConstants.TEXT = "text";
- com_ibm_rave_core_internal_svg_SVGConstants.G = "g";
- com_ibm_rave_core_internal_svg_SVGConstants.PATH = "path";
- com_ibm_rave_core_internal_svg_SVGConstants.POLYGON = "polygon";
- com_ibm_rave_core_internal_svg_SVGConstants.POLYLINE = "polyline";
- com_ibm_rave_core_internal_svg_SVGConstants.DEFS = "defs";
- com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT = "linearGradient";
- com_ibm_rave_core_internal_svg_SVGConstants.STOP = "stop";
- com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT = "radialGradient";
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils (runtime)
- var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing = {
-
- /**
- * Split the points into curve segments.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param newPoints
- * an array to be filled with curve info
- * @param prevResidue
- * optional object containing previous dash info
- */
- splitToDashedBezier : function(points, dash, newPoints, prevResidue) {
- var residue = 0, t = 0, da, i = 0;
- if (prevResidue) {
- da = prevResidue.l;
- i = prevResidue.i;
- } else {
- da = dash[0];
- }
- while (t < 1) {
- // get the 't' corresponding to the given dash value.
- t = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.tAtLength(points, da);
- if (t == 1) {
- var rl = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.computeLength(points);
- residue = {
- l : da - rl,
- i : i
- };
- }
- // split bezier at t: left part is the "dash" curve, right part is the remaining bezier points
- var curves = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.splitBezierAtT(points, t);
- if (!(i % 2)) {
- // only keep the "dash" curve
- newPoints.push(curves[0]);
- }
- points = curves[1];
- ++i;
- da = dash[i % dash.length];
- }
- return residue;
- },
-
- /**
- * Builds a set of bezier (cubic || quadratic)CurveTo' canvas instructions
- * that represents a dashed stroke of the specified bezier geometry.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param x
- * the start x coordinate
- * @param y
- * the start y coordinate
- * @param points
- * the control points
- * @param prevResidue
- * optional object containing previous dash info
- */
- toDashedCurveTo : function(ctx, dash, x, y, points, prevResidue) {
- var pts = [x, y].concat(points), quadratic = points.length === 4, api = quadratic ? "quadraticCurveTo"
- : "bezierCurveTo", curves = [];
- var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.splitToDashedBezier(pts, dash, curves, prevResidue);
- for (var c = 0; c < curves.length; ++c) {
- var curve = curves[c];
- ctx.moveTo(curve[0], curve[1]);
- ctx[api].apply(ctx, curve.slice(2));
- }
- return residue;
- },
-
- /**
- * Builds a set of moveTo/lineTo' canvas instructions that represents a
- * dashed stroke of the specified line geometry.
- *
- * @param ctx
- * the canvas context
- * @param dash
- * the dash array
- * @param x1
- * the start x coordinate
- * @param y1
- * the start y coordinate
- * @param x2
- * the end x coordinate
- * @param y2
- * the end y coordinate
- * @param prevResidue
- * optional object containing previous dash info
- */
- toDashedLineTo : function(ctx, dash, x1, y1, x2, y2, prevResidue) {
- 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;
- if (prevResidue) {
- da = prevResidue.l;
- i = prevResidue.i;
- } else {
- da += dash[0];
- }
- while (Math.abs(1 - r) > 0) {
- if (da > tlength) {
- residue = {
- l : da - tlength,
- i : i
- };
- da = tlength;
- }
- r = da / tlength;
- x = x1 + (x2 - x1) * r;
- y = y1 + (y2 - y1) * r;
- if (!(i++ % 2)) {
- ctx.moveTo(prevx, prevy);
- ctx.lineTo(x, y);
- }
- prevx = x;
- prevy = y;
- da += dash[i % dash.length];
- }
- if (!residue && i) {
- residue = {l: dash[i % dash.length], i: i};
- }
- return residue;
- }
- };
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // From dojo without the gfx dependency.
- // Required to support non-native dashing.
- var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils = (function() {
- var bu = {},
- error = 0.1;
- bu.tAtLength = function(points, length){
- // summary:
- // Returns the t corresponding to the given length for the specified bezier curve.
- // points: Number[]
- // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
- // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
- // length: Number
- // The length.
- var t = 0,
- quadratic = points.length == 6,
- currentLen = 0,
- splitCount = 0,
- splitFunc = quadratic ? splitQBezierAtT : splitBezierAtT;
- var _compute = function(p, error){
- // control points polygon length
- var pLen = 0;
- for(var i = 0; i < p.length-2; i+=2)
- pLen += distance(p[i],p[i+1],p[i+2],p[i+3]);
- // chord length
- var chord = quadratic ?
- distance(points[0],points[1],points[4],points[5]) :
- distance(points[0],points[1],points[6],points[7]);
- // if needs more approx. or if currentLen is greater than the target length,
- // split the curve one more time
- if(pLen - chord > error || currentLen + pLen > length + error){
- ++splitCount;
- var newbezier = splitFunc(p, .5);
- // check 1st subpath
- _compute(newbezier[0], error);
- // the 1st subcurve was the good one, we stop
- if(Math.abs(currentLen - length) <= error){
- return;
- }
- // need to continue with the 2nde subcurve
- _compute(newbezier[1], error);
- return ;
- }
- currentLen += pLen;
- t += 1.0 / (1 << splitCount);
- };
- if(length)
- _compute(points, 0.5);
- return t;
- };
- var computeLength = bu.computeLength = function(/*Array*/points){
- // summary:
- // Returns the length of the given bezier curve.
- // points: Number[]
- // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic
- // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve.
- var quadratic = points.length == 6, pLen=0;
- // control points polygon length
- for(var i = 0; i < points.length-2; i+=2)
- pLen += distance(points[i],points[i+1],points[i+2],points[i+3]);
- // chord length
- var chord = quadratic ?
- distance(points[0],points[1],points[4],points[5]) :
- distance(points[0],points[1],points[6],points[7]);
- // split polygons until the polygon and the chord are "the same"
- if(pLen-chord>error){
- var newBeziers = quadratic ? splitQBezierAtT(points,.5) : splitCBezierAtT(points,.5);
- var length = computeLength(newBeziers[0], quadratic);
- length += computeLength(newBeziers[1], quadratic);
- return length;
- }
- // pLen is close enough, done.
- return pLen;
- };
- var distance = bu.distance = function(x1, y1, x2, y2){
- // summary:
- // Returns the distance between the specified points.
- return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- };
- var splitQBezierAtT = function(points, t){
- // summary:
- // Split a quadratic bezier curve into 2 sub-quadratic beziers at the specified t.
- // de Casteljau
- var r = 1-t,
- r2 = r*r,
- t2 = t*t,
- p1x = points[0],
- p1y = points[1],
- cx = points[2],
- cy = points[3],
- p2x = points[4],
- p2y = points[5],
- ax = r*p1x + t*cx,
- ay = r*p1y + t*cy,
- bx = r*cx + t*p2x,
- by = r*cy + t*p2y,
- px = r2*p1x + 2*r*t*cx + t2*p2x,
- py = r2*p1y + 2*r*t*cy + t2*p2y;
- return [
- [
- p1x, p1y,
- ax, ay,
- px, py
- ],
- [
- px, py,
- bx, by,
- p2x, p2y
- ]
- ];
- };
- var splitCBezierAtT = function(points, t){
- // summary:
- // Split a cubic bezier curve into 2 sub-cubic beziers at the specified t.
- // de Casteljau
- var r = 1-t,
- r2 = r*r,
- r3 = r2*r,
- t2 = t*t,
- t3 = t2*t,
- p1x = points[0],
- p1y = points[1],
- c1x = points[2],
- c1y = points[3],
- c2x = points[4],
- c2y = points[5],
- p2x = points[6],
- p2y = points[7],
- ax = r*p1x + t*c1x,
- ay = r*p1y + t*c1y,
- cx = r*c2x + t*p2x,
- cy = r*c2y + t*p2y,
- mx = r2*p1x + 2*r*t*c1x + t2*c2x,
- my = r2*p1y + 2*r*t*c1y + t2*c2y,
- nx = r2*c1x + 2*r*t*c2x + t2*p2x,
- ny = r2*c1y + 2*r*t*c2y + t2*p2y,
- px = r3*p1x + 3*r2*t*c1x + 3*r*t2*c2x+t3*p2x,
- py = r3*p1y + 3*r2*t*c1y + 3*r*t2*c2y+t3*p2y;
- return [
- [
- p1x, p1y,
- ax, ay,
- mx, my,
- px, py
- ],
- [
- px, py,
- nx, ny,
- cx, cy,
- p2x, p2y
- ]
- ];
- };
- var splitBezierAtT = bu.splitBezierAtT = function(points, t){
- return points.length == 6 ? splitQBezierAtT(points, t) : splitCBezierAtT(points, t);
- };
- return bu;
- })();
- // $source: com/ibm/rave/render/internal/RendererConfiguration
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Configuration specific to native renderers and scene nodes.
- */
- var com_ibm_rave_render_internal_RendererConfiguration = com_ibm_rave_core_nativeImpl_Declare({
- //roots : null,
- constructor : function() {
- this.roots = [];
- },
- /**
- * Return all registered root providers.
- * @return (Array) A list of all registered root providers.
- */
- getRootProviders : function() {
- return this.roots;
- },
- /**
- * Return the root provider that contains a specific node.
- * @param (com.ibm.rave.core.scene.SceneNode) node Return the provider that contains this node.
- * @return (com.ibm.rave.render.internal.nodes.RootProvider) Matching root provider, or null if none found.
- */
- getRootProviderForNode : function(node) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var root = __exp_enFor0[__i_enFor0];
- if (node == root.getRoot().rave_getOwner()) {
- return root;
- }
- }
- return null;
- },
- /**
- * 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.
- * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to add to the system.
- */
- addRootProvider : function(rootProvider) {
- this.roots.push(rootProvider);
- },
- /**
- * 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.
- * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to remove from the system.
- */
- removeRootProvider : function(rootProvider) {
- var i = this.roots.indexOf(rootProvider);
- if (i >= 0) {
- this.roots.splice(i, 1);
- }
- },
- /**
- * Remove the root provider that contains a specific node.
- * @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.
- */
- removeRootProviderForNode : function(node) {
- var i = -1;
- var found = false;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var root = __exp_enFor0[__i_enFor0];
- i++;
- if (node == root.getRoot().rave_getOwner()) {
- found = true;
- break;
- }
- }
- if (found) {
- this.roots.splice(i, 1);
- }
- }
- //constructor : function() {}
- });
- /**
- * Singleton instance of this renderer configuration.
- */
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE = new com_ibm_rave_render_internal_RendererConfiguration();
- // $source: com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse
- //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
- /**
- * 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><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="val"]</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="nofollow"]</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>
- * @author Jonathan Hedley, jonathan@hedley.net
- * @see this.Element#this.select()
- */
- var com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector = com_ibm_rave_core_nativeImpl_Declare({
- //evaluator : null,
- //root : null,
- //cache : null,
- constructor : function(query, root, cache) {
- query = query.trim();
- this.evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(query);
- this.root = root;
- this.cache = cache;
- },
- select$1 : function() {
- return com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(this.evaluator, this.root, this.cache);
- },
- select : function() {
- var args = arguments;
- return this.select$1();
- }
- });
- /**
- * Find elements matching selector.
- * @param (String) query CSS selector
- * @param (com.ibm.rave.core.scene.SceneNode) root root element to descend into
- * @return (Array) matching elements, empty if not
- */
- com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0 = function(query, root, cache) {
- return new com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector(query, root, cache).select$1();
- };
- /**
- * Find elements matching selector.
- * @param (String) query CSS selector
- * @param (Array) roots root elements to descend into
- * @return (Array) matching elements, empty if not
- */
- com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$2 = function(query, roots, cache) {
- var elements = [];
- for (var __i_enFor0 = 0, __exp_enFor0 = roots, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var root = __exp_enFor0[__i_enFor0];
- 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;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var node = __exp_enFor1[__i_enFor1];
- if (elements.indexOf(node) < 0) {
- elements.push(node);
- }
- }
- }
- return elements;
- };
- com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select = function(a0, a1, a2) {
- var args = arguments;
- if (args.length == 3 && (a1 == null || Object.prototype.toString.call(a1) === "[object Array]")) {
- return com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$2(a0, a1, a2);
- }
- return com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select$0(a0, a1, a2);
- };
- // $source: com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- //@import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (static) // select
- /**
- * A CSS3 selection query engine for abstract scene tree/node type scene nodes.
- */
- var com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({
- matches : function(context, selectorString) {
- return this.querySelector$0(selectorString, context);
- },
- querySelector$0 : function(match, rootNode) {
- if (match != null) {
- var results = this.querySelectorAll$1(match, rootNode);
- if (results.length > 0) {
- return results[0];
- }
- }
- return null;
- },
- querySelector$1 : function(match) {
- if (match != null) {
- var matches = this.querySelectorAll$0(match);
- if (matches && matches.length > 0) {
- return matches[0];
- }
- }
- return null;
- },
- querySelectorAll$0 : function(match) {
- return this.querySelectorAll$1(match, null);
- },
- querySelectorAll$1 : function(match, rootNode) {
- var results = [];
- if (match != null) {
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, rootNode);
- }
- return results;
- },
- querySelector : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.querySelector$1(a0);
- }
- return this.querySelector$0(a0, a1);
- },
- querySelectorAll : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.querySelectorAll$0(a0);
- }
- return this.querySelectorAll$1(a0, a1);
- }
- });
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll = function(results, match, rootNode) {
- if (rootNode) {
- var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(rootNode);
- var realRoot = rootNode;
- var cache = null;
- if (rootProvider) {
- cache = rootProvider.getCacheManager();
- realRoot = rootProvider.getRoot();
- }
- 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;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- results.push(node);
- }
- } else {
- var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.roots;
- for (var __i_enFor1 = 0, __exp_enFor1 = providers, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var provider = __exp_enFor1[__i_enFor1];
- com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, provider.getRoot());
- }
- }
- };
- // $source: com/ibm/rave/render/internal/select/jsoup/select/QueryParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (runtime) // new
- //@import com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue (runtime) // new, unescape
- /**
- * Parses a CSS selector into an Evaluator tree.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_QueryParser = com_ibm_rave_core_nativeImpl_Declare({
- //tq : null,
- //evals : null,
- constructor : function(query) {
- this.evals = [];
- /**
- * Create a new QueryParser.
- * @param (String) query CSS query
- */
- {
- this.tq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(query);
- }
- },
- /**
- * Parse the query
- * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
- */
- parse$1 : function() {
- this.tq.consumeWhitespace();
- if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root());
- this.combinator(this.tq.consume$0());
- } else {
- if (!(this.findElements())) {
- return null;
- }
- }
- while (!(this.tq.isEmpty())) {
- var seenWhite = this.tq.consumeWhitespace();
- if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- this.combinator(this.tq.consume$0());
- } else if (seenWhite) {
- this.combinator(32);
- } else {
- if (!(this.findElements())) {
- return null;
- }
- }
- }
- if (this.evals.length == 1) {
- return this.evals[0];
- }
- return new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
- },
- combinator : function(combinator) {
- this.tq.consumeWhitespace();
- var subQuery = this.consumeSubQuery();
- var rootEval;
- var currentEval;
- var newEval = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery);
- var replaceRightMost = false;
- if (this.evals.length == 1) {
- rootEval = currentEval = this.evals[0];
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(rootEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or) && combinator != 44) {
- currentEval = (currentEval).rightMostEvaluator();
- replaceRightMost = true;
- }
- } else {
- rootEval = currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals);
- }
- this.evals = [];
- if (combinator == 62) {
- 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)]);
- } else if (combinator == 32) {
- 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)]);
- } else if (combinator == 43) {
- 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)]);
- } else if (combinator == 126) {
- 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)]);
- } else if (combinator == 44) {
- var or;
- if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(currentEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or)) {
- or = currentEval;
- or.add(newEval);
- } else {
- or = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or(null);
- or.add(currentEval);
- or.add(newEval);
- }
- currentEval = or;
- } else {
- return;
- }
- if (replaceRightMost) {
- (rootEval).replaceRightMostEvaluator(currentEval);
- } else {
- rootEval = currentEval;
- }
- this.evals.push(rootEval);
- },
- consumeSubQuery : function() {
- var sq = "";
- while (!(this.tq.isEmpty())) {
- if (this.tq.matches("(")) {
- sq += "(" + this.tq.chompBalanced(40, 41) + ")";
- } else if (this.tq.matches("[")) {
- sq += "[" + this.tq.chompBalanced(91, 93) + "]";
- } else if (this.tq.matchesAny.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) {
- break;
- } else {
- sq += String.fromCharCode(this.tq.consume$0());
- }
- }
- return sq;
- },
- findElements : function() {
- if (this.tq.matchChomp("#")) {
- this.byId();
- } else if (this.tq.matchChomp(".")) {
- this.byClass();
- } else if (this.tq.matchesWord()) {
- this.byTag();
- } else if (this.tq.matches("[")) {
- this.byAttribute();
- } else if (this.tq.matchChomp("*")) {
- this.allElements();
- } else if (this.tq.matchChomp(":lt(")) {
- this.indexLessThan();
- } else if (this.tq.matchChomp(":gt(")) {
- this.indexGreaterThan();
- } else if (this.tq.matchChomp(":eq(")) {
- this.indexEquals();
- } else if (this.tq.matches(":has(")) {
- this.has();
- } else if (this.tq.matches(":contains(")) {
- this.contains(false);
- } else if (this.tq.matches(":containsOwn(")) {
- this.contains(true);
- } else if (this.tq.matches(":matches(")) {
- this.matches(false);
- } else if (this.tq.matches(":matchesOwn(")) {
- this.matches(true);
- } else if (this.tq.matches(":not(")) {
- this.not();
- } else if (this.tq.matchChomp(":nth-child(")) {
- this.cssNthChild(false, false);
- } else if (this.tq.matchChomp(":nth-last-child(")) {
- this.cssNthChild(true, false);
- } else if (this.tq.matchChomp(":nth-of-type(")) {
- this.cssNthChild(false, true);
- } else if (this.tq.matchChomp(":nth-last-of-type(")) {
- this.cssNthChild(true, true);
- } else if (this.tq.matchChomp(":first-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild());
- } else if (this.tq.matchChomp(":last-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild());
- } else if (this.tq.matchChomp(":first-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(0, 1));
- } else if (this.tq.matchChomp(":last-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(0, 1));
- } else if (this.tq.matchChomp(":only-child")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild());
- } else if (this.tq.matchChomp(":only-of-type")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType());
- } else if (this.tq.matchChomp(":empty")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty());
- } else if (this.tq.matchChomp(":root")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot());
- } else {
- return false;
- }
- return true;
- },
- byId : function() {
- var id = this.tq.consumeCssIdentifier();
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id(id));
- },
- byClass : function() {
- var className = this.tq.consumeCssIdentifier();
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class(className.trim()));
- },
- byTag : function() {
- var tagName = this.tq.consumeElementSelector();
- if (0 <= tagName.indexOf("|")) {
- tagName = tagName.replace("|", ":");
- }
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag(tagName.trim().toLowerCase()));
- },
- byAttribute : function() {
- var cq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(this.tq.chompBalanced(91, 93));
- var key = cq.consumeToAny.apply(cq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals);
- cq.consumeWhitespace();
- if (cq.isEmpty()) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute(key));
- } else {
- if (cq.matchChomp("=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue(key, cq.remainder()));
- } else if (cq.matchChomp("!=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot(key, cq.remainder()));
- } else if (cq.matchChomp("^=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting(key, cq.remainder()));
- } else if (cq.matchChomp("$=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding(key, cq.remainder()));
- } else if (cq.matchChomp("*=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining(key, cq.remainder()));
- } else if (cq.matchChomp("~=")) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching(key, new RegExp(cq.remainder(), "i")));
- } else {
- return;
- }
- }
- },
- allElements : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements());
- },
- indexLessThan : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan(this.consumeIndex()));
- },
- indexGreaterThan : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan(this.consumeIndex()));
- },
- indexEquals : function() {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals(this.consumeIndex()));
- },
- cssNthChild : function(backwards, ofType) {
- var argS = this.tq.chompTo(")").trim().toLowerCase();
- var mAB = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_AB.exec(argS);
- var mB = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_B.exec(argS);
- var a, b;
- if ("odd" == argS) {
- a = 2;
- b = 1;
- } else if ("even" == argS) {
- a = 2;
- b = 0;
- } else if (mAB && mAB.length > 0) {
- a = mAB[3] != null ? ~~ (mAB[1].replace("^\\+", "")) : 1;
- b = mAB[4] != null ? ~~ (mAB[4].replace("^\\+", "")) : 1;
- } else if (mB && mB.length > 0) {
- a = 0;
- b = ~~ (mB[0].replace("^\\+", ""));
- } else {
- return;
- }
- if (ofType) {
- if (backwards) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(a, b));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(a, b));
- }
- } else {
- if (backwards) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild(a, b));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild(a, b));
- }
- }
- },
- consumeIndex : function() {
- var indexS = this.tq.chompTo(")").trim();
- return parseInt(indexS);
- },
- has : function() {
- this.tq.consume$1(":has");
- var subQuery = this.tq.chompBalanced(40, 41);
- 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)));
- },
- contains : function(own) {
- this.tq.consume$1(own ? ":containsOwn" : ":contains");
- var searchText = com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape(this.tq.chompBalanced(40, 41));
- if (own) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText(searchText));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText(searchText));
- }
- },
- matches : function(own) {
- this.tq.consume$1(own ? ":matchesOwn" : ":matches");
- var regex = this.tq.chompBalanced(40, 41);
- if (own) {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn(new RegExp(regex, "")));
- } else {
- this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches(new RegExp(regex, "")));
- }
- },
- not : function() {
- this.tq.consume$1(":not");
- var subQuery = this.tq.chompBalanced(40, 41);
- 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)));
- },
- parse : function() {
- var args = arguments;
- return this.parse$1();
- }
- });
- /**
- * Parse a CSS query into an Evaluator.
- * @param (String) query CSS query
- * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator
- */
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0 = function(query) {
- var p = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser(query);
- return p.parse$1();
- };
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse = function(a0) {
- var args = arguments;
- return com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(a0);
- };
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators = [",", ">", "+", "~", " "];
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals = ["=", "!=", "^=", "$=", "*=", "~="];
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_AB = new RegExp("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d*)?", "i");
- com_ibm_rave_render_internal_select_jsoup_select_QueryParser.NTH_B = new RegExp("(\\+|-)?(\\d+)", "");
- // $source: com/ibm/rave/render/internal/select/jsoup/select/Evaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Evaluates that an SceneNode matches the selector.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_Evaluator = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Test if a SceneNode has been cached for this evaluator.
- * @param element The element being tested
- * @return (Array) list of cached scene nodes.
- */
- cached : function(manager) {
- return null;
- }
- //constructor : function() {},
- /**
- * Test if the SceneNode meets the evaluator's requirements.
- * @param (com.ibm.rave.core.scene.SceneNode) root Root of the matching subtree
- * @param SceneNode tested SceneNode
- */
- //matches : function(root, element) {}
- });
- /**
- * Evaluator for tag name
- */
- 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, {
- //tagName : null,
- constructor : function(tagName) {
- this.tagName = tagName;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- return (element.rave_getName() == this.tagName);
- }
- });
- /**
- * Evaluator for SceneNode id
- */
- 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, {
- //id : null,
- constructor : function(id) {
- this.id = id;
- },
- matches : function(root, element) {
- return (this.id == (element).id);
- },
- cached : function(cache) {
- if (!cache) {
- return null;
- }
- var cached = cache.getOne(1000, this.id);
- return !cached ? null : [cached];
- }
- });
- /**
- * Evaluator for SceneNode class
- */
- 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, {
- //className : null,
- constructor : function(className) {
- this.className = className;
- },
- cached : function(cache) {
- if (!cache) {
- return null;
- }
- return cache.getMany(1001, this.className);
- },
- matches : function(root, element) {
- return (element.rave_containsClass(this.className));
- }
- });
- /**
- * Abstract evaluator for attribute name/value matching
- */
- 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, {
- //key : null,
- //value : null,
- isIdKey : false,
- isClassKey : false,
- constructor : function(key, value) {
- this.key = key.trim().toLowerCase();
- if (value != null) {
- if ((value.match("^[\"'].*") && value.match(".*[\"']$"))) {
- value = value.substring(1, value.length - 1);
- }
- this.value = value.trim();
- }
- if (this.key == "id") {
- this.isIdKey = true;
- } else if (this.key == "class") {
- this.isClassKey = true;
- }
- },
- cached : function(node) {
- return null;
- }
- });
- /**
- * Evaluator for attribute name matching
- */
- 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, {
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (this.isIdKey) {
- return (element).id != null;
- }
- return element.getAttribute(this.key) != null;
- },
- cached : function(node) {
- return null;
- }
- //constructor : function(key) {}
- });
- /**
- * Evaluator for attribute name/value matching
- */
- 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, {
- cached : function(cache) {
- if (!cache) {
- return null;
- }
- if (this.isIdKey) {
- var cached = cache.getOne(1000, this.value);
- return !cached ? null : [cached];
- } else if (this.isClassKey) {
- return cache.getMany(1001, this.value);
- }
- return null;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (this.isIdKey) {
- return this.value == (element).id;
- }
- var val = element.getAttribute(this.key);
- var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
- return this.value.toUpperCase() == attributeValue.toUpperCase();
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name != value matching
- */
- 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, {
- matches : function(root, element) {
- var val = element.getAttribute(this.key);
- var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key));
- return !(this.value.toUpperCase() == attributeValue.toUpperCase());
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value prefix)
- */
- 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, {
- matches : function(root, element) {
- var attributeValue = element.getAttribute(this.key);
- if (attributeValue == null) {
- return false;
- }
- var elementValue = ""+(attributeValue);
- return elementValue.match("^" + this.value + ".*");
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value ending)
- */
- 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, {
- matches : function(root, element) {
- var attributeVal = element.getAttribute(this.key);
- if (attributeVal == null) {
- return false;
- }
- var elementValue = ""+(attributeVal);
- return elementValue.match(".*" + this.value + "$");
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value containing)
- */
- 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, {
- matches : function(root, element) {
- var attributeValue = element.getAttribute(this.key);
- if (attributeValue == null) {
- return false;
- }
- var elementValue = ""+(attributeValue);
- return 0 <= elementValue.indexOf(this.value);
- }
- //constructor : function(key, value) {}
- });
- /**
- * Evaluator for attribute name/value matching (value regex matching)
- */
- 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, {
- //key : null,
- //pattern : null,
- constructor : function(key, pattern) {
- this.key = key.trim().toLowerCase();
- this.pattern = pattern;
- },
- matches : function(root, element) {
- return element.getAttribute(this.key) != null && this.pattern.test(""+(element.getAttribute(this.key)));
- }
- });
- /**
- * Evaluator for any / all SceneNode matching
- */
- 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, {
- matches : function(root, element) {
- return element != root;
- }
- });
- /**
- * Abstract evaluator for sibling index matching
- * @author ant
- */
- 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, {
- index : 0,
- constructor : function(index) {
- this.index = index;
- }
- });
- /**
- * Evaluator for matching by sibling index number (e < idx)
- */
- 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, {
- matches : function(root, element) {
- return (element).getSiblingIndex() < this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching by sibling index number (e > idx)
- */
- 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, {
- matches : function(root, element) {
- return (element).getSiblingIndex() > this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching by sibling index number (e = idx)
- */
- 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, {
- matches : function(root, element) {
- return (element).getSiblingIndex() == this.index;
- }
- //constructor : function(index) {}
- });
- /**
- * Evaluator for matching the last sibling (css :last-child)
- */
- 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, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return element != root && p && ((element).getSiblingIndex() == p.rave_getChildNodes().length - 1);
- }
- });
- 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, {
- a : 0, b : 0,
- constructor : function(a, b) {
- this.a = a;
- this.b = b;
- },
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- if (!p) {
- return false;
- }
- var pos = this.calculatePosition(root, element);
- if (this.a == 0) {
- return pos == this.b;
- }
- return (pos - this.b) * this.a >= 0 && (pos - this.b) % this.a == 0;
- }
- //calculatePosition : function(root, element) {}
- });
- 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, {
- calculatePosition : function(root, element) {
- var pos = 0;
- var family = element.rave_getParentNode().rave_getChildNodes();
- for (var i = (element).getSiblingIndex(); i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- }
- return pos;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css pseudo class nth-of-type
- */
- 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, {
- calculatePosition : function(root, element) {
- var pos = 0;
- var family = element.rave_getParentNode().rave_getChildNodes();
- for (var i = 0; i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- if (family[i] == element) {
- break;
- }
- }
- return pos;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css-compatible Evaluator for :eq (css :nth-child)
- * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
- */
- 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, {
- calculatePosition : function(root, element) {
- return (element).getSiblingIndex() + 1;
- }
- //constructor : function(a, b) {}
- });
- /**
- * css pseudo class :nth-last-child)
- * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals
- */
- 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, {
- calculatePosition : function(root, element) {
- return element.rave_getParentNode().rave_getChildNodes().length - (element).getSiblingIndex();
- }
- //constructor : function(a, b) {}
- });
- /**
- * Evaluator for matching the first sibling (css :first-child)
- */
- 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, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return p && (element).getSiblingIndex() == 0;
- }
- });
- /**
- * css3 pseudo-class :root
- * @see <a href="http://www.w3.org/TR/selectors/#root-pseudo">:root
- * selector</a>
- */
- 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, {
- matches : function(root, element) {
- return !element.rave_getParentNode();
- }
- });
- 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, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- return p && !element.rave_getPreviousSibling() && !element.rave_getNextSibling();
- }
- });
- 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, {
- matches : function(root, element) {
- var p = element.rave_getParentNode();
- if (!p) {
- return false;
- }
- var pos = 0;
- var family = p.rave_getChildNodes();
- for (var i = 0; i < family.length; ++i) {
- if (family[i].rave_getName() == element.rave_getName()) {
- pos++;
- }
- }
- return pos == 1;
- }
- });
- 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, {
- matches : function(root, element) {
- return !(element.rave_hasChildNodes());
- }
- });
- /**
- * Evaluator for matching SceneNode (and its descendants) text
- */
- 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, {
- //searchText : null,
- constructor : function(searchText) {
- this.searchText = searchText.toLowerCase();
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- if (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)) {
- return true;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (this.matches(element, child)) {
- return true;
- }
- }
- return false;
- }
- });
- /**
- * Evaluator for matching SceneNode's own text
- */
- 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, {
- //searchText : null,
- constructor : function(searchText) {
- this.searchText = searchText.toLowerCase();
- },
- matches : function(root, element) {
- return (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText));
- }
- });
- /**
- * Evaluator for matching SceneNode (and its descendants) text with regex
- */
- 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, {
- //pattern : null,
- constructor : function(pattern) {
- this.pattern = pattern;
- },
- matches : function(root, element) {
- if (this.pattern.test(element.rave_getText())) {
- return true;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- if (this.matches(element, child)) {
- return true;
- }
- }
- return false;
- }
- });
- /**
- * Evaluator for matching SceneNode's own text with regex
- */
- 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, {
- //pattern : null,
- constructor : function(pattern) {
- this.pattern = pattern;
- },
- matches : function(root, element) {
- return this.pattern.test(element.rave_getText());
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // new, superclass
- //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect
- /**
- * Base structural evaluator.
- */
- 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, {
- //evaluator : null
- });
- 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, {
- matches : function(root, element) {
- return root == element;
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- 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;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var e = __exp_enFor0[__i_enFor0];
- if (e != element && this.evaluator.matches(root, e)) {
- return true;
- }
- }
- return false;
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, node) {
- return !(this.evaluator.matches(root, node));
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var parent = element.rave_getParentNode();
- while (parent != root) {
- if (this.evaluator.matches(root, parent)) {
- return true;
- }
- parent = parent.rave_getParentNode();
- }
- return false;
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var parent = element.rave_getParentNode();
- return parent && this.evaluator.matches(root, parent);
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var prev = element.rave_getPreviousSibling();
- while (prev) {
- if (this.evaluator.matches(root, prev)) {
- return true;
- }
- prev = prev.rave_getPreviousSibling();
- }
- return false;
- }
- });
- 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, {
- constructor : function(evaluator) {
- this.evaluator = evaluator;
- },
- matches : function(root, element) {
- if (root == element) {
- return false;
- }
- var prev = element.rave_getPreviousSibling();
- return prev && this.evaluator.matches(root, prev);
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.
- */
- var com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor = com_ibm_rave_core_nativeImpl_Declare({
- //visitor : null,
- /**
- * Create a new traversor.
- * @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.
- */
- constructor : function(visitor) {
- this.visitor = visitor;
- },
- /**
- * Start a depth-first traverse of the root and all of its descendants.
- * @param (com.ibm.rave.core.scene.SceneNode) root the root node point to traverse.
- */
- traverse : function(root) {
- if (!root) {
- return;
- }
- var node = root;
- var depth = 0;
- this.visit(node, depth);
- },
- visit : function(node, depth) {
- if (!node) {
- return;
- }
- this.visitor.head(node, depth);
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.visit(child, depth + 1);
- }
- this.visitor.tail(node, depth);
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/Collector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor (static) // new
- /**
- * Collects a list of elements that match the supplied criteria.
- * @author Jonathan Hedley
- */
- var com_ibm_rave_render_internal_select_jsoup_select_Collector = com_ibm_rave_core_nativeImpl_Declare({
- //constructor : function() {}
- });
- /**
- * Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.
- * @param (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) evaluator Evaluator to test elements against
- * @param (com.ibm.rave.core.scene.SceneNode) root root of tree to descend
- * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache
- * @return (Array) list of matches; empty if none
- */
- com_ibm_rave_render_internal_select_jsoup_select_Collector.collect = function(evaluator, root, cache) {
- var elements = [];
- if (evaluator) {
- var cachedVals = evaluator.cached(cache);
- if (cachedVals) {
- for (var __i_enFor0 = 0, __exp_enFor0 = cachedVals, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- elements.push(node);
- }
- } else {
- 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);
- }
- }
- return elements;
- };
- com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator = com_ibm_rave_core_nativeImpl_Declare({
- //root : null,
- //elements : null,
- //evaluator : null,
- constructor : function(root, elements, evaluator) {
- this.root = root;
- this.elements = elements;
- this.evaluator = evaluator;
- },
- head : function(node, depth) {
- if (this.evaluator && this.evaluator.matches(this.root, node)) {
- this.elements.push(node);
- }
- },
- tail : function(node, depth) {}
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // superclass
- /**
- * Base combining (and, or) evaluator.
- */
- 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, {
- //evaluators : null,
- num : 0,
- constructor : function(evaluators) {
- this.evaluators = [];
- {
- if (evaluators) {
- for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var evaluator = __exp_enFor0[__i_enFor0];
- this.evaluators.push(evaluator);
- }
- }
- this.updateNumEvaluators();
- }
- },
- rightMostEvaluator : function() {
- return this.num > 0 ? this.evaluators[this.num - 1] : null;
- },
- replaceRightMostEvaluator : function(replacement) {
- this.evaluators[this.num - 1] = replacement;
- },
- updateNumEvaluators : function() {
- this.num = this.evaluators.length;
- }
- });
- 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, {
- matches : function(root, node) {
- for (var i = 0; i < this.num; ++i) {
- var s = this.evaluators[i];
- if (!(s.matches(root, node))) {
- return false;
- }
- }
- return true;
- }
- //constructor : function(evaluators) {}
- });
- 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, {
- /**
- * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR.
- * @param (Array) evaluators initial OR clause (these are wrapped into an AND evaluator).
- */
- constructor : function(evaluators) {
- if (this.num > 1) {
- this.evaluators.push(new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(evaluators));
- } else if (evaluators) {
- for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var evaluator = __exp_enFor0[__i_enFor0];
- this.evaluators.push(evaluator);
- }
- }
- this.updateNumEvaluators();
- },
- add : function(e) {
- this.evaluators.push(e);
- this.updateNumEvaluators();
- },
- matches : function(root, node) {
- for (var i = 0; i < this.num; ++i) {
- var s = this.evaluators[i];
- if (s.matches(root, node)) {
- return true;
- }
- }
- return false;
- }
- });
- // $source: com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/select/jsoup/helper/StringUtil (runtime) // isWhitespace, startsWith, regionMatches
- /**
- * A character queue with parsing helpers.
- * @author Jonathan Hedley
- */
- var com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue = com_ibm_rave_core_nativeImpl_Declare({
- //queue : null,
- pos : 0,
- /**
- * Create a new TokenQueue.
- * @param (String) data string of data to back queue.
- */
- constructor : function(data) {
- this.queue = data;
- },
- /**
- * Is the queue empty?
- * @return (boolean) true if no data left in queue.
- */
- isEmpty : function() {
- return this.remainingLength() == 0;
- },
- remainingLength : function() {
- return this.queue.length - this.pos;
- },
- /**
- * Tests if the next characters on the queue match the sequence. Case insensitive.
- * @param (String) seq String to check queue for.
- * @return (boolean) true if the next characters match.
- */
- matches : function(seq) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(this.queue, true, this.pos, seq, 0, seq.length);
- },
- /**
- * Case sensitive match test.
- * @param (String) seq string to case sensitively check for
- * @return (boolean) true if matched, false if not
- */
- matchesCS : function(seq) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith(this.queue, seq, this.pos);
- },
- /**
- * Tests if the next characters match any of the sequences. Case insensitive.
- * @param (java.lang.String[]) seq list of strings to case insensitively check for
- * @return (boolean) true of any matched, false if none did
- */
- matchesAny : function(seq) {
- if (seq !== null || arguments.length > 1){
- seq = Array.prototype.slice.call(arguments);
- }
- {
- for (var __i_enFor0 = 0, __len_enFor0 = seq.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var s = seq[__i_enFor0];
- if (this.matches(s)) {
- return true;
- }
- }
- return false;
- }
- },
- /**
- * Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue.
- * @param (String) seq String to search for, and if found, remove from queue.
- * @return (boolean) true if found and removed, false if not found.
- */
- matchChomp : function(seq) {
- if (this.matches(seq)) {
- this.pos += seq.length;
- return true;
- }
- return false;
- },
- /**
- * Tests if queue starts with a whitespace character.
- * @return (boolean) if starts with whitespace
- */
- matchesWhitespace : function() {
- return !(this.isEmpty()) && com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace(this.queue.charCodeAt(this.pos));
- },
- /**
- * Test if the queue matches a word character (letter or digit).
- * @return (boolean) if matches a word character
- */
- matchesWord : function() {
- var t = new RegExp("[:#\\.\\*\\[ \\,\\(\\)\\~\\=\\$\\^\\-\\']+", "");
- return !(t.test(this.queue.substring(this.pos, this.pos + 1)));
- },
- /**
- * Consume one character off queue.
- * @return (char) first character on queue.
- */
- consume$0 : function() {
- return this.queue.charCodeAt(this.pos++);
- },
- /**
- * 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.
- * @param (String) seq sequence to remove from head of queue.
- */
- consume$1 : function(seq) {
- var len = seq.length;
- this.pos += len;
- },
- /**
- * Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out.
- * @param (String) seq String to end on (and not include in return, but leave on queue). <b>Case sensitive.</b>
- * @return (String) The matched data consumed from queue.
- */
- consumeTo : function(seq) {
- var offset = this.queue.indexOf(seq, this.pos);
- if (offset != -1) {
- var consumed = this.queue.substring(this.pos, offset);
- this.pos += consumed.length;
- return consumed;
- }
- return this.remainder();
- },
- /**
- * Consumes to the first sequence provided, or to the end of the queue. Leaves the terminator on the queue.
- * @param (java.lang.String[]) seq any number of terminators to consume to. <b>Case insensitive.</b>
- * @return (String) consumed string
- */
- consumeToAny : function(seq) {
- if (seq !== null || arguments.length > 1){
- seq = Array.prototype.slice.call(arguments);
- }
- {
- var start = this.pos;
- while (!(this.isEmpty()) && !(this.matchesAny.apply(this, seq))) {
- this.pos++;
- }
- var data = this.queue.substring(start, this.pos);
- return data;
- }
- },
- /**
- * 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).
- * @param (String) seq String to match up to, and not include in return, and to pull off queue. <b>Case sensitive.</b>
- * @return (String) Data matched from queue.
- */
- chompTo : function(seq) {
- var data = this.consumeTo(seq);
- this.matchChomp(seq);
- return data;
- },
- /**
- * 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.
- * @param (char) open opener
- * @param (char) close closer
- * @return (String) data matched from the queue
- */
- chompBalanced : function(open, close) {
- var start = -1;
- var end = -1;
- var depth = 0;
- var last = 0;
- do {
- if (this.isEmpty()) {
- break;
- }
- var c = this.consume$0();
- if (last == 0 || last != 92) {
- if (c == open) {
- depth++;
- if (start == -1) {
- start = this.pos;
- }
- } else if (c == close) {
- depth--;
- }
- }
- if (depth > 0 && last != 0) {
- end = this.pos;
- }
- last = c;
- } while (depth > 0);
- return (end >= 0) ? this.queue.substring(start, end) : "";
- },
- /**
- * Pulls the next run of whitespace characters of the queue.
- */
- consumeWhitespace : function() {
- var seen = false;
- while (this.matchesWhitespace()) {
- this.pos++;
- seen = true;
- }
- return seen;
- },
- /**
- * Retrieves the next run of word type (letter or digit) off the queue.
- * @return (String) String of word characters from queue, or empty string if none.
- */
- consumeWord : function() {
- var start = this.pos;
- while (this.matchesWord()) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume an tag name off the queue (word or :, _, -)
- * @return (String) tag name
- */
- consumeTagName : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny(":", "_", "-"))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume a CSS element selector (tag name, but | instead of : for namespaces, to not conflict with :pseudo selects).
- * @return (String) tag name
- */
- consumeElementSelector : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("|", "_", "-"))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume a CSS identifier (ID or class) off the queue (letter, digit, -, _) http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
- * @return (String) identifier
- */
- consumeCssIdentifier : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("-", "_"))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume an attribute key off the queue (letter, digit, -, _, :")
- * @return (String) attribute key
- */
- consumeAttributeKey : function() {
- var start = this.pos;
- while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAny("-", "_", ":"))) {
- this.pos++;
- }
- return this.queue.substring(start, this.pos);
- },
- /**
- * Consume and return whatever is left on the queue.
- * @return (String) remained of queue.
- */
- remainder : function() {
- var remainder = this.queue.substring(this.pos, this.queue.length);
- this.pos = this.queue.length;
- return remainder;
- },
- consume : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.consume$0();
- }
- return this.consume$1(a0);
- }
- });
- /**
- * Unescaped a \ escaped string.
- * @param (String) text backslash escaped string
- * @return (String) unescaped string
- */
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape = function(text) {
- var out = "";
- var last = 0;
- for (var i = 0; i < text.length; ++i) {
- var c = text.charCodeAt(i);
- if (c == 92) {
- if (last != 0 && last == 92) {
- out += String.fromCharCode(c);
- }
- } else {
- out += String.fromCharCode(c);
- }
- last = c;
- }
- return out.valueOf();
- };
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.ESC = 92;
- com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.NIL = 0;
- // $source: com/ibm/rave/render/internal/select/jsoup/helper/StringUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A minimal String utility class. Designed for internal jsoup use only.
- */
- var com_ibm_rave_render_internal_select_jsoup_helper_StringUtil = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * Tests if a code point is "whitespace" as defined in the HTML spec.
- * @param (int) c code point to test
- * @return (boolean) true if code point is whitespace, false otherwise
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace = function(c) {
- return c == 32 || c == 9 || c == 10 || c == 12 || c == 13;
- };
- /**
- * Translatable version of Java String#regionMaches().
- * @param (String) original String to
- * @param (boolean) ignoreCase ignore case or not
- * @param (int) toffset starting offset of the original string
- * @param (String) other the string to compare
- * @param (int) ooffset starting offset of the subregion in the string
- * @param (int) len number of chars to compare
- * @return (boolean) true if regions match.
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches = function(original, ignoreCase, toffset, other, ooffset, len) {
- if (original.length < toffset + len || original.length < ooffset + len) {
- return false;
- }
- var substring1 = original.substring(toffset, toffset + len);
- var substring2 = other.substring(ooffset, ooffset + len);
- if (ignoreCase) {
- return substring1.toLowerCase() == substring2.toLowerCase();
- }
- return substring1 == substring2;
- };
- /**
- * @param (String) queue
- * @param (String) seq
- * @param (int) pos
- * @return (boolean)
- */
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith = function(queue, seq, pos) {
- return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(queue, false, 0, seq, 0, pos);
- };
- com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.padding = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "];
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- // @import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- // @import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (runtime) // select
- // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (runtime)
- /*
- * This class provides query support at the DOM level and into the canvas scene tree allowing
- * query selectors to cross the boundary from DOM to non-DOM.
- *
- * Example:
- * "body .visualization .axis text"
- *
- * Lets assume that ".axis text" is within a canvas.
- *
- * Start by executing this query against the DOM. No matches.
- * Then for each root provider, execute the same query. No matches.
- *
- * Breakdown the query into parts: ['body', '.visualization', '.axis', 'text']
- *
- * Remove the last part and execute the query on the DOM, ".body .visualization .axis". No matches.
- * Remove the last part again and execute the query on the DOM, ".body .visualization". We have a match.
- *
- * Now that we have a match reconstruct a query from the removed parts: ".axis text"
- * Find all root providers which are descendants of the DOM query matches.
- *
- * For all root providers which are descendants, execute the query ".axis text". We have a match.
- * Add the matches to the result.
- *
- * Keep breaking down the original query and performing the above steps until the query is empty.
- *
- * All the while making sure not to add duplicates to the results.
- *
- */
- var com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine = (function() {
-
- return com_ibm_rave_core_nativeImpl_Declare({
- constructor : function(domQueryEngine) {
- this._domQueryEngine = domQueryEngine;
- this._renderQueryEngine = new com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine();
- },
-
- matches : function(context, query) {
- return this._domQueryEngine.matches(context, query) || this.querySelector(query, context) != null;
- },
-
- querySelector : function(query, rootNode) {
- var result = this._domQueryEngine.querySelector(query, rootNode);
- if (result) {
- return result;
- }
-
- // TODO optimize
- var result = this.querySelectorAll(query, rootNode);
- if (result && result.length) {
- return result[0];
- }
- },
-
- querySelectorAll : function(query, rootNode) {
- rootNode = rootNode || rave_document;
-
- var results = this._domQueryEngine.querySelectorAll(query, rootNode);
-
- if (!results.concat) {
- // since results from the DOM query engine is a NodeList,
- // convert it to an array such that we can use the Array#concat method
- results = Array.prototype.slice.call(results, 0)
- }
-
- var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders();
- for (var i = 0; i < providers.length; i++) {
- // Add jsoup selection to results
- var matches = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(query, providers[i].getRoot(), providers[i].getCacheManager());
- if (matches && matches.length) {
- results = results.concat(matches);
- }
- }
-
- // break up the original query into parts
- var queryParts = query.split(' ');
- if (queryParts.length > 1) {
-
- // this array holds all the query parts we pop
- var endParts = [];
-
- while (queryParts.length > 1) {
-
- // remove a query part and insert it at the start of the endParts
- endParts.unshift(queryParts.pop());
-
- // construct the inner query from the end parts
- var innerQuery = endParts.join(' ');
-
- // execute the broken down query on the DOM
- var partialFind = this._domQueryEngine.querySelectorAll(queryParts.join(' '), rootNode);
- if (partialFind && partialFind.length) {
-
- // if we have matches we need to identify root providers were are descendants of the matches
- for (var i = 0; i < providers.length; i++) {
- var provider = providers[i];
- for (var j = 0; j < partialFind.length; j++) {
-
- // check if the root node is a child of any partial find
- var nodeToCompare = partialFind[j],
- parent = provider.getRoot().rave_getOwner();
- do {
- if (parent == nodeToCompare) {
- break;
- }
- } while (parent = parent.parentNode);
-
- if (parent) {
- // we have a match
- // now perform the remainder of the query on the provider's root node
- var innerResults = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(innerQuery, provider.getRoot(), provider.getCacheManager())
- if (innerResults && innerResults.length) {
- for (var k = 0; k < innerResults.length; k++) {
- // don't add duplicates
- if (results.indexOf(innerResults[k]) == -1) {
- results.push(innerResults[k]);
- }
- }
- }
- break;
- }
- }
- }
- }
- }
- }
-
- return results;
- }
- });
- })();
- // $source: com/ibm/rave/render/internal/SceneItemFactory
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/RectSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/CircleSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/LineSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PathSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PolygonSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/PolylineSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/DefsSceneItem (runtime) // new
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- //@import com/ibm/rave/render/internal/nodes/LinearGradientSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/RadialGradientSceneItem (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/StopSceneItem (runtime) // new
- var com_ibm_rave_render_internal_SceneItemFactory = com_ibm_rave_core_nativeImpl_Declare({
- _$functionClassMethod : function() {
- var _$self = function(nsuri, name, parentContext) {
- if ("rect" == name) {
- return new com_ibm_rave_render_internal_nodes_RectSceneItem(nsuri, parentContext);
- } else if ("circle" == name) {
- return new com_ibm_rave_render_internal_nodes_CircleSceneItem(nsuri, parentContext);
- } else if ("line" == name) {
- return new com_ibm_rave_render_internal_nodes_LineSceneItem(nsuri, parentContext);
- } else if ("text" == name) {
- return new com_ibm_rave_render_internal_nodes_TextSceneItem(nsuri, parentContext);
- } else if ("g" == name) {
- return new com_ibm_rave_render_internal_nodes_GroupSceneItem(nsuri, parentContext);
- } else if ("path" == name) {
- return new com_ibm_rave_render_internal_nodes_PathSceneItem(nsuri, parentContext);
- } else if ("polygon" == name) {
- return new com_ibm_rave_render_internal_nodes_PolygonSceneItem(nsuri, parentContext);
- } else if ("polyline" == name) {
- return new com_ibm_rave_render_internal_nodes_PolylineSceneItem(nsuri, parentContext);
- } else if ("defs" == name) {
- return new com_ibm_rave_render_internal_DefsSceneItem(nsuri, parentContext);
- } else if (com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT == name) {
- return new com_ibm_rave_render_internal_nodes_LinearGradientSceneItem(nsuri, parentContext);
- } else if (com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT == name) {
- return new com_ibm_rave_render_internal_nodes_RadialGradientSceneItem(nsuri, parentContext);
- } else if ("stop" == name) {
- return new com_ibm_rave_render_internal_nodes_StopSceneItem(nsuri, parentContext);
- }
- return null;
- };
- return _$self;
- }
- });
- // $source: com/ibm/rave/core/scene/SceneNode
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
- /**
- * The base type for all nodes.
- */
- var com_ibm_rave_core_scene_SceneNode = rave_externs["SceneNode"] = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Get the parent of this node.
- * @return (com.ibm.rave.core.scene.SceneNode) the parent of this node, or <code>null</code> if this node has no parent.
- */
- /** @expose */
- rave_getParentNode : function() {
- return this.rave_getParentNode.call(this);
- },
- /**
- * 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.
- * @return (com.ibm.rave.core.scene.SceneNode) the owner node
- */
- /** @expose */
- rave_getOwner : function() {},
- /**
- * Set the node's owner node.
- * @param (com.ibm.rave.core.scene.SceneNode) owner the owner node
- * @see #this.getOwner()
- */
- /** @expose */
- rave_setOwner : function(owner) {},
- /**
- * Set this node's parent. Clients should not call this method directly.
- * @param (com.ibm.rave.core.scene.SceneNode) parent the parent node, may be <code>null</code>
- */
- /** @expose */
- rave_setParentNode : function(parent) {},
- /**
- * Appends the given node to the end of the children.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to append
- */
- /** @expose */
- rave_appendChild : function(node) {
- this.appendChild.call(this, node);
- },
- /**
- * Does this node have children.
- * @return (boolean) <code>true</code> if this node has children, <code>false</code> otherwise
- */
- /** @expose */
- rave_hasChildNodes : function() {
- return this.rave_hasChildNodes.call(this);
- },
- /**
- * Get the children of this node.
- * @return (Array) a list of child nodes
- */
- /** @expose */
- rave_getChildNodes : function() {
- return this.rave_getChildNodes.call(this);
- },
- /**
- * Get this node's next sibling.
- * @return (com.ibm.rave.core.scene.SceneNode) The next sibling node, or <code>null</code> if the parent contains no more nodes.
- */
- /** @expose */
- rave_getNextSibling : function() {
- return this.rave_getNextSibling.call(this);
- },
- /**
- * Get this node's first child.
- * @return (com.ibm.rave.core.scene.SceneNode) The first child node, or <code>null</code> if this node has no children.
- */
- /** @expose */
- rave_getFirstChild : function() {
- return this.rave_getFirstChild.call(this);
- },
- /**
- * Get this node's previous sibling.
- * @return (com.ibm.rave.core.scene.SceneNode) The previous sibling node, or <code>null</code> if the parent contains no more nodes.
- */
- /** @expose */
- rave_getPreviousSibling : function() {
- return this.rave_getPreviousSibling.call(this);
- },
- /**
- * Insert the given node before the other specified node.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to insert
- * @param (com.ibm.rave.core.scene.SceneNode) before the node to insert before
- */
- /** @expose */
- rave_insertBefore : function(node, before) {
- this.insertBefore.call(this, node, before);
- },
- /**
- * Set the text content.
- * @param (String) text the text content
- */
- /** @expose */
- rave_setText : function(text) {
- this.rave_setText.call(this, text);
- },
- /**
- * Removes the node from the list of children.
- * @param (com.ibm.rave.core.scene.SceneNode) node the node to remove
- * @return (boolean) <code>true</code> if the node was a child node and removed, <code>false</code> otherwise
- */
- /** @expose */
- removeChild : function(node) {
- return this.removeChild.call(this, node);
- },
- /**
- * Set the style for the given name.
- * @param (String) styleName the style name
- * @param (Object) value the style value
- * @param (String) priority the style priority (ie, "important")
- */
- /** @expose */
- rave_setStyle : function(styleName, value, priority) {
- this.rave_setStyle.call(this, styleName, value, priority);
- },
- /**
- * Dispatches an event on this node.
- * @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event the triggering event
- * @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
- */
- /** @expose */
- dispatchEvent : function(event) {},
- /**
- * Retrieve the event listener for the given event type.
- * @param (String) eventType the event type
- * @return (com.ibm.rave.core.event.EventListener) the event listener, may be <code>null</code>
- */
- /** @expose */
- rave_getEventListener : function(eventType) {},
- /**
- * Removes all event listeners for the given qualifier.
- * @param (String) group a qualifier to the event type for grouping like events
- */
- /** @expose */
- rave_removeEventListeners : function(group) {},
- /**
- * Get the attribute value for the given attribute name.
- * @param (String) attribute the attribute name
- * @return (Object) the attribute value
- */
- /** @expose */
- getAttribute : function(attribute) {},
- /**
- * Get the attribute value for the given attribute name.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- * @return (Object) the attribute value
- */
- /** @expose */
- getAttributeNS : function(namespace, attribute) {},
- /**
- * Set the attribute value for the given attribute.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- * @param (Object) value the attribute value
- */
- /** @expose */
- setAttributeNS : function(namespace, attribute, value) {},
- /**
- * Remove the attribute for the given attribute name.
- * @param (String) attribute the attribute name
- */
- /** @expose */
- removeAttribute : function(attribute) {},
- /**
- * Remove the attribute for the given attribute name.
- * @param (String) namespace the namespace
- * @param (String) attribute the attribute name
- */
- /** @expose */
- removeAttributeNS : function(namespace, attribute) {},
- /**
- * Get the style for the given name.
- * @param (String) styleName the style name
- * @return (Object) the style value
- */
- /** @expose */
- rave_getStyle : function(styleName) {},
- /**
- * Get the computed style for the given name.
- * @param (String) styleName the style name
- * @return (Object) the computed style value
- */
- /** @expose */
- rave_getComputedStyle : function(styleName) {},
- /**
- * Remove the style for the given name.
- * @param (String) styleName the style name
- */
- /** @expose */
- rave_removeStyle : function(styleName) {},
- /**
- * Get the text content.
- * @return (String) the text content
- */
- /** @expose */
- rave_getText : function() {},
- /**
- * Get the html content.
- * @return (String) the html content
- */
- /** @expose */
- rave_getHtml : function() {},
- /**
- * Set the html content.
- * @param (String) html the html content
- */
- /** @expose */
- rave_setHtml : function(html) {},
- /**
- * Query whether the CSS class is set on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class is set, <code>false</code> otherwise
- */
- /** @expose */
- rave_containsClass : function(className) {},
- /**
- * Set or unset the CSS class on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
- */
- /** @expose */
- rave_addClass : function(className) {},
- /**
- * Remove the CSS class on the node.
- * @param (String) className the class to query
- * @return (boolean) <code>true</code> if the class changed, <code>false</code> otherwise
- */
- /** @expose */
- rave_removeClass : function(className) {},
- /**
- * Get the data associated with this node.
- * @return (Object) the associated data
- */
- /** @expose */
- rave_getData : function() {
- return this.rave_getProperty("__data__");
- },
- /**
- * Set the data for this node.
- * @param (Object) value the data value
- */
- /** @expose */
- rave_setData : function(value) {
- this.rave_setProperty("__data__", value);
- },
- /**
- * Returns true if the data had been set on this element
- * @return (boolean) true if data has been set otherwise false
- */
- /** @expose */
- rave_hasData : function() {
- return this.rave_hasProperty("__data__");
- },
- /**
- * Store a value on this node for a given key.
- * @param (String) key the property key
- * @param (Object) value the property value
- */
- /** @expose */
- rave_setProperty : function(key, value) {
- this.rave_setProperty.call(this, key, value);
- },
- /**
- * Set the attribute value for the given attribute.
- * @param (String) key the attribute key
- * @param (Object) value the attribute value
- */
- /** @expose */
- setAttribute : function(key, value) {
- this.setAttribute.call(this, key, value);
- },
- /**
- * Get a stored value from this node for a given key.
- * @param (String) key the property key
- * @return (Object) the property value
- */
- /** @expose */
- rave_getProperty : function(key) {},
- /**
- * Returns true if this element has a property with the same name as the string passed in
- * @param (String) proName property name to check
- * @return (boolean) true if the property exist otherwise false
- */
- /** @expose */
- rave_hasProperty : function(proName) {},
- /**
- * Get the name of this node.
- * @return (String) the name of this node
- */
- /** @expose */
- rave_getName : function() {},
- /**
- * Get the namespace URI of this node.
- * @return (String) the namespace URI, may be <code>null</code>
- */
- /** @expose */
- rave_getNamespaceURI : function() {},
- /**
- * Get the qualified name of this node. The qualified name is a concatenation of the namespace URI and the name with a colon delimiter.
- * @return (String) the qualified name
- */
- /** @expose */
- rave_getQualifiedName : function() {},
- /**
- * 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.
- */
- /** @expose */
- getBoundingClientRect : function() {
- var onr = this.rave_getOwner().getBoundingClientRect();
- var bb = this.getBBox();
- 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);
- },
- /**
- * 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.
- * @return (com.ibm.rave.core.geom.RaveRect) Bounding box of this shape. Must never return null.
- */
- /** @expose */
- getBBox : function() {},
- /**
- * Returns the draw type of node as an int.
- * @return (int) The integer representation of the type of drawable shape of this node.
- */
- /** @expose */
- rave_getDrawType : function() {
- return 0;
- },
- /**
- * Returns the computed transform matrix of this node in screen coordinates.
- * @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.
- */
- /** @expose */
- getScreenCTM : function() {
- return this.getScreenCTM.call(this);
- },
- /**
- * Returns the computed transform matrix of this node in local coordinates.
- * @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.
- */
- /** @expose */
- getCTM : function() {
- return this.getCTM.call(this);
- },
- /**
- * Dispose of this node; allow any clean up to be performed.
- */
- /** @expose */
- rave_dispose : function() {},
- /** @expose */
- rave_intersection : function(x, y) {},
- /** @expose */
- rave_initExtensions : function() {},
- /** @expose */
- rave_addEventListener : function(a0, a1, a2, a3) {
- var args = arguments;
- if (args.length == 2) {
- return this.rave_addEventListener$1(a0, a1);
- }
- if (args.length == 3) {
- return this.rave_addEventListener$2(a0, a1, a2);
- }
- return this.rave_addEventListener$0(a0, a1, a2, a3);
- },
- /** @expose */
- rave_removeEventListener : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_removeEventListener$0(a0);
- }
- return this.rave_removeEventListener$1(a0, a1);
- },
- /** @expose */
- rave_intersects : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_intersects$1(a0);
- }
- return this.rave_intersects$0(a0, a1);
- },
- /** @expose */
- rave_intersectionList : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_intersectionList$1(a0);
- }
- return this.rave_intersectionList$0(a0, a1);
- }
- /**
- * Adds an event listener for the given qualifier and event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
- * @param (String) group a qualified to the event type for grouping like events
- */
- //rave_addEventListener$0 : function(eventType, listener, useCapture, group) {},
- /**
- * Adds an event listener for the given event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- */
- //rave_addEventListener$1 : function(eventType, listener) {},
- /**
- * Adds an event listener for the given event type.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.core.event.EventListener) listener the event listener
- * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients
- */
- //rave_addEventListener$2 : function(eventType, listener, useCapture) {},
- /**
- * Removes an event listener for the given type.
- * @param (String) eventType the event type
- */
- //rave_removeEventListener$0 : function(eventType) {},
- /**
- * Removes an event listener for the given qualifier and type.
- * @param (String) eventType the event type
- * @param (String) group a qualifier to the event type for grouping like events
- */
- //rave_removeEventListener$1 : function(eventType, group) {},
- //rave_intersects$0 : function(x, y) {},
- //rave_intersects$1 : function(rect) {},
- //rave_intersectionList$0 : function(x, y) {},
- //rave_intersectionList$1 : function(rect) {}
- });
- /** @expose */
- com_ibm_rave_core_scene_SceneNode.DATA_PROPERTY = "__data__";
- // $source: com/ibm/rave/core/geom/NodeRect
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * An implementation of a DOMRect-like interface. Typically the values in this are relative to the viewport.
- * @author jim
- */
- var com_ibm_rave_core_geom_NodeRect = rave_externs["NodeRect"] = com_ibm_rave_core_nativeImpl_Declare({
- /** @expose */
- left : 0,
- /** @expose */
- right : 0,
- /** @expose */
- top : 0,
- /** @expose */
- bottom : 0,
- /** @expose */
- width : 0,
- /** @expose */
- height : 0,
- /** @expose */
- constructor : function(left, right, bottom, top, width, height) {
- this.left = left;
- this.right = right;
- this.top = top;
- this.bottom = bottom;
- this.width = width;
- this.height = height;
- }
- });
- // $source: com/ibm/rave/render/internal/properties/DynamicAttributesCollection
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * 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.
- */
- var com_ibm_rave_render_internal_properties_DynamicAttributesCollection = com_ibm_rave_core_nativeImpl_Declare({
- //propNames : null,
- //propValues : null,
- //dynamicMap : null,
- getByIndex : function(i) {
- return this.propValues[i];
- },
- setPropertyValue : function(index, value) {
- this.propValues[index] = value;
- },
- get : function(attribute) {
- var i = this.findProperty(attribute);
- if (i >= this.propNames.length) {
- return this.dynamicMap ? this.dynamicMap[attribute] : null;
- }
- return this.propValues[i];
- },
- put : function(attribute, value) {
- var i = this.findProperty(attribute);
- if (i >= this.propNames.length) {
- if (!this.dynamicMap) {
- this.dynamicMap = {};
- }
- this.dynamicMap[attribute] = value;
- } else {
- this.setPropertyValue(i, value);
- }
- },
- findProperty : function(attribute) {
- var i = 0;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var e = __exp_enFor0[__i_enFor0];
- if (e == attribute) {
- break;
- }
- i++;
- }
- return i;
- },
- /**
- * returns how many attributes exist in this attribute collection
- * @return (int) Number of properties in this collection.
- */
- size : function() {
- return this.propNames.length + ((!this.dynamicMap) ? 0 : Object.keys(this.dynamicMap).size());
- },
- /**
- * 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
- * @param (String) propName property to check
- * @return (boolean) true if there is a property with the same name otherwise false
- */
- containsProperty : function(propName) {
- var props = this.propNames;
- for (var index = 0; index < props.length; ++index) {
- if (props[index] == propName) {
- return true;
- }
- }
- return this.dynamicMap ? this.dynamicMap.hasOwnProperty(propName) : false;
- }
- });
- // $source: com/ibm/rave/render/internal/properties/SceneNodeAttributes
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- /**
- * A list of public attribute properties for scene nodes. Typically only used by renderers for quick access to properties.
- */
- var com_ibm_rave_render_internal_properties_SceneNodeAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames;
- this.propValues = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", ""];
- }
- });
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x = 0;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y = 1;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.width = 2;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.height = 3;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x1 = 4;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.x2 = 5;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.r = 6;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y1 = 7;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.y2 = 8;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.cx = 9;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.cy = 10;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.class_attr = 11;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.text = 12;
- com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames = ["x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "class", "text"];
- // $source: com/ibm/rave/render/internal/properties/SceneNodeStyles
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- /**
- * 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").
- */
- var com_ibm_rave_render_internal_properties_SceneNodeStyles = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames;
- 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];
- }
- });
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fill = 0;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke = 1;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.opacity = 2;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_width = 3;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_opacity = 4;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.fill_opacity = 5;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.display = 6;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_family = 7;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_size = 8;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_style = 9;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_weight = 10;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.font_variant = 11;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dasharray = 12;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dashoffset = 13;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linecap = 14;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linejoin = 15;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_miterlimit = 16;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.text_anchor = 17;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.text_decoration = 18;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.visibility = 19;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_color = 20;
- com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_opacity = 21;
- 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"];
- // $source: com/ibm/rave/render/internal/nodes/AttributesListener
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A class responsible for handling attribute changes on scene nodes. Listens for changes to specific attributes and performs modifications to the scene node.
- */
- var com_ibm_rave_render_internal_nodes_AttributesListener = com_ibm_rave_core_nativeImpl_Declare({
- //handlers : null,
- constructor : function() {
- this.handlers = {};
- },
- beforeUpdate : function(type, subType, key, value, node) {},
- afterUpdate : function(type, subType, key, value, node) {
- if (key != null) {
- var handler = this.handlers[key];
- if (handler) {
- handler.handle(value, node);
- }
- }
- }
- //constructor : function() {}
- });
- // $source: com/ibm/rave/render/internal/nodes/listeners/IdAttributeHandler
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * An AttributeHandler that gets called on changes to "id" attributes.
- */
- var com_ibm_rave_render_internal_nodes_listeners_IdAttributeHandler = com_ibm_rave_core_nativeImpl_Declare({
- handle : function(value, node) {
- node.setId(value != null ? ""+(value) : null);
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/listeners/TransformAttributeHandler
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/TransformParser (runtime) // parse
- /**
- * A handler that listens for "transform" changes to a scene node. Parses the style and updates the matrix on the node.
- */
- var com_ibm_rave_render_internal_nodes_listeners_TransformAttributeHandler = com_ibm_rave_core_nativeImpl_Declare({
- handle : function(value, node) {
- node.transformMatrix = value == null ? null : com_ibm_rave_render_internal_css_TransformParser.parse(""+(value));
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/AbstractSceneNode
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/scene/SceneNode (loadtime) // superclass
- //@import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime) // new
- //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime) // new
- //@import com/ibm/rave/core/internal/util/CollectionsUtil (runtime) // remove
- //@import com/ibm/rave/core/geom/RectStruct (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/AttributesListener (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/listeners/IdAttributeHandler (static) // new
- //@import com/ibm/rave/render/internal/nodes/listeners/TransformAttributeHandler (static) // new
- //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds, identity
- /**
- * A base type for scene nodes.
- */
- var com_ibm_rave_render_internal_nodes_AbstractSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scene_SceneNode, {
- //parent : null,
- //owner : null,
- //children : null,
- //namespaceURI : null,
- //attributes : null,
- //styles : null,
- //propertyBag : null,
- //classSet : null,
- //eventListeners : null,
- //listenersByGroup : null,
- //listenersByType : null,
- //renderer : null,
- //qname : null,
- //id : null,
- /**
- * Root node cache. Note that this may be different from the owner - it's the root abstract node of this node.
- */
- //root : null,
- /**
- * Combined transform of all transforms applied to this scene node.
- */
- //transformMatrix : null,
- constructor : function(nsuri, context) {
- this.attributes = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
- this.styles = new com_ibm_rave_render_internal_properties_SceneNodeStyles();
- {
- this.rave_initExtensions();
- this.namespaceURI = nsuri;
- if (context) {
- this.renderer = (context).renderer;
- }
- }
- },
- /**
- * Return this node's 'id' attribute. Must return the same value as getAttribute('id');
- * @return (String) String representation of this node's ID value.
- */
- getId : function() {
- return this.id;
- },
- /**
- * Sets this node's "id" attribute.
- * @param (String) id Unique identifier for this node.
- */
- setId : function(id) {
- this.id = id;
- this.attributes.put("id", id);
- },
- /** @expose */
- rave_hasProperty : function(propName) {
- return this.propertyBag ? this.propertyBag.containsProperty(propName) : false;
- },
- /**
- * Create an instance of our children list using a synchronized backing.
- */
- createChildren : function() {
- this.children = ([]);
- },
- /** @expose */
- rave_getEventListener : function(eventType) {
- var info = this.eventListeners ? this.eventListeners[eventType] : null;
- return info ? info.listener : null;
- },
- rave_addEventListener$1 : function(eventType, listener) {
- this.rave_addEventListener$0(eventType, listener, false, null);
- },
- rave_addEventListener$2 : function(eventType, listener, useCapture) {
- this.rave_addEventListener$0(eventType, listener, useCapture, null);
- },
- rave_addEventListener$0 : function(eventType, listener, useCapture, group) {
- var id = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
- if (!this.eventListeners) {
- this.eventListeners = {};
- this.listenersByGroup = {};
- this.listenersByType = {};
- } else if (this.eventListeners.hasOwnProperty(id)) {
- this.rave_removeEventListener$1(eventType, group);
- }
- var info = new com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo(id, eventType, listener, useCapture);
- this.eventListeners[id] = info;
- var groupList = this.listenersByGroup[group];
- if (!groupList) {
- groupList = [];
- this.listenersByGroup[group] = groupList;
- }
- groupList.push(info);
- var typeList = this.listenersByType[eventType];
- if (!typeList) {
- typeList = [];
- this.listenersByType[eventType] = typeList;
- if (this.renderer) {
- this.renderer.registerEvent(eventType, this);
- }
- }
- typeList.push(info);
- },
- rave_removeEventListener$0 : function(eventType) {
- if (this.eventListeners) {
- this.rave_removeEventListener$1(eventType, null);
- }
- },
- rave_removeEventListener$1 : function(eventType, group) {
- if (this.eventListeners) {
- var id = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group);
- var info = this.eventListeners[id];
- if (info) {
- delete this.eventListeners[id];
- info.isRemoved = true;
- var byGroupList = this.listenersByGroup[group];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byGroupList, info) && byGroupList.length == 0) {
- delete this.listenersByGroup[group];
- }
- var byTypeList = this.listenersByType[eventType];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info) && byTypeList.length == 0) {
- delete this.listenersByType[eventType];
- if (this.renderer) {
- this.renderer.unregisterEvent(eventType, this);
- }
- }
- }
- }
- },
- /** @expose */
- rave_removeEventListeners : function(group) {
- if (this.listenersByGroup) {
- var list = this.listenersByGroup[group];
- if (list) {
- for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var info = __exp_enFor0[__i_enFor0];
- delete this.eventListeners[info.id];
- info.isRemoved = true;
- var byTypeList = this.listenersByType[info.type];
- if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info)) {
- if (byTypeList.length == 0) {
- delete this.listenersByType[info.type];
- if (this.renderer) {
- this.renderer.unregisterEvent(info.type, this);
- }
- }
- }
- }
- delete this.listenersByGroup[group];
- }
- }
- },
- /** @expose */
- dispatchEvent : function(event) {
- if (!event) {
- throw new Error("Null event");
- }
- if (event.type == null || event.type.length == 0) {
- throw new Error("Uninitialized event");
- }
- var targetList = [];
- event.target = this;
- var targetParent = this.rave_getParentNode();
- while (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(targetParent, com_ibm_rave_render_internal_nodes_AbstractSceneNode)) {
- targetList.push(targetParent);
- targetParent = targetParent.rave_getParentNode();
- }
- event.eventPhase = 1;
- if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, true, false)) {
- event.eventPhase = 2;
- if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, this, false, true)) {
- if (event.bubbles && !event.propagationStopped) {
- event.eventPhase = 3;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, false, false);
- }
- }
- }
- event.currentTarget = null;
- event.eventPhase = 0;
- return event.defaultPrevented;
- },
- /** @expose */
- getAttribute : function(attribute) {
- return attribute == null ? null : this.attributes.get(attribute);
- },
- setRenderer : function(renderer) {
- this.renderer = renderer;
- if (this.children) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.children, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- (child).setRenderer(renderer);
- }
- }
- },
- /**
- * Notify listeners of a 'type' notification change on this node. Happens after the change has been made.
- * @param (int) type The SceneItemModificationType to notify listeners about.
- * @param (int) subType Optional SceneItemModificationType to notify listeners about.
- * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
- * @param (Object) value The value that the key is being updated to.
- */
- notifyAfterUpdate : function(type, subType, key, value) {
- if (!com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners) {
- return;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var listener = __exp_enFor0[__i_enFor0];
- listener.afterUpdate(type, subType, key, value, this);
- }
- },
- /**
- * Notify listeners of a 'type' notification change on this node. Happens before the change has been made.
- * @param (int) type The SceneItemModificationType to notify listeners about.
- * @param (int) subType Optional SceneItemModificationType to notify listeners about.
- * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name.
- * @param (Object) value The value that the key is being updated to.
- */
- notifyBeforeUpdate : function(type, subType, key, value) {
- if (!com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners) {
- return;
- }
- for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var listener = __exp_enFor0[__i_enFor0];
- listener.beforeUpdate(type, subType, key, value, this);
- }
- },
- /** @expose */
- rave_getStyle : function(attribute) {
- return this.styles.get(attribute);
- },
- /** @expose */
- rave_getComputedStyle : function(attribute) {
- return this.rave_getStyle(attribute);
- },
- /** @expose */
- rave_getText : function() {
- return this.attributes.get("text");
- },
- /** @expose */
- rave_getHtml : function() {
- return this.attributes.get("html");
- },
- /** @expose */
- rave_setHtml : function(html) {
- this.notifyBeforeUpdate(1000, 2003, "html", this.rave_getHtml());
- this.attributes.put("html", html);
- this.notifyAfterUpdate(1000, 2003, "html", html);
- },
- /** @expose */
- rave_addClass : function(className) {
- var added = true;
- if (!this.classSet) {
- this.classSet = {};
- } else {
- added = !(this.classSet.hasOwnProperty(className));
- }
- if (added) {
- this.notifyBeforeUpdate(1000, 2001, "class", null);
- this.classSet[className] = 1;
- this.notifyAfterUpdate(1000, 2001, "class", className);
- }
- return added;
- },
- /** @expose */
- rave_removeClass : function(className) {
- var wasRemoved = this.classSet && this.classSet.hasOwnProperty(className);
- if (wasRemoved) {
- this.notifyBeforeUpdate(1000, 2001, "class", className);
- delete this.classSet[className];
- this.notifyAfterUpdate(1000, 2001, "class", null);
- }
- return wasRemoved;
- },
- /** @expose */
- rave_containsClass : function(className) {
- return this.classSet ? this.classSet.hasOwnProperty(className) : false;
- },
- /** @expose */
- rave_getNamespaceURI : function() {
- return this.namespaceURI;
- },
- /** @expose */
- rave_getQualifiedName : function() {
- if (this.qname == null) {
- this.qname = this.namespaceURI + ":" + this.rave_getName();
- }
- return this.qname;
- },
- /** @expose */
- getAttributeNS : function(namespace, attribute) {
- return null;
- },
- /** @expose */
- setAttributeNS : function(namespace, attribute, value) {},
- /** @expose */
- removeAttribute : function(attribute) {
- this.notifyAfterUpdate(1000, 2000, attribute, this.getAttribute(attribute));
- this.attributes.put(attribute, null);
- this.notifyAfterUpdate(1000, 2000, attribute, null);
- },
- /** @expose */
- removeAttributeNS : function(namespace, attribute) {},
- /** @expose */
- rave_removeStyle : function(styleName) {
- this.styles.put(styleName, null);
- },
- /** @expose */
- rave_getProperty : function(key) {
- return this.getPropertyBag().get(key);
- },
- /**
- * @return (Object) Set of class names on this node.
- */
- getClassSet : function() {
- if (!this.classSet) {
- this.classSet = {};
- }
- return this.classSet;
- },
- getPropertyBag : function() {
- if (!this.propertyBag) {
- this.propertyBag = new com_ibm_rave_render_internal_properties_SceneNodeAttributes();
- }
- return this.propertyBag;
- },
- /** @expose */
- rave_setParentNode : function(parent) {
- var rendererSet = false;
- if (!this.renderer && parent) {
- var r = (parent).renderer;
- if (r) {
- this.setRenderer(r);
- rendererSet = true;
- }
- }
- if (this.renderer) {
- if ((!this.parent && parent) || rendererSet) {
- this.recursiveRegisterEventListeners();
- } else if (this.parent && !parent) {
- this.recursiveUnregisterEventListeners();
- }
- if (!parent) {
- this.setRenderer(null);
- }
- }
- this.parent = parent;
- this.root = null;
- },
- /** @expose */
- rave_getOwner : function() {
- if (this.owner) {
- return this.owner;
- }
- var p = this.rave_getParentNode();
- return !p ? null : p.rave_getOwner();
- },
- /** @expose */
- rave_setOwner : function(owner) {
- this.owner = owner;
- },
- recursiveRegisterEventListeners : function() {
- if (this.eventListeners) {
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var type = __exp_enFor0[__i_enFor0];
- this.renderer.registerEvent(type, this);
- }
- }
- if (this.children) {
- for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var child = __exp_enFor1[__i_enFor1];
- (child).recursiveRegisterEventListeners();
- }
- }
- },
- recursiveUnregisterEventListeners : function() {
- if (this.eventListeners) {
- for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var type = __exp_enFor0[__i_enFor0];
- this.renderer.unregisterEvent(type, this);
- }
- }
- if (this.children) {
- for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length;
- __i_enFor1 < __len_enFor1; ++__i_enFor1) {
- var child = __exp_enFor1[__i_enFor1];
- (child).recursiveUnregisterEventListeners();
- }
- }
- },
- /**
- * Removes the child from this parent but does not update the parent node of the child.
- * @param (com.ibm.rave.core.scene.SceneNode) child
- */
- internalRemoveChild : function(child) {
- var p = child.rave_getParentNode();
- if (p == this) {
- var idx = this.children.indexOf(child);
- if (idx >= 0) {
- this.children.splice(idx, 1);
- }
- }
- },
- /**
- * Helper method to append a child item.
- * @param (com.ibm.rave.core.scene.SceneNode) item the child item to append
- * @return (int) the index of the appended item
- */
- internalAppendChild : function(item) {
- if (!this.children) {
- this.createChildren();
- }
- this.internalRemoveChild(item);
- this.children.push(item);
- item.rave_setParentNode(this);
- return this.children.length - 1;
- },
- /**
- * 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.
- * @param (com.ibm.rave.core.scene.SceneNode) item the item to insert
- * @param (com.ibm.rave.core.scene.SceneNode) before the item to insert before
- * @return (int) the index of the inserted item.
- */
- insertChildBefore : function(item, before) {
- if (!this.children) {
- this.createChildren();
- }
- if (before && before.rave_getParentNode() == this) {
- var bidx = this.children.indexOf(before);
- if (item == before) {
- return bidx;
- }
- this.internalRemoveChild(item);
- item.rave_setParentNode(this);
- this.children.splice(bidx, 0, item);
- return bidx;
- }
- this.children.push(item);
- item.rave_setParentNode(this);
- return this.children.length - 1;
- },
- /**
- * 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.
- * @param (int) offset Integer index offset.
- * @return (com.ibm.rave.core.scene.SceneNode) This item's sibling at the specified index offset.
- */
- getSibling : function(offset) {
- var sibling;
- if (this.parent) {
- var c = this.parent.rave_getChildNodes();
- var idx = c.indexOf(this);
- var idxOffset = idx + offset;
- if (idx > -1 && (idxOffset >= 0 && idxOffset < c.length)) {
- sibling = c[idxOffset];
- }
- }
- return sibling;
- },
- rave_intersects$0 : function(x, y) {
- return this.rave_intersects$1(new com_ibm_rave_core_geom_RectStruct(x, y, 0, 0));
- },
- rave_intersects$1 : function(rect) {
- var r = this.getBBox();
- 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;
- },
- rave_intersectionList$0 : function(x, y) {
- return this.rave_intersectionList$1(new com_ibm_rave_core_geom_RectStruct(x, y, 1, 1));
- },
- rave_intersectionList$1 : function(rect) {
- var result = [];
- if (this.rave_hasChildNodes()) {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(result, this, rect);
- }
- return result;
- },
- /** @expose */
- rave_intersection : function(x, y) {
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(null, this, new com_ibm_rave_core_geom_RectStruct(x, y, 0, 0));
- },
- /** @expose */
- rave_initExtensions : function() {
- this.rave_setProperty = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT;
- this.appendChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT;
- this.rave_getParentNode = com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT;
- this.insertBefore = com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT;
- this.rave_getNextSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT;
- this.rave_getPreviousSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT;
- this.rave_getFirstChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD;
- this.rave_hasChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT;
- this.rave_getChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT;
- this.removeChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT;
- this.rave_setStyle = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT;
- this.setAttribute = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT;
- this.rave_setText = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT;
- this.getCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT;
- this.getScreenCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT;
- },
- /**
- * Return the index of this node relative to its siblings.
- * @return (int) The index of this node relative to its siblings.
- */
- getSiblingIndex : function() {
- return this.parent.rave_getChildNodes().indexOf(this);
- },
- /**
- * 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.
- * @return (com.ibm.rave.render.internal.nodes.AbstractSceneNode) The root node of this node.
- */
- getRoot : function() {
- if (!this.root) {
- var parentNode = this;
- while (parentNode) {
- this.root = parentNode;
- parentNode = parentNode.rave_getParentNode();
- }
- }
- return this.root;
- },
- /**
- * 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.
- * @return (boolean) <code>true</code> if this is a drawable node, <code>false</code> otherwise.
- */
- isDrawable : function() {
- return true;
- },
- getTransforms : function() {
- return this.transformMatrix;
- },
- /** @expose */
- rave_addEventListener : function(a0, a1, a2, a3) {
- var args = arguments;
- if (args.length == 2) {
- return this.rave_addEventListener$1(a0, a1);
- }
- if (args.length == 3) {
- return this.rave_addEventListener$2(a0, a1, a2);
- }
- return this.rave_addEventListener$0(a0, a1, a2, a3);
- },
- /** @expose */
- rave_removeEventListener : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_removeEventListener$0(a0);
- }
- return this.rave_removeEventListener$1(a0, a1);
- },
- /** @expose */
- rave_intersects : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_intersects$1(a0);
- }
- return this.rave_intersects$0(a0, a1);
- },
- /** @expose */
- rave_intersectionList : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_intersectionList$1(a0);
- }
- return this.rave_intersectionList$0(a0, a1);
- }
- });
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.initListeners = function() {
- var listeners = [];
- var listener = new com_ibm_rave_render_internal_nodes_AttributesListener();
- listener.handlers["id"] = new com_ibm_rave_render_internal_nodes_listeners_IdAttributeHandler();
- listener.handlers["transform"] = new com_ibm_rave_render_internal_nodes_listeners_TransformAttributeHandler();
- listeners.push(listener);
- return listeners;
- };
- /**
- * Add a new update listener to this node. Will receive notifications on any changes.
- */
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener = function(listener) {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners.push(listener);
- };
- /**
- * Remove an update listener from this node. This is used by Swift code to remove a 'parent' listener that causes a circular reference.
- * @param (com.ibm.rave.render.internal.query.SceneNodeNotificationListener) listener listener to be removed
- */
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.removeNotificationListener = function(listener) {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners.remove(listener);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId = function(eventType, group) {
- return eventType + (group != null ? "." + group : "");
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets = function(event, targetList, capturing, atTargetPhase) {
- var start = 0, inc = 1, end = targetList.length;
- if (capturing) {
- start = targetList.length - 1;
- inc = end = -1;
- }
- for (var i = start; i != end && !event.propagationStopped && !event.immediatePropagationStopped; i += inc) {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, targetList[i], capturing, atTargetPhase);
- }
- return !event.propagationStopped;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget = function(event, currentTarget, capturing, atTargetPhase) {
- if (currentTarget.listenersByType) {
- var list = currentTarget.listenersByType[event.type];
- if (list) {
- list = list.slice();
- var currentListener = list.length;
- while (--currentListener >= 0) {
- var info = list[currentListener];
- if (!info.isRemoved && (atTargetPhase || info.capture == capturing)) {
- event.currentTarget = currentTarget;
- info.listener.call(currentTarget, event);
- }
- }
- }
- }
- return !event.propagationStopped;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM = function(context, matchOwner) {
- var ctm = com_ibm_rave_core_transform_MatrixUtil.identity();
- var abstractContext = context;
- if (abstractContext.transformMatrix) {
- ctm = abstractContext.transformMatrix;
- }
- for (var current = context.rave_getParentNode(); current; current = current.rave_getParentNode()) {
- if (matchOwner && context.rave_getOwner() == current) {
- break;
- }
- ctm = ctm.multiply(current.getCTM());
- }
- return ctm;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection = function(list, node, r) {
- if (node.rave_hasChildNodes()) {
- var childNodes = node.rave_getChildNodes();
- for (var i = childNodes.length - 1; i >= 0; --i) {
- var child = childNodes[i];
- var ctm = child.getCTM();
- var hit = com_ibm_rave_render_internal_nodes_AbstractSceneNode.hitDetection(list, child, ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(r, ctm.inverse()) : r);
- if (hit) {
- return hit;
- }
- }
- }
- if (node.rave_intersects$1(r)) {
- if (list) {
- list.push(node);
- } else {
- return node;
- }
- }
- return null;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo = function(id, type, listener, capture) {
- this.id = id;
- this.type = type;
- this.listener = listener;
- this.capture = capture;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT = function(key, value) {
- (this).getPropertyBag().put(key, value);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT = function(node) {
- (node).notifyBeforeUpdate(1001, 3000, null, null);
- (this).internalAppendChild(node);
- (node).notifyAfterUpdate(1001, 3000, null, null);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT = function(node, before) {
- (node).notifyBeforeUpdate(1001, 3000, null, null);
- (this).insertChildBefore(node, before);
- (this).notifyAfterUpdate(1001, 3000, null, null);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT = function() {
- return (this).getSibling(1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT = function() {
- return (this).getSibling(-1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD = function() {
- var asc = this;
- if (asc.children && asc.children.length > 0) {
- return asc.children[0];
- }
- return asc.getSibling(1);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT = function() {
- var asc = this;
- return asc.children && asc.children.length > 0;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT = function() {
- var asc = this;
- if (!asc.children) {
- asc.createChildren();
- }
- return asc.children;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT = function(node) {
- (node).notifyBeforeUpdate(1002, 3000, null, null);
- var asc = this;
- var p = node.rave_getParentNode();
- var removed = false;
- if (p == this) {
- var idx = asc.children.indexOf(node);
- if (idx >= 0) {
- asc.children.splice(idx, 1);
- node.rave_setParentNode(null);
- removed = true;
- }
- } else if (p) {
- removed = p.removeChild(node);
- }
- (node).root = null;
- (node).notifyAfterUpdate(1002, 3000, null, null);
- return removed;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT = function() {
- return (this).parent;
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT = function(text) {
- (this).notifyBeforeUpdate(1000, 2004, "text", this.rave_getText());
- (this).attributes.put("text", text);
- (this).notifyAfterUpdate(1000, 2004, "text", text);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT = function(key, value) {
- if (key != null) {
- var k = key.toLowerCase();
- (this).notifyBeforeUpdate(1000, 2000, k, this.getAttribute(key));
- (this).attributes.put(k, value);
- (this).notifyAfterUpdate(1000, 2000, k, value);
- }
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT = function(styleName, value, priority) {
- (this).notifyBeforeUpdate(1000, 2002, styleName, this.rave_getStyle(styleName));
- (this).styles.put(styleName, value);
- (this).notifyAfterUpdate(1000, 2002, styleName, value);
- };
- /**
- * List of listeners for updates on this scene node.
- */
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.updateListeners = com_ibm_rave_render_internal_nodes_AbstractSceneNode.initListeners();
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT = function() {
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM(this, false);
- };
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT = function() {
- return com_ibm_rave_render_internal_nodes_AbstractSceneNode.computeCTM(this, true);
- };
- // $source: com/ibm/rave/render/internal/nodes/RectSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * An AWT Rectangle shape as a SceneNode.
- * @author sproulja
- */
- var com_ibm_rave_render_internal_nodes_RectSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBBox : function() {
- var x = + (this.attributes.get("x"));
- var y = + (this.attributes.get("y"));
- var width = + (this.attributes.get("width"));
- var height = + (this.attributes.get("height"));
- return new com_ibm_rave_core_geom_RaveRect(x, y, width, height);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1000;
- },
- /** @expose */
- rave_getName : function() {
- return "rect";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/css/TransformParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/CSSParser (runtime) // parseStyle
- //@import com/ibm/rave/core/transform/MatrixUtil (static) // create, identity
- //@import com/ibm/rave/render/internal/css/om/CSSTransformValue (runtime) // determineType
- /**
- * Responsible for taking a list of CSS transform declarations and converting them into a single multiplied matrix.
- */
- var com_ibm_rave_render_internal_css_TransformParser = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * Parse a transform string and return a multiplied matrix containing all values.
- * @param (String) style CSS transform style string.
- * @return (com.ibm.rave.core.transform.Matrix) Matrix combining all styles. Will return null if parsing returns no transforms.
- */
- com_ibm_rave_render_internal_css_TransformParser.parse = function(style) {
- var matrix;
- var declaration = com_ibm_rave_render_internal_css_CSSParser.parseStyle("transform", style);
- if (declaration) {
- declaration.each(function(name, value, i) {
- var valueList = value;
- if (valueList) {
- valueList.each(function(name, value, index) {
- var transformValue = value;
- var newMatrix = com_ibm_rave_render_internal_css_TransformParser.create(name, transformValue);
- if (matrix) {
- newMatrix = matrix.multiply(newMatrix);
- }
- matrix = newMatrix;
- });
- }
- });
- }
- return matrix;
- };
- com_ibm_rave_render_internal_css_TransformParser.create = function(operator, transformValue) {
- var result = com_ibm_rave_core_transform_MatrixUtil.identity();
- var values = [];
- transformValue.each(function(name, value, index) {
- values.push(value);
- });
- if (values.length > 0) {
- var firstValue = com_ibm_rave_render_internal_css_TransformParser.convert(values, 0);
- var type = com_ibm_rave_render_internal_css_om_CSSTransformValue.determineType(operator);
- switch (type) {
- case 5:
- if (values.length == 1) {
- result = result.scale(firstValue);
- } else if (values.length == 2) {
- result = result.scaleNonUniform(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
- }
- break;
- case 6:
- result = result.scaleNonUniform(firstValue, 1);
- break;
- case 7:
- result = result.scaleNonUniform(1, firstValue);
- break;
- case 4:
- if (values.length > 2) {
- result = result.rotate(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1), com_ibm_rave_render_internal_css_TransformParser.convert(values, 2));
- } else if (values.length == 1) {
- result = result.rotate(firstValue);
- }
- break;
- case 8:
- if (values.length > 1) {
- result = result.skewX(firstValue).skewY(com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
- }
- break;
- case 9:
- result = result.skewX(firstValue);
- break;
- case 10:
- result = result.skewY(firstValue);
- break;
- case 1:
- if (values.length > 1) {
- result = result.translate(firstValue, com_ibm_rave_render_internal_css_TransformParser.convert(values, 1));
- break;
- }
- case 2:
- result = result.translate(firstValue, 0);
- break;
- case 3:
- result = result.translate(0, firstValue);
- break;
- case 11:
- if (values.length == 6) {
- 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));
- }
- break;
- default:
- break;
- }
- }
- return result;
- };
- com_ibm_rave_render_internal_css_TransformParser.convert = function(values, index) {
- return + (values[index].value);
- };
- // $source: com/ibm/rave/render/internal/css/rules/CSSRule
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- var com_ibm_rave_render_internal_css_rules_CSSRule = com_ibm_rave_core_nativeImpl_Declare({
- //cssText : null,
- //parentRule : null,
- //parentStyleSheet : null,
- __starts : 0,
- __ends : 0
- //getType : function() {}
- });
- com_ibm_rave_render_internal_css_rules_CSSRule.UNKNOWN_RULE = 0;
- com_ibm_rave_render_internal_css_rules_CSSRule.STYLE_RULE = 1;
- com_ibm_rave_render_internal_css_rules_CSSRule.CHARSET_RULE = 2;
- com_ibm_rave_render_internal_css_rules_CSSRule.IMPORT_RULE = 3;
- com_ibm_rave_render_internal_css_rules_CSSRule.MEDIA_RULE = 4;
- com_ibm_rave_render_internal_css_rules_CSSRule.FONT_FACE_RULE = 5;
- com_ibm_rave_render_internal_css_rules_CSSRule.PAGE_RULE = 6;
- com_ibm_rave_render_internal_css_rules_CSSRule.KEYFRAMES_RULE = 7;
- com_ibm_rave_render_internal_css_rules_CSSRule.KEYFRAME_RULE = 8;
- com_ibm_rave_render_internal_css_rules_CSSRule.SUPPORTS_RULE = 12;
- com_ibm_rave_render_internal_css_rules_CSSRule.VIEWPORT_RULE = 15;
- com_ibm_rave_render_internal_css_rules_CSSRule.WEBKIT_FILTER_RULE = 17;
- com_ibm_rave_render_internal_css_rules_CSSRule.DOCUMENT_RULE = 20;
- com_ibm_rave_render_internal_css_rules_CSSRule.STYLESHEET_RULE = 21;
- // $source: com/ibm/rave/render/internal/css/rules/CSSRuleList
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/rules/CSSRule (loadtime) // superclass
- /**
- * An abstract CSSRule that contains a list of rules.
- */
- var com_ibm_rave_render_internal_css_rules_CSSRuleList = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRule, {
- /**
- * Public list of rules.
- */
- //cssRules : null,
- constructor : function() {
- this.cssRules = [];
- }
- });
- // $source: com/ibm/rave/render/internal/css/om/CSSStyleSheet
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/rules/CSSRuleList (loadtime) // superclass
- /**
- * A model representing a CSS style sheet.
- */
- var com_ibm_rave_render_internal_css_om_CSSStyleSheet = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRuleList, {
- getType : function() {
- return 21;
- }
- });
- // $source: com/ibm/rave/render/internal/css/rules/CSSStyleRule
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/rules/CSSRule (loadtime) // superclass
- var com_ibm_rave_render_internal_css_rules_CSSStyleRule = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSRule, {
- //selectorText : null,
- //style : null,
- getType : function() {
- return 1;
- }
- });
- // $source: com/ibm/rave/render/internal/css/om/CSSStyleDeclaration
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- var com_ibm_rave_render_internal_css_om_CSSStyleDeclaration = com_ibm_rave_core_nativeImpl_Declare({
- //propNames : null,
- //propValues : null,
- __starts : 0,
- constructor : function() {
- this.propNames = [];
- this.propValues = [];
- },
- /**
- * Return the property as a string - as it was set in the CSS originally.
- * @param (String) propertyName The name to retrieve value for.
- * @return (String) The property value as a string.
- */
- getPropertyValue : function(propertyName) {
- var index = this.propNames.indexOf(propertyName);
- return (index >= 0) ? this.propValues[index].value : null;
- },
- getPropertyCSSValue : function(propertyName) {
- return null;
- },
- /**
- * Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
- * @param (String) propertyName Name of the style to look up.
- * @return (String) Returns literal string "important" if this property has been flagged as important. Empty string otherwise.
- */
- getPropertyPriority : function(propertyName) {
- var index = this.propNames.indexOf(propertyName);
- if (index == -1) {
- return null;
- }
- return (this.propValues[index].priority) ? "important" : "";
- },
- setProperty : function(propertyName, value, priority) {
- var property = this.findOrCreateProperty(propertyName);
- property.value = value;
- property.priority = "important" == priority;
- },
- setPropertyValue : function(propertyName, value) {
- var property = this.findOrCreateProperty(propertyName);
- property.value = value;
- },
- setPropertyPriority : function(propertyName, priority) {
- var property = this.findOrCreateProperty(propertyName);
- property.priority = "important" == priority;
- },
- findOrCreateProperty : function(propertyName) {
- var index = this.propNames.indexOf(propertyName);
- var property;
- if (index >= 0) {
- property = this.propValues[index];
- } else {
- this.propNames.push(propertyName);
- property = new com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.PropertyValueStruct();
- this.propValues.push(property);
- }
- return property;
- },
- /**
- * Return the 1-index size of the list of properties.
- * @return (int) Size of the list of properties. 1 indexed.
- */
- length : function() {
- return this.propNames.length;
- },
- /**
- * Return the property name at a certain index. Returns null if the index doesn't exist.
- * @param (int) index Index to retreive property name for.
- * @return (String) Property name at this index. Null if index doesn't exist.
- */
- item : function(index) {
- return this.propNames[index];
- },
- /**
- * Helper method to go through each style in this declaration and return the CSSValue of it.
- * @param (com.ibm.rave.render.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
- */
- each : function(cssValueHandler) {
- var i = 0;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var name = __exp_enFor0[__i_enFor0];
- cssValueHandler(name, this.getPropertyCSSValue(name), i++);
- }
- }
- });
- com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.PropertyValueStruct = function(){};
- com_ibm_rave_render_internal_css_om_CSSStyleDeclaration.IMPORTANT = "important";
- // $source: com/ibm/rave/render/internal/css/om/StyleDeclaration
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSStyleDeclaration (loadtime) // superclass
- /**
- * Internal representation of a CSSStyleDeclaration.
- */
- var com_ibm_rave_render_internal_css_om_StyleDeclaration = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSStyleDeclaration, {
- //cssValues : null,
- constructor : function() {
- this.cssValues = {};
- },
- /**
- * Set the internal CSSValue for a property to 'value'.
- * @param (String) propertyName Name of property to set.
- * @param (com.ibm.rave.render.internal.css.om.CSSValue) value CSSValue to assign to property.
- */
- setPropertyCSSValue : function(propertyName, value) {
- this.cssValues[propertyName] = value;
- },
- getPropertyCSSValue : function(propertyName) {
- return this.cssValues[propertyName];
- }
- });
- // $source: com/ibm/rave/render/internal/css/rules/CSSKeyframeRule
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/rules/CSSStyleRule (loadtime) // superclass
- var com_ibm_rave_render_internal_css_rules_CSSKeyframeRule = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_rules_CSSStyleRule, {
- //keyText : null,
- getType : function() {
- return 8;
- }
- });
- // $source: com/ibm/rave/render/internal/css/om/CSSValue
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- var com_ibm_rave_render_internal_css_om_CSSValue = com_ibm_rave_core_nativeImpl_Declare({
- //getType : function() {},
- //cssText : function() {},
- //getName : function() {}
- });
- com_ibm_rave_render_internal_css_om_CSSValue.CSS_INHERIT = 0;
- com_ibm_rave_render_internal_css_om_CSSValue.CSS_PRIMITIVE_VALUE = 1;
- com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST = 2;
- com_ibm_rave_render_internal_css_om_CSSValue.CSS_CUSTOM = 3;
- // $source: com/ibm/rave/render/internal/css/om/CSSValueList
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSValue (loadtime) // CSS_VALUE_LIST, superclass
- /**
- * A list of values parsed from a CSS value declaration. IE - the declaration "scale(10,20)" has two values - 10 and 20.
- */
- var com_ibm_rave_render_internal_css_om_CSSValueList = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValue, {
- //objects : null,
- constructor : function() {
- this.objects = [];
- },
- /**
- * Append a single value to this list.
- * @param (com.ibm.rave.render.internal.css.om.CSSValue) value Value to append to value list.
- */
- append : function(value) {
- this.objects.push(value);
- },
- /**
- * Remove all values from this list.
- */
- removeAll : function() {
- this.objects.length = 0;
- },
- /**
- * Return CSSValue at index.
- * @param (int) index
- * @return (com.ibm.rave.render.internal.css.om.CSSValue) CSSValue
- */
- item : function(index) {
- if (this.objects.length > index) {
- return this.objects[index];
- }
- return null;
- },
- cssText : function() {
- var results = "";
- for (var i = 0; i < this.objects.length; ++i) {
- results += this.objects[i].cssText();
- if (i < this.objects.length - 1) {
- results += ",";
- }
- }
- return results;
- },
- /**
- * @return (int) Number of values in this list.
- */
- length : function() {
- return this.objects.length;
- },
- getType : function() {
- return com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST;
- },
- /**
- * Helper method to go through each style in this valueList and return the CSSValue of it.
- * @param (com.ibm.rave.render.internal.css.om.CSSValue.CSSValueHandler) cssValueHandler Handler that gets called for each property value.
- */
- each : function(cssValueHandler) {
- var i = 0;
- for (var __i_enFor0 = 0, __exp_enFor0 = this.objects, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var object = __exp_enFor0[__i_enFor0];
- cssValueHandler(object.getName(), object, i++);
- }
- },
- getName : function() {
- return null;
- }
- /**
- * Create a new list of CSSValues.
- */
- //constructor : function() {}
- });
- // $source: com/ibm/rave/render/internal/css/CSSParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSStyleSheet (runtime) // new
- //@import com/ibm/rave/render/internal/css/rules/CSSStyleRule (static) // new
- //@import com/ibm/rave/render/internal/css/om/StyleDeclaration (static) // new
- //@import com/ibm/rave/render/internal/css/rules/CSSKeyframeRule (static) // new
- //@import com/ibm/rave/render/internal/css/om/CSSValue (static) // CSSValue
- //@import com/ibm/rave/render/internal/css/om/CSSValueList (static) // new
- //@import com/ibm/rave/render/internal/css/CSSValueParser (runtime) // new
- /**
- * A java port of CSSOM. Contains custom modifications to support more value types.
- */
- var com_ibm_rave_render_internal_css_CSSParser = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * 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.
- * @param (String) styleName The name of the style.
- * @param (String) token The CSS block contents.
- * @return (com.ibm.rave.render.internal.css.om.CSSStyleDeclaration) CSSStyleSheet with the model. Returns null if a parsing error occured.
- */
- com_ibm_rave_render_internal_css_CSSParser.parseStyle = function(styleName, token) {
- var sheet = com_ibm_rave_render_internal_css_CSSParser.parse("*{" + styleName + ":" + token + "}");
- if (sheet) {
- if (sheet && sheet.cssRules.length > 0) {
- return (sheet.cssRules[0]).style;
- }
- }
- return null;
- };
- /**
- * Parse a CSS stylesheet string into a CSSStyleSheet object.
- * @param (String) token The css stylesheet string.
- * @return (com.ibm.rave.render.internal.css.om.CSSStyleSheet) CSSStyleSheet. Will return null on a parsing error.
- */
- com_ibm_rave_render_internal_css_CSSParser.parse = function(token) {
- var state = 1001;
- var index;
- var buffer = "";
- var SIGNIFICANT_WHITESPACE = {};
- SIGNIFICANT_WHITESPACE[1003] = 1;
- SIGNIFICANT_WHITESPACE[1006] = 1;
- SIGNIFICANT_WHITESPACE[1013] = 1;
- SIGNIFICANT_WHITESPACE[1007] = 1;
- SIGNIFICANT_WHITESPACE[1008] = 1;
- SIGNIFICANT_WHITESPACE[1010] = 1;
- SIGNIFICANT_WHITESPACE[1009] = 1;
- var styleSheet = new com_ibm_rave_render_internal_css_om_CSSStyleSheet();
- var currentScope = styleSheet;
- var parentRule;
- var name;
- var priority = "";
- var styleRule = new com_ibm_rave_render_internal_css_rules_CSSStyleRule();
- var character;
- var cssValue;
- var currentOperation = "";
- for (var i = 0; i < token.length; ++i) {
- character = token.charCodeAt(i);
- switch (character) {
- case 32:
- case 9:
- case 13:
- case 10:
- case 12:
- if (SIGNIFICANT_WHITESPACE.hasOwnProperty(state)) {
- buffer += String.fromCharCode(character);
- }
- break;
- case 34:
- index = i + 1;
- do {
- index = token.indexOfCharCode(34, index) + 1;
- if (index == 0) {
- return null;
- }
- } while (token.substring(index - 2, 1) == "\\");
- buffer += token.substring(i, index);
- i = index - 1;
- if (state == 1002) {
- state = 1006;
- } else if (state == 1007) {
- state = 1008;
- }
- break;
- case 39:
- index = i + 1;
- do {
- index = token.indexOf("'", index) + 1;
- if (index == 0) {
- return null;
- }
- } while (token.substring(index - 2, 1) == "\\");
- buffer += token.substring(i, index);
- i = index - 1;
- switch (state) {
- case 1002:
- {
- state = 1006;
- break;
- } case 1007:
- state = 1008;
- break;
- default:
- break;
- }
- break;
- case 47:
- if (token.charCodeAt(i + 1) == 42) {
- i += 2;
- index = token.indexOf("*/", i);
- if (index == -1) {
- return null;
- }
- i = index + 1;
- } else {
- buffer += String.fromCharCode(character);
- }
- if (state == 1007) {
- buffer += " ";
- state = 1008;
- }
- break;
- case 64:
- if (token.indexOf("@-moz-document", i) == i) {
- state = 1009;
- i += "-moz-document".length;
- buffer = "";
- break;
- } else if (token.indexOf("@media", i) == i) {
- state = 1010;
- i += "media".length;
- buffer = "";
- break;
- } else if (token.indexOf("@import", i) == i) {
- state = 1007;
- i += "import".length;
- buffer += "@import";
- break;
- } else if (token.indexOf("@font-face", i) == i) {
- state = 1011;
- i += "font-face".length;
- buffer = "";
- break;
- } else {
- com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp["lastIndex"] = i;
- var matchKeyframes = com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp.exec(token);
- if (matchKeyframes && matchKeyframes.index == i) {
- state = 1012;
- i += matchKeyframes[0].length - 1;
- buffer = "";
- break;
- } else if (state == 1003) {
- state = 1013;
- }
- }
- buffer += String.fromCharCode(character);
- break;
- case 123:
- if (state == 1003 || state == 1013) {
- styleRule.selectorText = buffer.trim();
- styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
- styleRule.style.__starts = i;
- buffer = "";
- state = 1000;
- } else if (state == 1010) {
- buffer = "";
- state = 1001;
- } else if (state == 1011) {
- buffer = "";
- state = 1000;
- } else if (state == 1012) {
- buffer = "";
- state = 1004;
- } else if (state == 1004) {
- styleRule = new com_ibm_rave_render_internal_css_rules_CSSKeyframeRule();
- (styleRule).keyText = buffer.trim();
- styleRule.__starts = i;
- buffer = "";
- state = 1000;
- } else if (state == 1009) {
- buffer = "";
- state = 1001;
- }
- break;
- case 58:
- if (state == 1005) {
- name = buffer.trim();
- buffer = "";
- state = 1002;
- } else {
- buffer += String.fromCharCode(character);
- }
- break;
- case 40:
- if (state == 1006) {
- var propertyType = com_ibm_rave_render_internal_css_CSSParser.determinePropertyType(name);
- if (!cssValue) {
- cssValue = com_ibm_rave_render_internal_css_CSSParser.createValueContainer(propertyType);
- }
- var info = com_ibm_rave_render_internal_css_CSSParser.parseValues(propertyType, currentOperation, token, i);
- i = info.idx;
- if (info.error == 0) {
- buffer += info.expression;
- if (cssValue && cssValue.getType() == com_ibm_rave_render_internal_css_om_CSSValue.CSS_VALUE_LIST) {
- (cssValue).append(info.cssValue);
- } else {
- cssValue = info.cssValue;
- }
- } else {
- buffer = "";
- }
- currentOperation = "";
- } else {
- buffer += String.fromCharCode(character);
- }
- break;
- case 33:
- if (state == 1006 && token.indexOf("!" + "important", i) == i) {
- priority = "important";
- i += "important".length;
- } else {
- buffer += String.fromCharCode(character);
- }
- break;
- case 59:
- switch (state) {
- case 1006:
- styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
- styleRule.style.setProperty(name, buffer.trim(), priority);
- (styleRule.style).setPropertyCSSValue(name, cssValue);
- priority = "";
- buffer = "";
- state = 1000;
- cssValue = null;
- break;
- case 1013:
- buffer = "";
- state = 1001;
- break;
- case 1008:
- buffer = "";
- state = 1001;
- break;
- default:
- buffer += String.fromCharCode(character);
- }
- break;
- case 125:
- switch (state) {
- case 1006:
- styleRule.style = (!styleRule.style) ? new com_ibm_rave_render_internal_css_om_StyleDeclaration() : styleRule.style;
- styleRule.style.setProperty(name, buffer.trim(), priority);
- (styleRule.style).setPropertyCSSValue(name, cssValue);
- priority = "";
- cssValue = null;
- case 1000:
- case 1005:
- styleRule.__ends = i + 1;
- if (parentRule) {
- styleRule.parentRule = parentRule;
- }
- styleRule.parentStyleSheet = styleSheet;
- currentScope.cssRules.push(styleRule);
- buffer = "";
- if (currentScope.getType() == 7) {
- state = 1004;
- } else {
- state = 1001;
- }
- break;
- case 1004:
- case 1001:
- case 1003:
- if (parentRule) {
- currentScope.__ends = i + 1;
- styleSheet.cssRules.push(currentScope);
- }
- currentScope = styleSheet;
- parentRule = null;
- buffer = "";
- state = 1001;
- break;
- }
- break;
- default:
- switch (state) {
- case 1001:
- state = 1003;
- styleRule = new com_ibm_rave_render_internal_css_rules_CSSStyleRule();
- styleRule.__starts = i;
- break;
- case 1000:
- state = 1005;
- break;
- case 1002:
- state = 1006;
- case 1006:
- currentOperation += String.fromCharCode(character);
- break;
- case 1007:
- state = 1008;
- break;
- }
- buffer += String.fromCharCode(character);
- break;
- }
- }
- return styleSheet;
- };
- /**
- * Create a CSSValue that holds values for propertyType. For instance, a TransformValue requires a CSSValueList.
- * @param (int) propertyType
- * @return (com.ibm.rave.render.internal.css.om.CSSValue)
- */
- com_ibm_rave_render_internal_css_CSSParser.createValueContainer = function(propertyType) {
- var cssValue;
- if (propertyType == 0) {
- cssValue = new com_ibm_rave_render_internal_css_om_CSSValueList();
- }
- return cssValue;
- };
- com_ibm_rave_render_internal_css_CSSParser.parseValues = function(propertyType, buffer, token, i) {
- var valueExpression = new com_ibm_rave_render_internal_css_CSSValueParser(propertyType, buffer, token, i);
- return valueExpression.parse();
- };
- com_ibm_rave_render_internal_css_CSSParser.determinePropertyType = function(type) {
- if (type == "transform") {
- return 0;
- }
- return -1;
- };
- com_ibm_rave_render_internal_css_CSSParser.BEFORE_NAME = 1000;
- com_ibm_rave_render_internal_css_CSSParser.BEFORE_SELECTOR = 1001;
- com_ibm_rave_render_internal_css_CSSParser.BEFORE_VALUE = 1002;
- com_ibm_rave_render_internal_css_CSSParser.SELECTOR = 1003;
- com_ibm_rave_render_internal_css_CSSParser.KEYFRAMERULE_BEGIN = 1004;
- com_ibm_rave_render_internal_css_CSSParser.NAME = 1005;
- com_ibm_rave_render_internal_css_CSSParser.VALUE = 1006;
- com_ibm_rave_render_internal_css_CSSParser.IMPORTRULE_BEGIN = 1007;
- com_ibm_rave_render_internal_css_CSSParser.IMPORTRULE = 1008;
- com_ibm_rave_render_internal_css_CSSParser.DOCUMENTRULE_BEGIN = 1009;
- com_ibm_rave_render_internal_css_CSSParser.ATBLOCK = 1010;
- com_ibm_rave_render_internal_css_CSSParser.FONTFACERULE_BEGIN = 1011;
- com_ibm_rave_render_internal_css_CSSParser.KEYFRAMESRULE_BEGIN = 1012;
- com_ibm_rave_render_internal_css_CSSParser.ATRULE = 1013;
- com_ibm_rave_render_internal_css_CSSParser.atKeyframesRegExp = new RegExp("@(-(?:\\w+-)+)?keyframes", "g");
- // $source: com/ibm/rave/render/internal/css/CSSValueParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSTransformValue (runtime) // new
- //@import com/ibm/rave/render/internal/css/om/CSSValueList (runtime) // new
- //@import com/ibm/rave/render/internal/css/om/CSSPrimitiveValue (runtime) // new
- /**
- * 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.
- */
- var com_ibm_rave_render_internal_css_CSSValueParser = com_ibm_rave_core_nativeImpl_Declare({
- //_token : null,
- //name : null,
- //valueList : null,
- type : 0,
- _idx : 0,
- UNDEF : 0,
- INSIDE_FUNCTION : 1,
- constructor : function(type, name, token, index) {
- this.type = type;
- this._token = token;
- this._idx = index;
- this.name = name;
- this.valueList = this.createArgumentContainer();
- },
- parse : function() {
- var token = this._token;
- var idx = this._idx;
- var character;
- var expression = "";
- var error = 0;
- var info;
- var paren = [];
- var state = this.UNDEF;
- var currentArg = "";
- for (;; ++idx) {
- if (idx == token.length) {
- error = -1;
- break;
- }
- character = token.charCodeAt(idx);
- switch (character) {
- case 40:
- state = this.INSIDE_FUNCTION;
- paren.push(character);
- expression += String.fromCharCode(character);
- break;
- case 41:
- if (state == this.INSIDE_FUNCTION) {
- this.valueList.append(this.createValue(currentArg));
- currentArg = "";
- }
- state = this.UNDEF;
- paren.pop();
- expression += String.fromCharCode(character);
- break;
- case 44:
- if (state == this.INSIDE_FUNCTION) {
- this.valueList.append(this.createValue(currentArg));
- currentArg = "";
- }
- expression += String.fromCharCode(character);
- break;
- case 47:
- if ((info = this._parseJSComment(token, idx))) {
- if (info.error != 0) {
- error = -2;
- } else {
- idx = info.idx;
- }
- } else {
- expression += String.fromCharCode(character);
- }
- break;
- case 39:
- case 34:
- info = this._parseJSString(token, idx, String.fromCharCode(character) + "");
- if (info) {
- idx = info.idx;
- expression += info.text;
- } else {
- expression += String.fromCharCode(character);
- }
- break;
- case 32:
- case 9:
- case 13:
- case 10:
- case 12:
- break;
- default:
- switch (state) {
- case this.UNDEF:
- break;
- case this.INSIDE_FUNCTION:
- currentArg += String.fromCharCode(character);
- }
- expression += String.fromCharCode(character);
- break;
- }
- if (error != 0) {
- break;
- }
- if (paren.length == 0) {
- break;
- }
- }
- var ret = new com_ibm_rave_render_internal_css_CSSValueParser.CSSValueExpressionInfo();
- ret.error = error;
- ret.idx = idx;
- ret.expression = expression;
- ret.cssValue = this.valueList;
- return ret;
- },
- _parseJSComment : function(token, idx) {
- var nextChar = token.charCodeAt(idx + 1);
- var text;
- if (nextChar == 47 || nextChar == 42) {
- var startIdx = idx;
- var endIdx;
- var commentEndChar = null;
- if (nextChar == 47) {
- commentEndChar = "\n";
- } else if (nextChar == 42) {
- commentEndChar = "*/";
- }
- endIdx = commentEndChar != null ? token.indexOf(commentEndChar, startIdx + 1 + 1) : -1;
- var struct = new com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct();
- if (endIdx != -1) {
- endIdx = endIdx + commentEndChar.length - 1;
- text = token.substring(idx, endIdx + 1);
- struct.idx = endIdx;
- struct.text = text;
- } else {
- struct.error = -1;
- }
- return struct;
- }
- return null;
- },
- /**
- * @return (com.ibm.rave.render.internal.css.CSSValueParser.JSCommentStruct) {Object|false} - idx: - text: or false
- */
- _parseJSString : function(token, idx, sep) {
- var endIdx = com_ibm_rave_render_internal_css_CSSValueParser._findMatchedIdx(token, idx, sep);
- var text;
- if (endIdx == -1) {
- return null;
- }
- text = token.substring(idx, endIdx + sep.length);
- var struct = new com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct();
- struct.idx = endIdx;
- struct.text = text;
- return struct;
- },
- /**
- * Create a new CSS Value "container" for the current type of css operation. This will contain the argument CSS Values inside it.
- * @param value
- * @return (com.ibm.rave.render.internal.css.om.CSSValueList)
- */
- createArgumentContainer : function() {
- switch (this.type) {
- case (0):
- return new com_ibm_rave_render_internal_css_om_CSSTransformValue(this.name);
- default:
- return new com_ibm_rave_render_internal_css_om_CSSValueList();
- }
- },
- /**
- * Create a CSS Value from the current type of operation.
- * @param argumentContainer
- * @param (String) value
- * @return (com.ibm.rave.render.internal.css.om.CSSValue)
- */
- createValue : function(value) {
- var val;
- switch (this.type) {
- case (0):
- default:
- val = new com_ibm_rave_render_internal_css_om_CSSPrimitiveValue(value);
- break;
- }
- return val;
- }
- });
- /**
- * find next sep(same line) index in `token`
- * @return (int) {Number}
- */
- com_ibm_rave_render_internal_css_CSSValueParser._findMatchedIdx = function(token, idx, sep) {
- var startIdx = idx;
- var endIdx;
- var NOT_FOUND = -1;
- var result = new RegExp("\\+$", "");
- while (true) {
- endIdx = token.indexOf(sep, startIdx + 1);
- if (endIdx == -1) {
- endIdx = NOT_FOUND;
- break;
- }
- var text = token.substring(idx + 1, endIdx);
- var matched = result.exec(text);
- if (!matched || matched.length == 1) {
- break;
- }
- startIdx = endIdx;
- }
- var nextNewLineIdx = token.indexOfCharCode(10, idx + 1);
- if (nextNewLineIdx < endIdx) {
- endIdx = NOT_FOUND;
- }
- return endIdx;
- };
- com_ibm_rave_render_internal_css_CSSValueParser.CSSValueExpressionInfo = function(){};
- /**
- * @return {Object|false} - idx: - text: or - error: or false
- */
- com_ibm_rave_render_internal_css_CSSValueParser.JSCommentStruct = function(){};
- // $source: com/ibm/rave/render/internal/css/om/CSSTransformValue
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSValueList (loadtime) // superclass
- var com_ibm_rave_render_internal_css_om_CSSTransformValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValueList, {
- //operationType : null,
- constructor : function(operationType) {
- this.operationType = operationType;
- },
- cssText : function() {
- return this.operationType + "(" + com_ibm_rave_render_internal_css_om_CSSValueList.prototype.cssText.call(this) + ")";
- },
- getName : function() {
- return this.operationType;
- }
- });
- /**
- * Returns a transform operation type based on the string representation.
- * @param (String) type String representation of the type.
- * @return (int) One of the transform operation types. -1 if undefined.
- */
- com_ibm_rave_render_internal_css_om_CSSTransformValue.determineType = function(type) {
- if (type.indexOf("translate") == 0) {
- if (type.length == 10) {
- if (type.charCodeAt(9) == 88) {
- return 2;
- }
- return 3;
- }
- return 1;
- }
- if (type.indexOf("rotate") == 0) {
- return 4;
- }
- if (type.indexOf("scale") == 0) {
- if (type.length == 6) {
- if (type.charCodeAt(5) == 88) {
- return 6;
- }
- return 7;
- }
- return 5;
- }
- if (type.indexOf("skew") == 0) {
- if (type.length == 5) {
- if (type.charCodeAt(4) == 88) {
- return 9;
- }
- return 10;
- }
- return 8;
- }
- if (type.indexOf("matrix") == 0) {
- return 11;
- }
- return -1;
- };
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATE = 1;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATEX = 2;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_TRANSLATEY = 3;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_ROTATE = 4;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALE = 5;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALEX = 6;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SCALEY = 7;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEW = 8;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEWX = 9;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_SKEWY = 10;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.CSS_MATRIX = 11;
- com_ibm_rave_render_internal_css_om_CSSTransformValue.transformNames = ["translate", "translateX", "translateY", "rotate", "rotateX", "rotateY", "scale", "scaleX", "scaleY", "skew", "skewX", "skewY", "matrix"];
- // $source: com/ibm/rave/render/internal/css/om/CSSPrimitiveValue
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/css/om/CSSValue (loadtime) // CSS_PRIMITIVE_VALUE, superclass
- var com_ibm_rave_render_internal_css_om_CSSPrimitiveValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_css_om_CSSValue, {
- //value : null,
- constructor : function(value) {
- this.value = value;
- },
- cssText : function() {
- return ""+(this.value);
- },
- getType : function() {
- return com_ibm_rave_render_internal_css_om_CSSValue.CSS_PRIMITIVE_VALUE;
- },
- getName : function() {
- return null;
- }
- });
- // $source: com/ibm/rave/core/geom/RaveRect
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * A class that describes a Rectangular shape in a non-native way. Immutable. Uses doubles as coordinates.
- * @author jim
- */
- var com_ibm_rave_core_geom_RaveRect = rave_externs["RaveRect"] = com_ibm_rave_core_nativeImpl_Declare({
- /** @expose */
- x : 0,
- /** @expose */
- y : 0,
- /** @expose */
- width : 0,
- /** @expose */
- height : 0,
- /** @expose */
- constructor : function(x, y, width, height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- },
- /** @expose */
- getX : function() {
- return this.x;
- },
- /** @expose */
- getX2 : function() {
- return this.x + this.width;
- },
- /** @expose */
- getY : function() {
- return this.y;
- },
- /** @expose */
- getY2 : function() {
- return this.y + this.height;
- },
- /** @expose */
- getWidth : function() {
- return this.width;
- },
- /** @expose */
- getHeight : function() {
- return this.height;
- },
- /**
- * Create new intersection between this rect and the passed in rect2.
- * @param (com.ibm.rave.core.geom.RaveRect) rect2 Rectangle to intersect with this rectangle.
- * @return (com.ibm.rave.core.geom.RaveRect) New RaveRect shape that contains the new bounds.
- */
- /** @expose */
- createIntersect : function(rect2) {
- var newX = Math.min(this.x, rect2.x);
- var newY = Math.min(this.y, rect2.y);
- var newWidth = Math.max(this.getX2(), rect2.getX2()) - newX;
- var newHeight = Math.max(this.getY2(), rect2.getY2()) - newY;
- return new com_ibm_rave_core_geom_RaveRect(newX, newY, newWidth, newHeight);
- },
- /**
- * Does this rect intersect the passed in rect.
- * @param (com.ibm.rave.core.geom.RaveRect) rect
- * @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.
- */
- /** @expose */
- intersects : function(rect) {
- return (this.x <= this.getX2() && this.getX2() >= rect.x && this.y <= rect.getY2() && this.getY2() >= rect.y);
- },
- /** @expose */
- hasSize : function() {
- return this.width > 0 && this.height > 0;
- },
- /** @expose */
- add : function(x, y) {
- var rectx = 0, rectwidth = 0, recty = 0, rectheight = 0;
- if (this.x > x) {
- rectx = x;
- rectwidth += (this.x - x);
- } else if (this.getX2() < x) {
- rectwidth += (x - this.getX2());
- }
- if (this.y > y) {
- recty = y;
- rectheight += (this.x - x);
- } else if (this.getY2() < y) {
- rectwidth += (y - this.getY2());
- }
- return new com_ibm_rave_core_geom_RaveRect(rectx, recty, rectwidth, rectheight);
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/CircleSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- //@import com/ibm/rave/core/geom/NodeRect (runtime) // new
- /**
- * Circle shape.
- * @author sproulja
- */
- var com_ibm_rave_render_internal_nodes_CircleSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBBox : function() {
- var cx = + (this.attributes.get("cx"));
- var cy = + (this.attributes.get("cy"));
- var r = + (this.attributes.get("r"));
- return new com_ibm_rave_core_geom_RaveRect(cx - r, cy - r, r * 2, r * 2);
- },
- /** @expose */
- getBoundingClientRect : function() {
- var rb = this.rave_getOwner().getBBox();
- var cx = + (this.attributes.get("cx"));
- var cy = + (this.attributes.get("cy"));
- var r = + (this.attributes.get("r"));
- return new com_ibm_rave_core_geom_NodeRect(cx - r, rb.width - cx - r, rb.height - cy - r, cy - r, r * 2, r * 2);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1002;
- },
- /** @expose */
- rave_getName : function() {
- return "circle";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/LineSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * Circle shape.
- * @author sproulja
- */
- var com_ibm_rave_render_internal_nodes_LineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBBox : function() {
- var x1 = + (this.attributes.get("x1"));
- var x2 = + (this.attributes.get("x2"));
- var y1 = + (this.attributes.get("y1"));
- var y2 = + (this.attributes.get("y2"));
- var tmp;
- if (x1 > x2) {
- tmp = x1;
- x1 = x2;
- x2 = tmp;
- }
- if (y1 > y2) {
- tmp = y1;
- y1 = y2;
- y2 = tmp;
- }
- return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1001;
- },
- /** @expose */
- rave_getName : function() {
- return "line";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/TextSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- /**
- * Text shape.
- * @author sproulja
- */
- var com_ibm_rave_render_internal_nodes_TextSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBoundingClientRect : function() {
- return null;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1003;
- },
- /** @expose */
- rave_getName : function() {
- return "text";
- },
- /** @expose */
- getBBox : function() {
- return null;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/GroupSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/RectSceneItem (loadtime) // superclass
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- var com_ibm_rave_render_internal_nodes_GroupSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_RectSceneItem, {
- /** @expose */
- rave_getName : function() {
- return "g";
- },
- rave_intersects$0 : function(x, y) {
- return false;
- },
- rave_intersects$1 : function(rect) {
- return false;
- },
- /** @expose */
- getBBox : function() {
- var x1, y1, x2, y2, cx2, cy2;
- x1 = y1 = Infinity;
- x2 = y2 = 0;
- if (this.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- var bb = child.getBBox();
- cx2 = bb.x + bb.width;
- cy2 = bb.y + bb.height;
- if (bb.x < x1) {
- x1 = bb.x;
- }
- if (bb.y < y1) {
- y1 = bb.y;
- }
- if (cx2 > x2) {
- x2 = cx2;
- }
- if (cy2 > y2) {
- y2 = cy2;
- }
- }
- }
- return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1);
- },
- /** @expose */
- rave_intersects : function(a0, a1) {
- var args = arguments;
- if (args.length == 1) {
- return this.rave_intersects$1(a0);
- }
- return this.rave_intersects$0(a0, a1);
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/PathSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- /**
- * A translated implementation of an SVG path shape.
- * @author jim
- */
- var com_ibm_rave_render_internal_nodes_PathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBoundingClientRect : function() {
- return null;
- },
- /** @expose */
- getBBox : function() {
- return null;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1006;
- },
- /** @expose */
- rave_getName : function() {
- return "path";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/PolygonSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- /**
- * A translated implementation of an SVG polygon shape.
- */
- var com_ibm_rave_render_internal_nodes_PolygonSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBoundingClientRect : function() {
- return null;
- },
- /** @expose */
- getBBox : function() {
- return null;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1010;
- },
- /** @expose */
- rave_getName : function() {
- return "polygon";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/PolylineSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- /**
- * A translated implementation of an SVG polyline shape.
- */
- var com_ibm_rave_render_internal_nodes_PolylineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- /** @expose */
- getBoundingClientRect : function() {
- return null;
- },
- /** @expose */
- getBBox : function() {
- return null;
- },
- /** @expose */
- rave_getDrawType : function() {
- return 1009;
- },
- /** @expose */
- rave_getName : function() {
- return "polyline";
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/DefsSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
- /**
- * A scene node representing an SVG "defs" node. May contain other shapes, gradient declarations, clips, etc.
- */
- var com_ibm_rave_render_internal_DefsSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
- /** @expose */
- getName : function() {
- return "defs";
- },
- isDrawable : function() {
- return false;
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/internal/nodes/LinearGradientSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/render/internal/properties/LinearGradientAttributes (runtime) // new
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- var com_ibm_rave_render_internal_nodes_LinearGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- constructor : function(nsuri, context) {
- this.attributes = new com_ibm_rave_render_internal_properties_LinearGradientAttributes();
- },
- /** @expose */
- getName : function() {
- return com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT;
- },
- isDrawable : function() {
- return false;
- },
- /** @expose */
- getBBox : function() {
- return null;
- },
- /** @expose */
- getDrawType : function() {
- return 1011;
- }
- });
- // $source: com/ibm/rave/render/internal/properties/LinearGradientAttributes
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- var com_ibm_rave_render_internal_properties_LinearGradientAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_LinearGradientAttributes.propertyNames;
- this.propValues = [0, 0, 0, 0];
- }
- });
- com_ibm_rave_render_internal_properties_LinearGradientAttributes.x1 = 0;
- com_ibm_rave_render_internal_properties_LinearGradientAttributes.y1 = 1;
- com_ibm_rave_render_internal_properties_LinearGradientAttributes.x2 = 2;
- com_ibm_rave_render_internal_properties_LinearGradientAttributes.y2 = 3;
- com_ibm_rave_render_internal_properties_LinearGradientAttributes.propertyNames = ["x1", "x2", "y1", "y2"];
- // $source: com/ibm/rave/render/internal/nodes/RadialGradientSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass
- //@import com/ibm/rave/render/internal/properties/RadialGradientAttributes (runtime) // new
- //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants
- var com_ibm_rave_render_internal_nodes_RadialGradientSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, {
- constructor : function(nsuri, context) {
- this.attributes = new com_ibm_rave_render_internal_properties_RadialGradientAttributes();
- },
- /** @expose */
- getName : function() {
- return com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT;
- },
- isDrawable : function() {
- return false;
- },
- /** @expose */
- getBBox : function() {
- return null;
- },
- /** @expose */
- getDrawType : function() {
- return 1012;
- }
- });
- // $source: com/ibm/rave/render/internal/properties/RadialGradientAttributes
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- var com_ibm_rave_render_internal_properties_RadialGradientAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_RadialGradientAttributes.propertyNames;
- this.propValues = [0, 0, 0, 0, 0];
- }
- });
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.cx = 0;
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.cy = 1;
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.r = 2;
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.fx = 3;
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.fy = 4;
- com_ibm_rave_render_internal_properties_RadialGradientAttributes.propertyNames = ["cx", "cy", "r", "fx", "fy"];
- // $source: com/ibm/rave/render/internal/nodes/StopSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/DefsSceneItem (loadtime) // superclass
- //@import com/ibm/rave/render/internal/properties/StopAttributes (runtime) // new
- var com_ibm_rave_render_internal_nodes_StopSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_DefsSceneItem, {
- constructor : function(nsuri, context) {
- this.attributes = new com_ibm_rave_render_internal_properties_StopAttributes();
- },
- /** @expose */
- getName : function() {
- return "stop";
- }
- });
- // $source: com/ibm/rave/render/internal/properties/StopAttributes
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass
- var com_ibm_rave_render_internal_properties_StopAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, {
- constructor : function() {
- this.propNames = com_ibm_rave_render_internal_properties_StopAttributes.propertyNames;
- this.propValues = [0, 0, 1];
- }
- });
- com_ibm_rave_render_internal_properties_StopAttributes.offset = 0;
- com_ibm_rave_render_internal_properties_StopAttributes.propertyNames = ["offset", "stop-color", "stop-opacity"];
- // $source: com/ibm/rave/render/internal/nodes/RootSceneItem
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (loadtime) // superclass
- //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration
- /**
- * A root scene item
- */
- var com_ibm_rave_render_internal_nodes_RootSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_GroupSceneItem, {
- /** @expose */
- dispose : function() {
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.removeRootProviderForNode(this.rave_getOwner());
- }
- //constructor : function(nsuri, context) {}
- });
- // $source: com/ibm/rave/render/AbstractRenderer
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/DirtyRegionManager (runtime) // new
- //@import com/ibm/rave/core/Rave (runtime) // Rave
- //@import com/ibm/rave/render/internal/style/StyleManager (runtime) // getFont, getFill, getStroke
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime) // addNotificationListener
- var com_ibm_rave_render_AbstractRenderer = rave_externs["AbstractRenderer"] = com_ibm_rave_core_nativeImpl_Declare({
- //dirtyRegion : null,
- /** @expose */
- root : null,
- //event : null,
- //eventManager : null,
- /**
- * 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
- */
- drawRunning : false,
- constructor : function(root) {
- this.dirtyRegion = new com_ibm_rave_render_internal_DirtyRegionManager();
- {
- this.root = root;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener(this);
- (root).setRenderer(this);
- var renderer = this;
- this.event = function(elapsed) {
- renderer.repaint();
- renderer.drawRunning = false;
- return true;
- };
- }
- },
- /**
- * By default repaint just calls render() to re-render the whole scene.
- */
- /** @expose */
- repaint : function() {
- this.start();
- this.render(this.root);
- this.finish();
- },
- /** @expose */
- createEventManager : function() {},
- /** @expose */
- registerEvent : function(eventType, node) {
- if (!this.eventManager) {
- this.eventManager = this.createEventManager();
- }
- this.eventManager.registerEvent(eventType, node);
- },
- /** @expose */
- unregisterEvent : function(eventType, node) {
- if (this.eventManager) {
- this.eventManager.unregisterEvent(eventType, node);
- }
- },
- /** @expose */
- handleDrawEvent : function(type, item) {
- if (!this.drawRunning) {
- this.drawRunning = true;
- com_ibm_rave_core_Rave.timer(this.event, 0, 0);
- }
- },
- /** @expose */
- beforeUpdate : function(type, subType, key, value, item) {},
- /** @expose */
- afterUpdate : function(type, subType, key, value, item) {
- this.handleDrawEvent(type, item);
- },
- /** @expose */
- render : function(item) {
- var matrix = (item).transformMatrix;
- if (matrix) {
- this.saveGraphicsState();
- this.applyMatrix(matrix);
- }
- if (this.dirtyRegion.intersects(item)) {
- var newClip = this.dirtyRegion.getClip();
- if (newClip.hasSize()) {
- this.setClip(newClip);
- }
- this.drawShape(item);
- }
- {
- for (var __i_enFor0 = 0, __exp_enFor0 = item.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- this.render(child);
- }
- }
- if (matrix) {
- this.restoreGraphicsState();
- }
- },
- /** @expose */
- start : function() {},
- /** @expose */
- finish : function() {},
- drawShape : function(sceneItem) {
- var x, y;
- var text, points;
- var attributes = sceneItem.attributes;
- switch (sceneItem.rave_getDrawType()) {
- case (1000):
- this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(sceneItem));
- this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
- x = + (attributes.getByIndex(0));
- y = + (attributes.getByIndex(1));
- var width = + (attributes.getByIndex(2));
- var height = + (attributes.getByIndex(3));
- this.drawRect(x, y, width, height);
- break;
- case (1001):
- this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
- var x1 = + (attributes.getByIndex(4));
- var y1 = + (attributes.getByIndex(7));
- var x2 = + (attributes.getByIndex(5));
- var y2 = + (attributes.getByIndex(8));
- this.drawLine(x1, y1, x2, y2);
- break;
- case (1003):
- this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
- text = attributes.getByIndex(12);
- x = + (attributes.getByIndex(0));
- y = + (attributes.getByIndex(1));
- this.drawText(text, com_ibm_rave_render_internal_style_StyleManager.getFont(sceneItem), x, y);
- break;
- case (1002):
- this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(sceneItem));
- this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(sceneItem));
- var cx = + (attributes.getByIndex(9));
- var cy = + (attributes.getByIndex(10));
- var r = + (attributes.getByIndex(6)) * 2;
- this.drawEllipse(cx, cy, r, r);
- break;
- case (1009):
- points = sceneItem.getAttribute("points");
- if (points.length > 0) {
- this.prepPath(sceneItem, "points", 'M' + points);
- }
- break;
- case (1010):
- points = sceneItem.getAttribute("points");
- if (points.length > 0) {
- this.prepPath(sceneItem, "points", 'M' + points + 'Z');
- }
- break;
- case (1006):
- this.prepPath(sceneItem, "d", sceneItem.getAttribute("d"));
- break;
- default:
- break;
- }
- },
- prepPath : function(node, attr, d) {
- this.fill(com_ibm_rave_render_internal_style_StyleManager.getFill(node));
- this.stroke(com_ibm_rave_render_internal_style_StyleManager.getStroke(node));
- this.drawPath(this.createPath2D(node, attr, d));
- },
- applyMatrix : function(matrix) {
- this.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
- },
- /**
- * Create a path object understood by this renderer to be used in the {@link #this.drawPath(Object)} method.
- * @param (com.ibm.rave.core.scene.SceneNode) node the scene node owning the path
- * @param (String) attr the attribute of the scene node containing the original path
- * @param (String) d the path string to parse
- * @return (Object) a path object
- */
- /** @expose */
- createPath2D : function(node, attr, d) {},
- /**
- * Draw the path object created by {@link #this.createPath2D(com_ibm_rave_core_scene_SceneNode, String)} .
- * @param (Object) path a path object
- */
- /** @expose */
- drawPath : function(path) {},
- /** @expose */
- drawRect : function(x, y, width, height) {},
- /** @expose */
- drawLine : function(x1, y1, x2, y2) {},
- /** @expose */
- drawText : function(text, style, x, y) {},
- /** @expose */
- drawEllipse : function(centerX, centerY, width, height) {},
- /** @expose */
- drawImage : function(url, height, width) {},
- /** @expose */
- fill : function(fill) {},
- /** @expose */
- stroke : function(stroke) {},
- /** @expose */
- transform : function(a, b, c, d, e, f) {},
- /** @expose */
- saveGraphicsState : function() {},
- /** @expose */
- restoreGraphicsState : function() {},
- /** @expose */
- setClip : function(newClip) {},
- /** @expose */
- clearRect : function(clip) {}
- });
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare (load)
- // @import com/ibm/rave/render/AbstractRenderer (load)
- // @import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime)
- // @import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime)
- // @import com/ibm/rave/core/nativeImpl/Object (runtime)
- // @import com/ibm/rave/render/event/EventManager (runtime)
- // @import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime)
- // @import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime)
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing (runtime)
- var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_AbstractRenderer, {
-
- constructor : function() {
- this._context = this._getCanvasNode().getContext('2d');
- this._hasNativeDash = typeof this._context.setLineDash == "function";
- this._hasNativePath2D = !!window.Path2D;
- },
- clear: function() {
- this.saveGraphicsState();
- var canvas = this._getCanvasNode(), ctx = this._context;
-
- // Clear the main rect. remove any transforms for this calculation just to be sure.
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- this.restoreGraphicsState();
- },
- fill: function (fill) {
- this._fill = fill;
- },
-
- stroke: function (stroke) {
- this._stroke = stroke;
- this._dashArray = !this._hasNativeDash && stroke ? stroke.getDashArray() : null;
- },
-
- start: function() {
- this.clear();
- },
-
- finish: function() {
- },
-
- transform: function(a,b,c,d,e,f) {
- this._context.transform(a,b,c,d,e,f);
- },
-
- drawRect: function(x,y,width,height){
- this._preDraw();
- var ctx = this._context;
- if (this._dashArray) {
- var endX = x + width, endY = y + height;
- var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x, y, endX, y);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, endX, y, endX, endY, residue);
- residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, endX, endY, x, endY, residue);
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x, endY, x, y, residue);
- } else {
- ctx.rect(x,y,width,height);
- }
- this._postDraw();
- },
-
- drawLine: function(x1, y1, x2, y2){
- this._preDraw();
- var ctx = this._context;
- if (this._dashArray) {
- com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(ctx, this._dashArray, x1, y1, x2, y2);
- } else {
- ctx.moveTo(x1, y1);
- ctx.lineTo(x2, y2);
- }
- this._postDraw();
- },
-
- createPath2D : function(node, attr, d) {
- var oriPath = node.getAttribute(attr);
- if (!oriPath.__d) {
- // cache the path on the string object itself until caching is done in common code
- oriPath = new String(oriPath);
- node.setAttribute(attr, oriPath);
- if (this._hasNativePath2D) {
- oriPath.__d = new Path2D(d);
- } else {
- oriPath.__d = new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler();
- new com_ibm_rave_render_internal_nodes_path_Path2DParser(oriPath.__d).parse(d);
- }
- }
- return oriPath.__d;
- },
-
- drawPath: function(path) {
- this._preDraw();
- var ctx = this._context;
- if (!this._hasNativePath2D) {
- path.draw(ctx, this);
- }
- if (this._fill) {
- this._applyFill(this._fill, this._hasNativePath2D);
- if (this._hasNativePath2D) {
- ctx.fill(path);
- }
- }
- if (this._stroke) {
- this._applyStroke(this._stroke, this._hasNativePath2D);
- if (this._hasNativePath2D) {
- ctx.stroke(path);
- }
- }
-
- this._postDraw();
- },
-
- drawEllipse: function(cx, cy, width, height){
- this._preDraw();
-
- // Draw an ellipse by scaling a full arc (unless it's just a circle)
- var r = width / 2, ctx = this._context, twoPI = 2 * Math.PI;
- if (width != height) {
- this.saveGraphicsState();
- if (width > height) {
- ctx.scale(1, height/width);
- } else {
- r = height / 2;
- ctx.scale(width/height, 1);
- }
- }
-
- if (this._dashArray) {
- var startAngle = 0, angle;
- for (var i = 0, l = this._dashArray.length; startAngle < twoPI; ++i) {
- angle = this._dashArray[i % l] / r;
- if (!(i % 2)) {
- ctx.moveTo(cx + (r * Math.cos(startAngle)), cy + (r * Math.sin(startAngle)));
- ctx.arc(cx, cy, r, startAngle, startAngle + angle, false);
- }
- startAngle += angle;
- }
- } else {
- ctx.arc(cx, cy, r, 0, twoPI, false);
- }
-
- if (width != height) {
- this.restoreGraphicsState();
- }
- this._postDraw();
- },
-
- drawText: function(text, style, x, y) {
- this._preDraw();
- if (this._fill) {
- this._context.fillText(text, x, y);
- }
- if (this._stroke) {
- this._context.strokeText(text, x, y, this._stroke.width);
- }
- this._postDraw();
- },
- saveGraphicsState: function() {
- this._context.save();
- },
- restoreGraphicsState: function() {
- this._context.restore();
- },
- setClip: function(clip) {
-
- },
-
- _getCanvasNode: function() {
- return this.root._canvasNode;
- },
-
- _preDraw: function() {
- this._context.beginPath();
- },
-
- _postDraw: function() {
- this._applyStyles(this._fill, this._stroke);
- },
-
- // Apply all the styles defined in the passed styles object.
- _applyStyles: function(fill, stroke) {
- this._applyFill(fill);
- this._applyStroke(stroke);
- },
-
- _applyFill: function(fill, skipFill) {
- if (fill) {
- this._context.fillStyle = fill.getColor().toString();
- if (!skipFill) {
- this._context.fill();
- }
- }
- },
-
- _applyStroke: function(stroke, skipStroke) {
- if (stroke) {
- var color = stroke.getColor().toString();
- if (color) {
- var ctx = this._context;
- ctx.strokeStyle = color;
- ctx.lineWidth = stroke.getWidth();
- ctx.lineCap = stroke.getLineCap();
- ctx.lineJoin = stroke.getLineJoin();
- ctx.miterLimit = stroke.getMiterLimit();
- if (this._hasNativeDash && stroke.getDashArray()) {
- ctx.setLineDash(stroke.getDashArray());
- ctx.lineDashOffset = stroke.getDashOffset();
- }
- if (!skipStroke) {
- ctx.stroke();
- }
- }
- }
- },
-
- createEventManager : function() {
- var canvas = this._getCanvasNode();
-
- // create a native event manager
- return new (com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager, {
- addNativeEventListener : function(eventType, listener) {
- var nativeListener = function(e) {
-
- // create an event object
- var event = wrapEvent(e);
-
- // listener callback
- listener(event);
-
- unwrapEvent(e, event);
- };
-
- canvas.addEventListener(eventType, nativeListener);
- return nativeListener;
- },
- removeNativeEventListener : function(eventType, nativeObject) {
- canvas.removeEventListener(eventType, nativeObject);
- }
- }))(this);
- }
-
- });
- var com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer_PathHandler = com_ibm_rave_core_nativeImpl_Declare({
-
- constructor : function() {
- this._cmds = [];
- },
-
- draw : function(c, r) {
- var cmds = this._cmds;
- for (var i = 0; i < cmds.length; i++) {
- cmds[i](c, r, this);
- }
- },
-
- fail : function(index) {
- this._cmds.push(function(c) {
- c.closePath();
- });
- },
-
- startPath : function() {
- this._cmds.push(function(c, r, self) {
- c.beginPath();
- self._x = self._y = 0;
- });
- },
-
- closePath : function() {
- this._cmds.push(function(c) {
- c.closePath();
- });
- },
-
- moveTo : function(x, y) {
- this._cmds.push(function(c, r, self) {
- c.moveTo(x,y);
- self._x = x;
- self._y = y;
- });
- },
-
- lineTo : function(x, y) {
- this._cmds.push(function(c, r, self) {
- if (r._dashArray) {
- self._residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.toDashedLineTo(c, r._dashArray, self._x, self._y, x, y, self._residue);
- self._x = x;
- self._y = y;
- } else {
- c.lineTo(x,y);
- }
- });
- },
-
- bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) {
- this._cmds.push(function(c, r , self) {
- if (r._dashArray) {
- 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);
- self._x = x;
- self._y = y;
- } else {
- c.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
- }
- });
- },
-
- quadraticCurveTo : function(cpx, cpy, x, y) {
- this._cmds.push(function(c, r , self) {
- if (r._dashArray) {
- 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);
- self._x = x;
- self._y = y;
- } else {
- c.quadraticCurveTo(cpx, cpy, x, y);
- }
- });
- },
-
- arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this,
- x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
- }
- });
- // $source: com/ibm/rave/core/canvas/internal/nativeImpl/Module
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @OnDemandLoad("rave-canvas")
- // Must be the first import
- // @import ./ModuleHeader
- // Other module dependencies
- // @import com/ibm/rave/core/internal/nativeImpl/Module
- // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (static)
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine (static)
- // @import com/ibm/rave/render/internal/SceneItemFactory (static)
- // @import com/ibm/rave/render/internal/nodes/RootSceneItem (static)
- // @import com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/CanvasRenderer (static)
- // @import com/ibm/rave/render/internal/nodes/AbstractSceneNode (static)
- // @import com/ibm/rave/core/nativeImpl/Object (runtime)
- // @import com/ibm/rave/render/internal/RendererConfiguration (runtime)
- // @import com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager (runtime)
- function wrapEvent(e) {
- if (!e) {
- return null;
- }
- // create an event object
- var event = {};
-
- // mixin the native event properties into the new event object
- com_ibm_rave_core_nativeImpl_Object.mixin(event, e);
-
- // create new functions on the new event object because we cannot
- // execute the mixin'd functions due to native constraints
- // also because the generated code expects properties #immediatePropagationStopped
- // and #propagationStopped
- event.preventDefault = function() {
- this.defaultPrevented = true;
- };
- event.stopImmediatePropagation = function() {
- this.immediatePropagationStopped = true;
- };
- event.stopPropagation = function() {
- this.propagationStopped = true;
- };
-
- return event;
- }
- function unwrapEvent(e, wrapped) {
- // propagate event properties to the native event
- if (wrapped.defaultPrevented) {
- e.preventDefault();
- }
- if (wrapped.immediatePropagationStopped) {
- e.stopImmediatePropagation();
- }
- if (wrapped.propagationStopped) {
- e.stopPropagation();
- }
- return e;
- }
- (function() {
- var config = rave.configuration;
-
- // register the canvas scene item factory
-
- var canvasFactory = new com_ibm_rave_render_internal_SceneItemFactory();
- config.setSceneNodeFactory("canvas", canvasFactory);
- config.setSceneNodeFactory("http://www.w3.org/1999/xhtml:CANVAS", function(nsuri, name, context) {
- var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context);
- if (!rootProvider) {
- var root = new com_ibm_rave_render_internal_nodes_RootSceneItem();
- root.getBoundingClientRect = function() {
- return context.getBoundingClientRect();
- };
- root._canvasNode = context;
- root.rave_setOwner(context);
- context.rave_setProperty("__rave_canvas_root__", root);
- // This registers the new renderer with the root scene node.
- root.setRenderer(new com_ibm_rave_canvas_internal_nativeImpl_render_canvas_CanvasRenderer(root));
- var cacheManager = new com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager(root);
- rootProvider = {
- getRoot: function() {
- return root;
- },
- getCacheManager: function() {
- return cacheManager;
- }
- };
- com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.addRootProvider(rootProvider);
- }
- var rootNode = rootProvider.getRoot();
- var item = canvasFactory("canvas", name, rootNode);
- rootNode.rave_appendChild(item);
- return item;
- });
-
- // Query Engines
- var canvasQueryEngine = new com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine();
- config.setQueryEngine("canvas", canvasQueryEngine);
- config.setQueryEngine("http://www.w3.org/1999/xhtml:CANVAS", canvasQueryEngine);
-
- // Need to override the default query selector so we can select over multiple roots (svg and canvas)
- var domQueryEngine = config.getQueryEngine(null);
- var defaultCanvasQueryEngine = new com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine(domQueryEngine);
- config.setQueryEngine(null, defaultCanvasQueryEngine);
- config.setQueryEngine("http://www.w3.org/1999/xhtml", defaultCanvasQueryEngine);
-
- // For non-DOM nodes we need to wrap the event such that it can be modified by our own dispatcher
- var oriDispatchEvent = com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent;
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.dispatchEvent = function(e) {
- var wrapped = wrapEvent(e),
- result = oriDispatchEvent.call(this, wrapped);
- unwrapEvent(e, wrapped);
- return result;
- };
- })();
- // $source: com/ibm/rave/render/internal/DirtyRegionManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/geom/RaveRect (runtime) // new
- /**
- * Manages dirty regions for a renderer.
- * @author jim
- */
- var com_ibm_rave_render_internal_DirtyRegionManager = com_ibm_rave_core_nativeImpl_Declare({
- //dirtyRegion : null,
- constructor : function() {
- this.dirtyRegion = new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0);
- },
- /**
- * Add a sceneItem's bounds to the current dirtyRegion.
- * @param (com.ibm.rave.core.scene.SceneNode) sceneItem
- */
- add : function(sceneItem) {
- if (!this.dirtyRegion || !(this.dirtyRegion.hasSize())) {
- this.dirtyRegion = sceneItem.getBBox();
- } else {
- this.dirtyRegion = this.dirtyRegion.createIntersect(sceneItem.getBBox());
- }
- },
- /**
- * Clear all dirty regions.
- */
- clear : function() {
- this.dirtyRegion = null;
- },
- getClip : function() {
- return this.dirtyRegion;
- },
- /**
- * Does the passed scene item intersect with the current dirty region.
- * @param (com.ibm.rave.core.scene.SceneNode) item
- * @return (boolean) true if the item intersects with the current dirty region, false otherwise.
- */
- intersects : function(item) {
- if (!this.dirtyRegion || !(this.dirtyRegion.hasSize())) {
- return true;
- }
- return this.dirtyRegion.intersects(item.getBBox());
- }
- });
- // $source: com/ibm/rave/render/internal/style/AbstractStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * An abstract implementation of a style. Includes things typically required in a style class like color, opacity, etc.
- * @author jim
- */
- var com_ibm_rave_render_internal_style_AbstractStyle = com_ibm_rave_core_nativeImpl_Declare({
- opacity : 0,
- constructor : function(opacity) {
- this.opacity = opacity;
- },
- /**
- * Return opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque.
- * @return (double) opacity of this style between 0-1.
- */
- getOpacity : function() {
- return this.opacity;
- },
- /**
- * Does this style produce a style that is visible and should be drawn.
- * @return (boolean) <code>true</code> if this style is visible <code>false</code> otherwise.
- */
- isVisible : function() {
- return this.opacity > 0;
- }
- });
- // $source: com/ibm/rave/render/internal/style/FillStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- var com_ibm_rave_render_internal_style_FillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- //color : null,
- /**
- * 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.
- * @param (String) color A color style to apply as a fill in a CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc).
- * @param (double) opacity The amount of opacity to apply from 0 (transparent) to 1 (opaque).
- * @see <a
- * href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>
- */
- constructor : function(color, opacity) {
- this.color = com_ibm_rave_core_Rave.rgb(color);
- },
- /**
- * Parses the value of getColor() as an RGB string and returns a new RGB object.
- * @return (com.ibm.rave.core.color.RGB) RGB object representing color.
- */
- getColor : function() {
- return this.color;
- },
- isVisible : function() {
- return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.color;
- }
- });
- // $source: com/ibm/rave/render/internal/style/StrokeStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass
- //@import com/ibm/rave/core/Rave (runtime) // rgb
- var com_ibm_rave_render_internal_style_StrokeStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, {
- //lineJoin : null,
- //lineCap : null,
- //dashArray : null,
- //strokeColor : null,
- width : 0,
- miterLimit : 0,
- dashOffset : 0,
- /**
- * A class that holds information about stroke styling.
- * @param (String) strokeColor A string representation of a color in CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc)
- * @param (double) width the pixel stroke width
- * @param (double) opacity the opacity between 0 and 1 inclusive
- * @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'.
- * @param (String) lineJoin the type of corner created when two lines meet. Valid values: bevel, round, miter
- * @param (String) lineCap the style of end caps for a line. Valid values: butt, round, square
- * @param (float[]) dashArray the pattern of dashes and gaps (positive numbers) used to stroke paths
- * @param (double) dashOffset the distance into the dash pattern to start the dash
- */
- constructor : function(strokeColor, width, opacity, miterLimit, lineJoin, lineCap, dashArray, dashOffset) {
- this.strokeColor = com_ibm_rave_core_Rave.rgb(strokeColor);
- this.width = width;
- this.miterLimit = miterLimit;
- this.lineJoin = lineJoin;
- this.lineCap = lineCap;
- this.dashArray = dashArray;
- this.dashOffset = dashOffset;
- },
- isVisible : function() {
- return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.width > 0;
- },
- /**
- * Return the stroke width.
- * @return (double) Stroke width.
- */
- getWidth : function() {
- return this.width;
- },
- /**
- * Return the line cap.
- * @return (String) line cap
- */
- getLineCap : function() {
- return this.lineCap;
- },
- /**
- * Return the line join
- * @return (String) line join
- */
- getLineJoin : function() {
- return this.lineJoin;
- },
- /**
- * Return the miter limit.
- * @return (double) the miter limit
- */
- getMiterLimit : function() {
- return this.miterLimit;
- },
- /**
- * Return the stroke color as RGB. May return null.
- * @return (com.ibm.rave.core.color.RGB) Set stroke color. Returns 'black' if the defined color is not valid.
- */
- getColor : function() {
- return this.strokeColor;
- },
- /**
- * Return the dash array.
- * @return (float[]) the dash array
- */
- getDashArray : function() {
- return this.dashArray;
- },
- /**
- * Return the dash offset.
- * @return (double) the dash offset
- */
- getDashOffset : function() {
- return this.dashOffset;
- }
- });
- // $source: com/ibm/rave/render/internal/style/FontStyle
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- var com_ibm_rave_render_internal_style_FontStyle = com_ibm_rave_core_nativeImpl_Declare({
- //style : null,
- //family : null,
- size : 0,
- unit : 0,
- weight : 0,
- /**
- * 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.
- * @param (String) style The style in which the font is displayed. Valid values are "normal", "italic", "oblique".
- * @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.
- * @param (String) size The font size in 'unit' measurements.
- * @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} .
- * @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".
- */
- constructor : function(style, family, size, unit, weight) {
- if (style == null) {
- style = "";
- }
- this.style = style;
- this.size = com_ibm_rave_render_internal_style_FontStyle.parseFontSize(size);
- this.unit = com_ibm_rave_render_internal_style_FontStyle.parseFontUnit(unit);
- if (family == null) {
- family = "";
- }
- this.family = family;
- this.weight = com_ibm_rave_render_internal_style_FontStyle.parseWeight(weight);
- },
- getStyle : function() {
- return this.style;
- },
- /**
- * Returns the current size of the font in the set unit.
- * @return (double) The size of the font in the current unit measurement.
- */
- getSize : function() {
- return this.size;
- },
- /**
- * 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.
- * @return (String) Font family as a comma separated (CSS-style) list.
- */
- getFamily : function() {
- return this.family;
- },
- /**
- * Return the unit type set for this style. {@link (com.ibm.rave.render.internal.style.FontUnitType) FontUnitType}
- * @return (int) int representing a FontUnitType c-style enum.
- */
- getUnit : function() {
- return this.unit;
- },
- /**
- * Return the weight type set for this style. {@link (com.ibm.rave.render.internal.style.FontWeightType) FontWeightType}
- * @return (int) int representing a FontUnitType c-style enum.
- */
- getWeight : function() {
- return this.weight;
- }
- });
- /**
- * Parse out the unit type from a 'font-size' CSS style. Defaults to 'FontUnitType.PX' (pixels). Valid values are: <p> px
- * @param (String) style Full font-size property (ie- 12px, 21 pt, etc)
- * @return (int) FontUnitType enum value that represents the type of unit.
- */
- com_ibm_rave_render_internal_style_FontStyle.parseFontUnit = function(style) {
- return 1000;
- };
- com_ibm_rave_render_internal_style_FontStyle.parseFontSize = function(size) {
- if (size == null || size.length == 0) {
- return 12.0;
- }
- return + (size);
- };
- com_ibm_rave_render_internal_style_FontStyle.parseWeight = function(weight2) {
- var type = 1000;
- if (weight2 != null) {
- if (weight2 == "normal") {
- type = 1000;
- } else if (weight2 == "bold") {
- type = 1001;
- } else {
- var value = + (weight2);
- value = Math.floor((value + 50) / 100) * 100;
- if (value <= 100) {
- type = 100;
- } else if (value == 200) {
- type = 200;
- } else if (value == 300) {
- type = 300;
- } else if (value == 400) {
- type = 400;
- } else if (value == 500) {
- type = 500;
- } else if (value == 600) {
- type = 600;
- } else if (value == 700) {
- type = 700;
- } else if (value == 800) {
- type = 800;
- } else if (value >= 900) {
- type = 900;
- }
- }
- }
- return type;
- };
- com_ibm_rave_render_internal_style_FontStyle.DEFAULT_FONT_SIZE = 12;
- com_ibm_rave_render_internal_style_FontStyle.DEFAULT_FONT_UNIT = 1000;
- // $source: com/ibm/rave/render/internal/style/StyleManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/style/FillStyle (static) // new
- //@import com/ibm/rave/render/internal/style/StrokeStyle (static) // new
- //@import com/ibm/rave/render/internal/style/FontStyle (static) // new
- /**
- * An internal helper class that converts styles on a SceneNode to internal style classes (FillStyle, FontStyle, etc).
- */
- var com_ibm_rave_render_internal_style_StyleManager = com_ibm_rave_core_nativeImpl_Declare({
- });
- /**
- * 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.
- * @return (com.ibm.rave.render.internal.style.FillStyle) FillStyle object representing styles set on the node.
- */
- com_ibm_rave_render_internal_style_StyleManager.getFill = function(node) {
- var fill = node.rave_getStyle("fill");
- if (fill == null || fill.length == 0) {
- fill = "#000000";
- } else if ("transparent" == fill || "none" == fill) {
- return null;
- }
- var opacity = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "fill-opacity", 1);
- if (opacity > 0) {
- var gradient = null;
- return new com_ibm_rave_render_internal_style_FillStyle(fill, Math.max(opacity, 1));
- }
- return null;
- };
- /**
- * 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.
- * @return (com.ibm.rave.render.internal.style.StrokeStyle) FillStyle object representing styles set on the node.
- */
- com_ibm_rave_render_internal_style_StyleManager.getStroke = function(node) {
- var stroke = node.rave_getStyle("stroke");
- if (stroke == null || stroke.length == 0 || "transparent" == stroke || "none" == stroke) {
- return null;
- }
- var strokeWidth = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-width", 1);
- if (strokeWidth > 0) {
- var opacity = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-opacity", 1);
- if (opacity > 0) {
- var miterLimit = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-miterlimit", 4);
- var lineJoin = node.rave_getStyle("stroke-linejoin");
- if (lineJoin == null) {
- lineJoin = "miter";
- }
- var lineCap = node.rave_getStyle("stroke-linecap");
- if (lineCap == null) {
- lineCap = "butt";
- }
- var dashArray = com_ibm_rave_render_internal_style_StyleManager.getDashArray(node);
- var dashOffset = com_ibm_rave_render_internal_style_StyleManager.getDoubleValue(node, "stroke-dashoffset", 1);
- return new com_ibm_rave_render_internal_style_StrokeStyle(stroke, strokeWidth, Math.max(opacity, 1), miterLimit, lineJoin, lineCap, dashArray, dashOffset);
- }
- }
- return null;
- };
- /**
- * 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>
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node with styles set.
- * @return (com.ibm.rave.render.internal.style.FontStyle) FontStyle object that holds font information for drawing.
- */
- com_ibm_rave_render_internal_style_StyleManager.getFont = function(node) {
- var style = node.rave_getStyle("font-style");
- var family = node.rave_getStyle("font-family");
- var unit = node.rave_getStyle("font-size");
- var size = unit;
- var weight = node.rave_getStyle("font-weight");
- return new com_ibm_rave_render_internal_style_FontStyle(style, family, size, unit, weight);
- };
- com_ibm_rave_render_internal_style_StyleManager.getDoubleValue = function(node, style, def) {
- var result = def;
- var o = node.rave_getStyle(style);
- if (o != null) {
- result = + (o);
- if (isNaN(result)) {
- result = def;
- }
- }
- return result;
- };
- com_ibm_rave_render_internal_style_StyleManager.getDashArray = function(node) {
- var dashArray;
- var o = node.rave_getStyle("stroke-dasharray");
- if (o != null) {
- var parts = o.split(",");
- var odd = (parts.length % 2) == 1;
- dashArray = [];
- var i = 0;
- for (var __i_enFor0 = 0, __len_enFor0 = parts.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var part = parts[__i_enFor0];
- part = part.trim();
- dashArray[i++] = + (part);
- }
- if (odd) {
- for (var j = 0; j < parts.length; ++j) {
- dashArray[i++] = dashArray[j];
- }
- }
- }
- return dashArray;
- };
- //com_ibm_rave_render_internal_style_StyleManager.TRANSPARENT = "transparent";
- //com_ibm_rave_render_internal_style_StyleManager.NONE = "none";
- //com_ibm_rave_render_internal_style_StyleManager.BLACK = "#000000";
- //com_ibm_rave_render_internal_style_StyleManager.FILL = "fill";
- //com_ibm_rave_render_internal_style_StyleManager.FILL_OPACITY = "fill-opacity";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE = "stroke";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_WIDTH = "stroke-width";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_OPACITY = "stroke-opacity";
- //com_ibm_rave_render_internal_style_StyleManager.FONT_STYLE = "font-style";
- //com_ibm_rave_render_internal_style_StyleManager.FONT_FAMILY = "font-family";
- //com_ibm_rave_render_internal_style_StyleManager.FONT_SIZE = "font-size";
- //com_ibm_rave_render_internal_style_StyleManager.FONT_WEIGHT = "font-weight";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_LINECAP = "stroke-linecap";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_LINEJOIN = "stroke-linejoin";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_MITERLIMIT = "stroke-miterlimit";
- //com_ibm_rave_render_internal_style_StyleManager.BUTT = "butt";
- //com_ibm_rave_render_internal_style_StyleManager.MITER = "miter";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_DASHARRAY = "stroke-dasharray";
- //com_ibm_rave_render_internal_style_StyleManager.STROKE_DASHOFFSET = "stroke-dashoffset";
- // $source: com/ibm/rave/render/event/EventManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * 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.
- */
- var com_ibm_rave_render_event_EventManager = rave_externs["EventManager"] = com_ibm_rave_core_nativeImpl_Declare({
- //eventHandlers : null,
- //renderer : null,
- constructor : function(renderer) {
- this.eventHandlers = {};
- {
- this.renderer = renderer;
- }
- },
- /**
- * Notifies the event manager that the given scene node is interested in receiving events of the given type.
- * @param (String) eventType string describing the different event types
- * @param (com.ibm.rave.core.scene.SceneNode) node scene node that will listen for events
- */
- /** @expose */
- registerEvent : function(eventType, node) {
- var info = this.eventHandlers[eventType];
- var key = "__rave-eventmanager-" + eventType;
- if (!info) {
- info = this.createNativeEventHandler(eventType);
- if (info) {
- this.eventHandlers[eventType] = info;
- node.rave_setProperty(key, eventType);
- info.addNode(node);
- }
- } else if (!(node.rave_hasProperty(key))) {
- node.rave_setProperty(key, eventType);
- info.addNode(node);
- }
- },
- /**
- * Notifies the event manager that the given scene node is no longer interested in receiving events of the given type.
- * @param (String) eventType string describing the different event types
- * @param (com.ibm.rave.core.scene.SceneNode) node scene node that was listening for events
- */
- /** @expose */
- unregisterEvent : function(eventType, node) {
- var info = this.eventHandlers[eventType];
- if (info) {
- var key = "__rave-eventmanager-" + eventType;
- if (node.rave_hasProperty(key)) {
- node.rave_setProperty(key, null);
- info.removeNode(node);
- if (info.canDispose()) {
- info.dispose();
- delete this.eventHandlers[eventType];
- }
- }
- }
- },
- createNativeEventHandler : function(eventType) {
- var result;
- if ("mouseover" == eventType) {
- result = this.createMouseOverListener(eventType);
- } else if ("mouseout" == eventType) {
- result = this.createMouseOutListener(eventType);
- } else if ("mouseenter" == eventType) {
- result = this.createMouseEnterListener(eventType);
- } else if ("mouseleave" == eventType) {
- result = this.createMouseLeaveListener(eventType);
- } else if ("click" == eventType || "dblclick" == eventType || "mousemove" == eventType || "mouseup" == eventType || "mousedown" == eventType || "contextmenu" == eventType || "wheel" == eventType) {
- result = this.createSimpleEventListener(eventType);
- } else if ("touchmove" == eventType || "touchend" == eventType || "touchcancel" == eventType) {
- result = this.createTouchEventListener(eventType);
- } else if ("touchstart" == eventType) {
- result = this.createTouchStartEventListener(eventType);
- }
- return result;
- },
- /**
- * 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.
- * @param (String) eventType the event type
- */
- createMouseOverListener : function(eventType) {
- var target;
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit && hit != target) {
- event.type = eventType;
- hit.dispatchEvent(event);
- event.type = "mousemove";
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- target = null;
- })));
- return info;
- },
- /**
- * 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.
- * @param (String) eventType the event type
- */
- createMouseOutListener : function(eventType) {
- var target;
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (target && hit != target) {
- event.type = eventType;
- target.dispatchEvent(event);
- event.type = "mousemove";
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- if (target) {
- target.dispatchEvent(event);
- target = null;
- }
- })));
- return info;
- },
- /**
- * 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.
- * @param (String) eventType the event type
- */
- createMouseEnterListener : function(eventType) {
- var target;
- var self = this;
- var ancestors = [];
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit) {
- if (hit != target) {
- var index = ancestors.indexOf(hit);
- if (index >= 0) {
- ancestors.length =index + 1;
- } else {
- event.type = eventType;
- var bubbles = event.bubbles;
- event.bubbles = false;
- var isDescendant = false;
- for (var i = ancestors.length - 1; i >= 0; --i) {
- var ancestor = ancestors[i];
- if (com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
- ancestors.length =i + 1;
- var newAncestors = [];
- var parent = hit;
- do {
- newAncestors.push(parent);
- parent.dispatchEvent(event);
- } while ((parent = parent.rave_getParentNode()) != ancestor);
- for (var j = newAncestors.length - 1; j >= 0; --j) {
- ancestors.push(newAncestors[j]);
- }
- isDescendant = true;
- break;
- }
- }
- if (!isDescendant) {
- ancestors.length = 0;
- var parent = hit;
- do {
- ancestors.push(parent);
- parent.dispatchEvent(event);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- }
- event.bubbles = bubbles;
- event.type = "mousemove";
- }
- }
- } else if (target) {
- ancestors.length = 0;
- }
- target = hit;
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- target = null;
- ancestors.length = 0;
- })));
- return info;
- },
- /**
- * 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
- * @param (String) eventType the event type
- */
- createMouseLeaveListener : function(eventType) {
- var target;
- var self = this;
- var ancestors = [];
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mousemove", this.addNativeEventListener("mousemove", function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit != target) {
- if (!target) {
- var parent = hit;
- do {
- ancestors.push(parent);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- } else {
- var index = ancestors.indexOf(hit);
- if (index >= 0) {
- for (var i = ancestors.length - 1; i > index; --i) {
- ancestors[i].dispatchEvent(event);
- }
- ancestors.length =index + 1;
- } else {
- event.type = eventType;
- var bubbles = event.bubbles;
- event.bubbles = false;
- var isDescendant = false;
- for (var i = ancestors.length - 1; i >= 0; --i) {
- var ancestor = ancestors[i];
- if (hit && com_ibm_rave_render_event_EventManager.isDescendant(ancestor, hit)) {
- ancestors.length =i + 1;
- var newAncestors = [];
- var parent = hit;
- do {
- newAncestors.push(parent);
- } while ((parent = parent.rave_getParentNode()) != ancestor);
- for (var j = newAncestors.length - 1; j >= 0; --j) {
- ancestors.push(newAncestors[j]);
- }
- isDescendant = true;
- break;
- }
- ancestor.dispatchEvent(event);
- }
- if (!isDescendant && hit) {
- var parent = hit;
- do {
- ancestors.push(parent);
- } while ((parent = parent.rave_getParentNode()));
- ancestors.reverse();
- }
- event.bubbles = bubbles;
- event.type = "mousemove";
- }
- }
- target = hit;
- }
- })));
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle("mouseout", this.addNativeEventListener("mouseout", function(event) {
- if (target) {
- event.type = eventType;
- target.dispatchEvent(event);
- target = null;
- ancestors.length = 0;
- event.type = "mouseout";
- }
- })));
- return info;
- },
- /**
- * Adds a native event listener for the same event in the event listener info.
- * @param (String) eventType the event type
- */
- createSimpleEventListener : function(eventType) {
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener = function(event) {
- var hit = self.findHit(event.clientX, event.clientY);
- if (hit) {
- hit.dispatchEvent(event);
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * Adds a native event listener for the touchstart event.
- * @param (String) eventType the event type
- */
- createTouchStartEventListener : function(eventType) {
- var self = this;
- var info = new com_ibm_rave_render_event_EventManager.EventListenerInfo(this, eventType);
- var listener = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = (event).changedTouches, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var touch = __exp_enFor0[__i_enFor0];
- var hit = self.findHit(touch.clientX, touch.clientY);
- if (hit) {
- hit.dispatchEvent(event);
- }
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * 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.
- * @param (String) eventType the event type
- */
- createTouchEventListener : function(eventType) {
- var info = new com_ibm_rave_render_event_EventManager.NodeCapturingEventListenerInfo(this, eventType);
- var listener = function(event) {
- for (var __i_enFor0 = 0, __exp_enFor0 = info.nodes, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var node = __exp_enFor0[__i_enFor0];
- node.dispatchEvent(event);
- }
- };
- info.bundles.push(new com_ibm_rave_render_event_EventManager.NativeListenerBundle(info.eventType, this.addNativeEventListener(info.eventType, listener)));
- return info;
- },
- /**
- * Finds a scene node under the given coordinates.
- * @param (double) x x coordinate
- * @param (double) y y coordinate
- * @return (com.ibm.rave.core.scene.SceneNode) the scene node under the coordinates, or <code>null</code> if none found
- */
- findHit : function(x, y) {
- var root = this.renderer.root;
- var nodeClientRect = root.rave_getOwner().getBoundingClientRect();
- return root.rave_intersection(x - nodeClientRect.left, y - nodeClientRect.top);
- },
- /**
- * Add a listener for native events.
- * @param (String) eventType the event type
- * @param (com.ibm.rave.render.event.NativeEventListener) listener the event listener
- * @return (Object) a native object, typically the native listener, which will be used when calling {@link #this.removeNativeEventListener(String, Object)}
- */
- /** @expose */
- addNativeEventListener : function(eventType, listener) {},
- /**
- * Removes a listener for native events.
- * @param (String) eventType the event type
- * @param (Object) nativeObject a native object received as the return value from {@link #this.addNativeEventListener(String, com_ibm_rave_core_event_EventListener)}
- */
- /** @expose */
- removeNativeEventListener : function(eventType, nativeObject) {}
- });
- com_ibm_rave_render_event_EventManager.isDescendant = function(ancestor, node) {
- var parent = node;
- while ((parent = parent.rave_getParentNode())) {
- if (parent == ancestor) {
- return true;
- }
- }
- return false;
- };
- com_ibm_rave_render_event_EventManager.NativeListenerBundle = function(eventType, listener) {
- this.eventType = eventType;
- this.nativeListenerObject = listener;
- };
- /**
- * Keeps a count of interested in a particular event type. When the count reaches 0, this event listener info can be disposed.
- */
- com_ibm_rave_render_event_EventManager.EventListenerInfo = com_ibm_rave_core_nativeImpl_Declare({
- //bundles : null,
- //eventType : null,
- //em : null,
- /** @expose */
- nodeCount : 0,
- constructor : function(em, eventType) {
- this.bundles = [];
- {
- this.em = em;
- this.eventType = eventType;
- }
- },
- dispose : function() {
- for (var __i_enFor0 = 0, __exp_enFor0 = this.bundles, __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var bundle = __exp_enFor0[__i_enFor0];
- this.em.removeNativeEventListener(bundle.eventType, bundle.nativeListenerObject);
- }
- },
- addNode : function(node) {
- this.nodeCount++;
- },
- removeNode : function(node) {
- this.nodeCount--;
- },
- canDispose : function() {
- return this.nodeCount == 0;
- }
- });
- /**
- * Captures addition and removal of nodes in conjunction with the count such that the listening nodes can be referenced later on for dispatching events.
- */
- com_ibm_rave_render_event_EventManager.NodeCapturingEventListenerInfo = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_event_EventManager.EventListenerInfo, {
- //nodes : null,
- constructor : function() {
- this.nodes = [];
- },
- addNode : function(node) {
- this.nodeCount++;
- this.nodes.push(node);
- },
- removeNode : function(node) {
- this.nodeCount--;
- this.nodes.splice(this.nodes.indexOf(node), 1);
- }
- //constructor : function(em, eventType) {}
- });
- /**
- * Property key for caching the type of event a node is listening to.
- */
- //com_ibm_rave_render_event_EventManager.CACHE_KEY_PREFIX = "__rave-eventmanager-";
- // $source: com/ibm/rave/render/internal/nodes/path/Path2DParser
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * SVG path parser.
- */
- var com_ibm_rave_render_internal_nodes_path_Path2DParser = com_ibm_rave_core_nativeImpl_Declare({
- //path : null,
- //d : null,
- currentX : 0, currentY : 0, xCenter : 0, yCenter : 0,
- idx : 0,
- dLength : 0,
- fail : false,
- constructor : function(path) {
- this.path = path;
- },
- parse : function(pathString) {
- this.currentX = this.currentY = this.xCenter = this.yCenter = this.idx = 0;
- this.d = pathString;
- this.dLength = pathString.length;
- this.path.startPath();
- for (; this.idx < this.dLength;) {
- this.fail = false;
- this.skipWhitespace();
- switch (this.d.charCodeAt(this.idx++)) {
- case 109:
- this._moveTo(false);
- break;
- case 77:
- this._moveTo(true);
- break;
- case 108:
- this._lineTo(false, true, true);
- break;
- case 76:
- this._lineTo(true, true, true);
- break;
- case 99:
- this._bezierCurveTo(false, false);
- break;
- case 67:
- this._bezierCurveTo(true, false);
- break;
- case 115:
- this._bezierCurveTo(false, true);
- break;
- case 83:
- this._bezierCurveTo(true, true);
- break;
- case 113:
- this._quadraticCurveTo(false, false);
- break;
- case 81:
- this._quadraticCurveTo(true, false);
- break;
- case 116:
- this._quadraticCurveTo(false, true);
- break;
- case 84:
- this._quadraticCurveTo(true, true);
- break;
- case 104:
- this._lineTo(false, false, true);
- break;
- case 72:
- this._lineTo(true, false, true);
- break;
- case 118:
- this._lineTo(false, true, false);
- break;
- case 86:
- this._lineTo(true, true, false);
- break;
- case 97:
- this._arcTo(false);
- break;
- case 65:
- this._arcTo(true);
- break;
- case 122:
- case 90:
- this.path.closePath();
- break;
- default:
- this.path.fail(this.idx - 1);
- return;
- }
- }
- },
- /**
- * Skips 4 different types of whitespace characters: <ul> <li>space</li> <li>line feed</li> <li>tab</li> <li>carriage return</li>
- */
- skipWhitespace : function() {
- while (this.idx < this.dLength) {
- switch (this.d.charCodeAt(this.idx)) {
- case 32:
- case 13:
- case 10:
- case 9:
- this.idx++;
- break;
- default:
- return;
- }
- }
- },
- /**
- * Skips whitespace following by an optional comma and additional whitespace.
- */
- skipWhitespaceComma : function() {
- this.skipWhitespace();
- if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 44) {
- this.idx++;
- this.skipWhitespace();
- }
- },
- /**
- * Increments the index if a '-' or '+' sign is identified.
- */
- sign : function() {
- if (this.idx < this.dLength) {
- var c = this.d.charCodeAt(this.idx);
- if (c == 45 || c == 43) {
- this.idx++;
- }
- }
- },
- /**
- * Increments the index for each digit found.
- * @param (boolean) optional whether or not a digit sequence is optional
- */
- digitSequence : function(optional) {
- var found = optional;
- while (this.idx < this.dLength) {
- switch (this.d.charCodeAt(this.idx)) {
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- this.idx++;
- found = true;
- break;
- default:
- if (!optional && !found) {
- this.fail = true;
- }
- return;
- }
- }
- },
- /**
- * Increments the index if an exponent is found starting with 'e' or 'E' followed by an sign optional sign and required digits.
- */
- exponent : function() {
- if (this.idx < this.dLength) {
- var c = this.d.charCodeAt(this.idx);
- if (c == 101 || c == 69) {
- this.idx++;
- this.sign();
- this.digitSequence(false);
- }
- }
- },
- /**
- * 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.
- * @param (int) start the starting index of the number
- * @return (double) the parsed number
- */
- parseNumber : function(start) {
- this.digitSequence(true);
- if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 46) {
- this.idx++;
- this.digitSequence(false);
- if (this.fail) {
- return NaN;
- }
- }
- if (this.idx < this.dLength) {
- this.exponent();
- }
- if (this.idx == start) {
- this.fail = true;
- return NaN;
- }
- var result = parseFloat(this.d.substring(start, this.idx));
- this.fail = isNaN(result);
- return result;
- },
- /**
- * Parse a number with optional sign.
- * @return (double) the parsed number
- */
- number : function() {
- var start = this.idx;
- this.sign();
- return this.parseNumber(start);
- },
- /**
- * Parse a positive number with optional '+' sign.
- * @return (double) the parsed number
- */
- nonNegativeNumber : function() {
- var start = this.idx;
- if (this.idx < this.dLength && this.d.charCodeAt(this.idx) == 43) {
- this.idx++;
- }
- return this.parseNumber(start);
- },
- /**
- * Parse a number with optional preceding whitespace and comma.
- * @return (double) the parsed number
- */
- whitespaceCommaNumber : function() {
- this.skipWhitespaceComma();
- return this.number();
- },
- /**
- * Parse a number with optional preceding whitespace and comma.
- * @param (boolean) noComma whether or a not a comma is allow or not
- * @return (double) the parsed number
- */
- whitespaceOptCommaNumber : function(noComma) {
- if (noComma) {
- this.skipWhitespace();
- } else {
- this.skipWhitespaceComma();
- }
- return this.number();
- },
- /**
- * Parse a positive number with optional preceding whitespace and comma.
- * @return (double) the parsed number
- */
- whitespaceCommaNonNegativeNumber : function() {
- this.skipWhitespaceComma();
- return this.nonNegativeNumber();
- },
- /**
- * Parse a positive number with optional preceding whitespace and comma.
- * @param noComma whether or a not a comma is allow or not
- * @return (double) the parsed number
- */
- whitespaceOptCommaNonNegativeNumber : function(firstNumber) {
- if (firstNumber) {
- this.skipWhitespace();
- } else {
- this.skipWhitespaceComma();
- }
- return this.nonNegativeNumber();
- },
- /**
- * Parse an integer flag. A parsed value of 1 is 'true' while a parsed value of 0 is 'false'.
- * @return (boolean) the parsed flag
- */
- flag : function() {
- this.skipWhitespaceComma();
- var result = true;
- if (this.idx < this.dLength) {
- var c = this.d.charCodeAt(this.idx);
- if (c == 48) {
- result = false;
- } else if (c != 49) {
- this.fail = true;
- }
- } else {
- this.fail = true;
- }
- if (!this.fail) {
- this.idx++;
- }
- return result;
- },
- _moveTo : function(absolute) {
- this.skipWhitespace();
- var x = this.number();
- if (this.fail) {
- return;
- }
- var y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- this.path.moveTo(x, y);
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- this.skipWhitespaceComma();
- this._lineTo(absolute, true, true);
- },
- _lineTo : function(absolute, vertical, horizontal) {
- var noComma = true;
- for (;;) {
- var x = 0, y = 0;
- if (horizontal) {
- x = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- }
- } else {
- x = this.currentX;
- }
- if (vertical) {
- y = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- if (!absolute) {
- y += this.currentY;
- }
- } else {
- y = this.currentY;
- }
- this.path.lineTo(x, y);
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- noComma = false;
- }
- },
- _quadraticCurveTo : function(absolute, usePreviousCP) {
- var noComma = true;
- var cpx, cpy, x, y;
- for (;;) {
- if (usePreviousCP) {
- cpx = 2 * this.currentX - this.xCenter;
- cpy = 2 * this.currentY - this.yCenter;
- } else {
- cpx = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- cpy = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- }
- x = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- this.path.quadraticCurveTo(cpx, cpy, x, y);
- this.currentX = x;
- this.currentY = y;
- this.xCenter = cpx;
- this.yCenter = cpy;
- noComma = false;
- }
- },
- _bezierCurveTo : function(absolute, usePreviousCP) {
- var noComma = true;
- var cpx1, cpy1, cpx2, cpy2, x, y;
- for (;;) {
- if (usePreviousCP) {
- cpx1 = 2 * this.currentX - this.xCenter;
- cpy1 = 2 * this.currentY - this.yCenter;
- } else {
- cpx1 = this.whitespaceOptCommaNumber(noComma);
- noComma = false;
- if (this.fail) {
- return;
- }
- cpy1 = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- }
- cpx2 = this.whitespaceOptCommaNumber(noComma);
- if (this.fail) {
- return;
- }
- cpy2 = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- x = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- cpx1 += this.currentX;
- cpy1 += this.currentY;
- cpx2 += this.currentX;
- cpy2 += this.currentY;
- x += this.currentX;
- y += this.currentY;
- }
- this.path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y);
- this.currentX = x;
- this.currentY = y;
- this.xCenter = cpx2;
- this.yCenter = cpy2;
- noComma = false;
- }
- },
- _arcTo : function(absolute) {
- var noComma = true, largeArcFlag, sweepFlag;
- var rx, ry, xAxisRotation, x, y;
- for (;;) {
- rx = this.whitespaceOptCommaNonNegativeNumber(noComma);
- if (this.fail) {
- return;
- }
- ry = this.whitespaceCommaNonNegativeNumber();
- if (this.fail) {
- return;
- }
- xAxisRotation = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- largeArcFlag = this.flag();
- if (this.fail) {
- return;
- }
- sweepFlag = this.flag();
- if (this.fail) {
- return;
- }
- x = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- y = this.whitespaceCommaNumber();
- if (this.fail) {
- return;
- }
- if (!absolute) {
- x += this.currentX;
- y += this.currentY;
- }
- if (this.currentX != x || this.currentY != y) {
- if (rx == 0 || ry == 0) {
- this.path.lineTo(x, y);
- } else {
- this.path.arcTo(this.currentX, this.currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
- }
- this.xCenter = this.currentX = x;
- this.yCenter = this.currentY = y;
- }
- noComma = false;
- }
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/path/Path2DUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/transform/MatrixUtil (static) // identity, mapPoints
- var com_ibm_rave_render_internal_nodes_path_Path2DUtil = {
- //constructor : function() {}
- };
- /**
- * Utility for converting an SVG arc to bezier curves. Useful for platforms that do not support the SVG arc in the same way.
- */
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier = function(path, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
- var angle = xAxisRotation % 360;
- var dx2 = (x0 - x) / 2.0;
- var dy2 = (y0 - y) / 2.0;
- var angleRad = angle / 180.0 * Math.PI;
- var cosAngle = Math.cos(angleRad);
- var sinAngle = Math.sin(angleRad);
- var x1 = (cosAngle * dx2 + sinAngle * dy2);
- var y1 = (-sinAngle * dx2 + cosAngle * dy2);
- var rxAbs = Math.abs(rx);
- var ryAbs = Math.abs(ry);
- var Prx = rxAbs * rxAbs;
- var Pry = ryAbs * ryAbs;
- var Px1 = x1 * x1;
- var Py1 = y1 * y1;
- var radiiCheck = Px1 / Prx + Py1 / Pry;
- if (radiiCheck > 1) {
- rxAbs = Math.sqrt(radiiCheck) * rxAbs;
- ryAbs = Math.sqrt(radiiCheck) * ryAbs;
- Prx = rxAbs * rxAbs;
- Pry = ryAbs * ryAbs;
- }
- var sign = (largeArcFlag == sweepFlag) ? -1 : 1;
- var sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1));
- sq = (sq < 0) ? 0 : sq;
- var coef = (sign * Math.sqrt(sq));
- var cx1 = coef * ((rxAbs * y1) / ryAbs);
- var cy1 = coef * -((ryAbs * x1) / rxAbs);
- var sx2 = (x0 + x) / 2.0;
- var sy2 = (y0 + y) / 2.0;
- var cx = sx2 + (cosAngle * cx1 - sinAngle * cy1);
- var cy = sy2 + (sinAngle * cx1 + cosAngle * cy1);
- var ux = (x1 - cx1) / rxAbs;
- var uy = (y1 - cy1) / ryAbs;
- var vx = (-x1 - cx1) / rxAbs;
- var vy = (-y1 - cy1) / ryAbs;
- var p, n;
- n = Math.sqrt((ux * ux) + (uy * uy));
- p = ux;
- sign = (uy < 0) ? -1 : 1;
- var angleStart = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
- n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
- p = ux * vx + uy * vy;
- sign = (ux * vy - uy * vx < 0) ? -1 : 1;
- var angleExtent = (sign * Math.acos(p / n)) * 180.0 / Math.PI;
- if (!sweepFlag && angleExtent > 0) {
- angleExtent -= 360;
- } else if (sweepFlag && angleExtent < 0) {
- angleExtent += 360;
- }
- angleExtent %= 360;
- angleStart %= 360;
- var bezierPoints = com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers(angleStart, angleExtent);
- var m = com_ibm_rave_core_transform_MatrixUtil.identity();
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.scaleNonUniform(rxAbs, ryAbs));
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.rotate(angle));
- com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.translate(cx, cy));
- bezierPoints[bezierPoints.length - 2] = x;
- bezierPoints[bezierPoints.length - 1] = y;
- for (var i = 0; i < bezierPoints.length; i += 6) {
- path.bezierCurveTo(bezierPoints[i], bezierPoints[i + 1], bezierPoints[i + 2], bezierPoints[i + 3], bezierPoints[i + 4], bezierPoints[i + 5]);
- }
- };
- com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers = function(angleStart, angleExtent) {
- var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0);
- var angleStartRad = angleStart / 180.0 * Math.PI;
- var angleExtentRad = angleExtent / 180.0 * Math.PI;
- var angleIncrement = (angleExtentRad / numSegments);
- var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));
- var coords = [];
- var pos = 0;
- for (var i = 0; i < numSegments; ++i) {
- var angle = angleStartRad + i * angleIncrement;
- var dx = Math.cos(angle);
- var dy = Math.sin(angle);
- coords[pos++] = (dx - controlLength * dy);
- coords[pos++] = (dy + controlLength * dx);
- angle += angleIncrement;
- dx = Math.cos(angle);
- dy = Math.sin(angle);
- coords[pos++] = (dx + controlLength * dy);
- coords[pos++] = (dy - controlLength * dx);
- coords[pos++] = dx;
- coords[pos++] = dy;
- }
- return coords;
- };
- // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCacheManager
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache (runtime) // new
- //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime) // addNotificationListener
- /**
- * A manager for a scene node cache. Listens for events on a scene node item and updates the cache if needed.
- */
- var com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager = com_ibm_rave_core_nativeImpl_Declare({
- //idCache : null,
- //classCache : null,
- constructor : function() {
- this.idCache = new com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache();
- this.classCache = new com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache();
- /**
- * Create a new cache manager that handles caching for 'root' node.
- * @param root The root node of this scene tree.
- */
- {
- com_ibm_rave_render_internal_nodes_AbstractSceneNode.addNotificationListener(this);
- }
- },
- /**
- * Retrieve a single SceneNode from a cache, anywhere within this scene tree from the owner down.
- * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
- * @param (String) idString Unique id to search for in this entire scene tree, starting from the owner.
- * @return (com.ibm.rave.core.scene.SceneNode) SceneNode matching the passed unique id.
- */
- getOne : function(cacheId, idString) {
- if (cacheId == 1000) {
- return this.idCache.get(idString);
- }
- return null;
- },
- /**
- * Retrieve a list of SceneNodes with a particular class anywhere within this scene tree from the owner down.
- * @param (int) cacheId The SceneNodeCacheType id of the cache to retrieve a single value from.
- * @param (String) className className to search for in this entire scene tree, starting from the owner.
- * @return (Array) All SceneNodes matching the passed class.
- */
- getMany : function(cacheId, className) {
- if (cacheId == 1001) {
- return this.classCache.get(className);
- }
- return null;
- },
- /**
- * 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.
- * @param value
- * @param context
- */
- addToIDCache : function(node) {
- this.idCache.add(node.id, node);
- },
- /**
- * 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.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node The node to add
- * @param (String) className The key of the set of nodes.
- */
- addToClassCache : function(node, className) {
- if (className == null) {
- return;
- }
- this.classCache.add(className, node);
- },
- /**
- * Add all classes on this node to the cache.
- * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node
- */
- addAllClassesToClassCache : function(node) {
- this.classCache.addMany(node.getClassSet(), node);
- },
- removeFromIdCache : function(node) {
- if (node.id != null) {
- this.idCache.remove$0(node.id, node);
- }
- },
- removeFromClassCache : function(node, value) {
- if (value != null) {
- this.classCache.remove$0(""+(value), node);
- }
- },
- removeAllClassesFromClassCache : function(node) {
- this.classCache.remove$1(node.getClassSet(), node);
- },
- beforeUpdate : function(type, subType, key, value, node) {
- switch (type) {
- case (1000):
- if (subType == 2000) {
- if ("id" == key) {
- this.removeFromIdCache(node);
- }
- } else if (subType == 2001) {
- this.removeFromClassCache(node, value);
- }
- break;
- default:
- break;
- }
- },
- afterUpdate : function(type, subType, key, value, node) {
- switch (type) {
- case (1000):
- if (subType == 2000) {
- if ("id" == key) {
- this.addToIDCache(node);
- }
- } else if (subType == 2001 && value != null) {
- this.addToClassCache(node, ""+(value));
- }
- break;
- case (1001):
- this.addToIDCache(node);
- this.addAllClassesToClassCache(node);
- break;
- case (1002):
- this.removeFromIdCache(node);
- this.removeAllClassesFromClassCache(node);
- break;
- default:
- break;
- }
- }
- });
- //com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager.ID = "id";
- // $source: com/ibm/rave/render/internal/nodes/cache/SceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- /**
- * 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.
- * @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.
- */
- var com_ibm_rave_render_internal_nodes_cache_SceneNodeCache = com_ibm_rave_core_nativeImpl_Declare({
- //factory : null,
- //cache : null,
- _isReady : true,
- constructor : function() {
- this.cache = {};
- },
- /**
- * Is this cache ready to accept nodes or not?
- * @return (boolean) True if this cache is ready to accept nodes. False otherwise.
- */
- isReady : function() {
- return this._isReady;
- },
- /**
- * Add a node to this cache under 'key'.
- * @param (String) key The key of the cache.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to add
- */
- add : function(key, node) {
- if (!(this.isReady()) || key == null) {
- return null;
- }
- var container = this.get(key);
- if (!container) {
- container = this.factory(node);
- this.cache[key] = container;
- }
- return container;
- },
- /**
- * Add a node to the container of each 'key' in 'keys'.
- * @param (Object) keys Multiple key names of the cache.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to add to each key container.
- */
- addMany : function(keys, node) {
- if (!(this.isReady()) || !keys) {
- return null;
- }
- var setValues = Object.keys(keys);
- for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = setValues[__i_enFor0];
- this.add(key, node);
- }
- return setValues;
- },
- /**
- * Return the first matching node for this key from our cached set of nodes.
- * @param (String) key The bucket to get a node from.
- * @return (java.lang.Object) The first matching node for this key.
- */
- get : function(key) {
- if (!(this.isReady()) || key == null) {
- return null;
- }
- return this.cache[key];
- },
- /**
- * Remove a node from the set of nodes under 'key' in this cache.
- * @param (String) key The bucket to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$0 : function(key, node) {
- if (!(this.isReady()) || key == null) {
- return;
- }
- delete this.cache[key];
- },
- /**
- * Remove a node from multiple keys in this cache.
- * @param (Object) keys The buckets to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$1 : function(keys, node) {
- if (!(this.isReady()) || !keys) {
- return;
- }
- var setValues = Object.keys(keys);
- for (var __i_enFor0 = 0, __len_enFor0 = setValues.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var key = setValues[__i_enFor0];
- this.remove$0(key, node);
- }
- },
- remove : function(a0, a1) {
- var args = arguments;
- if (args.length == 2 && (a0 == null || typeof a0 === "string")) {
- return this.remove$0(a0, a1);
- }
- return this.remove$1(a0, a1);
- }
- //constructor : function() {}
- });
- // $source: com/ibm/rave/render/internal/nodes/cache/SingleSceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
- /**
- * A cache that can hold only one node per key (id, for example)
- */
- var com_ibm_rave_render_internal_nodes_cache_SingleSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
- /**
- * A cache that can hold only one node per key (id, for example)
- */
- constructor : function() {
- this.factory = function(node) {
- return node;
- };
- }
- });
- // $source: com/ibm/rave/render/internal/nodes/cache/MultiSceneNodeCache
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/render/internal/nodes/cache/SceneNodeCache (loadtime) // superclass
- /**
- * A cache that can hold multiple nodes per key (classes, for example)
- */
- var com_ibm_rave_render_internal_nodes_cache_MultiSceneNodeCache = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_cache_SceneNodeCache, {
- /**
- * A cache that can hold multiple nodes per key (classes, for example)
- */
- constructor : function() {
- this.factory = function(node) {
- return [];
- };
- },
- add : function(className, node) {
- this.remove$0(className, node);
- var container = com_ibm_rave_render_internal_nodes_cache_SceneNodeCache.prototype.add.call(this, className, node);
- if (className != null) {
- container.push(node);
- }
- return container;
- },
- /**
- * Remove a node from the set of nodes under 'key' in this cache.
- * @param (String) className The bucket to remove the node from.
- * @param (com.ibm.rave.core.scene.SceneNode) node The node to remove.
- */
- remove$0 : function(className, node) {
- var list = this.get(className);
- if (list) {
- var i = list.indexOf(node);
- if (i >= 0) {
- list.splice(i, 1);
- }
- }
- }
- });
- })();
|