rave-library.js 613 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524
  1. ;(function(root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. define(['rave'], factory);
  4. } else if (typeof exports === 'object') {
  5. module.exports = factory(require('rave'));
  6. } else {
  7. root.raveLibrary = factory(root.rave);
  8. }
  9. }(this, function(rave) {
  10. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  11. module.exports={
  12. "paletteConfiguration": {
  13. "palettes" : [
  14. {
  15. "id": "rave2.colorpalette.default",
  16. "label": "defaultPalette.label",
  17. "description": "defaultPalette.description",
  18. "icon": "",
  19. "fillType": "simple",
  20. "fills":[
  21. "#5aaafa",
  22. "#4178be",
  23. "#af6ee8",
  24. "#a6266e",
  25. "#d74108",
  26. "#ff7832",
  27. "#fdd600",
  28. "#00b4a0",
  29. "#008571",
  30. "#264a60",
  31. "#7cc7ff",
  32. "#7c1c58",
  33. "#ff3ca0",
  34. "#ff71d4",
  35. "#e71d32",
  36. "#a53725",
  37. "#efc100",
  38. "#be9b00",
  39. "#8cd211",
  40. "#4b8400"
  41. ]
  42. },
  43. {
  44. "id": "rave2.colorpalette.dark",
  45. "label": "rave2.colorpalette.dark.label",
  46. "description": "rave2.colorpalette.dark.description",
  47. "icon": "",
  48. "fillType": "simple",
  49. "fills":[
  50. "#166888",
  51. "#045272",
  52. "#524d71",
  53. "#64144f",
  54. "#8f3022",
  55. "#8f5515",
  56. "#978126",
  57. "#00625e",
  58. "#004844",
  59. "#012e47",
  60. "#507b91",
  61. "#4b184a",
  62. "#8c2658",
  63. "#915268",
  64. "#7c131a",
  65. "#6d2b17",
  66. "#956c0e",
  67. "#616020",
  68. "#537627",
  69. "#005232"
  70. ]
  71. },
  72. {
  73. "id": "rave2.colorpalette.light",
  74. "label": "rave2.colorpalette.light.label",
  75. "description": "rave2.colorpalette.light.description",
  76. "icon": "",
  77. "fillType": "simple",
  78. "fills":[
  79. "#a7def4",
  80. "#9bd0e5",
  81. "#d0cce4",
  82. "#dca6cd",
  83. "#f9b9b0",
  84. "#f8d2a7",
  85. "#feefb2",
  86. "#99dad8",
  87. "#99c9c7",
  88. "#99b7c9",
  89. "#b9d3e0",
  90. "#cba9cb",
  91. "#f6b3d3",
  92. "#facfde",
  93. "#eba6ab",
  94. "#e1b6a8",
  95. "#fce1a2",
  96. "#d9d9af",
  97. "#d0e7b3",
  98. "#99d0ba"
  99. ]
  100. },
  101. {
  102. "id": "rave2.colorpalette.medical",
  103. "label": "rave2.colorpalette.medical.label",
  104. "description": "rave2.colorpalette.medical.description",
  105. "icon": "",
  106. "fillType": "simple",
  107. "fills":[
  108. "#1ec0d7",
  109. "#0992da",
  110. "#aeb6b6",
  111. "#1dcdd8",
  112. "#72b8f1",
  113. "#e4ae80",
  114. "#eccab7",
  115. "#6b9bb3",
  116. "#99d0dc",
  117. "#c5baae",
  118. "#1eadc8",
  119. "#de9f5b",
  120. "#ebac92",
  121. "#e09085",
  122. "#a8662d",
  123. "#0193b8",
  124. "#417380",
  125. "#8fcbfd",
  126. "#148fd3",
  127. "#00b4a0"
  128. ]
  129. },
  130. {
  131. "id": "rave2.colorpalette.financial",
  132. "label": "rave2.colorpalette.financial.label",
  133. "description": "rave2.colorpalette.financial.description",
  134. "icon": "",
  135. "fillType": "simple",
  136. "fills":[
  137. "#4d7aad",
  138. "#86a9d9",
  139. "#ce202c",
  140. "#264a60",
  141. "#5596e6",
  142. "#959595",
  143. "#464646",
  144. "#4178be",
  145. "#6d120f",
  146. "#aeaeae",
  147. "#645a5a",
  148. "#dec0b2",
  149. "#4178be",
  150. "#a53725",
  151. "#c7c7c7",
  152. "#8c7300",
  153. "#734098",
  154. "#264a60",
  155. "#739433",
  156. "#1896bc"
  157. ]
  158. },
  159. {
  160. "id": "rave2.colorpalette.redDiscreteSequential",
  161. "label" : "rave2.colorpalette.redDiscreteSequential.label",
  162. "description" : "rave2.colorpalette.redDiscreteSequential.description",
  163. "icon" : "",
  164. "fillType": "discrete",
  165. "valueType": "normalized",
  166. "fills": [
  167. {
  168. "fill" : "#8c101c",
  169. "at" : 0.0
  170. },
  171. {
  172. "fill" : "#ad1625",
  173. "at" : 0.143
  174. },
  175. {
  176. "fill" : "#e71d32",
  177. "at" : 0.286
  178. },
  179. {
  180. "fill" : "#ff5050",
  181. "at" : 0.429
  182. },
  183. {
  184. "fill" : "#ff7d87",
  185. "at" : 0.572
  186. },
  187. {
  188. "fill" : "#ffa5b4",
  189. "at" : 0.715
  190. },
  191. {
  192. "fill" : "#ffd2dd",
  193. "at" : 0.858
  194. }
  195. ]
  196. },
  197. {
  198. "id": "rave2.colorpalette.orangeDiscreteSequential",
  199. "label" : "rave2.colorpalette.orangeDiscreteSequential.label",
  200. "description" : "rave2.colorpalette.orangeDiscreteSequential.description",
  201. "icon" : "",
  202. "fillType": "discrete",
  203. "valueType": "normalized",
  204. "fills": [
  205. {
  206. "fill" : "#872a0f",
  207. "at" : 0.0
  208. },
  209. {
  210. "fill" : "#a53725",
  211. "at" : 0.143
  212. },
  213. {
  214. "fill" : "#d74108",
  215. "at" : 0.286
  216. },
  217. {
  218. "fill" : "#ff5003",
  219. "at" : 0.429
  220. },
  221. {
  222. "fill" : "#ff7832",
  223. "at" : 0.572
  224. },
  225. {
  226. "fill" : "#ffa573",
  227. "at" : 0.715
  228. },
  229. {
  230. "fill" : "#ffd4a0",
  231. "at" : 0.858
  232. }
  233. ]
  234. },
  235. {
  236. "id": "rave2.colorpalette.yellowDiscreteSequential",
  237. "label" : "rave2.colorpalette.yellowDiscreteSequential.label",
  238. "description" : "rave2.colorpalette.yellowDiscreteSequential.description",
  239. "icon" : "",
  240. "fillType": "discrete",
  241. "valueType": "normalized",
  242. "fills": [
  243. {
  244. "fill" : "#574a00",
  245. "at" : 0.0
  246. },
  247. {
  248. "fill" : "#735f00",
  249. "at" : 0.143
  250. },
  251. {
  252. "fill" : "#8c7300",
  253. "at" : 0.286
  254. },
  255. {
  256. "fill" : "#be9b00",
  257. "at" : 0.429
  258. },
  259. {
  260. "fill" : "#efc100",
  261. "at" : 0.572
  262. },
  263. {
  264. "fill" : "#fdd600",
  265. "at" : 0.715
  266. },
  267. {
  268. "fill" : "#fde876",
  269. "at" : 0.858
  270. }
  271. ]
  272. },
  273. {
  274. "id": "rave2.colorpalette.greenDiscreteSequential",
  275. "label" : "rave2.colorpalette.greenDiscreteSequential.label",
  276. "description" : "rave2.colorpalette.greenDiscreteSequential.description",
  277. "icon" : "",
  278. "fillType": "discrete",
  279. "valueType": "normalized",
  280. "fills": [
  281. {
  282. "fill" : "#144d14",
  283. "at" : 0.0
  284. },
  285. {
  286. "fill" : "#2d660a",
  287. "at" : 0.143
  288. },
  289. {
  290. "fill" : "#4b8400",
  291. "at" : 0.286
  292. },
  293. {
  294. "fill" : "#5aa700",
  295. "at" : 0.429
  296. },
  297. {
  298. "fill" : "#8cd211",
  299. "at" : 0.572
  300. },
  301. {
  302. "fill" : "#b4e051",
  303. "at" : 0.715
  304. },
  305. {
  306. "fill" : "#c8f08f",
  307. "at" : 0.858
  308. }
  309. ]
  310. },
  311. {
  312. "id": "rave2.colorpalette.tealDiscreteSequential",
  313. "label" : "rave2.colorpalette.tealDiscreteSequential.label",
  314. "description" : "rave2.colorpalette.tealDiscreteSequential.description",
  315. "icon" : "",
  316. "fillType": "discrete",
  317. "valueType": "normalized",
  318. "fills": [
  319. {
  320. "fill" : "#005448",
  321. "at" : 0.0
  322. },
  323. {
  324. "fill" : "#006d5d",
  325. "at" : 0.143
  326. },
  327. {
  328. "fill" : "#008571",
  329. "at" : 0.286
  330. },
  331. {
  332. "fill" : "#00b4a0",
  333. "at" : 0.429
  334. },
  335. {
  336. "fill" : "#41d6c3",
  337. "at" : 0.572
  338. },
  339. {
  340. "fill" : "#6eedd8",
  341. "at" : 0.715
  342. },
  343. {
  344. "fill" : "#a7fae6",
  345. "at" : 0.858
  346. }
  347. ]
  348. },
  349. {
  350. "id": "rave2.colorpalette.blueDiscreteSequential",
  351. "label" : "rave2.colorpalette.blueDiscreteSequential.label",
  352. "description" : "rave2.colorpalette.blueDiscreteSequential.description",
  353. "icon" : "",
  354. "fillType": "discrete",
  355. "valueType": "normalized",
  356. "fills": [
  357. {
  358. "fill" : "#264a60",
  359. "at" : 0.0
  360. },
  361. {
  362. "fill" : "#325c80",
  363. "at" : 0.143
  364. },
  365. {
  366. "fill" : "#4178be",
  367. "at" : 0.286
  368. },
  369. {
  370. "fill" : "#5596e6",
  371. "at" : 0.429
  372. },
  373. {
  374. "fill" : "#5aaafa",
  375. "at" : 0.572
  376. },
  377. {
  378. "fill" : "#7cc7ff",
  379. "at" : 0.715
  380. },
  381. {
  382. "fill" : "#c0e6ff",
  383. "at" : 0.858
  384. }
  385. ]
  386. },
  387. {
  388. "id": "rave2.colorpalette.purpleDiscreteSequential",
  389. "label" : "rave2.colorpalette.purpleDiscreteSequential.label",
  390. "description" : "rave2.colorpalette.purpleDiscreteSequential.description",
  391. "icon" : "",
  392. "fillType": "discrete",
  393. "valueType": "normalized",
  394. "fills": [
  395. {
  396. "fill" : "#562f72",
  397. "at" : 0.0
  398. },
  399. {
  400. "fill" : "#734098",
  401. "at" : 0.143
  402. },
  403. {
  404. "fill" : "#9855d4",
  405. "at" : 0.286
  406. },
  407. {
  408. "fill" : "#af6ee8",
  409. "at" : 0.429
  410. },
  411. {
  412. "fill" : "#ba8ff7",
  413. "at" : 0.572
  414. },
  415. {
  416. "fill" : "#d7aaff",
  417. "at" : 0.715
  418. },
  419. {
  420. "fill" : "#eed2ff",
  421. "at" : 0.858
  422. }
  423. ]
  424. },
  425. {
  426. "id": "rave2.colorpalette.violetDiscreteSequential",
  427. "label" : "rave2.colorpalette.violetDiscreteSequential.label",
  428. "description" : "rave2.colorpalette.violetDiscreteSequential.description",
  429. "icon" : "",
  430. "fillType": "discrete",
  431. "valueType": "normalized",
  432. "fills": [
  433. {
  434. "fill" : "#7c1c58",
  435. "at" : 0.0
  436. },
  437. {
  438. "fill" : "#a6266e",
  439. "at" : 0.143
  440. },
  441. {
  442. "fill" : "#db2780",
  443. "at" : 0.286
  444. },
  445. {
  446. "fill" : "#ff3ca0",
  447. "at" : 0.429
  448. },
  449. {
  450. "fill" : "#ff71d4",
  451. "at" : 0.572
  452. },
  453. {
  454. "fill" : "#ff9eee",
  455. "at" : 0.715
  456. },
  457. {
  458. "fill" : "#ffd2ff",
  459. "at" : 0.858
  460. }
  461. ]
  462. },
  463. {
  464. "id": "rave2.colorpalette.redContinousSequential",
  465. "label" : "rave2.colorpalette.redContinuousSequential.label",
  466. "description" : "rave2.colorpalette.redContinuousSequential.description",
  467. "icon" : "",
  468. "fillType": "continuous",
  469. "valueType": "normalized",
  470. "fills": [
  471. {
  472. "fill" : "#8c101c",
  473. "at" : 0.0
  474. },
  475. {
  476. "fill" : "#ad1625",
  477. "at" : 0.167
  478. },
  479. {
  480. "fill" : "#e71d32",
  481. "at" : 0.334
  482. },
  483. {
  484. "fill" : "#ff5050",
  485. "at" : 0.501
  486. },
  487. {
  488. "fill" : "#ff7d87",
  489. "at" : 0.668
  490. },
  491. {
  492. "fill" : "#ffa5b4",
  493. "at" : 0.835
  494. },
  495. {
  496. "fill" : "#ffd2dd",
  497. "at" : 1.0
  498. }
  499. ]
  500. },
  501. {
  502. "id": "rave2.colorpalette.orangeContinuousSequential",
  503. "label" : "rave2.colorpalette.orangeContinuousSequential.label",
  504. "description" : "rave2.colorpalette.orangeContinuousSequential.description",
  505. "icon" : "",
  506. "fillType": "continuous",
  507. "valueType": "normalized",
  508. "fills": [
  509. {
  510. "fill" : "#872a0f",
  511. "at" : 0.0
  512. },
  513. {
  514. "fill" : "#a53725",
  515. "at" : 0.167
  516. },
  517. {
  518. "fill" : "#d74108",
  519. "at" : 0.334
  520. },
  521. {
  522. "fill" : "#ff5003",
  523. "at" : 0.501
  524. },
  525. {
  526. "fill" : "#ff7832",
  527. "at" : 0.668
  528. },
  529. {
  530. "fill" : "#ffa573",
  531. "at" : 0.835
  532. },
  533. {
  534. "fill" : "#ffd4a0",
  535. "at" : 1.0
  536. }
  537. ]
  538. },
  539. {
  540. "id": "rave2.colorpalette.yellowContinuousSequential",
  541. "label" : "rave2.colorpalette.yellowContinuousSequential.label",
  542. "description" : "rave2.colorpalette.yellowContinuousSequential.description",
  543. "icon" : "",
  544. "fillType": "continuous",
  545. "valueType": "normalized",
  546. "fills": [
  547. {
  548. "fill" : "#574a00",
  549. "at" : 0.0
  550. },
  551. {
  552. "fill" : "#735f00",
  553. "at" : 0.167
  554. },
  555. {
  556. "fill" : "#8c7300",
  557. "at" : 0.334
  558. },
  559. {
  560. "fill" : "#be9b00",
  561. "at" : 0.501
  562. },
  563. {
  564. "fill" : "#efc100",
  565. "at" : 0.668
  566. },
  567. {
  568. "fill" : "#fdd600",
  569. "at" : 0.835
  570. },
  571. {
  572. "fill" : "#fde876",
  573. "at" : 1.0
  574. }
  575. ]
  576. },
  577. {
  578. "id": "rave2.colorpalette.greenContinuousSequential",
  579. "label" : "rave2.colorpalette.greenContinuousSequential.label",
  580. "description" : "rave2.colorpalette.greenContinuousSequential.description",
  581. "icon" : "",
  582. "fillType": "continuous",
  583. "valueType": "normalized",
  584. "fills": [
  585. {
  586. "fill" : "#144d14",
  587. "at" : 0.0
  588. },
  589. {
  590. "fill" : "#2d660a",
  591. "at" : 0.167
  592. },
  593. {
  594. "fill" : "#4b8400",
  595. "at" : 0.334
  596. },
  597. {
  598. "fill" : "#5aa700",
  599. "at" : 0.501
  600. },
  601. {
  602. "fill" : "#8cd211",
  603. "at" : 0.668
  604. },
  605. {
  606. "fill" : "#b4e051",
  607. "at" : 0.835
  608. },
  609. {
  610. "fill" : "#c8f08f",
  611. "at" : 1.0
  612. }
  613. ]
  614. },
  615. {
  616. "id": "rave2.colorpalette.tealContinuousSequential",
  617. "label" : "rave2.colorpalette.tealContinuousSequential.label",
  618. "description" : "rave2.colorpalette.tealContinuousSequential.description",
  619. "icon" : "",
  620. "fillType": "continuous",
  621. "valueType": "normalized",
  622. "fills": [
  623. {
  624. "fill" : "#005448",
  625. "at" : 0.0
  626. },
  627. {
  628. "fill" : "#006d5d",
  629. "at" : 0.167
  630. },
  631. {
  632. "fill" : "#008571",
  633. "at" : 0.334
  634. },
  635. {
  636. "fill" : "#00b4a0",
  637. "at" : 0.501
  638. },
  639. {
  640. "fill" : "#41d6c3",
  641. "at" : 0.668
  642. },
  643. {
  644. "fill" : "#6eedd8",
  645. "at" : 0.835
  646. },
  647. {
  648. "fill" : "#a7fae6",
  649. "at" : 1.0
  650. }
  651. ]
  652. },
  653. {
  654. "id": "rave2.colorpalette.blueContinuousSequential",
  655. "label" : "rave2.colorpalette.blueContinuousSequential.label",
  656. "description" : "rave2.colorpalette.blueContinuousSequential.description",
  657. "icon" : "",
  658. "fillType": "continuous",
  659. "valueType": "normalized",
  660. "fills": [
  661. {
  662. "fill" : "#264a60",
  663. "at" : 0.0
  664. },
  665. {
  666. "fill" : "#325c80",
  667. "at" : 0.167
  668. },
  669. {
  670. "fill" : "#4178be",
  671. "at" : 0.334
  672. },
  673. {
  674. "fill" : "#5596e6",
  675. "at" : 0.501
  676. },
  677. {
  678. "fill" : "#5aaafa",
  679. "at" : 0.668
  680. },
  681. {
  682. "fill" : "#7cc7ff",
  683. "at" : 0.835
  684. },
  685. {
  686. "fill" : "#c0e6ff",
  687. "at" : 1.0
  688. }
  689. ]
  690. },
  691. {
  692. "id": "rave2.colorpalette.purpleContinousSequential",
  693. "label" : "rave2.colorpalette.purpleContinuousSequential.label",
  694. "description" : "rave2.colorpalette.purpleContinuousSequential.description",
  695. "icon" : "",
  696. "fillType": "continuous",
  697. "valueType": "normalized",
  698. "fills": [
  699. {
  700. "fill" : "#562f72",
  701. "at" : 0.0
  702. },
  703. {
  704. "fill" : "#734098",
  705. "at" : 0.167
  706. },
  707. {
  708. "fill" : "#9855d4",
  709. "at" : 0.334
  710. },
  711. {
  712. "fill" : "#af6ee8",
  713. "at" : 0.501
  714. },
  715. {
  716. "fill" : "#ba8ff7",
  717. "at" : 0.668
  718. },
  719. {
  720. "fill" : "#d7aaff",
  721. "at" : 0.835
  722. },
  723. {
  724. "fill" : "#eed2ff",
  725. "at" : 1.0
  726. }
  727. ]
  728. },
  729. {
  730. "id": "rave2.colorpalette.violetContinuousSequential",
  731. "label" : "rave2.colorpalette.violetContinuousSequential.label",
  732. "description" : "rave2.colorpalette.violetContinuousSequential.description",
  733. "icon" : "",
  734. "fillType": "continuous",
  735. "valueType": "normalized",
  736. "fills": [
  737. {
  738. "fill" : "#7c1c58",
  739. "at" : 0.0
  740. },
  741. {
  742. "fill" : "#a6266e",
  743. "at" : 0.167
  744. },
  745. {
  746. "fill" : "#db2780",
  747. "at" : 0.334
  748. },
  749. {
  750. "fill" : "#ff3ca0",
  751. "at" : 0.501
  752. },
  753. {
  754. "fill" : "#ff71d4",
  755. "at" : 0.668
  756. },
  757. {
  758. "fill" : "#ff9eee",
  759. "at" : 0.835
  760. },
  761. {
  762. "fill" : "#ffd2ff",
  763. "at" : 1.0
  764. }
  765. ]
  766. },
  767. {
  768. "id": "rave2.colorpalette.redGreenDiscreteDivergent",
  769. "label" : "rave2.colorpalette.redGreenDiscreteDivergent.label",
  770. "description" : "rave2.colorpalette.redGreenDiscreteDivergent.description",
  771. "icon" : "",
  772. "fillType": "discrete",
  773. "valueType": "normalized",
  774. "fills": [
  775. {
  776. "fill" : "#ce202c",
  777. "at" : 0.0
  778. },
  779. {
  780. "fill" : "#ff5050",
  781. "at" : 0.11
  782. },
  783. {
  784. "fill" : "#f79d9d",
  785. "at" : 0.22
  786. },
  787. {
  788. "fill" : "#e8bfc9",
  789. "at" : 0.33
  790. },
  791. {
  792. "fill" : "#e9e0e0",
  793. "at" : 0.44
  794. },
  795. {
  796. "fill" : "#bbe085",
  797. "at" : 0.55
  798. },
  799. {
  800. "fill" : "#8cd211",
  801. "at" : 0.66
  802. },
  803. {
  804. "fill" : "#5aa700",
  805. "at" : 0.77
  806. },
  807. {
  808. "fill" : "#4b8400",
  809. "at" : 0.88
  810. }
  811. ]
  812. },
  813. {
  814. "id": "rave2.colorpalette.redBlueDiscreteDivergent",
  815. "label" : "rave2.colorpalette.redBlueDiscreteDivergent.label",
  816. "description" : "rave2.colorpalette.redBlueDiscreteDivergent.description",
  817. "icon" : "",
  818. "fillType": "discrete",
  819. "valueType": "normalized",
  820. "fills": [
  821. {
  822. "fill" : "#ce202c",
  823. "at" : 0.0
  824. },
  825. {
  826. "fill" : "#ff5050",
  827. "at" : 0.11
  828. },
  829. {
  830. "fill" : "#f79d9d",
  831. "at" : 0.22
  832. },
  833. {
  834. "fill" : "#e8bfc9",
  835. "at" : 0.33
  836. },
  837. {
  838. "fill" : "#e9e0e0",
  839. "at" : 0.44
  840. },
  841. {
  842. "fill" : "#b4d8f0",
  843. "at" : 0.55
  844. },
  845. {
  846. "fill" : "#7cc7ff",
  847. "at" : 0.66
  848. },
  849. {
  850. "fill" : "#5596e6",
  851. "at" : 0.77
  852. },
  853. {
  854. "fill" : "#4178be",
  855. "at" : 0.88
  856. }
  857. ]
  858. },
  859. {
  860. "id": "rave2.colorpalette.blueGreenDiscreteDivergent",
  861. "label" : "rave2.colorpalette.blueGreenDiscreteDivergent.label",
  862. "description" : "rave2.colorpalette.blueGreenDiscreteDivergent.description",
  863. "icon" : "",
  864. "fillType": "discrete",
  865. "valueType": "normalized",
  866. "fills": [
  867. {
  868. "fill" : "#4178be",
  869. "at" : 0.0
  870. },
  871. {
  872. "fill" : "#5596e6",
  873. "at" : 0.11
  874. },
  875. {
  876. "fill" : "#7cc7ff",
  877. "at" : 0.22
  878. },
  879. {
  880. "fill" : "#b4d8f0",
  881. "at" : 0.33
  882. },
  883. {
  884. "fill" : "#dfe9e9",
  885. "at" : 0.44
  886. },
  887. {
  888. "fill" : "#bbe085",
  889. "at" : 0.55
  890. },
  891. {
  892. "fill" : "#8cd211",
  893. "at" : 0.66
  894. },
  895. {
  896. "fill" : "#5aa700",
  897. "at" : 0.77
  898. },
  899. {
  900. "fill" : "#4b8400",
  901. "at" : 0.88
  902. }
  903. ]
  904. },
  905. {
  906. "id": "rave2.colorpalette.tealPurpleDiscreteDivergent",
  907. "label" : "rave2.colorpalette.tealPurpleDiscreteDivergent.label",
  908. "description" : "rave2.colorpalette.tealPurpleDiscreteDivergent.description",
  909. "icon" : "",
  910. "fillType": "discrete",
  911. "valueType": "normalized",
  912. "fills": [
  913. {
  914. "fill" : "#008571",
  915. "at" : 0.0
  916. },
  917. {
  918. "fill" : "#00b4a0",
  919. "at" : 0.11
  920. },
  921. {
  922. "fill" : "#41d6c3",
  923. "at" : 0.22
  924. },
  925. {
  926. "fill" : "#65dbc7",
  927. "at" : 0.33
  928. },
  929. {
  930. "fill" : "#dfe9e9",
  931. "at" : 0.44
  932. },
  933. {
  934. "fill" : "#d7aaff",
  935. "at" : 0.55
  936. },
  937. {
  938. "fill" : "#ba8ff7",
  939. "at" : 0.66
  940. },
  941. {
  942. "fill" : "#af6ee8",
  943. "at" : 0.77
  944. },
  945. {
  946. "fill" : "#9855d4",
  947. "at" : 0.88
  948. }
  949. ]
  950. },
  951. {
  952. "id": "rave2.colorpalette.redGreenInverseDiscreteDivergent",
  953. "label" : "rave2.colorpalette.redGreenInverseDiscreteDivergent.label",
  954. "description" : "rave2.colorpalette.redGreenInverseDiscreteDivergent.description",
  955. "icon" : "",
  956. "fillType": "discrete",
  957. "valueType": "normalized",
  958. "fills": [
  959. {
  960. "fill" : "#ffd2dd",
  961. "at" : 0.0
  962. },
  963. {
  964. "fill" : "#ffa5b4",
  965. "at" : 0.11
  966. },
  967. {
  968. "fill" : "#ff5050",
  969. "at" : 0.22
  970. },
  971. {
  972. "fill" : "#ce202c",
  973. "at" : 0.33
  974. },
  975. {
  976. "fill" : "#a53725",
  977. "at" : 0.44
  978. },
  979. {
  980. "fill" : "#4b8400",
  981. "at" : 0.55
  982. },
  983. {
  984. "fill" : "#5aa700",
  985. "at" : 0.66
  986. },
  987. {
  988. "fill" : "#8cd211",
  989. "at" : 0.77
  990. },
  991. {
  992. "fill" : "#bbe085",
  993. "at" : 0.88
  994. }
  995. ]
  996. },
  997. {
  998. "id": "rave2.colorpalette.redBlueInverseDiscreteDivergent",
  999. "label" : "rave2.colorpalette.redBlueInverseDiscreteDivergent.label",
  1000. "description" : "rave2.colorpalette.redBlueInverseDiscreteDivergent.description",
  1001. "icon" : "",
  1002. "fillType": "discrete",
  1003. "valueType": "normalized",
  1004. "fills": [
  1005. {
  1006. "fill" : "#ffd2dd",
  1007. "at" : 0.0
  1008. },
  1009. {
  1010. "fill" : "#ffa5b4",
  1011. "at" : 0.11
  1012. },
  1013. {
  1014. "fill" : "#ff5050",
  1015. "at" : 0.22
  1016. },
  1017. {
  1018. "fill" : "#e71d32",
  1019. "at" : 0.33
  1020. },
  1021. {
  1022. "fill" : "#734098",
  1023. "at" : 0.44
  1024. },
  1025. {
  1026. "fill" : "#4178be",
  1027. "at" : 0.55
  1028. },
  1029. {
  1030. "fill" : "#5596e6",
  1031. "at" : 0.66
  1032. },
  1033. {
  1034. "fill" : "#7cc7ff",
  1035. "at" : 0.77
  1036. },
  1037. {
  1038. "fill" : "#c0e6ff",
  1039. "at" : 0.88
  1040. }
  1041. ]
  1042. },
  1043. {
  1044. "id": "rave2.colorpalette.redGreenContinuousDivergent",
  1045. "label" : "rave2.colorpalette.redGreenContinuousDivergent.label",
  1046. "description" : "rave2.colorpalette.redGreenContinuousDivergent.description",
  1047. "icon" : "",
  1048. "fillType": "continuous",
  1049. "valueType": "normalized",
  1050. "fills": [
  1051. {
  1052. "fill" : "#ce202c",
  1053. "at" : 0.0
  1054. },
  1055. {
  1056. "fill" : "#ff5050",
  1057. "at" : 0.125
  1058. },
  1059. {
  1060. "fill" : "#f79d9d",
  1061. "at" : 0.25
  1062. },
  1063. {
  1064. "fill" : "#e8bfc9",
  1065. "at" : 0.375
  1066. },
  1067. {
  1068. "fill" : "#e9e0e0",
  1069. "at" : 0.5
  1070. },
  1071. {
  1072. "fill" : "#bbe085",
  1073. "at" : 0.625
  1074. },
  1075. {
  1076. "fill" : "#8cd211",
  1077. "at" : 0.75
  1078. },
  1079. {
  1080. "fill" : "#5aa700",
  1081. "at" : 0.875
  1082. },
  1083. {
  1084. "fill" : "#4b8400",
  1085. "at" : 1.0
  1086. }
  1087. ]
  1088. },
  1089. {
  1090. "id": "rave2.colorpalette.redBlueContinuousDivergent",
  1091. "label" : "rave2.colorpalette.redBlueContinuousDivergent.label",
  1092. "description" : "rave2.colorpalette.redBlueContinuousDivergent.description",
  1093. "icon" : "",
  1094. "fillType": "continuous",
  1095. "valueType": "normalized",
  1096. "fills": [
  1097. {
  1098. "fill" : "#ce202c",
  1099. "at" : 0.0
  1100. },
  1101. {
  1102. "fill" : "#ff5050",
  1103. "at" : 0.125
  1104. },
  1105. {
  1106. "fill" : "#f79d9d",
  1107. "at" : 0.25
  1108. },
  1109. {
  1110. "fill" : "#e8bfc9",
  1111. "at" : 0.375
  1112. },
  1113. {
  1114. "fill" : "#e9e0e0",
  1115. "at" : 0.5
  1116. },
  1117. {
  1118. "fill" : "#b4d8f0",
  1119. "at" : 0.625
  1120. },
  1121. {
  1122. "fill" : "#7cc7ff",
  1123. "at" : 0.75
  1124. },
  1125. {
  1126. "fill" : "#5596e6",
  1127. "at" : 0.875
  1128. },
  1129. {
  1130. "fill" : "#4178be",
  1131. "at" : 1.0
  1132. }
  1133. ]
  1134. },
  1135. {
  1136. "id": "rave2.colorpalette.blueGreenContinuousDivergent",
  1137. "label" : "rave2.colorpalette.blueGreenContinuousDivergent.label",
  1138. "description" : "rave2.colorpalette.blueGreenContinuousDivergent.description",
  1139. "icon" : "",
  1140. "fillType": "continuous",
  1141. "valueType": "normalized",
  1142. "fills": [
  1143. {
  1144. "fill" : "#4178be",
  1145. "at" : 0.0
  1146. },
  1147. {
  1148. "fill" : "#5596e6",
  1149. "at" : 0.125
  1150. },
  1151. {
  1152. "fill" : "#7cc7ff",
  1153. "at" : 0.25
  1154. },
  1155. {
  1156. "fill" : "#b4d8f0",
  1157. "at" : 0.375
  1158. },
  1159. {
  1160. "fill" : "#dfe9e9",
  1161. "at" : 0.5
  1162. },
  1163. {
  1164. "fill" : "#bbe085",
  1165. "at" : 0.625
  1166. },
  1167. {
  1168. "fill" : "#8cd211",
  1169. "at" : 0.75
  1170. },
  1171. {
  1172. "fill" : "#5aa700",
  1173. "at" : 0.875
  1174. },
  1175. {
  1176. "fill" : "#4b8400",
  1177. "at" : 1.0
  1178. }
  1179. ]
  1180. },
  1181. {
  1182. "id": "rave2.colorpalette.tealPurpleContinuousDivergent",
  1183. "label" : "rave2.colorpalette.tealPurpleContinuousDivergent.label",
  1184. "description" : "rave2.colorpalette.tealPurpleContinuousDivergent.description",
  1185. "icon" : "",
  1186. "fillType": "continuous",
  1187. "valueType": "normalized",
  1188. "fills": [
  1189. {
  1190. "fill" : "#008571",
  1191. "at" : 0.0
  1192. },
  1193. {
  1194. "fill" : "#00b4a0",
  1195. "at" : 0.125
  1196. },
  1197. {
  1198. "fill" : "#41d6c3",
  1199. "at" : 0.25
  1200. },
  1201. {
  1202. "fill" : "#65dbc7",
  1203. "at" : 0.375
  1204. },
  1205. {
  1206. "fill" : "#dfe9e9",
  1207. "at" : 0.5
  1208. },
  1209. {
  1210. "fill" : "#d7aaff",
  1211. "at" : 0.625
  1212. },
  1213. {
  1214. "fill" : "#ba8ff7",
  1215. "at" : 0.75
  1216. },
  1217. {
  1218. "fill" : "#af6ee8",
  1219. "at" : 0.875
  1220. },
  1221. {
  1222. "fill" : "#9855d4",
  1223. "at" : 1.0
  1224. }
  1225. ]
  1226. },
  1227. {
  1228. "id": "rave2.colorpalette.redGreenInverseContinuousDivergent",
  1229. "label" : "rave2.colorpalette.redGreenInverseContinuousDivergent.label",
  1230. "description" : "rave2.colorpalette.redGreenInverseContinuousDivergent.description",
  1231. "icon" : "",
  1232. "fillType": "continuous",
  1233. "valueType": "normalized",
  1234. "fills": [
  1235. {
  1236. "fill" : "#ffd2dd",
  1237. "at" : 0.0
  1238. },
  1239. {
  1240. "fill" : "#ffa5b4",
  1241. "at" : 0.125
  1242. },
  1243. {
  1244. "fill" : "#ff5050",
  1245. "at" : 0.25
  1246. },
  1247. {
  1248. "fill" : "#ce202c",
  1249. "at" : 0.375
  1250. },
  1251. {
  1252. "fill" : "#a53725",
  1253. "at" : 0.5
  1254. },
  1255. {
  1256. "fill" : "#4b8400",
  1257. "at" : 0.625
  1258. },
  1259. {
  1260. "fill" : "#5aa700",
  1261. "at" : 0.75
  1262. },
  1263. {
  1264. "fill" : "#8cd211",
  1265. "at" : 0.875
  1266. },
  1267. {
  1268. "fill" : "#bbe085",
  1269. "at" : 1.0
  1270. }
  1271. ]
  1272. },
  1273. {
  1274. "id": "rave2.colorpalette.redBlueInverseContinuousDivergent",
  1275. "label" : "rave2.colorpalette.redBlueInverseContinuousDivergent.label",
  1276. "description" : "rave2.colorpalette.redBlueInverseContinuousDivergent.description",
  1277. "icon" : "",
  1278. "fillType": "continuous",
  1279. "valueType": "normalized",
  1280. "fills": [
  1281. {
  1282. "fill" : "#ffd2dd",
  1283. "at" : 0.0
  1284. },
  1285. {
  1286. "fill" : "#ffa5b4",
  1287. "at" : 0.125
  1288. },
  1289. {
  1290. "fill" : "#ff5050",
  1291. "at" : 0.25
  1292. },
  1293. {
  1294. "fill" : "#e71d32",
  1295. "at" : 0.375
  1296. },
  1297. {
  1298. "fill" : "#734098",
  1299. "at" : 0.5
  1300. },
  1301. {
  1302. "fill" : "#4178be",
  1303. "at" : 0.625
  1304. },
  1305. {
  1306. "fill" : "#5596e6",
  1307. "at" : 0.75
  1308. },
  1309. {
  1310. "fill" : "#7cc7ff",
  1311. "at" : 0.875
  1312. },
  1313. {
  1314. "fill" : "#c0e6ff",
  1315. "at" : 1.0
  1316. }
  1317. ]
  1318. }
  1319. ],
  1320. "defaultPaletteID" : "rave2.colorpalette.default"
  1321. }
  1322. }
  1323. },{}],2:[function(require,module,exports){
  1324. (function() {
  1325. var $ = {};
  1326. // $source: com/ibm/rave/library/internal/nativeImpl/ModuleHeader
  1327. /************************************************************************
  1328. ** IBM Confidential
  1329. **
  1330. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1331. **
  1332. ** (C) Copyright IBM Corp. 2015
  1333. **
  1334. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1335. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1336. ************************************************************************/
  1337. var com_ibm_rave_core_RegistryService = rave["internal"]["RegistryService"];
  1338. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  1339. var rave_library_externs={};
  1340. rave["internal"]["CSSUtil"] = rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  1341. // $source: com/ibm/rave/library/service/ErrorDispatcher
  1342. /************************************************************************
  1343. ** IBM Confidential
  1344. **
  1345. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1346. **
  1347. ** (C) Copyright IBM Corp. 2017
  1348. **
  1349. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1350. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1351. ************************************************************************/
  1352. // GENERATED
  1353. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  1354. var com_ibm_rave_library_service_ErrorDispatcher = rave['internal']['Declare']({
  1355. getReporter : function() {
  1356. return rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().getData("ERROR_REPORTER_KEY");
  1357. },
  1358. /** @expose */
  1359. setReporter : function(reporter) {
  1360. rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().putData("ERROR_REPORTER_KEY", reporter);
  1361. },
  1362. /**
  1363. * Dispatch error
  1364. * @param (com.ibm.rave.library.service.LibraryError) error
  1365. */
  1366. /** @expose */
  1367. error : function(error) {
  1368. var reporter = this.getReporter();
  1369. if (reporter) {
  1370. reporter(error);
  1371. }
  1372. },
  1373. /**
  1374. * Log an error with the given code, and null location and bundle name.
  1375. * @param (int) code Error code
  1376. */
  1377. logError$0 : function(code) {
  1378. this.error(com_ibm_rave_library_service_LibraryError.create(code));
  1379. },
  1380. /**
  1381. * Log an error with the given code and location, and null bundle name.
  1382. * @param (int) code Error code
  1383. * @param (String) location Error location
  1384. */
  1385. logError$1 : function(code, location) {
  1386. this.error(com_ibm_rave_library_service_LibraryError.create(code, location));
  1387. },
  1388. /**
  1389. * Log an error with the given code, location, and bundle name.
  1390. * @param (int) code Error code
  1391. * @param (String) location Error code
  1392. * @param (String) bundleName Bundle name
  1393. */
  1394. logError$2 : function(code, location, bundleName) {
  1395. this.error(com_ibm_rave_library_service_LibraryError.create(code, location, bundleName));
  1396. },
  1397. /** @expose */
  1398. logError : function(a0, a1, a2) {
  1399. var args = arguments;
  1400. if (args.length == 1) {
  1401. return this.logError$0(a0);
  1402. }
  1403. if (args.length == 2) {
  1404. return this.logError$1(a0, a1);
  1405. }
  1406. return this.logError$2(a0, a1, a2);
  1407. }
  1408. //constructor : function() {}
  1409. });
  1410. //com_ibm_rave_library_service_ErrorDispatcher.ERROR_REPORTER_KEY = "ERROR_REPORTER_KEY";
  1411. /** @expose */
  1412. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE = new com_ibm_rave_library_service_ErrorDispatcher();
  1413. // $source: com/ibm/rave/library/service/LibraryError
  1414. /************************************************************************
  1415. ** IBM Confidential
  1416. **
  1417. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1418. **
  1419. ** (C) Copyright IBM Corp. 2017
  1420. **
  1421. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1422. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1423. ************************************************************************/
  1424. // GENERATED
  1425. /**
  1426. * LibraryError This class is intended as a replacement for exceptions, which are not supported in some of our target languages (i.e. Swift) and which we are trying to avoid. Each time an error needs to be reported a new instance of this class is created and using the {@link this.Library#this.logError()} function you can set an error code. The corresponding error message is adding by a lookup into the OMap. Two Interface classes are defined here in order to allow callbacks to be invoked set by the user.
  1427. */
  1428. var com_ibm_rave_library_service_LibraryError = rave['internal']['Declare']({
  1429. //errorMessage : null,
  1430. //errorLocation : null,
  1431. //bundlename : null,
  1432. errorCode : 0,
  1433. /**
  1434. * @param (int) code Error code
  1435. * @param (String) location Error location, may be null
  1436. * @param (String) bundleName Bundle name, may be null
  1437. * @return (void) Library error with that code, location, and bundle name
  1438. */
  1439. constructor : function(code, location, bundleName) {
  1440. this.errorCode = code;
  1441. this.errorMessage = com_ibm_rave_library_service_LibraryError.errorMap[code];
  1442. this.errorLocation = location;
  1443. this.bundlename = bundleName;
  1444. },
  1445. /**
  1446. * @return (int) a value to indicate the error type
  1447. */
  1448. /** @expose */
  1449. code : function() {
  1450. return this.errorCode;
  1451. },
  1452. /**
  1453. * @return (String) a message describing the error
  1454. */
  1455. /** @expose */
  1456. message : function() {
  1457. return this.errorMessage;
  1458. },
  1459. /**
  1460. * @param (String) bundleName - the bundle name the error occurred in
  1461. */
  1462. /** @expose */
  1463. setBundlename : function(bundleName) {
  1464. this.bundlename = bundleName;
  1465. },
  1466. /**
  1467. * @return (String) the bundle name the error occurred in
  1468. */
  1469. /** @expose */
  1470. getBundlename : function() {
  1471. return this.bundlename;
  1472. },
  1473. /**
  1474. * @return (String) the method or stack where the error occurs
  1475. */
  1476. /** @expose */
  1477. location : function() {
  1478. return this.errorLocation;
  1479. }
  1480. });
  1481. /**
  1482. * @param (int) code Error code
  1483. * @return (com.ibm.rave.library.service.LibraryError) LibraryError with that code and a null location and bundle name
  1484. */
  1485. com_ibm_rave_library_service_LibraryError.create$0 = function(code) {
  1486. return new com_ibm_rave_library_service_LibraryError(code, null, null);
  1487. };
  1488. /**
  1489. * @param (int) code Error code
  1490. * @param (String) location Error location
  1491. * @return (com.ibm.rave.library.service.LibraryError) LibraryError with that code and location and a null bundle name
  1492. */
  1493. com_ibm_rave_library_service_LibraryError.create$1 = function(code, location) {
  1494. return new com_ibm_rave_library_service_LibraryError(code, location, null);
  1495. };
  1496. /**
  1497. * @param (int) code Error code
  1498. * @param (String) location Error location
  1499. * @param (String) bundleName Bundle name
  1500. * @return (com.ibm.rave.library.service.LibraryError) LibraryError with that code, location, and bundle name
  1501. */
  1502. com_ibm_rave_library_service_LibraryError.create$2 = function(code, location, bundleName) {
  1503. return new com_ibm_rave_library_service_LibraryError(code, location, bundleName);
  1504. };
  1505. com_ibm_rave_library_service_LibraryError.populateErrorMap = function() {
  1506. var errorMap = {};
  1507. errorMap[300] = "No metadata about the bundle could be found in the json file.";
  1508. errorMap[301] = "The specified info does not exist";
  1509. errorMap[302] = "Preview format is not supported. It is either svg or img";
  1510. errorMap[201] = "Unable to load bundle";
  1511. errorMap[206] = "Manifest not available for this bundle";
  1512. errorMap[207] = "Bower not available for this bundle";
  1513. errorMap[204] = "Requested configuration ID not available for this bundle";
  1514. errorMap[4] = "PropertyNativeUtils parse";
  1515. errorMap[5] = "Palettes must have a unique id with at least 1 character. PaletteSet add";
  1516. errorMap[205] = "Configuration file load error ";
  1517. errorMap[101] = "Data model Error";
  1518. errorMap[203] = "NLS catalog file load error ";
  1519. errorMap[1] = "A property error has occurred.";
  1520. errorMap[104] = "No datamodels defined";
  1521. errorMap[105] = "Data model not found";
  1522. errorMap[106] = "Data set not found";
  1523. errorMap[107] = "Data slot not found";
  1524. errorMap[108] = "Accessor is not of a type allowed for the data slot";
  1525. errorMap[409] = "Mismatched data type";
  1526. errorMap[109] = "No data has been assigned to a required data set";
  1527. errorMap[110] = "No accessor has been assigned to a required data slot";
  1528. errorMap[401] = "Missing ImportData or required ImportData property (visJSONData, index, dataSetId), or JSON parse error. Please check input data.";
  1529. errorMap[402] = "ImportData index out of range";
  1530. errorMap[403] = "selected table is null or has no fields";
  1531. errorMap[404] = "ImportData dataSetId is not valid";
  1532. errorMap[405] = "map has an invalid data slot ID";
  1533. errorMap[406] = "ImportData dataSetId is not of the correct type (tabular or hierarchical)";
  1534. errorMap[407] = "ImportData levels uses an ID which is not a field ID";
  1535. errorMap[6] = "The numeric value given is NaN";
  1536. errorMap[7] = "The value given does not exist in the specified list";
  1537. errorMap[8] = "The value given is less than the minimum specified";
  1538. errorMap[9] = "The value given is greater than the maximum specified";
  1539. errorMap[10] = "value of minimum is negative";
  1540. errorMap[11] = "value of maximum is negative";
  1541. errorMap[12] = "The minmum value is greater than the maximum value";
  1542. errorMap[13] = "Options array is empty.";
  1543. errorMap[14] = "Option array for string property are not unique.";
  1544. errorMap[15] = "The property must be string.";
  1545. errorMap[16] = "The property must be numeric.";
  1546. errorMap[17] = "The property must be boolean.";
  1547. errorMap[18] = "The property must be an array.";
  1548. errorMap[19] = "The property must be an object.";
  1549. errorMap[20] = "The value must be an integer.";
  1550. errorMap[21] = "Property simple id is null";
  1551. errorMap[22] = "Property simple id is invalid";
  1552. errorMap[23] = "Property entry type is invalid";
  1553. errorMap[24] = "Property entry is null";
  1554. errorMap[25] = "Property entry type is not an object";
  1555. errorMap[26] = "Property entry type is not a string";
  1556. errorMap[27] = "Property entry has no type";
  1557. errorMap[28] = "Property entry has no properties";
  1558. errorMap[29] = "Property entry has unknown type";
  1559. errorMap[30] = "Found duplicate property entries with the same id but of different types";
  1560. errorMap[31] = "value being set is not a JSON object";
  1561. errorMap[32] = "value object has an unknown property";
  1562. errorMap[33] = "Both the true and false label must be provided";
  1563. errorMap[34] = "Value is not part of enum.";
  1564. errorMap[35] = "Can't change value of unmodifiable property";
  1565. errorMap[36] = "A property in value object does not exist.";
  1566. errorMap[37] = "String does not match regular expression";
  1567. errorMap[38] = "Can not set value for unknown type";
  1568. errorMap[39] = "A required property has no default value";
  1569. errorMap[40] = "Can't set a required property with no default to null";
  1570. errorMap[41] = "Missing enum options array";
  1571. errorMap[42] = "Invalid Enum. Entry: missing enum/enumLabel";
  1572. errorMap[43] = "Duplicate enum value";
  1573. errorMap[408] = "Stacking isn't allowed";
  1574. return errorMap;
  1575. };
  1576. /** @expose */
  1577. com_ibm_rave_library_service_LibraryError.create = function(a0, a1, a2) {
  1578. var args = arguments;
  1579. if (args.length == 1) {
  1580. return com_ibm_rave_library_service_LibraryError.create$0(a0);
  1581. }
  1582. if (args.length == 2) {
  1583. return com_ibm_rave_library_service_LibraryError.create$1(a0, a1);
  1584. }
  1585. return com_ibm_rave_library_service_LibraryError.create$2(a0, a1, a2);
  1586. };
  1587. com_ibm_rave_library_service_LibraryError.errorMap = com_ibm_rave_library_service_LibraryError.populateErrorMap();
  1588. // $source: com/ibm/rave/library/service/BundleService
  1589. /************************************************************************
  1590. ** IBM Confidential
  1591. **
  1592. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1593. **
  1594. ** (C) Copyright IBM Corp. 2017
  1595. **
  1596. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1597. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1598. ************************************************************************/
  1599. // GENERATED
  1600. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  1601. /**
  1602. * A registry service for bundles.
  1603. */
  1604. var com_ibm_rave_library_service_BundleService = rave['internal']['Declare'](com_ibm_rave_core_RegistryService, {
  1605. /** @expose */
  1606. getServiceId : function() {
  1607. return "BundleService";
  1608. }
  1609. /**
  1610. * singleton
  1611. */
  1612. //constructor : function() {}
  1613. });
  1614. /** @expose */
  1615. com_ibm_rave_library_service_BundleService.INSTANCE = new com_ibm_rave_library_service_BundleService();
  1616. // $source: com/ibm/rave/library/service/LibraryExtensionService
  1617. /************************************************************************
  1618. ** IBM Confidential
  1619. **
  1620. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1621. **
  1622. ** (C) Copyright IBM Corp. 2017
  1623. **
  1624. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1625. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1626. ************************************************************************/
  1627. // GENERATED
  1628. //@import com/ibm/rave/core/RegistryService (loadtime) // superclass
  1629. /**
  1630. * A registry service for library extensions. The INSTANCE is available through Library.extensions.
  1631. */
  1632. var com_ibm_rave_library_service_LibraryExtensionService = rave['internal']['Declare'](com_ibm_rave_core_RegistryService, {
  1633. /** @expose */
  1634. getServiceId : function() {
  1635. return "LibraryExtensionService";
  1636. }
  1637. /**
  1638. * singleton
  1639. */
  1640. //constructor : function() {}
  1641. });
  1642. /** @expose */
  1643. com_ibm_rave_library_service_LibraryExtensionService.INSTANCE = new com_ibm_rave_library_service_LibraryExtensionService();
  1644. // $source: com/ibm/rave/library/palette/internal/PaletteManager
  1645. /************************************************************************
  1646. ** IBM Confidential
  1647. **
  1648. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1649. **
  1650. ** (C) Copyright IBM Corp. 2017
  1651. **
  1652. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1653. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1654. ************************************************************************/
  1655. // GENERATED
  1656. //@import com/ibm/rave/library/palette/internal/PaletteSet (runtime) // new
  1657. /**
  1658. * <p> The library level manager of all palettes. the palette manager will request the library config in order to read in all the palette files defined at the libaray level as well as the default palette to use and set them on itself for use by all bundles </p> <p> The loader gets the contents of the JSON configuration files and saves them in the config. We then add a call back to the loader so once it's done loading the resources we can setup the palettes and defualt id to use </p>
  1659. */
  1660. var com_ibm_rave_library_palette_internal_PaletteManager = rave['internal']['Declare']({
  1661. //obj : null,
  1662. //paletteConfig : null,
  1663. getPaletteManagerData : function() {
  1664. var paletteManagerData = rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().getData("PALETTE_MANAGER_DATA_KEY");
  1665. if (!paletteManagerData) {
  1666. paletteManagerData = new com_ibm_rave_library_palette_internal_PaletteManager.PaletteManagerData();
  1667. rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().putData("PALETTE_MANAGER_DATA_KEY", paletteManagerData);
  1668. this.populate(this.obj);
  1669. }
  1670. return paletteManagerData;
  1671. },
  1672. constructor : function() {
  1673. this.obj = require("./configuration/configuration.json");
  1674. },
  1675. /**
  1676. * Populate the palette manager from a JSON configuration object. This object must contain a "paletteConfiguration" property that contains a "palettes" property containing an array of palette information.
  1677. * @param (Object) config JSON configuration containing palette information.
  1678. */
  1679. populate : function(config) {
  1680. if (config) {
  1681. this.paletteConfig = config["paletteConfiguration"];
  1682. if (this.paletteConfig) {
  1683. this.getPaletteManagerData().palettes.populate(this.paletteConfig["palettes"]);
  1684. var defaultPaletteId = this.paletteConfig["defaultPaletteID"];
  1685. if (defaultPaletteId != null) {
  1686. this.getPaletteManagerData().defaultPalette = ""+(defaultPaletteId);
  1687. }
  1688. }
  1689. }
  1690. },
  1691. /**
  1692. * Set the default palette
  1693. * @param (String) paletteId The default palette id
  1694. */
  1695. setDefaultPalette : function(paletteId) {
  1696. this.getPaletteManagerData().defaultPalette = paletteId;
  1697. },
  1698. /**
  1699. * get the default id
  1700. * @return (String) the default palette id
  1701. */
  1702. getDefaultId : function() {
  1703. return this.getPaletteManagerData().defaultPalette;
  1704. },
  1705. /**
  1706. * get the default palette object
  1707. * @return (com.ibm.rave.library.palette.Palette) the default palette object
  1708. */
  1709. getDefaultPalette : function() {
  1710. var paletteManagerData = this.getPaletteManagerData();
  1711. return paletteManagerData.palettes.get(paletteManagerData.defaultPalette);
  1712. },
  1713. /**
  1714. * get the default with the given id
  1715. * @return (com.ibm.rave.library.palette.Palette) the default palette object with the given id
  1716. */
  1717. getPalette : function(paletteId) {
  1718. return this.getPaletteManagerData().palettes.get(paletteId);
  1719. },
  1720. /**
  1721. * Creates a palette with colors adjusted by the adjustment amount This is useful when a slightly darker or lighter color is needed for a border or stroke
  1722. * @param (String) paletteId Palette to start with
  1723. * @param (double) adjustment Percentage to adjust the color, negative is darker, positive is lighter
  1724. * @return (com.ibm.rave.library.palette.Palette) adjusted palette
  1725. */
  1726. getAdjustedColorPalette : function(paletteId, adjustment) {
  1727. var originalPalette = this.getPaletteManagerData().palettes.getPaletteJSON(paletteId);
  1728. var adjustedPaletteId = originalPalette["id"] + "_" + adjustment;
  1729. var adjustedPalette = this.getPaletteManagerData().palettes.get(adjustedPaletteId);
  1730. if (!adjustedPalette) {
  1731. var adjustedPaletteClone = {};
  1732. adjustedPaletteClone["id"] = adjustedPaletteId;
  1733. adjustedPaletteClone["valueType"] = originalPalette["valueType"];
  1734. var fillType = originalPalette["fillType"];
  1735. adjustedPaletteClone["fillType"] = fillType;
  1736. var simpleFill = fillType.localeCompare("simple") == 0 ? true : false;
  1737. var originalFills = originalPalette["fills"];
  1738. var newFills = [];
  1739. adjustedPaletteClone["fills"] = newFills;
  1740. for (var i = 0; i < originalFills.length; ++i) {
  1741. if (simpleFill) {
  1742. var fill = originalFills[i];
  1743. if (adjustment < 0) {
  1744. fill = rave.rgb(fill).darker(adjustment * -1).toString();
  1745. } else {
  1746. fill = rave.rgb(fill).brighter(adjustment).toString();
  1747. }
  1748. newFills.push(fill);
  1749. } else {
  1750. var oFill = originalFills[i];
  1751. var fill = oFill["fill"];
  1752. if (adjustment < 0) {
  1753. fill = rave.rgb(fill).darker(adjustment * -1).toString();
  1754. } else {
  1755. fill = rave.rgb(fill).brighter(adjustment).toString();
  1756. }
  1757. var newFill = {};
  1758. newFill["at"] = (oFill["at"]);
  1759. newFill["fill"] = fill;
  1760. newFills.push(newFill);
  1761. }
  1762. }
  1763. this.getPaletteManagerData().palettes.add(adjustedPaletteClone);
  1764. adjustedPalette = this.getPaletteManagerData().palettes.get(adjustedPaletteId);
  1765. }
  1766. return adjustedPalette;
  1767. },
  1768. /**
  1769. * add a new palette to the palette manager
  1770. * @param (Object) palette the json representation of the palette
  1771. */
  1772. addPalette : function(palette) {
  1773. this.getPaletteManagerData().palettes.add(palette);
  1774. },
  1775. /**
  1776. * remove a new palette from the palette manager
  1777. * @param (String) paletteId the id of the palette
  1778. * @param (com.ibm.rave.library.service.LibraryError) error the library error
  1779. */
  1780. removePalette : function(paletteId, error) {
  1781. this.getPaletteManagerData().palettes.remove(paletteId, error);
  1782. },
  1783. /**
  1784. * add an array of new palette to the palette manager
  1785. * @param (Array) palettes the json representation of an array of palettes
  1786. */
  1787. addPalettes : function(palettes) {
  1788. var paletteSet = this.getPaletteManagerData().palettes;
  1789. for (var __i_enFor0 = 0, __exp_enFor0 = palettes, __len_enFor0 = __exp_enFor0.length;
  1790. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1791. var palette = __exp_enFor0[__i_enFor0];
  1792. paletteSet.add(palette);
  1793. }
  1794. },
  1795. /**
  1796. * get every palette in the palette manager
  1797. * @return (Array) an array of palettes
  1798. */
  1799. getAllPalettes : function() {
  1800. return this.getPaletteManagerData().palettes.getAll();
  1801. },
  1802. /**
  1803. * get every palette id in the palette manager
  1804. * @return (Array) an array of palettes ids
  1805. */
  1806. getAllPaletteIds : function() {
  1807. return this.getPaletteManagerData().palettes.getAllIds();
  1808. },
  1809. /**
  1810. * Get the JSON definition of a palette as JSON
  1811. */
  1812. getJSONPalette : function(id) {
  1813. return this.getPaletteManagerData().palettes.getPaletteJSON(id);
  1814. }
  1815. });
  1816. com_ibm_rave_library_palette_internal_PaletteManager.PaletteManagerData = rave['internal']['Declare']({
  1817. /**
  1818. * PaletteSet to hold the library level palettes
  1819. */
  1820. //palettes : null,
  1821. /**
  1822. * The default palette id
  1823. */
  1824. //defaultPalette : null,
  1825. constructor : function() {
  1826. this.palettes = new com_ibm_rave_library_palette_internal_PaletteSet();
  1827. }
  1828. });
  1829. //com_ibm_rave_library_palette_internal_PaletteManager.PALETTE_MANAGER_DATA_KEY = "PALETTE_MANAGER_DATA_KEY";
  1830. // $source: com/ibm/rave/library/palette/internal/PaletteSet
  1831. /************************************************************************
  1832. ** IBM Confidential
  1833. **
  1834. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1835. **
  1836. ** (C) Copyright IBM Corp. 2017
  1837. **
  1838. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1839. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1840. ************************************************************************/
  1841. // GENERATED
  1842. //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isJSONObject
  1843. //@import com/ibm/rave/library/Library (runtime) // logError
  1844. //@import com/ibm/rave/library/palette/internal/CategoricalPalette (runtime) // new
  1845. //@import com/ibm/rave/library/palette/internal/ContinuousPalette (runtime) // new
  1846. //@import com/ibm/rave/library/palette/internal/ConditionalPalette (runtime) // new
  1847. /**
  1848. * <p> This class allows for the creation of an set of palettes, and allows a new Palette to be added and an existing Palette to be retrieved by providing its id. </p> <p> Each {@link (com.ibm.rave.library.palette.Palette) Palette} is created from a JSONObject in the JSONArray passed in as an argument to the constructor. Also passed in is a {@link (com.ibm.rave.library.service.LibraryError) LibraryError} object which will record the specifics of any error that occurs. Any error triggers the end of the creation of the palettes in the constructor. </p> <p> The ids of the palettes are mapped to the palettes themselves so that palettes can be retrieved using {@link #this.get(String this.id)} with their matching id. </p>
  1849. */
  1850. var com_ibm_rave_library_palette_internal_PaletteSet = rave['internal']['Declare']({
  1851. //palettes : null,
  1852. /**
  1853. * Create an empty Palette set. See {@link #this.populate(Array)} to populate the set with palettes.
  1854. */
  1855. constructor : function() {
  1856. this.palettes = {};
  1857. },
  1858. /**
  1859. * Creates the palettes based upon the contents of the palettes array. If an error occurs, the creation of the palettes will stop immediately and the cause of the error will be stored in the error object.
  1860. * @param (Array) palettes A JSONArray of palettes as JSONObjects
  1861. */
  1862. populate : function(palettes) {
  1863. if (!palettes) {
  1864. return;
  1865. }
  1866. for (var i = 0; i < palettes.length; ++i) {
  1867. var obj = palettes[i];
  1868. if (com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj)) {
  1869. var jsonPalette = obj;
  1870. var passed = this.add(jsonPalette);
  1871. if (!passed) {
  1872. return;
  1873. }
  1874. }
  1875. }
  1876. },
  1877. /**
  1878. * Adds a new Palette, or if one of that id already exists, replaces it. If there is no id, we set the error.
  1879. * @param (Object) palette The new Palette
  1880. * @return (boolean) The new Palette
  1881. */
  1882. add : function(palette) {
  1883. var id = ""+(palette["id"]);
  1884. if (id != null && id.length > 0) {
  1885. this.palettes[id] = palette;
  1886. return true;
  1887. }
  1888. com_ibm_rave_library_Library.logError(5);
  1889. return false;
  1890. },
  1891. /**
  1892. * Remove a Palette. If there is no id, we set the error.
  1893. * @param (String) paletteId The Palette to remove
  1894. * @param (com.ibm.rave.library.service.LibraryError) error indicates if an error occurs, and what the error was
  1895. */
  1896. remove : function(paletteId, error) {
  1897. if (paletteId != null && paletteId.length > 0) {
  1898. delete this.palettes[paletteId];
  1899. } else {
  1900. com_ibm_rave_library_Library.logError(5, "PaletteSet remove");
  1901. }
  1902. },
  1903. /**
  1904. * Return the JSON representation of a palette
  1905. * @param (String) paletteId
  1906. * @return (Object) palette
  1907. */
  1908. getPaletteJSON : function(paletteId) {
  1909. return this.palettes[paletteId];
  1910. },
  1911. /**
  1912. * This method returns the Palette with the corresponding id.
  1913. * @param (String) id The id to match
  1914. * @return (com.ibm.rave.library.palette.Palette) the Palette with the matching id
  1915. */
  1916. get : function(id) {
  1917. var palette;
  1918. if (id != null) {
  1919. var jsonPalette = this.palettes[id];
  1920. if (jsonPalette) {
  1921. if ("simple" == jsonPalette["fillType"]) {
  1922. palette = new com_ibm_rave_library_palette_internal_CategoricalPalette(jsonPalette);
  1923. } else if ("continuous" == jsonPalette["fillType"] || "discrete" == jsonPalette["fillType"]) {
  1924. palette = new com_ibm_rave_library_palette_internal_ContinuousPalette(jsonPalette);
  1925. } else if ("conditional" == jsonPalette["fillType"]) {
  1926. palette = new com_ibm_rave_library_palette_internal_ConditionalPalette(jsonPalette);
  1927. }
  1928. }
  1929. }
  1930. return palette;
  1931. },
  1932. /**
  1933. * Retrieve all palettes as an array. Note, this constructs a <em>new array</em> containing the palettes in this set.
  1934. * @return (Array) All palettes
  1935. */
  1936. getAll : function() {
  1937. var paletteArray = [];
  1938. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.palettes), __len_enFor0 = __exp_enFor0.length;
  1939. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1940. var key = __exp_enFor0[__i_enFor0];
  1941. paletteArray.push(this.get(key));
  1942. }
  1943. return paletteArray;
  1944. },
  1945. /**
  1946. * Retrieve all palette Ids as an array. Note, this constructs a <em>new array</em> containing the palette Ids in this set.
  1947. * @return (Array) All palettes Ids
  1948. */
  1949. getAllIds : function() {
  1950. var paletteIds = [];
  1951. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.palettes), __len_enFor0 = __exp_enFor0.length;
  1952. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1953. var key = __exp_enFor0[__i_enFor0];
  1954. paletteIds.push(key);
  1955. }
  1956. return paletteIds;
  1957. }
  1958. });
  1959. // $source: com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils
  1960. /************************************************************************
  1961. ** IBM Confidential
  1962. **
  1963. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1964. **
  1965. ** (C) Copyright IBM Corp. 2015
  1966. **
  1967. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1968. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1969. ************************************************************************/
  1970. var com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils = (function() {
  1971. //constructor : function() {}
  1972. });
  1973. /** @expose */
  1974. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.parse = function(jString) {
  1975. var json = null;
  1976. try {
  1977. json = JSON.parse(jString);
  1978. } catch (e) {
  1979. com_ibm_rave_library_Library.logError(com_ibm_rave_library_LibraryError.PROPERTY_JSON_PARSE_ERROR, "PropertyNativeUtils parse");
  1980. }
  1981. return json;
  1982. };
  1983. /** @expose */
  1984. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject = function(obj) {
  1985. return (obj != null && obj instanceof Object && !com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray(obj));
  1986. };
  1987. /** @expose */
  1988. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray = function(obj) {
  1989. return (obj instanceof Array);
  1990. };
  1991. /** @expose */
  1992. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isNumber = function(object) {
  1993. return (typeof object == 'number' || object instanceof Number);
  1994. };
  1995. /** @expose */
  1996. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString = function(object) {
  1997. return (typeof object == 'string' || object instanceof String);
  1998. };
  1999. /** @expose */
  2000. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isBoolean = function(object) {
  2001. return (typeof object == 'boolean' || object instanceof Boolean);
  2002. };
  2003. /** @expose */
  2004. com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.stringMatchesRexExp = function(str, regexp) {
  2005. var re = new RegExp(regexp);
  2006. var match = re.exec(str);
  2007. if (match[0] == str) {
  2008. return true;
  2009. }
  2010. return false;
  2011. };
  2012. // $source: com/ibm/rave/library/palette/Palette
  2013. /************************************************************************
  2014. ** IBM Confidential
  2015. **
  2016. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2017. **
  2018. ** (C) Copyright IBM Corp. 2017
  2019. **
  2020. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2021. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2022. ************************************************************************/
  2023. // GENERATED
  2024. //@import com/ibm/rave/library/framework/internal/ScaleManager (runtime) // ordinalDomain
  2025. //@import com/ibm/rave/library/framework/internal/OrdinalCoordinateScaleDatum (runtime) // new
  2026. /**
  2027. * A palette class the palette will hold colors to be used by the bundles
  2028. */
  2029. var com_ibm_rave_library_palette_Palette = rave_library_externs["Palette"] = rave['internal']['Declare']({
  2030. /**
  2031. * The palette id
  2032. */
  2033. //_id : null,
  2034. /**
  2035. * The palette label
  2036. */
  2037. //_label : null,
  2038. /**
  2039. * The palette description
  2040. */
  2041. //_description : null,
  2042. /**
  2043. * The palette icon
  2044. */
  2045. //_icon : null,
  2046. /**
  2047. * null value color
  2048. */
  2049. /** @expose */
  2050. nullColor : null,
  2051. /**
  2052. * The accessor function to get the data for the palette
  2053. */
  2054. /** @expose */
  2055. dataAccessor : null,
  2056. /**
  2057. * The palette type
  2058. */
  2059. /** @expose */
  2060. type : null,
  2061. /**
  2062. * TODO:
  2063. */
  2064. //_originalDomain : null,
  2065. //_originalDomainLabelAccessor : null,
  2066. /**
  2067. * the validity of the domain
  2068. */
  2069. _domainValidity : 0,
  2070. /**
  2071. * Palette constructor which takes a json representation of the palette
  2072. * @param (Object) jsonPalette the json representation of the palette
  2073. */
  2074. /** @expose */
  2075. constructor : function(jsonPalette) {
  2076. this._id = (jsonPalette["id"]);
  2077. this._label = (jsonPalette["label"]);
  2078. this._description = (jsonPalette["description"]);
  2079. this._icon = (jsonPalette["icon"]);
  2080. this.nullColor = null;
  2081. this._domainValidity = com_ibm_rave_library_palette_Palette.VALID_DOMAIN;
  2082. this.dataAccessor = function(data) {
  2083. return data;
  2084. };
  2085. },
  2086. /**
  2087. * Get the palettes id
  2088. * @return (String) the id
  2089. */
  2090. /** @expose */
  2091. getId : function() {
  2092. return this._id;
  2093. },
  2094. /**
  2095. * Get the palettes label
  2096. * @return (String) the label
  2097. */
  2098. /** @expose */
  2099. getLabel : function() {
  2100. return this._label;
  2101. },
  2102. /**
  2103. * Get the palettes description
  2104. * @return (String) the description
  2105. */
  2106. /** @expose */
  2107. getDescription : function() {
  2108. return this._description;
  2109. },
  2110. /**
  2111. * Get the palettes icon
  2112. * @return (String) the icon
  2113. */
  2114. /** @expose */
  2115. getIcon : function() {
  2116. return this._icon;
  2117. },
  2118. /**
  2119. * Get the palettes type
  2120. * @return (String) the type
  2121. */
  2122. /** @expose */
  2123. getType : function() {
  2124. return this.type;
  2125. },
  2126. /**
  2127. * @return (int) the _domainValidity
  2128. */
  2129. /** @expose */
  2130. getDomainValidity : function() {
  2131. return this._domainValidity;
  2132. },
  2133. /**
  2134. * Set the data accessor function
  2135. * @param (rave['internal']['SingleValueFunction']) singleValueFunction value function
  2136. */
  2137. /** @expose */
  2138. setAccessor : function(singleValueFunction) {
  2139. this.dataAccessor = singleValueFunction;
  2140. },
  2141. /**
  2142. * set the data for the palette with the included domain
  2143. * @param (Array) domain the data domain
  2144. * @param (com.ibm.rave.library.datamodel.DataSet) dataSet the data set to be used in the palette's domain
  2145. * @param (String) slot the data slot in the data set
  2146. */
  2147. setData$0 : function(domain, dataSet, slot) {
  2148. var dataSlot = dataSet.slot(slot);
  2149. this.setDomain(domain, dataSlot ? dataSlot.entry() : null, null, null);
  2150. },
  2151. /**
  2152. * set the data for the palette from the data set
  2153. * @param (com.ibm.rave.library.datamodel.DataSet) dataSet the data set to be used in the palette's domain
  2154. * @param (String) slot the data slot in the data set
  2155. */
  2156. setData$1 : function(dataSet, slot) {
  2157. var dataSlot = dataSet.slot(slot);
  2158. var colorAccessor = dataSlot ? dataSlot.entry() : null;
  2159. var data = dataSet.data();
  2160. var originalDomain;
  2161. var originalDomainLabelAccessor;
  2162. var domain;
  2163. if (colorAccessor) {
  2164. if ("numeric" == colorAccessor.type$0()) {
  2165. domain = com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, colorAccessor, true);
  2166. } else {
  2167. domain = com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, colorAccessor, false);
  2168. }
  2169. if (domain) {
  2170. var originalDomainMap = rave['internal']['ES6Map'].create();
  2171. for (var __i_enFor0 = 0, __exp_enFor0 = domain, __len_enFor0 = __exp_enFor0.length;
  2172. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2173. var key = __exp_enFor0[__i_enFor0];
  2174. originalDomainMap.set(key, new com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum(key));
  2175. }
  2176. for (var __i_enFor1 = 0, __exp_enFor1 = data, __len_enFor1 = __exp_enFor1.length;
  2177. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  2178. var o = __exp_enFor1[__i_enFor1];
  2179. var key = colorAccessor(o);
  2180. var datum = originalDomainMap.get(key);
  2181. if (datum) {
  2182. datum.push(o);
  2183. }
  2184. }
  2185. originalDomain = [];
  2186. for (var __i_enFor2 = 0, __exp_enFor2 = domain, __len_enFor2 = __exp_enFor2.length;
  2187. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  2188. var d = __exp_enFor2[__i_enFor2];
  2189. originalDomain.push(originalDomainMap.get(d));
  2190. }
  2191. originalDomainLabelAccessor = function(data, index, groupIndex) {
  2192. var key = (data).key();
  2193. return ""+(key);
  2194. };
  2195. }
  2196. }
  2197. this.setDomain(domain, colorAccessor, originalDomain, originalDomainLabelAccessor);
  2198. },
  2199. /**
  2200. * validate the domain and set it accordingly
  2201. * @param (Array) domain the data domain
  2202. * @param label the label for the data if no valid domain is used
  2203. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) colorAccessor the accessor for the color slot
  2204. */
  2205. setDomain : function(domain, colorAccessor, originalDomain, originalDomainLabelAccessor) {
  2206. if (!domain) {
  2207. this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL;
  2208. this.invalidateDomain();
  2209. } else if (domain.length <= 0) {
  2210. this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_EMPTY;
  2211. this.invalidateDomain();
  2212. } else if (!(this.canHandleDataType(colorAccessor ? colorAccessor.type$0() : null))) {
  2213. this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_DATATYPE;
  2214. this.invalidateDomain();
  2215. } else {
  2216. this._domainValidity = com_ibm_rave_library_palette_Palette.VALID_DOMAIN;
  2217. this.domain(domain);
  2218. this._originalDomain = originalDomain;
  2219. this._originalDomainLabelAccessor = originalDomainLabelAccessor;
  2220. }
  2221. },
  2222. /**
  2223. * set the palettes null value color
  2224. * @param (String) color the null color
  2225. */
  2226. /** @expose */
  2227. setNullColor : function(color) {
  2228. this.nullColor = color;
  2229. },
  2230. /**
  2231. * Adds a single color into the palette
  2232. * @param (Object) color a json object representing a color
  2233. */
  2234. /** @expose */
  2235. addColor : function(color) {},
  2236. /**
  2237. * Adds an array of colors into the palette
  2238. * @param (Array) colors a json object representing a color
  2239. */
  2240. /** @expose */
  2241. addAllColors : function(colors) {},
  2242. /**
  2243. * removed a single color from the palette
  2244. * @param (Object) color a json object representing a color to remove
  2245. */
  2246. /** @expose */
  2247. removeColor : function(color) {},
  2248. /**
  2249. * set the domain of the palette
  2250. * @param (Array) domain the domain to be set on the palette
  2251. */
  2252. /** @expose */
  2253. domain : function(domain) {},
  2254. /**
  2255. * Set domain to be invalid
  2256. */
  2257. /** @expose */
  2258. invalidateDomain : function() {},
  2259. /**
  2260. * get the scale for the palette
  2261. * @return (rave['internal']['AbstractScale']) the scale
  2262. */
  2263. /** @expose */
  2264. getScale : function() {},
  2265. /**
  2266. * Can the palette handle the data type
  2267. * @return (boolean) whether the palette can handle the data type
  2268. */
  2269. /** @expose */
  2270. canHandleDataType : function(type) {},
  2271. /**
  2272. * TODO:
  2273. */
  2274. /** @expose */
  2275. originalDomain : function() {
  2276. return this._originalDomain;
  2277. },
  2278. /**
  2279. * TODO: Copied from OrdinalCoordinateScale Set a label accessor function to be used with an "original domain" (See {@link #this.originalDomain()} ). The provided format function should return a String when provided with an original data value.
  2280. */
  2281. originalDomainLabelAccessor$0 : function(format) {
  2282. this._originalDomainLabelAccessor = format;
  2283. },
  2284. /**
  2285. * TODO: Copied from OrdinalCoordinateScale Retrieve the label accessor function. May be null if no accessor was supplied through {@link #this.originalDomainLabelAccessor(rave['internal']['ValueFunction'])} .
  2286. */
  2287. originalDomainLabelAccessor$1 : function() {
  2288. return this._originalDomainLabelAccessor;
  2289. },
  2290. /** @expose */
  2291. setData : function(a0, a1, a2) {
  2292. var args = arguments;
  2293. if (args.length == 2) {
  2294. return this.setData$1(a0, a1);
  2295. }
  2296. return this.setData$0(a0, a1, a2);
  2297. },
  2298. /** @expose */
  2299. originalDomainLabelAccessor : function(a0) {
  2300. var args = arguments;
  2301. if (args.length == 0) {
  2302. return this.originalDomainLabelAccessor$1();
  2303. }
  2304. return this.originalDomainLabelAccessor$0(a0);
  2305. }
  2306. });
  2307. /**
  2308. * numeric data type
  2309. */
  2310. //com_ibm_rave_library_palette_Palette.DATATYPE_NUMERIC = "numeric";
  2311. /**
  2312. * string data type
  2313. */
  2314. //com_ibm_rave_library_palette_Palette.DATATYPE_STRING = "string";
  2315. /**
  2316. * valid domain
  2317. */
  2318. /** @expose */
  2319. com_ibm_rave_library_palette_Palette.VALID_DOMAIN = 0;
  2320. /**
  2321. * the reason for the invalid domain is the datatype
  2322. */
  2323. /** @expose */
  2324. com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_DATATYPE = 1;
  2325. /**
  2326. * the reason for the invalid domain is its empty
  2327. */
  2328. /** @expose */
  2329. com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_EMPTY = 2;
  2330. /**
  2331. * the reason for the invalid domain is it is null. Null domain means color slot isn't defined in data. Empty domain means color slot is defined, but returns null in all cases.
  2332. */
  2333. /** @expose */
  2334. com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL = 3;
  2335. // $source: com/ibm/rave/library/framework/internal/CoordinateScaleImpl
  2336. /************************************************************************
  2337. ** IBM Confidential
  2338. **
  2339. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2340. **
  2341. ** (C) Copyright IBM Corp. 2018
  2342. **
  2343. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2344. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2345. ************************************************************************/
  2346. // GENERATED
  2347. /**
  2348. * <p> A CoordinateScaleImpl simplifies using scales for coordinates where the data values may be ordinal or non-ordinal. It wraps a RAVE core scale and delegates to that scale. Instances are obtained from the factory methods. </p> <p> The scale is not an AbstractScale. The {@link #this.scale()} method gives access to the internal scale, so that it can be used with axes and related core code. This scale should not be directly modified, although it is safe to use it in pan-zoom. </p> <p> Conceptually each input value is scaled to a band of output pixel coordinates using the {@link #this.range(, , Number, Number)} . All bands are the same width. The coordinate methods {@link #this.center(Object)} , {@link #this.lower(Object)} , and {@link #this.upper(Object)} give the center and two endpoints of these bands, and {@link #this.width()} gives the band width. For continuous scales the width is by default 0, and the coordinate methods all return the center; however the width can be changed by the bundle, for example by setting the column width. </p> <p> For example, a point component can use either ordinal or non-ordinal scales on the two axes. The point component is passed the two CoordinateScales wrapping those scales, and uses {@link #this.center(Object)} to get the coordinate of the center of the point element. An interval element would similarly use the {@link #this.lower(Object)} and {@link #this.upper(Object)} for the span of the interval. </p> <p> Methods are also provided to modify the input domain by including zero or by expanding the domain by a percentage or by pixels. These methods only modify continuous scales. </p>
  2349. */
  2350. var com_ibm_rave_library_framework_internal_CoordinateScaleImpl = rave['internal']['Declare']({
  2351. /**
  2352. * Returns the internal scale used by the coordinate scale; for clustered scales this is the first scale. This may be used for axes and pan-zoom. Changing the domain or range of this scale may have unexpected effects.
  2353. * @return (rave['internal']['AbstractScale']) The scale passed to the factory method
  2354. */
  2355. /** @expose */
  2356. scale : function() {},
  2357. /**
  2358. * Base class returns false.
  2359. * @return (boolean) Whether the scale is continuous (linear or time)
  2360. */
  2361. isContinuous : function() {
  2362. return false;
  2363. },
  2364. /**
  2365. * Base class returns false.
  2366. * @return (boolean) Whether the scale is the ordinal subclass
  2367. */
  2368. /** @expose */
  2369. isOrdinal : function() {
  2370. return false;
  2371. },
  2372. /**
  2373. * Base class returns false.
  2374. * @return (boolean) Whether the scale is the linear subclass
  2375. */
  2376. /** @expose */
  2377. isLinear : function() {
  2378. return false;
  2379. },
  2380. /**
  2381. * Base class returns false.
  2382. * @return (boolean) Whether the scale is the time subclass
  2383. */
  2384. /** @expose */
  2385. isTime : function() {
  2386. return false;
  2387. },
  2388. /**
  2389. * Base class returns false.
  2390. * @return (boolean) Whether the scale is the clustered subclass
  2391. */
  2392. /** @expose */
  2393. isClustered : function() {
  2394. return false;
  2395. },
  2396. /**
  2397. * <p> Expands the domain of a non-ordinal scale by the given fraction at both ends. For example if the domain is [0,10] and the fraction is 0.10, the domain becomes [-1,11]. If the domain has more than two values, only the end values are changed. Ordinal and clustered scales are not changed. </p> <p> If keepZero is true, any endpoint with value zero will not be changed. In the above example with domain [0,10], if keepZero is true the domain becomes [0,11]. </p> <p> The base class implementation does nothing. </p>
  2398. * @param (double) fraction Fraction of the current domain by which to expand the domain
  2399. * @param (boolean) keepZero If true, a zero value is not modified by the expansion
  2400. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2401. */
  2402. expandFraction : function(fraction, keepZero) {
  2403. return this;
  2404. },
  2405. /**
  2406. * <p> Expands the domain of a non-ordinal scale at both ends so that the original endpoints of the domain are the given number of pixels from the ends of the range. The range of the scale must be set before calling this method. For example if the original domain was [0,10] with range [0,500] and pixels is 50, the domain becomes [-1.25,11.25] (since that now maps 0 to 50 and 10 to 450). </p> <p> If keepZero is true, any endpoint with value zero will not be changed. In the above example with domain [0,10], if keepZero is true the domain becomes [0,11.111]; domain 0.0 still maps to range 0.0, and domain 10.0 now maps to range 450. </p> <p> The domain is not changed if pixels is non-positive, or if the range is too small to allow the expansion. Ordinal and clustered scales are not changed. </p> <p> The base class implementation does nothing. </p>
  2407. * @param (double) pixels Number of pixels on the ends of the domain
  2408. * @param (boolean) keepZero If true and an endpoint is zero, the endpoint is not changed
  2409. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2410. */
  2411. expandPixels : function(pixels, keepZero) {
  2412. return this;
  2413. },
  2414. /**
  2415. * <p> Expands the domain of a non-ordinal scale to include zero. If the domain has more than two values, only the end values are changed. The domain is not changed if it already includes zero. Ordinal and clustered scales are not changed. </p> <p> The base class implementation does nothing. </p>
  2416. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2417. */
  2418. includeZero : function() {
  2419. return this;
  2420. },
  2421. /**
  2422. * <p> If the domain is continuous and has zero extent (e.g. [X,X]), expands the extent so the domain is valid for use with an axis. The new domain contains X. </p> <p> If keepZero is true and the domain is [0,0] (only possible with numbers), the domain becomes [0,1]; this is mostly for charts that have included zero, where the expectation is that 0 will remain at one end of the domain. </p> <p> The base class implementation does nothing. </p>
  2423. * @param (boolean) keepZero
  2424. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) this
  2425. */
  2426. expandZeroExtent : function(keepZero) {
  2427. return this;
  2428. },
  2429. /**
  2430. * <p> Extends the domain so that it starts and ends on nice round values of multiple of 10 ^ tickMagnitude. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value considering the tick magnitude. </p> <p> The base class implementation does nothing. </p>
  2431. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2432. */
  2433. nice$0 : function(tickMagnitude) {
  2434. return this;
  2435. },
  2436. /**
  2437. * <p> Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value. </p> <p> The base class implementation does nothing. </p>
  2438. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2439. */
  2440. nice$1 : function() {
  2441. return this;
  2442. },
  2443. /**
  2444. * <p> Get the center value for the data. If the internal scale is ordinal or clustered, this is the center of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null. </p>
  2445. * @param (Object) data Value to be scaled
  2446. * @return (Number) Coordinate for the center of that value
  2447. */
  2448. /** @expose */
  2449. center : function(data) {},
  2450. /**
  2451. * <p> Get the lower value for the data. If the internal scale is ordinal or clustered, this is the start of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null. This value is always less than or equal to the center value, even if the scale is configured with a reverse pixel range. </p>
  2452. * @param (Object) data Value to be scaled
  2453. * @return (Number) Coordinate for the lower end of that value
  2454. */
  2455. /** @expose */
  2456. lower : function(data) {},
  2457. /**
  2458. * <p> Get the upper value for the data. If the internal scale is ordinal or clustered, this is the end of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null. This value is always greater than or equal to the center value, even if the scale is configured with a reverse pixel range. </p>
  2459. * @param (Object) data Value to be scaled
  2460. * @return (Number) Coordinate for the lower end of that value
  2461. */
  2462. /** @expose */
  2463. upper : function(data) {},
  2464. /**
  2465. * <p> Get the width in pixels of the band for the data. As the core scales are not configured with variable widths (yet), this is the same for all data values. It is the difference of the {@link #this.upper(Object)} and {@link #this.lower(Object)} values, with the {@link #this.center(Object)} halfway between. </p> <p> For ordinal scales, this is the width allocated to each value by the core scale range bands. For continuous scales it is the width set by {@link #this.setWidth()} . </p>
  2466. */
  2467. /** @expose */
  2468. width : function() {},
  2469. /**
  2470. * <p> Set the width in pixels of the band for the data. This is the difference of the {@link #this.upper(Object)} and {@link #this.lower(Object)} values, with the {@link #this.center(Object)} halfway between. </p> <p> For ordinal scales this does nothing unless {@link #this.applyWidth()} is called with true, since the band widths are fixed by default by the range bands of the core scales. Ordinal scales will also revert to default behavior if the value passed in here is 0 or less. </p> <p> For continuous scales, if the argument width is negative the scale's width is not changed. </p> <p> The base class implementation does nothing. </p>
  2471. * @param (double) w The width
  2472. */
  2473. setWidth : function(w) {},
  2474. /**
  2475. * <p> Allow the width set in {@link #this.setWidth()} to affect even ordinal scales. If this is false, or it is never called, ordinal scales will not be affected by the width, which is their default behavior. </p> <p> This affects only ordinal scales, and does nothing for continuous scales. </p> <p> The base class implementation does nothing. </p>
  2476. * @param (boolean) apply
  2477. */
  2478. applyWidth : function(apply) {},
  2479. /**
  2480. * Retrieve the list of client data that this scale's domain is based upon. Will return null if the scale is not Ordinal or Clustered, or was not constructed from external client data.
  2481. */
  2482. originalDomain : function() {
  2483. return null;
  2484. },
  2485. /**
  2486. * Set a label accessor function to be used with an "original domain" (See {@link #this.originalDomain()} ). The provided format function should return a String when provided with an original data value. Note this only effects Ordinal and Clustered Coordinate scales. Numeric scales do not support original data domains.
  2487. */
  2488. originalDomainLabelAccessor$0 : function(format) {},
  2489. /**
  2490. * Retrieve the label accessor function. May be null if no accessor was supplied through {@link #this.originalDomainLabelAccessor(rave['internal']['ValueFunction'])} . Note this only effects Ordinal and Clustered Coordinate scales. Numeric scales do not support original data domains.
  2491. */
  2492. originalDomainLabelAccessor$1 : function() {
  2493. return null;
  2494. },
  2495. nice : function(a0) {
  2496. var args = arguments;
  2497. if (args.length == 0) {
  2498. return this.nice$1();
  2499. }
  2500. return this.nice$0(a0);
  2501. },
  2502. originalDomainLabelAccessor : function(a0) {
  2503. var args = arguments;
  2504. if (args.length == 0) {
  2505. return this.originalDomainLabelAccessor$1();
  2506. }
  2507. return this.originalDomainLabelAccessor$0(a0);
  2508. }
  2509. /**
  2510. * Set the coordinate range of the scale to the given interval [v1,v2] with padding arguments as used with a core ordinal scale. If the internal scale is non-ordinal these arguments are ignored.
  2511. * @param (double) v1 First end of range
  2512. * @param (double) v2 Second end of range
  2513. * @param (Number) padding Padding, see OrdinalScale documentation
  2514. * @param (Number) outerPadding Outer padding, see OrdinalScale documentation
  2515. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale
  2516. */
  2517. //range : function(v1, v2, padding, outerPadding) {}
  2518. });
  2519. /**
  2520. * Determines if rangeRoundBands should be used in favor or rangeBands for ordinal coordinate scales (i.e. OrdinalCoordinateScale, ClusteredCoordinateScale).
  2521. * @param (double) v1 Interval starting value. Note, this need not be the "minimum" value.
  2522. * @param (double) v2 Interval ending value. Note, this need not be the "maximum" value.
  2523. * @param (int) domainSize The number of data values to be represented in the provided interval range (e.g. the length of an ordinal scale's domain array).
  2524. * @param (Number) padding Padding percentage. See OrdinalScale#rangeBands for more detail.
  2525. * @param (Number) outerPadding Outer padding percentage. See OrdinalScale#rangeBands for more detail.
  2526. * @return (boolean) True if range rounding should be used. False otherwise.
  2527. */
  2528. com_ibm_rave_library_framework_internal_CoordinateScaleImpl.useRounding = function(v1, v2, domainSize, padding, outerPadding) {
  2529. var pad = padding != null ? padding : 0.0;
  2530. var oPad = outerPadding != null ? outerPadding : 0.0;
  2531. return (Math.abs(v2 - v1) / (domainSize - pad + 2 * oPad)) >= 10.0;
  2532. };
  2533. com_ibm_rave_library_framework_internal_CoordinateScaleImpl.ROUND_TOLERANCE = 10;
  2534. // $source: com/ibm/rave/library/framework/internal/OrdinalCoordinateScaleDatum
  2535. /************************************************************************
  2536. ** IBM Confidential
  2537. **
  2538. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2539. **
  2540. ** (C) Copyright IBM Corp. 2017
  2541. **
  2542. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2543. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2544. ************************************************************************/
  2545. // GENERATED
  2546. /**
  2547. * A data object to be attached to ordinal axis ticks. Example usage: <pre> bundleInstance .node("#bundleNode") .render(); rave.select("#bundleNode") .selectAll(".axis.bottom .tick") .on("click", function(d) { console.log(d.originalData()); }); </pre> The resulting output is an array containing all data values associated with the category of the "clicked" axis tick.
  2548. */
  2549. var com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum = rave['internal']['Declare']({
  2550. //_key : null,
  2551. //_values : null,
  2552. /**
  2553. * Construct a new datum for the given key value. The key is the value that will be converted to a string and displayed as the axis tick label.
  2554. */
  2555. constructor : function(key) {
  2556. this._key = key;
  2557. this._values = [];
  2558. },
  2559. /**
  2560. * Add a value to the list of client values associated with this datum's key (category).
  2561. */
  2562. push : function(v) {
  2563. this._values.push(v);
  2564. },
  2565. /**
  2566. * Retrieve this datum's key value.
  2567. */
  2568. key : function() {
  2569. return this._key;
  2570. },
  2571. originalData : function() {
  2572. return this._values;
  2573. },
  2574. originalDataList : function() {
  2575. return this._values;
  2576. },
  2577. toString : function() {
  2578. return this._key.toString();
  2579. }
  2580. });
  2581. // $source: com/ibm/rave/library/action/ActionOperation
  2582. /************************************************************************
  2583. ** IBM Confidential
  2584. **
  2585. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2586. **
  2587. ** (C) Copyright IBM Corp. 2017
  2588. **
  2589. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2590. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2591. ************************************************************************/
  2592. // GENERATED
  2593. var com_ibm_rave_library_action_ActionOperation = rave_library_externs["ActionOperation"] = rave['internal']['Declare']({
  2594. /**
  2595. * Returns useful state information from the action(Should the information exist), such as the zoom behavior object in the case of the pan/zoom operation.
  2596. * @param (String) id the ID of the object
  2597. * @return (Object) the state object for the operation.
  2598. */
  2599. /** @expose */
  2600. get : function(id) {
  2601. return null;
  2602. }
  2603. });
  2604. // $source: com/ibm/rave/library/action/FiltersUtil
  2605. /************************************************************************
  2606. ** IBM Confidential
  2607. **
  2608. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2609. **
  2610. ** (C) Copyright IBM Corp. 2017
  2611. **
  2612. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2613. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2614. ************************************************************************/
  2615. // GENERATED
  2616. var com_ibm_rave_library_action_FiltersUtil = rave_library_externs["FiltersUtil"] = rave['internal']['Declare']({
  2617. /**
  2618. * Selection filter utility, This is used to filter out elements with the "selected" flag from the rest of the elements, keeping them in the "selected" state intead of allowing them to fade out with the background elements.
  2619. * @param (rave['internal']['Selector']) context All the other element in the context.
  2620. * @param (boolean) flag a boolean to decide whether the return should be selected/unselected elements true: unselected, false: selected.
  2621. * @return (rave['internal']['Selector']) Filtered Selection (selected elements.)
  2622. */
  2623. /** @expose */
  2624. selectionFilter : function(context, flag) {
  2625. return context.filter(flag ? function(data, i, groupIndext) {
  2626. var selected = rave.select(this).property("selected");
  2627. return (selected == null);
  2628. } : function(data, i, groupIndext) {
  2629. var selected = rave.select(this).property("selected");
  2630. return ((selected) == true);
  2631. });
  2632. }
  2633. });
  2634. /** @expose */
  2635. com_ibm_rave_library_action_FiltersUtil.INSTANCE = new com_ibm_rave_library_action_FiltersUtil();
  2636. // $source: com/ibm/rave/library/property/PropertySet
  2637. /************************************************************************
  2638. ** IBM Confidential
  2639. **
  2640. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2641. **
  2642. ** (C) Copyright IBM Corp. 2017
  2643. **
  2644. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2645. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2646. ************************************************************************/
  2647. // GENERATED
  2648. //@import com/ibm/rave/library/property/PropertyProcessor (runtime) // processProperties
  2649. //@import com/ibm/rave/library/property/ObjectPropertyImpl (runtime) // new
  2650. //@import com/ibm/rave/library/property/PropertyImpl (runtime) // new
  2651. /**
  2652. * <p> This class allows for the creation of an set of properties, and allows a new property to be added and an existing property to be retrieved by providing its id. </p> <p> Each {@link (com.ibm.rave.library.property.PropertyImpl) PropertyImpl} is created from a JSONObject in the containing properties JSONObject passed in as an argument to the populate method, or from a each of properties meta types in the passed list. </p> <p> The fully qualified ids of the properties are mapped to the properties themselves so that properties can be retrieved using {@link #this.property(String this.id)} with their matching fully qualified id. </p>
  2653. */
  2654. var com_ibm_rave_library_property_PropertySet = rave_library_externs["PropertySet"] = rave['internal']['Declare']({
  2655. /**
  2656. * Map containing all property definitions.
  2657. */
  2658. //_flattennedPropMap : null,
  2659. /**
  2660. * List containing all visible (public API) property definitions; null when it needs to be re-created.
  2661. */
  2662. //_visibleProperties : null,
  2663. /**
  2664. * List containing all visible (public API) property metainformation; null when it needs to be re-created.
  2665. */
  2666. //_visibleMeta : null,
  2667. /**
  2668. * Create an empty property set. See {@link #this.populate(Array)} and {@link #this.populate(Object, com_ibm_rave_library_i18n_MessagesRegistry, )} to populate the set with properties.
  2669. */
  2670. /** @expose */
  2671. constructor : function() {
  2672. this._flattennedPropMap = {};
  2673. this._visibleProperties = null;
  2674. this._visibleMeta = null;
  2675. },
  2676. populate$0 : function(properties) {
  2677. for (var __i_enFor0 = 0, __exp_enFor0 = properties, __len_enFor0 = __exp_enFor0.length;
  2678. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2679. var propertyMeta = __exp_enFor0[__i_enFor0];
  2680. this.addTopLevelProperty(propertyMeta.copy(null));
  2681. }
  2682. this._visibleProperties = null;
  2683. this._visibleMeta = null;
  2684. },
  2685. /**
  2686. * Creates the properties based upon the contents of the props array. If an error occurs, the creation of the properties will stop immediately and the cause of the error will be stored in the error object.
  2687. * @param (Object) props A JSONArray of properties as JSONObjects
  2688. * @param (boolean) validate Whether or not validation is on.
  2689. */
  2690. populate$1 : function(props, messages, validate) {
  2691. var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(props, messages, validate);
  2692. this.populate$0(info.properties);
  2693. },
  2694. addTopLevelProperty : function(propertyType) {
  2695. var prop = this._flattennedPropMap[propertyType.id()];
  2696. if (!prop) {
  2697. this.addProperty(propertyType, null);
  2698. } else {
  2699. this.mergeProperty(prop, propertyType, null);
  2700. }
  2701. },
  2702. addProperty : function(propertyType, parent) {
  2703. var newProperty;
  2704. if (propertyType.typeId() == 21) {
  2705. var objPropType = propertyType;
  2706. newProperty = new com_ibm_rave_library_property_ObjectPropertyImpl(objPropType, parent);
  2707. this._flattennedPropMap[propertyType.id()] = newProperty;
  2708. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objPropType._childProperties), __len_enFor0 = __exp_enFor0.length;
  2709. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2710. var key = __exp_enFor0[__i_enFor0];
  2711. var childProperty = objPropType._childProperties[key];
  2712. this.addProperty(childProperty, newProperty);
  2713. }
  2714. } else {
  2715. newProperty = new com_ibm_rave_library_property_PropertyImpl(propertyType, parent);
  2716. this._flattennedPropMap[propertyType.id()] = newProperty;
  2717. }
  2718. if (parent && parent.meta().typeId() == 21) {
  2719. (parent).childProperties()[newProperty.meta().simpleId()] = newProperty;
  2720. }
  2721. },
  2722. mergeProperty : function(existingProperty, newPropertyType, parent) {
  2723. if (existingProperty.meta().typeId() == 21 && newPropertyType.typeId() == 21) {
  2724. var existingObj = existingProperty;
  2725. var newObjType = newPropertyType;
  2726. var newObjectTypeChildIds = {};
  2727. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(newObjType._childProperties), __len_enFor0 = __exp_enFor0.length;
  2728. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2729. var key = __exp_enFor0[__i_enFor0];
  2730. newObjectTypeChildIds[key] = 1;
  2731. var newChildPropertyType = newObjType._childProperties[key];
  2732. var existingChildProperty = existingObj.childProperties()[key];
  2733. if (existingChildProperty) {
  2734. this.mergeProperty(existingChildProperty, newChildPropertyType, existingObj);
  2735. } else {
  2736. this.fuseProperty(newChildPropertyType, existingObj);
  2737. }
  2738. }
  2739. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(newObjectTypeChildIds), __len_enFor1 = __exp_enFor1.length;
  2740. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  2741. var key = __exp_enFor1[__i_enFor1];
  2742. delete newObjType._childProperties[""+(key)];
  2743. }
  2744. } else {
  2745. this.overwriteProperty(existingProperty, newPropertyType, parent);
  2746. }
  2747. },
  2748. overwriteProperty : function(existingProperty, newPropertyType, parent) {
  2749. if (existingProperty.meta().typeId() == 21) {
  2750. var objProperty = existingProperty;
  2751. var children = objProperty.childProperties();
  2752. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(children), __len_enFor0 = __exp_enFor0.length;
  2753. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2754. var propertyId = __exp_enFor0[__i_enFor0];
  2755. var childProperty = children[propertyId];
  2756. this.removePropertyFromFlatMap(childProperty);
  2757. }
  2758. }
  2759. if (parent && parent.meta().typeId() == 21) {
  2760. this.fuseProperty(newPropertyType, parent);
  2761. } else {
  2762. newPropertyType._parent = (existingProperty.meta())._parent;
  2763. this.addProperty(newPropertyType, parent);
  2764. }
  2765. (existingProperty.meta())._parent = null;
  2766. },
  2767. fuseProperty : function(newChildPropertyType, existingParentObj) {
  2768. this.addProperty(newChildPropertyType, existingParentObj);
  2769. var existingParentObjType = existingParentObj.meta();
  2770. existingParentObjType._childProperties[newChildPropertyType.simpleId()] = newChildPropertyType;
  2771. newChildPropertyType._parent = existingParentObjType;
  2772. var defaultInstance = existingParentObj.meta().defaultValue();
  2773. defaultInstance[newChildPropertyType.simpleId()] = newChildPropertyType.defaultValue();
  2774. var valueInstance = existingParentObj.value();
  2775. valueInstance[newChildPropertyType.simpleId()] = newChildPropertyType.defaultValue();
  2776. },
  2777. removePropertyFromFlatMap : function(property) {
  2778. delete this._flattennedPropMap[property.meta().id()];
  2779. if (property.meta().typeId() == 21) {
  2780. var objProperty = property;
  2781. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objProperty.childProperties()).arrayIterator(), __len_enFor0 = __exp_enFor0.length;
  2782. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2783. var propertyId = __exp_enFor0[__i_enFor0];
  2784. var childProperty = objProperty.childProperties()[propertyId];
  2785. this.removePropertyFromFlatMap(childProperty);
  2786. }
  2787. }
  2788. },
  2789. /**
  2790. * <p> Configure properties from the given JSON. If it does not have a "properties" property, nothing is done. </p> <p> Otherwise, the "properties" is an array of objects describing the properties configuration, as in the schema. The array is traversed and used to set initial property values and to mark properties hidden and readonly. </p>
  2791. */
  2792. /** @expose */
  2793. configure : function(json) {
  2794. var v = json["properties"];
  2795. if (v != null) {
  2796. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  2797. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2798. var o = __exp_enFor0[__i_enFor0];
  2799. var config = o;
  2800. var prop = this._flattennedPropMap[""+(config["id"])];
  2801. if (prop) {
  2802. var value = config["value"];
  2803. if (value != null && !(prop._readonly)) {
  2804. prop.value(value);
  2805. prop.meta().setDefaultValue(value);
  2806. }
  2807. var b = (config["hidden"]);
  2808. if (b != null && b) {
  2809. prop.setHidden();
  2810. }
  2811. b = (config["readonly"]);
  2812. if (b != null && b) {
  2813. prop.setReadonly();
  2814. }
  2815. }
  2816. }
  2817. this._visibleProperties = null;
  2818. this._visibleMeta = null;
  2819. }
  2820. },
  2821. /**
  2822. * This method returns the property with the corresponding id, or null if there is no such id.
  2823. * @param (String) id The id to match
  2824. * @return (com.ibm.rave.library.property.Property) the property with the matching id
  2825. */
  2826. /** @expose */
  2827. property : function(id) {
  2828. if (id != null) {
  2829. return this._flattennedPropMap[id];
  2830. }
  2831. return null;
  2832. },
  2833. /**
  2834. * Get a list of all visible (public API) properties.
  2835. * @return (Array) List of visible properties
  2836. */
  2837. /** @expose */
  2838. properties : function() {
  2839. if (!this._visibleProperties) {
  2840. this.buildVisibleProperties();
  2841. }
  2842. return this._visibleProperties;
  2843. },
  2844. /**
  2845. * Get a list of all visible (public API) property meta.
  2846. * @return (Array) List of visible property metadata
  2847. */
  2848. /** @expose */
  2849. meta : function() {
  2850. if (!this._visibleMeta) {
  2851. this.buildVisibleProperties();
  2852. }
  2853. return this._visibleMeta;
  2854. },
  2855. /**
  2856. * Builds _visibleProperties and _visibleMeta. Both contain only the leaf properties that are not hidden.
  2857. */
  2858. buildVisibleProperties : function() {
  2859. this._visibleProperties = [];
  2860. this._visibleMeta = [];
  2861. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._flattennedPropMap), __len_enFor0 = __exp_enFor0.length;
  2862. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2863. var id = __exp_enFor0[__i_enFor0];
  2864. var prop = this._flattennedPropMap[id];
  2865. if (prop.meta().typeId() != 21 && !(prop._hidden)) {
  2866. this._visibleProperties.push(prop);
  2867. this._visibleMeta.push(prop.meta());
  2868. }
  2869. }
  2870. },
  2871. /** @expose */
  2872. populate : function(a0, a1, a2) {
  2873. var args = arguments;
  2874. if (args.length == 1) {
  2875. return this.populate$0(a0);
  2876. }
  2877. return this.populate$1(a0, a1, a2);
  2878. }
  2879. });
  2880. /**
  2881. * Given a list of meta type loaded from different JSON files, the merge method will try to perform a very simple merge of these properties if it detects a fully qualified id collision amongst them. The rules of the simple merge are as follows: 1- If the colliding properties are both objects, then the child properties of the object that shows up later in the list will be added to the children of the object that showed up earlier, resolving collision amongst those children recursively using the same rules. The meta type of both objects and their properties will change as well in order to maintain the parent child relationship amongst them. 2- If at lease one of the properties is not an object, then the property that comes later in the list will completely overwrite the previous one. It is important to keep in mind that in case of collision, the passed properties will change structurally in terms of their parent-child relationship. Also, it is important to keep in mind that the order of meta properties affect the final result.
  2882. * @param (Array) properties the list of meta properties to merge
  2883. * @return (Array) a new list of the merged properties. In case of no collision then the returned list have the exact same properties as the passed list.
  2884. */
  2885. /** @expose */
  2886. com_ibm_rave_library_property_PropertySet.merge = function(properties) {
  2887. var propertySet = new com_ibm_rave_library_property_PropertySet();
  2888. propertySet.populate(properties);
  2889. var props = propertySet.properties();
  2890. var mergedMeta = [];
  2891. for (var __i_enFor0 = 0, __exp_enFor0 = props, __len_enFor0 = __exp_enFor0.length;
  2892. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2893. var p = __exp_enFor0[__i_enFor0];
  2894. mergedMeta.push(p.meta());
  2895. }
  2896. return mergedMeta;
  2897. };
  2898. // $source: com/ibm/rave/library/property/PropertyProcessingInfo
  2899. /************************************************************************
  2900. ** IBM Confidential
  2901. **
  2902. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2903. **
  2904. ** (C) Copyright IBM Corp. 2017
  2905. **
  2906. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2907. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2908. ************************************************************************/
  2909. // GENERATED
  2910. /**
  2911. * When parsing a JSON properties file to create meta properties, the PropertyProcesser return this structure as a result
  2912. */
  2913. var com_ibm_rave_library_property_PropertyProcessingInfo = rave_library_externs["PropertyProcessingInfo"] = rave['internal']['Declare']({
  2914. /**
  2915. * The list of top level meta properties that got processed from the properties JSON file
  2916. */
  2917. /** @expose */
  2918. properties : null,
  2919. //error : null,
  2920. /**
  2921. * Indicates whether any of the properties processed from the JSON file is invalid
  2922. */
  2923. /** @expose */
  2924. hasInvalidProperties : false,
  2925. /**
  2926. * Indicates whether the PropertyProcessor generated this info while validating the properties JSON file
  2927. */
  2928. /** @expose */
  2929. validate : false,
  2930. constructor : function(validate) {
  2931. this.properties = [];
  2932. {
  2933. this.validate = validate;
  2934. }
  2935. },
  2936. processError : function() {
  2937. this.hasInvalidProperties = true;
  2938. }
  2939. });
  2940. // $source: com/ibm/rave/library/property/PropertyUtil
  2941. /************************************************************************
  2942. ** IBM Confidential
  2943. **
  2944. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2945. **
  2946. ** (C) Copyright IBM Corp. 2017
  2947. **
  2948. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2949. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2950. ************************************************************************/
  2951. // GENERATED
  2952. //@import com/ibm/rave/library/Library (runtime) // logError
  2953. //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isBoolean, isJSONArray, isNumber, isString, isJSONObject
  2954. /**
  2955. */
  2956. var com_ibm_rave_library_property_PropertyUtil = rave['internal']['Declare']({
  2957. constructor : function() {
  2958. com_ibm_rave_library_property_PropertyUtil.propertyTypes["string"] = 1;
  2959. com_ibm_rave_library_property_PropertyUtil.propertyTypes["boolean"] = 1;
  2960. com_ibm_rave_library_property_PropertyUtil.propertyTypes["numeric"] = 1;
  2961. com_ibm_rave_library_property_PropertyUtil.propertyTypes["enum"] = 1;
  2962. com_ibm_rave_library_property_PropertyUtil.propertyTypes["font"] = 1;
  2963. com_ibm_rave_library_property_PropertyUtil.propertyTypes["color"] = 1;
  2964. com_ibm_rave_library_property_PropertyUtil.propertyTypes["array"] = 1;
  2965. com_ibm_rave_library_property_PropertyUtil.propertyTypes["palette"] = 1;
  2966. com_ibm_rave_library_property_PropertyUtil.propertyTypes["length"] = 1;
  2967. com_ibm_rave_library_property_PropertyUtil.propertyTypes["padding"] = 1;
  2968. com_ibm_rave_library_property_PropertyUtil.propertyTypes["dasharray"] = 1;
  2969. com_ibm_rave_library_property_PropertyUtil.propertyTypes["object"] = 1;
  2970. com_ibm_rave_library_property_PropertyUtil.propertyTypes["jsonobject"] = 1;
  2971. com_ibm_rave_library_property_PropertyUtil.propertyTypes["geojson"] = 1;
  2972. com_ibm_rave_library_property_PropertyUtil.propertyTypes["shadow"] = 1;
  2973. },
  2974. validateNumeric : function(obj, decimal) {
  2975. if (!(this.validateBasicType(obj, 11))) {
  2976. return false;
  2977. }
  2978. var num = + (obj);
  2979. if (isNaN(num)) {
  2980. com_ibm_rave_library_Library.logError(6, "Property Validator");
  2981. return false;
  2982. }
  2983. if (!decimal) {
  2984. return this.validateIsInteger(num);
  2985. }
  2986. return true;
  2987. },
  2988. validateObjectExistInList : function(list, value) {
  2989. if (list.indexOf(value) == -1) {
  2990. com_ibm_rave_library_Library.logError(7, "Property Validator");
  2991. return false;
  2992. }
  2993. return true;
  2994. },
  2995. validateNumericProperties : function(_options, value, decimal) {
  2996. if (_options.length == 0) {
  2997. return true;
  2998. }
  2999. for (var i = 0; i < _options.length; ++i) {
  3000. var listVal = _options[i];
  3001. if (decimal) {
  3002. if (listVal.value() == value) {
  3003. return true;
  3004. }
  3005. } else {
  3006. if (listVal.value() == value) {
  3007. return true;
  3008. }
  3009. }
  3010. }
  3011. com_ibm_rave_library_Library.logError(7, "Property Validator");
  3012. return false;
  3013. },
  3014. validateMinMaxPropertyValue : function(min, max, decimal, value) {
  3015. if (value != null) {
  3016. if (!decimal) {
  3017. if (!(this.validateIsInteger(value))) {
  3018. return false;
  3019. }
  3020. }
  3021. if (min != null && min > value) {
  3022. com_ibm_rave_library_Library.logError(8, "Property Validator");
  3023. return false;
  3024. }
  3025. if (max != null && max < value) {
  3026. com_ibm_rave_library_Library.logError(9, "Property Validator");
  3027. return false;
  3028. }
  3029. }
  3030. return true;
  3031. },
  3032. validateMinMaxProperties : function(minObj, maxObj, decimal, allowNegatives) {
  3033. var min;
  3034. var max;
  3035. if (minObj != null) {
  3036. if (!(this.validateNumeric(minObj, decimal))) {
  3037. return false;
  3038. }
  3039. min = + (minObj);
  3040. if (!allowNegatives) {
  3041. if (min < 0) {
  3042. com_ibm_rave_library_Library.logError(10, "Property Validator");
  3043. return false;
  3044. }
  3045. }
  3046. }
  3047. if (maxObj != null) {
  3048. if (!(this.validateNumeric(maxObj, decimal))) {
  3049. return false;
  3050. }
  3051. max = + (maxObj);
  3052. if (!allowNegatives) {
  3053. if (max < 0) {
  3054. com_ibm_rave_library_Library.logError(11, "Property Validator");
  3055. return false;
  3056. }
  3057. }
  3058. if (min != null && min > max) {
  3059. com_ibm_rave_library_Library.logError(12, "Property Validator");
  3060. return false;
  3061. }
  3062. }
  3063. return true;
  3064. },
  3065. validateSimpleOptions : function(optionsArray, property) {
  3066. var len = optionsArray.length;
  3067. if (len == 0) {
  3068. com_ibm_rave_library_Library.logError(13, "Property Validator");
  3069. return false;
  3070. }
  3071. var optionsSet = {};
  3072. for (var i = 0; i < len; ++i) {
  3073. var obj = optionsArray[i];
  3074. if (optionsSet.hasOwnProperty(obj)) {
  3075. com_ibm_rave_library_Library.logError(14, "Property Validator");
  3076. return false;
  3077. }
  3078. optionsSet[obj] = 1;
  3079. if (!(property.validateValue(obj))) {
  3080. return false;
  3081. }
  3082. }
  3083. return true;
  3084. },
  3085. validateStringOptions : function(optionsArray, property) {
  3086. var len = optionsArray.length;
  3087. if (len == 0) {
  3088. com_ibm_rave_library_Library.logError(13, "Property Validator");
  3089. return false;
  3090. }
  3091. var optionsSet = {};
  3092. for (var i = 0; i < len; ++i) {
  3093. var value = (optionsArray[i])["value"];
  3094. if (optionsSet.hasOwnProperty(value)) {
  3095. com_ibm_rave_library_Library.logError(14, "Property Validator");
  3096. return false;
  3097. }
  3098. optionsSet[value] = 1;
  3099. if (!(property.validateValue(value))) {
  3100. return false;
  3101. }
  3102. }
  3103. return true;
  3104. },
  3105. validateBasicType : function(obj, typeId) {
  3106. switch (typeId) {
  3107. case 10:
  3108. {
  3109. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString(obj))) {
  3110. com_ibm_rave_library_Library.logError(15, "Property Validator");
  3111. return false;
  3112. }
  3113. return true;
  3114. } case 11:
  3115. {
  3116. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isNumber(obj))) {
  3117. com_ibm_rave_library_Library.logError(16, "Property Validator");
  3118. return false;
  3119. }
  3120. return true;
  3121. } case 12:
  3122. {
  3123. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isBoolean(obj))) {
  3124. com_ibm_rave_library_Library.logError(17, "Property Validator");
  3125. return false;
  3126. }
  3127. return true;
  3128. } case 20:
  3129. {
  3130. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray(obj))) {
  3131. com_ibm_rave_library_Library.logError(18, "Property Validator");
  3132. return false;
  3133. }
  3134. return true;
  3135. } case 21:
  3136. {
  3137. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj))) {
  3138. com_ibm_rave_library_Library.logError(19, "Property Validator");
  3139. return false;
  3140. }
  3141. return true;
  3142. } default:
  3143. {
  3144. return false;
  3145. } }
  3146. },
  3147. validateIsInteger : function(num) {
  3148. if ((~~ (num) != num)) {
  3149. com_ibm_rave_library_Library.logError(20, "Property Validator");
  3150. return false;
  3151. }
  3152. return true;
  3153. },
  3154. validatePropertySimpleId : function(simpleId) {
  3155. if (simpleId == null) {
  3156. com_ibm_rave_library_Library.logError(21, "PropertySet.populate");
  3157. return false;
  3158. }
  3159. if (simpleId.indexOf(".") != -1) {
  3160. com_ibm_rave_library_Library.logError(22, "PropertySet.populate");
  3161. return false;
  3162. }
  3163. return true;
  3164. },
  3165. validType : function(type) {
  3166. if (!(com_ibm_rave_library_property_PropertyUtil.propertyTypes.hasOwnProperty(type))) {
  3167. com_ibm_rave_library_Library.logError(23, "PropertySet.populate");
  3168. return false;
  3169. }
  3170. return true;
  3171. },
  3172. propertyEntry : function(propertyJSON, propertyId) {
  3173. var propertyEntry = propertyJSON[propertyId];
  3174. if (propertyEntry == null) {
  3175. com_ibm_rave_library_Library.logError(24, "PropertySet.populate");
  3176. return null;
  3177. }
  3178. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(propertyEntry))) {
  3179. com_ibm_rave_library_Library.logError(25, "PropertySet.populate");
  3180. return null;
  3181. }
  3182. return propertyEntry;
  3183. },
  3184. type : function(propertyJSON) {
  3185. var type = propertyJSON["type"];
  3186. if (type == null) {
  3187. com_ibm_rave_library_Library.logError(26, "PropertySet.populate");
  3188. return null;
  3189. }
  3190. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString(type))) {
  3191. com_ibm_rave_library_Library.logError(27, "PropertySet.populate");
  3192. return null;
  3193. }
  3194. var typeStr = ""+(type);
  3195. if (!(this.validType(typeStr))) {
  3196. return null;
  3197. }
  3198. return typeStr;
  3199. }
  3200. });
  3201. com_ibm_rave_library_property_PropertyUtil.propertyTypes = {};
  3202. com_ibm_rave_library_property_PropertyUtil.INSTANCE = new com_ibm_rave_library_property_PropertyUtil();
  3203. // $source: com/ibm/rave/library/framework/meta/PropertyMeta
  3204. /************************************************************************
  3205. ** IBM Confidential
  3206. **
  3207. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3208. **
  3209. ** (C) Copyright IBM Corp. 2017
  3210. **
  3211. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3212. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3213. ************************************************************************/
  3214. // GENERATED
  3215. /**
  3216. * Interface to meta data for a bundle Property.
  3217. * @param < (java.lang.Object) E > The type of options this property accepts.
  3218. */
  3219. var com_ibm_rave_library_framework_meta_PropertyMeta = rave_library_externs["PropertyMeta"] = rave['internal']['Declare']({
  3220. /**
  3221. * The fully qualified id of the property (starting from its parent if any). When requesting a property, this is the field you query by.
  3222. * @return (String) the Property ID.
  3223. */
  3224. /** @expose */
  3225. id : function() {},
  3226. /**
  3227. * The simple (non-qualified) id of the property. This is how the property's parent refers to it. If the property has no parent, then this would be equivalent to its fully qualified id
  3228. * @return (String) (non-qualified) property id
  3229. */
  3230. /** @expose */
  3231. simpleId : function() {},
  3232. /**
  3233. * @return (String) the Property Name. This name is used as a label for some properties--for example, in labelled PropertyArrayTypes.
  3234. */
  3235. /** @expose */
  3236. name : function() {},
  3237. /**
  3238. * @return (String) the Property Description
  3239. */
  3240. /** @expose */
  3241. description : function() {},
  3242. /**
  3243. * @return (String) the Property Icon string, which is the URL of the icon file used in the property editor
  3244. */
  3245. /** @expose */
  3246. icon : function() {},
  3247. /**
  3248. * Gets the parent's property if any
  3249. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) the parent property, or null if this is a top level property
  3250. */
  3251. /** @expose */
  3252. parent : function() {},
  3253. /**
  3254. * @return (String) the property type as string
  3255. */
  3256. /** @expose */
  3257. type : function() {},
  3258. /**
  3259. * @return (int) the property type as an integer
  3260. */
  3261. /** @expose */
  3262. typeId : function() {},
  3263. /**
  3264. * Indicates if this property is required.
  3265. * @return (boolean) true if it is required, false otherwise
  3266. */
  3267. /** @expose */
  3268. required : function() {},
  3269. /**
  3270. * @return (Object) the default value of the property
  3271. */
  3272. /** @expose */
  3273. defaultValue : function() {},
  3274. /**
  3275. * @param (Object) defaultValue the default value of the property
  3276. */
  3277. /** @expose */
  3278. setDefaultValue : function(defaultValue) {},
  3279. /**
  3280. * @return (Array) list of property options.
  3281. */
  3282. /** @expose */
  3283. options : function() {},
  3284. /**
  3285. * Validates if the passed object meets all the constraints imposed on this property
  3286. * @param (Object) obj the value to validate
  3287. * @return (boolean) true if the object is valid, false otherwise
  3288. */
  3289. /** @expose */
  3290. validateValue : function(obj) {},
  3291. /**
  3292. * Does the change of property value require resetting the view? Resetting view means recalculating data and redrawing components. Some properties change the layout/scales, for instance, layout padding. Some properties involve no data change but need redrawing the components. For instance, background color.
  3293. * @return (String) one of 3 values: data---need to recalculate data and redraw components layout---no data recalculation is required, but need to reset layout/scales and redraw components none----no data or layout/scales change, but redraw components to show style changes
  3294. */
  3295. /** @expose */
  3296. resetView : function() {},
  3297. /**
  3298. * Performs a deep copy of this property meta. Changing anything on the copy will not affect this object.
  3299. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) a deep copy of this property meta.
  3300. */
  3301. /** @expose */
  3302. copy : function(parent) {},
  3303. /**
  3304. * Get the tags from the property
  3305. */
  3306. /** @expose */
  3307. tags : function() {}
  3308. });
  3309. /** @expose */
  3310. com_ibm_rave_library_framework_meta_PropertyMeta.STRING = "string";
  3311. /** @expose */
  3312. com_ibm_rave_library_framework_meta_PropertyMeta.BOOLEAN = "boolean";
  3313. /** @expose */
  3314. com_ibm_rave_library_framework_meta_PropertyMeta.NUMERIC = "numeric";
  3315. /** @expose */
  3316. com_ibm_rave_library_framework_meta_PropertyMeta.ENUM = "enum";
  3317. /** @expose */
  3318. com_ibm_rave_library_framework_meta_PropertyMeta.FONT = "font";
  3319. /** @expose */
  3320. com_ibm_rave_library_framework_meta_PropertyMeta.COLOR = "color";
  3321. /** @expose */
  3322. com_ibm_rave_library_framework_meta_PropertyMeta.PALETTE = "palette";
  3323. /** @expose */
  3324. com_ibm_rave_library_framework_meta_PropertyMeta.LENGTH = "length";
  3325. /** @expose */
  3326. com_ibm_rave_library_framework_meta_PropertyMeta.PADDING = "padding";
  3327. /** @expose */
  3328. com_ibm_rave_library_framework_meta_PropertyMeta.DASHARRAY = "dasharray";
  3329. /** @expose */
  3330. com_ibm_rave_library_framework_meta_PropertyMeta.ARRAY = "array";
  3331. /** @expose */
  3332. com_ibm_rave_library_framework_meta_PropertyMeta.OBJECT = "object";
  3333. /** @expose */
  3334. com_ibm_rave_library_framework_meta_PropertyMeta.JSONOBJECT = "jsonobject";
  3335. /** @expose */
  3336. com_ibm_rave_library_framework_meta_PropertyMeta.GEOJSON = "geojson";
  3337. /** @expose */
  3338. com_ibm_rave_library_framework_meta_PropertyMeta.SHADOW = "shadow";
  3339. /** @expose */
  3340. com_ibm_rave_library_framework_meta_PropertyMeta.UNKNOWN_TYPE = "UNKNOWN_TYPE";
  3341. /** @expose */
  3342. com_ibm_rave_library_framework_meta_PropertyMeta.STRING_ID = 10;
  3343. /** @expose */
  3344. com_ibm_rave_library_framework_meta_PropertyMeta.NUMERIC_ID = 11;
  3345. /** @expose */
  3346. com_ibm_rave_library_framework_meta_PropertyMeta.BOOLEAN_ID = 12;
  3347. /** @expose */
  3348. com_ibm_rave_library_framework_meta_PropertyMeta.ENUM_ID = 13;
  3349. /** @expose */
  3350. com_ibm_rave_library_framework_meta_PropertyMeta.FONT_ID = 14;
  3351. /** @expose */
  3352. com_ibm_rave_library_framework_meta_PropertyMeta.COLOR_ID = 15;
  3353. /** @expose */
  3354. com_ibm_rave_library_framework_meta_PropertyMeta.PALETTE_ID = 16;
  3355. /** @expose */
  3356. com_ibm_rave_library_framework_meta_PropertyMeta.LENGTH_ID = 17;
  3357. /** @expose */
  3358. com_ibm_rave_library_framework_meta_PropertyMeta.PADDING_ID = 18;
  3359. /** @expose */
  3360. com_ibm_rave_library_framework_meta_PropertyMeta.DASHARRAY_ID = 19;
  3361. /** @expose */
  3362. com_ibm_rave_library_framework_meta_PropertyMeta.ARRAY_ID = 20;
  3363. /** @expose */
  3364. com_ibm_rave_library_framework_meta_PropertyMeta.OBJECT_ID = 21;
  3365. /** @expose */
  3366. com_ibm_rave_library_framework_meta_PropertyMeta.JSONOBJECT_ID = 22;
  3367. /** @expose */
  3368. com_ibm_rave_library_framework_meta_PropertyMeta.GEOJSON_ID = 23;
  3369. /** @expose */
  3370. com_ibm_rave_library_framework_meta_PropertyMeta.SHADOW_ID = 24;
  3371. /** @expose */
  3372. com_ibm_rave_library_framework_meta_PropertyMeta.NONE = -1;
  3373. /** @expose */
  3374. com_ibm_rave_library_framework_meta_PropertyMeta.UNKNOWN_TYPE_ID = -1;
  3375. // $source: com/ibm/rave/library/property/EnumPropertyOption
  3376. /************************************************************************
  3377. ** IBM Confidential
  3378. **
  3379. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3380. **
  3381. ** (C) Copyright IBM Corp. 2017
  3382. **
  3383. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3384. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3385. ************************************************************************/
  3386. // GENERATED
  3387. /**
  3388. * <p> A property option value for enum properties. The value of the property is the enum integer value, and the label is the uninternationalized enum label. If the label is ever internationalized (i.e. the label becomes a message ID), the only modification needed will be in the label() method, to look up the message ID in the messages. </p>
  3389. */
  3390. var com_ibm_rave_library_property_EnumPropertyOption = rave_library_externs["EnumPropertyOption"] = rave['internal']['Declare']({
  3391. //_value : null,
  3392. //_label : null,
  3393. //_messages : null,
  3394. /**
  3395. * Construct.
  3396. * @param (Number) value The value of the option
  3397. * @param (String) label The label of the option
  3398. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map
  3399. */
  3400. /** @expose */
  3401. constructor : function(value, label, messages) {
  3402. this._value = value;
  3403. this._label = label;
  3404. this._messages = messages;
  3405. },
  3406. /** @expose */
  3407. value : function() {
  3408. return this._value;
  3409. },
  3410. /** @expose */
  3411. id : function() {
  3412. return this._value;
  3413. },
  3414. /** @expose */
  3415. label : function() {
  3416. return this._label;
  3417. }
  3418. });
  3419. // $source: com/ibm/rave/library/property/NumberPropertyOption
  3420. /************************************************************************
  3421. ** IBM Confidential
  3422. **
  3423. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3424. **
  3425. ** (C) Copyright IBM Corp. 2017
  3426. **
  3427. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3428. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3429. ************************************************************************/
  3430. // GENERATED
  3431. /**
  3432. * A property option value that is a number. The option is created with the numeric value as used in the code. The label is the number as a string; the messages map is not used. Example JSON: <code> "options": [ 0, 2.2, 10.0 ] </code>
  3433. */
  3434. var com_ibm_rave_library_property_NumberPropertyOption = rave_library_externs["NumberPropertyOption"] = rave['internal']['Declare']({
  3435. //_value : null,
  3436. /**
  3437. * Construct.
  3438. * @param (Number) value The property value as used in the code
  3439. */
  3440. /** @expose */
  3441. constructor : function(value) {
  3442. this._value = value;
  3443. },
  3444. /** @expose */
  3445. value : function() {
  3446. return this._value;
  3447. },
  3448. /** @expose */
  3449. id : function() {
  3450. return this._value;
  3451. },
  3452. /** @expose */
  3453. label : function() {
  3454. return ""+(this._value);
  3455. }
  3456. });
  3457. // $source: com/ibm/rave/library/property/PalettePropertyOption
  3458. /************************************************************************
  3459. ** IBM Confidential
  3460. **
  3461. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3462. **
  3463. ** (C) Copyright IBM Corp. 2017
  3464. **
  3465. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3466. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3467. ************************************************************************/
  3468. // GENERATED
  3469. /**
  3470. * <p> A string property option value for use in palette properties. The "options" in the palette property JSON is an array of palette types, but the options stored in the property itself are the palette IDs for those types. Palettes are not yet internationalized, so the option label is the palette's label and the messages are not used. They are included in the constructor so that the signature of this class is the same as StringPropertyOption, and if palette labels are ever internationalized this class can be replaced with the StringPropertyOption.
  3471. */
  3472. var com_ibm_rave_library_property_PalettePropertyOption = rave_library_externs["PalettePropertyOption"] = rave['internal']['Declare']({
  3473. //_value : null,
  3474. //_label : null,
  3475. //_messages : null,
  3476. /**
  3477. * Construct.
  3478. * @param (String) value The value of the option
  3479. * @param (String) label The label of the option
  3480. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map, unused (but included so the constructor signature is that of StringPropertyOption)
  3481. */
  3482. /** @expose */
  3483. constructor : function(value, label, messages) {
  3484. this._value = value;
  3485. this._label = label;
  3486. this._messages = messages;
  3487. },
  3488. /** @expose */
  3489. value : function() {
  3490. return this._value;
  3491. },
  3492. /** @expose */
  3493. id : function() {
  3494. return this._value;
  3495. },
  3496. /** @expose */
  3497. label : function() {
  3498. return this._messages._nls(this._label, this._label);
  3499. }
  3500. });
  3501. // $source: com/ibm/rave/library/property/StringPropertyOption
  3502. /************************************************************************
  3503. ** IBM Confidential
  3504. **
  3505. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3506. **
  3507. ** (C) Copyright IBM Corp. 2017
  3508. **
  3509. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3510. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3511. ************************************************************************/
  3512. // GENERATED
  3513. /**
  3514. * A property option value that is a string. The option is created with the string value as used in the code, and with a message ID and messages map. The label is the result of looking up the message ID in the messages, using the value as the alternate/default if the message ID is not found.
  3515. */
  3516. var com_ibm_rave_library_property_StringPropertyOption = rave_library_externs["StringPropertyOption"] = rave['internal']['Declare']({
  3517. //_value : null,
  3518. //_messageID : null,
  3519. //_messages : null,
  3520. /**
  3521. * Construct.
  3522. * @param (String) value The property value as used in the code
  3523. * @param (String) messageID The message ID used to look up the property label
  3524. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map
  3525. */
  3526. /** @expose */
  3527. constructor : function(value, messageID, messages) {
  3528. this._value = value;
  3529. this._messageID = messageID;
  3530. this._messages = messages;
  3531. },
  3532. /** @expose */
  3533. value : function() {
  3534. return this._value;
  3535. },
  3536. /** @expose */
  3537. label : function() {
  3538. return this._messages._nls(this._messageID, this._value);
  3539. },
  3540. /** @expose */
  3541. id : function() {
  3542. return this.value();
  3543. }
  3544. });
  3545. // $source: com/ibm/rave/library/framework/Bundle
  3546. /************************************************************************
  3547. ** IBM Confidential
  3548. **
  3549. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3550. **
  3551. ** (C) Copyright IBM Corp. 2017
  3552. **
  3553. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3554. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3555. ************************************************************************/
  3556. // GENERATED
  3557. //@import com/ibm/rave/library/framework/meta/internal/GenericMetadataImpl (runtime) // new
  3558. //@import com/ibm/rave/library/framework/meta/internal/PreviewsMetadataImpl (runtime) // new
  3559. //@import com/ibm/rave/library/datamodel/internal/BundleDataModels (runtime) // new
  3560. //@import com/ibm/rave/library/framework/meta/internal/BundleConfigurationManager (runtime) // new
  3561. //@import com/ibm/rave/library/i18n/MessagesRegistry (runtime) // new
  3562. //@import com/ibm/rave/library/internal/nativeImpl/LoaderNativeUtils (runtime) // getMessagesPath
  3563. //@import com/ibm/rave/library/framework/internal/AbstractController (runtime) // new
  3564. //@import com/ibm/rave/library/Library (runtime) // logError, _generateId, Library
  3565. //@import com/ibm/rave/library/framework/internal/BundleContext (runtime) // new
  3566. //@import com/ibm/rave/library/framework/meta/ActionMeta (runtime) // parse
  3567. //@import com/ibm/rave/library/framework/meta/internal/PropertyPresentationMetaImpl (runtime) // new
  3568. //@import com/ibm/rave/library/property/PropertyProcessor (runtime) // processProperties
  3569. //@import com/ibm/rave/library/property/PropertySet (runtime) // merge
  3570. //@import com/ibm/rave/library/i18n/Messages (runtime) // createFromCatalog
  3571. //@import com/ibm/rave/library/framework/BundleInfo (runtime)
  3572. /**
  3573. * Access point for Bundle metadata and creation of visualization instances. <br /> Bundle meta data can be accessed through the {@link this.Bundle#this.info()} API. <br /> Bundle visualization instances can be created through {@link this.Bundle#this.create()} .
  3574. */
  3575. var com_ibm_rave_library_framework_Bundle = rave_library_externs["Bundle"] = rave['internal']['Declare']({
  3576. /**
  3577. * Metadata (using same class as in an instance)
  3578. */
  3579. //_metadata : null,
  3580. //_previewsMeta : null,
  3581. /**
  3582. * Property metadata
  3583. */
  3584. //_properties : null,
  3585. /**
  3586. * Property presentations metadata
  3587. */
  3588. //_propertyPresentations : null,
  3589. /**
  3590. * Actions metadata
  3591. */
  3592. //_actions : null,
  3593. /**
  3594. * Data models metadata (using same class as in an instance)
  3595. */
  3596. //_dataModels : null,
  3597. /**
  3598. * Configurations available in the bundle
  3599. */
  3600. //_configurations : null,
  3601. /**
  3602. * Bundle information API (metadata, properties, actions, data models, configurations)
  3603. */
  3604. //_info : null,
  3605. /**
  3606. * Default localization messages
  3607. */
  3608. //_messages : null,
  3609. //_locale : null,
  3610. /**
  3611. * Copy of the messages manifest for the bundle
  3612. */
  3613. /** @expose */
  3614. _manifest : null,
  3615. /**
  3616. * Need to hang on to this for Swift.
  3617. */
  3618. //messageXhr : null,
  3619. /**
  3620. * Bundle version
  3621. */
  3622. _version : "0.0.0",
  3623. /**
  3624. * Bundle build
  3625. */
  3626. _build : "development",
  3627. /**
  3628. * Bundle Path -- used to load messages
  3629. */
  3630. _path : "development",
  3631. constructor : function() {
  3632. this._metadata = new com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl();
  3633. this._previewsMeta = new com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl();
  3634. this._properties = [];
  3635. this._propertyPresentations = [];
  3636. this._actions = [];
  3637. this._dataModels = new com_ibm_rave_library_datamodel_internal_BundleDataModels();
  3638. this._configurations = new com_ibm_rave_library_framework_meta_internal_BundleConfigurationManager();
  3639. this._messages = new com_ibm_rave_library_i18n_MessagesRegistry();
  3640. this._locale = com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE;
  3641. /**
  3642. * Only used by subclasses.
  3643. */
  3644. {
  3645. var self = this;
  3646. this._info = new (rave['internal']['Declare']({
  3647. meta : function() {
  3648. return self._metadata;
  3649. },
  3650. properties : function() {
  3651. return self._properties;
  3652. },
  3653. propertyPresentations : function() {
  3654. return self._propertyPresentations;
  3655. },
  3656. actions : function() {
  3657. return self._actions;
  3658. },
  3659. dataModels : function() {
  3660. return self._dataModels.getDataModels();
  3661. },
  3662. getPreview$2 : function(format, tags) {
  3663. return self._previewsMeta.getPreview(format, tags);
  3664. },
  3665. getPreviewTags : function() {
  3666. return self._previewsMeta.getAllTags();
  3667. },
  3668. getPreviews$1 : function(format) {
  3669. return self._previewsMeta.getPreviews(format);
  3670. },
  3671. getPreview$1 : function(format) {
  3672. return self._previewsMeta.getPreview(format, null);
  3673. },
  3674. getPreview$0 : function() {
  3675. return self._previewsMeta.getPreview("svg", null);
  3676. },
  3677. getPreviews$0 : function() {
  3678. return self._previewsMeta.getPreviews("svg");
  3679. },
  3680. previews : function() {
  3681. return self._previewsMeta;
  3682. },
  3683. getPreview : function(a0, a1) {
  3684. var args = arguments;
  3685. if (args.length == 0) {
  3686. return this.getPreview$0();
  3687. }
  3688. if (args.length == 1) {
  3689. return this.getPreview$1(a0);
  3690. }
  3691. return this.getPreview$2(a0, a1);
  3692. },
  3693. getPreviews : function(a0) {
  3694. var args = arguments;
  3695. if (args.length == 0) {
  3696. return this.getPreviews$0();
  3697. }
  3698. return this.getPreviews$1(a0);
  3699. }
  3700. }))();
  3701. this._configurations.setBundleInfo(this, this._info);
  3702. }
  3703. },
  3704. /**
  3705. * @return (com.ibm.rave.library.framework.BundleInfo) Access point to bundle meta data information.
  3706. */
  3707. /** @expose */
  3708. info : function() {
  3709. return this._info;
  3710. },
  3711. /**
  3712. * @return (String) The version of this bundle.
  3713. */
  3714. /** @expose */
  3715. version : function() {
  3716. return this._version;
  3717. },
  3718. /**
  3719. * @return (String) The build label of this bundle.
  3720. */
  3721. /** @expose */
  3722. build : function() {
  3723. return this._build;
  3724. },
  3725. /**
  3726. * A bundle instance ( {@link (com.ibm.rave.library.framework.Controller) Controller} will always return a non-null but empty list.
  3727. * @return (Array) List of all configurations this bundle provides.
  3728. */
  3729. /** @expose */
  3730. configurations : function() {
  3731. return this._configurations._configList;
  3732. },
  3733. /**
  3734. * Create an instance of this bundle for rendering.
  3735. * @return (com.ibm.rave.library.framework.Controller) A Controller interface to control the visualization.
  3736. */
  3737. create$0 : function() {
  3738. return this.doCreate(null, true);
  3739. },
  3740. /**
  3741. * Create an instance of this bundle for rendering, using the configuration with the given ID. If the ID is null no configuration is applied (it is the same as {@link #this.create()} ). If there is no configuration with the given ID an error is reported to the Library and null is returned.
  3742. * @param (String) configID ID of the configuration
  3743. * @return (com.ibm.rave.library.framework.Controller) A Controller interface to control the visualization.
  3744. */
  3745. create$1 : function(configID) {
  3746. return this.doCreate(configID, true);
  3747. },
  3748. create$2 : function(configID, viewRequired) {
  3749. return this.doCreate(configID, viewRequired);
  3750. },
  3751. /**
  3752. * Returns the current default locale for the bundle. Any new bundle instances created will use this locale. <p> Defaults to 'en'.
  3753. * @return (String) String representing the default locale for bundle.
  3754. */
  3755. locale$0 : function() {
  3756. return this._locale;
  3757. },
  3758. /**
  3759. * Sets the current default locale for the bundle. If never called, the locale defaults to 'en'.
  3760. */
  3761. locale$1 : function(locale) {
  3762. this._locale = locale;
  3763. },
  3764. locale$2 : function(locale, url, userCallback) {
  3765. var self = this;
  3766. var path = com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.getMessagesPath(locale, url);
  3767. if (self._messages.locale$0(locale)) {
  3768. if (userCallback) {
  3769. userCallback();
  3770. }
  3771. return;
  3772. }
  3773. self.messageXhr = rave.json(path, function(error, response) {
  3774. if (!error) {
  3775. self.setMessageCatalog(locale, (response));
  3776. self._messages.locale(locale);
  3777. if (userCallback) {
  3778. userCallback();
  3779. }
  3780. }
  3781. });
  3782. },
  3783. /**
  3784. * This API is used to pass in configurations to the bundle. The bundle can use those configurations to tweak some settings including updating the properties dynamically prior to the bundle creation {@link #this.create()} . this method should be called and its callback function can be used to initialize the bundle etc. current expected properties for the configurations json "mapboxkey" : "your access token here" "mapboxaccountname" : "your account name here"
  3785. * @param (Object) configurations A JSON object containing various settings for the bundle
  3786. * @param (com.ibm.rave.library.framework.Controller.Callback) userCallback the function to be called after the configuration is completed
  3787. */
  3788. /** @expose */
  3789. configure : function(configurations, userCallback) {
  3790. if (configurations) {
  3791. this._doConfigure(configurations, userCallback, this);
  3792. } else if (userCallback) {
  3793. userCallback();
  3794. }
  3795. },
  3796. /**
  3797. * This function will use the configurations object to setup a bundle based on the specific bundle implementation on this method by default this method does nothing and calls the passed in callback
  3798. * @param (Object) configurations A JSON object containing required info that bundles may need
  3799. * @param (com.ibm.rave.library.framework.Controller.Callback) userCallback the function to be called after the setup is completed
  3800. */
  3801. /** @expose */
  3802. _doConfigure : function(configurations, userCallback, bundle) {
  3803. if (userCallback) {
  3804. userCallback();
  3805. }
  3806. },
  3807. /**
  3808. * Retrieve the String name for this bundle.
  3809. */
  3810. /** @expose */
  3811. getName : function() {},
  3812. /**
  3813. * Create an instance of the View for this bundle.
  3814. */
  3815. /** @expose */
  3816. createView : function(ctx) {},
  3817. /**
  3818. * A bundle author may override this method if a bundle requires its own controller implementation.
  3819. * @param (String) bundleName String bundle identifier.
  3820. * @param (com.ibm.rave.library.framework.internal.BundleContext) ctx The context instantiated from the Bundle metadata descriptions.
  3821. * @param (com.ibm.rave.library.framework.internal.AbstractView) view A bundle view instance (see {@link this.Bundle#this.createView(com_ibm_rave_library_framework_internal_BundleContext)} ).
  3822. * @return (com.ibm.rave.library.framework.internal.AbstractController) Visualization Controller instance.
  3823. */
  3824. /** @expose */
  3825. createController : function(bundleName, ctx, view) {
  3826. return new com_ibm_rave_library_framework_internal_AbstractController(bundleName, ctx, view);
  3827. },
  3828. /**
  3829. * <p> Bundle instance creation. </p> <p> If the configuration ID is non-null and the requested configuration does not exist, an error is reported to the Library and null is returned. </p>
  3830. * @param (String) configID ID of the configuration
  3831. * @param messages The Messages catalog to assign to the visualization instance (this can be different from the messages currently assigned to this Bundle).
  3832. * @return (com.ibm.rave.library.framework.Controller) Controller for the visualization instance.
  3833. */
  3834. doCreate : function(configID, viewRequired) {
  3835. var instanceId = com_ibm_rave_library_Library._generateId();
  3836. var ctx = this.createBundleContext(instanceId);
  3837. if (configID != null) {
  3838. var configuration = this._configurations.configuration(configID);
  3839. if (!configuration) {
  3840. com_ibm_rave_library_Library.logError(204, configID);
  3841. return null;
  3842. }
  3843. var configJSON = configuration._json;
  3844. (ctx._metadata).populate(configJSON);
  3845. if (viewRequired) {
  3846. ctx._metadata.configure(configJSON);
  3847. }
  3848. (ctx._previewsMeta).populate(configJSON);
  3849. (ctx._metadata)._messages = this._messages;
  3850. ctx.datamodels.configure(configJSON);
  3851. ctx.properties.configure(configJSON);
  3852. ctx.propertyPresentations.configure(configJSON);
  3853. ctx.actions.configure(configJSON);
  3854. this.validatePresentations(ctx);
  3855. }
  3856. var view = viewRequired ? this.createView(ctx) : null;
  3857. return this.createController(this.getName(), ctx, view);
  3858. },
  3859. validatePresentations : function(ctx) {
  3860. var presentations = ctx.propertyPresentations.meta();
  3861. for (var __i_enFor0 = 0, __exp_enFor0 = presentations, __len_enFor0 = __exp_enFor0.length;
  3862. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3863. var p = __exp_enFor0[__i_enFor0];
  3864. (p).validateProperties(ctx.properties);
  3865. }
  3866. },
  3867. getMessageCatalog : function() {
  3868. var catalog = this._messages.get(this._locale);
  3869. if (!catalog) {
  3870. catalog = this._messages.get(com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE);
  3871. }
  3872. return catalog;
  3873. },
  3874. createBundleContext : function(instanceId) {
  3875. var ctx = new com_ibm_rave_library_framework_internal_BundleContext(instanceId, this._messages, this._dataModels.copy(), this._metadata.copy(), this._previewsMeta.copy());
  3876. for (var __i_enFor0 = 0, __exp_enFor0 = this._propertyPresentations, __len_enFor0 = __exp_enFor0.length;
  3877. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3878. var property = __exp_enFor0[__i_enFor0];
  3879. ctx.propertyPresentations.put((property).copy());
  3880. }
  3881. ctx.actions.populate$1(this._actions);
  3882. ctx.properties.populate(this._properties);
  3883. return ctx;
  3884. },
  3885. parseActions : function(list) {
  3886. for (var i = 0; i < list.length; ++i) {
  3887. var a = com_ibm_rave_library_framework_meta_ActionMeta.parse(list[i], this._messages);
  3888. this._actions.push(a);
  3889. }
  3890. },
  3891. parsePropertyPresentations : function(list) {
  3892. for (var i = 0; i < list.length; ++i) {
  3893. var PP = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl(this._messages);
  3894. this._propertyPresentations.push(PP.parse(list[i]));
  3895. }
  3896. },
  3897. /**
  3898. * Initialize this bundle using configuration information in a JSON object. See documentation for more details on valid property names and values.
  3899. * @param (Object) config JSON object containing configuration information. See documentation for more details on valid property names and values.
  3900. */
  3901. /** @expose */
  3902. initialize : function(config) {
  3903. if (!config) {
  3904. return;
  3905. }
  3906. this._metadata.populate(config);
  3907. this._metadata._messages = this._messages;
  3908. this._previewsMeta.populate(config);
  3909. this._dataModels.populate(config, this._messages);
  3910. var resourceObject = config["properties"];
  3911. if (resourceObject) {
  3912. var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(resourceObject, this._messages, false);
  3913. for (var __i_enFor0 = 0, __exp_enFor0 = info.properties, __len_enFor0 = __exp_enFor0.length;
  3914. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3915. var p = __exp_enFor0[__i_enFor0];
  3916. this._properties.push(p);
  3917. }
  3918. }
  3919. var resourceArray = config["propertyPresentations"];
  3920. if (resourceArray) {
  3921. this.parsePropertyPresentations(resourceArray);
  3922. }
  3923. resourceArray = config["actions"];
  3924. if (resourceArray) {
  3925. this.parseActions(resourceArray);
  3926. }
  3927. resourceArray = config["colorpalettes"];
  3928. if (resourceArray) {
  3929. com_ibm_rave_library_Library.palettes.addPalettes(resourceArray);
  3930. }
  3931. this._configurations.populate(config, this._messages);
  3932. this._properties = com_ibm_rave_library_property_PropertySet.merge(this._properties);
  3933. var version = ""+(config["version"]);
  3934. if (version != null) {
  3935. this._version = ""+(version);
  3936. }
  3937. var build = ""+(config["build"]);
  3938. if (build != null) {
  3939. this._build = ""+(build);
  3940. }
  3941. },
  3942. /**
  3943. * Populate this bundle with localized id->value key/value pairs of translated strings. All new instances of this bundle will inherit this set of translated strings. <p> 'en-us' is the default locale for all bundles.
  3944. * @param (String) locale String representing the locale (ie 'en-us')
  3945. * @param (Object) catalog JSONObject in the following format: <code>{ "id" : "Translated String", ... }</code>
  3946. */
  3947. /** @expose */
  3948. setMessageCatalog : function(locale, catalog) {
  3949. var message = com_ibm_rave_library_i18n_Messages.createFromCatalog(catalog, locale);
  3950. this._messages.add(locale, message);
  3951. },
  3952. /** @expose */
  3953. create : function(a0, a1) {
  3954. var args = arguments;
  3955. if (args.length == 0) {
  3956. return this.create$0();
  3957. }
  3958. if (args.length == 1) {
  3959. return this.create$1(a0);
  3960. }
  3961. return this.create$2(a0, a1);
  3962. },
  3963. /** @expose */
  3964. locale : function(a0, a1, a2) {
  3965. var args = arguments;
  3966. if (args.length == 0) {
  3967. return this.locale$0();
  3968. }
  3969. if (args.length == 1) {
  3970. return this.locale$1(a0);
  3971. }
  3972. return this.locale$2(a0, a1, a2);
  3973. }
  3974. });
  3975. /**
  3976. * Default locale
  3977. */
  3978. /** @expose */
  3979. com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE = "en";
  3980. // $source: com/ibm/rave/library/framework/meta/internal/GenericMetadataImpl
  3981. /************************************************************************
  3982. ** IBM Confidential
  3983. **
  3984. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3985. **
  3986. ** (C) Copyright IBM Corp. 2017
  3987. **
  3988. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3989. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3990. ************************************************************************/
  3991. // GENERATED
  3992. /**
  3993. * <p> Implementation of GenericMetadata. An example of what a json file would look like for generic metadata: </p> <pre> { "genericMeta": { "id": "greatBundle", "label": "IDS_LABEL", "author": "Stephen D. Gibson", "createdOn": "2015-01-01", "version": 5, "description": "IDS_DESC", "tags": ["IDS_MAP", "IDS_RS"] } } </pre>
  3994. */
  3995. var com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl = rave['internal']['Declare']({
  3996. /**
  3997. * Map from key to value, does not include "tags"
  3998. */
  3999. //metadataInfo : null,
  4000. /**
  4001. * Tags, may include duplicates
  4002. */
  4003. //metadataTags : null,
  4004. /**
  4005. * Messages lookup required for internationalization
  4006. */
  4007. //_messages : null,
  4008. constructor : function() {
  4009. this.metadataInfo = rave['internal']['ES6Map'].create();
  4010. this.metadataTags = [];
  4011. },
  4012. /** @expose */
  4013. ids : function() {
  4014. var keys = this.metadataInfo.keys();
  4015. var keyArray = keys;
  4016. for (var i = 0; i < keyArray.length; ++i) {
  4017. keyArray[i] = this._messages._nls(keyArray[i], keyArray[i]);
  4018. }
  4019. return keyArray;
  4020. },
  4021. /** @expose */
  4022. id : function(id) {
  4023. var str = this.metadataInfo.get(id);
  4024. if ("name" == id || "label" == id || "description" == id) {
  4025. str = this._messages._nls(str, str);
  4026. }
  4027. return str;
  4028. },
  4029. /** @expose */
  4030. tags : function() {
  4031. var newTags = [];
  4032. for (var __i_enFor0 = 0, __exp_enFor0 = this.metadataTags, __len_enFor0 = __exp_enFor0.length;
  4033. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4034. var tag = __exp_enFor0[__i_enFor0];
  4035. newTags.push(this._messages._nls(tag, tag));
  4036. }
  4037. return newTags;
  4038. },
  4039. /**
  4040. * Populate the metadata from the given object. If the object has a key "genericMeta", that is used to populate key-value pairs and tags; otherwise nothing is done.
  4041. * @param (Object) o The object
  4042. */
  4043. populate : function(o) {
  4044. this.process(o, true);
  4045. },
  4046. /**
  4047. * Configure the metadata from the given object. This works exactly like populate, except that the "id" field cannot be changed. Any tags are appended to the existing array.
  4048. * @param (Object) o The object
  4049. */
  4050. /** @expose */
  4051. configure : function(o) {
  4052. this.process(o, false);
  4053. },
  4054. /**
  4055. * Set the message registry for displaying the meta data in the current locale.
  4056. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry
  4057. */
  4058. setMessages : function(messages) {
  4059. this._messages = messages;
  4060. },
  4061. /**
  4062. * Returns the message registry--needed for copying
  4063. * @return (com.ibm.rave.library.i18n.MessagesRegistry) the MessagesRegistry
  4064. */
  4065. getMessages : function() {
  4066. return this._messages;
  4067. },
  4068. /**
  4069. * Do processing for populate and configure.
  4070. * @param (Object) o JSON description of the meta
  4071. * @param (boolean) isPopulate Whether this is for populate
  4072. */
  4073. process : function(o, isPopulate) {
  4074. var genericMeta = o["genericMeta"];
  4075. if (genericMeta) {
  4076. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(genericMeta), __len_enFor0 = __exp_enFor0.length;
  4077. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4078. var k = __exp_enFor0[__i_enFor0];
  4079. var key = (k);
  4080. if (key == "tags") {
  4081. var tagsArray = genericMeta[key];
  4082. if (tagsArray) {
  4083. var l = tagsArray.length;
  4084. for (var i = 0; i < l; ++i) {
  4085. var tag = ""+(tagsArray[i]);
  4086. if (!(this.metadataTags.indexOf(tag)> -1)) {
  4087. this.metadataTags.push(tag);
  4088. }
  4089. }
  4090. }
  4091. } else {
  4092. if (isPopulate || !("id" == key)) {
  4093. var v = genericMeta[key];
  4094. if (v != null) {
  4095. this.metadataInfo.set(key, ""+(v));
  4096. }
  4097. }
  4098. }
  4099. }
  4100. }
  4101. },
  4102. /**
  4103. * Create a copy of this metadata. The collections (meta and tags) are deep-copied, so the copy's version can be modified without affecting the original.
  4104. * @return (com.ibm.rave.library.framework.meta.internal.GenericMetadataImpl) Copy of the metadata
  4105. */
  4106. copy : function() {
  4107. var c = new com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl();
  4108. for (var __i_enFor0 = 0, __exp_enFor0 = this.metadataInfo.keys(), __len_enFor0 = __exp_enFor0.length;
  4109. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4110. var key = __exp_enFor0[__i_enFor0];
  4111. c.metadataInfo.set(key, this.metadataInfo.get(key));
  4112. }
  4113. for (var __i_enFor1 = 0, __exp_enFor1 = this.metadataTags, __len_enFor1 = __exp_enFor1.length;
  4114. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4115. var t = __exp_enFor1[__i_enFor1];
  4116. c.metadataTags.push(t);
  4117. }
  4118. c._messages = this._messages;
  4119. return c;
  4120. }
  4121. });
  4122. //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.GENERIC_META = "genericMeta";
  4123. //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.ID = "id";
  4124. //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.NAME = "name";
  4125. //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.LABEL = "label";
  4126. //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.DESCRIPTION = "description";
  4127. // $source: com/ibm/rave/library/framework/meta/internal/PreviewsMetadataImpl
  4128. /************************************************************************
  4129. ** IBM Confidential
  4130. **
  4131. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4132. **
  4133. ** (C) Copyright IBM Corp. 2017
  4134. **
  4135. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4136. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4137. ************************************************************************/
  4138. // GENERATED
  4139. //@import com/ibm/rave/library/framework/meta/internal/PreviewMeta (runtime) // new
  4140. //@import com/ibm/rave/library/Library (runtime) // logError
  4141. /**
  4142. * <p> An example of what a json file would look like for preview metadata: </p> <pre> "previews" : { "svg" : [ { "file": "resources/svgPreviewNoText.svg", "tags": [ "small", "notext" ] }, { "file": "resources/svgPreview.svg", "tags": [ "large", "text" ] } ], "image" : [ { "file": "resources/imageNoTextSmall.png", "tags": [ "small", "notext" ] }, { "file": "resources/imageLarge.png", "tags": [ "large", "text" ] } ] } </pre>
  4143. */
  4144. var com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl = rave['internal']['Declare']({
  4145. //svgPreview : null,
  4146. //imgPreview : null,
  4147. //allTags : null,
  4148. constructor : function() {
  4149. this.svgPreview = [];
  4150. this.imgPreview = [];
  4151. this.allTags = [];
  4152. },
  4153. populate : function(o) {
  4154. this.svgPreview.length = 0;
  4155. this.imgPreview.length = 0;
  4156. var previews = o["previews"];
  4157. if (previews) {
  4158. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(previews), __len_enFor0 = __exp_enFor0.length;
  4159. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4160. var k = __exp_enFor0[__i_enFor0];
  4161. var key = (k);
  4162. if (key == "svg") {
  4163. var svgArray = previews[key];
  4164. for (var __i_enFor1 = 0, __exp_enFor1 = svgArray, __len_enFor1 = __exp_enFor1.length;
  4165. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4166. var svg = __exp_enFor1[__i_enFor1];
  4167. this.processPreview(svg, "svg");
  4168. }
  4169. } else {
  4170. var imgArray = previews[key];
  4171. for (var __i_enFor2 = 0, __exp_enFor2 = imgArray, __len_enFor2 = __exp_enFor2.length;
  4172. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  4173. var img = __exp_enFor2[__i_enFor2];
  4174. this.processPreview(img, "image");
  4175. }
  4176. }
  4177. }
  4178. }
  4179. },
  4180. processPreview : function(object, format) {
  4181. var jsonObj = object;
  4182. var file = ""+(jsonObj["file"]);
  4183. var tagsArray = jsonObj["tags"];
  4184. var tags = [];
  4185. for (var __i_enFor0 = 0, __exp_enFor0 = tagsArray, __len_enFor0 = __exp_enFor0.length;
  4186. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4187. var t = __exp_enFor0[__i_enFor0];
  4188. var tag = ""+(t);
  4189. tags.push(tag);
  4190. if (!(this.allTags.indexOf(tag)> -1)) {
  4191. this.allTags.push(tag);
  4192. }
  4193. }
  4194. if (format == "svg") {
  4195. this.svgPreview.push(new com_ibm_rave_library_framework_meta_internal_PreviewMeta(file, tags, format));
  4196. } else {
  4197. this.imgPreview.push(new com_ibm_rave_library_framework_meta_internal_PreviewMeta(file, tags, format));
  4198. }
  4199. },
  4200. /** @expose */
  4201. configure : function(o) {
  4202. this.populate(o);
  4203. },
  4204. /** @expose */
  4205. getAllTags : function() {
  4206. return this.allTags;
  4207. },
  4208. /** @expose */
  4209. getPreviews : function(format) {
  4210. var previews = format == "svg" ? this.svgPreview : this.imgPreview;
  4211. var result = [];
  4212. for (var __i_enFor0 = 0, __exp_enFor0 = previews, __len_enFor0 = __exp_enFor0.length;
  4213. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4214. var view = __exp_enFor0[__i_enFor0];
  4215. result.push(view.file());
  4216. }
  4217. return result;
  4218. },
  4219. /** @expose */
  4220. getPreview : function(format, tags) {
  4221. var previews;
  4222. if (format == null || format == "svg") {
  4223. previews = this.svgPreview;
  4224. } else if (format == "image") {
  4225. previews = this.imgPreview;
  4226. }
  4227. if (!previews) {
  4228. com_ibm_rave_library_Library.logError(302);
  4229. return null;
  4230. }
  4231. if (!tags) {
  4232. return previews.length > 0 ? previews[0].file() : null;
  4233. }
  4234. var maxCount = -1;
  4235. var result;
  4236. for (var __i_enFor0 = 0, __exp_enFor0 = previews, __len_enFor0 = __exp_enFor0.length;
  4237. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4238. var meta = __exp_enFor0[__i_enFor0];
  4239. var metaTags = meta.tags();
  4240. var count = this.MatchTags(metaTags, tags);
  4241. if (count > maxCount) {
  4242. maxCount = count;
  4243. result = meta;
  4244. }
  4245. }
  4246. return !result ? null : result.file();
  4247. },
  4248. getSvgPreviewMeta : function() {
  4249. var result = [];
  4250. for (var __i_enFor0 = 0, __exp_enFor0 = this.svgPreview, __len_enFor0 = __exp_enFor0.length;
  4251. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4252. var view = __exp_enFor0[__i_enFor0];
  4253. result.push(view);
  4254. }
  4255. return result;
  4256. },
  4257. MatchTags : function(available, expected) {
  4258. var result = 0;
  4259. for (var __i_enFor0 = 0, __exp_enFor0 = expected, __len_enFor0 = __exp_enFor0.length;
  4260. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4261. var tag = __exp_enFor0[__i_enFor0];
  4262. if (available.indexOf(tag)> -1) {
  4263. result++;
  4264. }
  4265. }
  4266. return result;
  4267. },
  4268. copy : function() {
  4269. var result = new com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl();
  4270. for (var __i_enFor0 = 0, __exp_enFor0 = this.allTags, __len_enFor0 = __exp_enFor0.length;
  4271. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4272. var t = __exp_enFor0[__i_enFor0];
  4273. result.allTags.push(t);
  4274. }
  4275. for (var __i_enFor1 = 0, __exp_enFor1 = this.svgPreview, __len_enFor1 = __exp_enFor1.length;
  4276. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4277. var meta = __exp_enFor1[__i_enFor1];
  4278. var m = meta.copy();
  4279. result.svgPreview.push(m);
  4280. }
  4281. for (var __i_enFor2 = 0, __exp_enFor2 = this.imgPreview, __len_enFor2 = __exp_enFor2.length;
  4282. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  4283. var meta = __exp_enFor2[__i_enFor2];
  4284. var m = meta.copy();
  4285. result.imgPreview.push(m);
  4286. }
  4287. return result;
  4288. }
  4289. });
  4290. // $source: com/ibm/rave/library/framework/meta/internal/PreviewMeta
  4291. /************************************************************************
  4292. ** IBM Confidential
  4293. **
  4294. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4295. **
  4296. ** (C) Copyright IBM Corp. 2017
  4297. **
  4298. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4299. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4300. ************************************************************************/
  4301. // GENERATED
  4302. /**
  4303. * <p> Preview metadata stores information about the bundle. It consists of preview properties as well as an array of tags. </p>
  4304. */
  4305. var com_ibm_rave_library_framework_meta_internal_PreviewMeta = rave['internal']['Declare']({
  4306. //_file : null,
  4307. //_tags : null,
  4308. //_format : null,
  4309. constructor : function(file, tags, format) {
  4310. this._file = file;
  4311. this._tags = tags;
  4312. this._format = format;
  4313. },
  4314. file : function() {
  4315. return this._file;
  4316. },
  4317. tags : function() {
  4318. return this._tags;
  4319. },
  4320. copy : function() {
  4321. var tag = [];
  4322. for (var __i_enFor0 = 0, __exp_enFor0 = this.tags(), __len_enFor0 = __exp_enFor0.length;
  4323. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4324. var t = __exp_enFor0[__i_enFor0];
  4325. tag.push(t);
  4326. }
  4327. var result = new com_ibm_rave_library_framework_meta_internal_PreviewMeta(this._file, tag, this._format);
  4328. return result;
  4329. }
  4330. });
  4331. // $source: com/ibm/rave/library/datamodel/internal/DataModelDescriptorImpl
  4332. /************************************************************************
  4333. ** IBM Confidential
  4334. **
  4335. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4336. **
  4337. ** (C) Copyright IBM Corp. 2017
  4338. **
  4339. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4340. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4341. ************************************************************************/
  4342. // GENERATED
  4343. //@import com/ibm/rave/library/datamodel/internal/DataSetDescriptorImpl (runtime) // create
  4344. /**
  4345. * Implementation of the {@link DataModelDescriptor} . This is the only implementation of the interface used by VizLibrary.
  4346. */
  4347. var com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl = rave['internal']['Declare']({
  4348. /**
  4349. * The id, set in the constructor
  4350. */
  4351. //_id : null,
  4352. /**
  4353. * The label, set in the constructor
  4354. */
  4355. //_label : null,
  4356. /**
  4357. * The descriptor, set in the constructor
  4358. */
  4359. //_description : null,
  4360. /**
  4361. * The tags, set in the constructor; never null, empty array if no tags defined
  4362. */
  4363. //_tags : null,
  4364. /**
  4365. * The data sets, set in the constructor; never null, empty array if no sets defined
  4366. */
  4367. //_dataSets : null,
  4368. /**
  4369. * Map from set name to index
  4370. */
  4371. //_setIndexes : null,
  4372. /**
  4373. * Localization strings
  4374. */
  4375. //_messages : null,
  4376. /**
  4377. * Private constructor used by factory methods. The data sets array is allocated but empty.
  4378. * @param (String) id The id
  4379. * @param (String) label The label
  4380. * @param (String) description The description
  4381. * @param (Array) tags The array of tags
  4382. */
  4383. constructor : function(id, label, description, tags) {
  4384. this._id = id;
  4385. this._label = label;
  4386. this._description = description;
  4387. this._tags = tags;
  4388. this._dataSets = [];
  4389. this._setIndexes = {};
  4390. },
  4391. /**
  4392. * Processes all data slot configurations from the configuration file, setting slots to be hidden and limiting their types if the model id matches this model and the set ids match any of the datasets for this model.
  4393. * @param (Array) dataSlotConfigs The JSONArray of data slot configurations
  4394. * @return (com.ibm.rave.library.datamodel.DataModelDescriptor) this DataModelDescriptor
  4395. */
  4396. configure : function(dataSlotConfigs) {
  4397. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length;
  4398. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4399. var dataSet = __exp_enFor0[__i_enFor0];
  4400. (dataSet).clearConfiguration();
  4401. }
  4402. for (var __i_enFor1 = 0, __exp_enFor1 = dataSlotConfigs, __len_enFor1 = __exp_enFor1.length;
  4403. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4404. var configObj = __exp_enFor1[__i_enFor1];
  4405. var config = configObj;
  4406. if (this._id == config["dataModelId"]) {
  4407. for (var __i_enFor2 = 0, __exp_enFor2 = this._dataSets, __len_enFor2 = __exp_enFor2.length;
  4408. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  4409. var dataSet = __exp_enFor2[__i_enFor2];
  4410. if (dataSet.id() == config["dataSetId"]) {
  4411. (dataSet).configure(config);
  4412. }
  4413. }
  4414. }
  4415. }
  4416. return this;
  4417. },
  4418. /**
  4419. * Set the message registry for displaying the data in the current locale.
  4420. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry
  4421. */
  4422. setMessages : function(messages) {
  4423. this._messages = messages;
  4424. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length;
  4425. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4426. var set = __exp_enFor0[__i_enFor0];
  4427. (set).setMessages(messages);
  4428. }
  4429. },
  4430. /** @expose */
  4431. id : function() {
  4432. return this._id;
  4433. },
  4434. /** @expose */
  4435. label : function() {
  4436. if (!this._messages) {
  4437. return this._label;
  4438. }
  4439. return this._messages._nls(this._label, this._label);
  4440. },
  4441. /** @expose */
  4442. description : function() {
  4443. if (!this._messages) {
  4444. return this._description;
  4445. }
  4446. return this._messages._nls(this._description, this._description);
  4447. },
  4448. /** @expose */
  4449. tags : function() {
  4450. if (!this._messages) {
  4451. return this._tags;
  4452. }
  4453. var msgTags = [];
  4454. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  4455. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4456. var tag = __exp_enFor0[__i_enFor0];
  4457. msgTags.push(this._messages._nls(tag, tag));
  4458. }
  4459. return msgTags;
  4460. },
  4461. /** @expose */
  4462. dataSets : function() {
  4463. return this._dataSets;
  4464. },
  4465. copy : function() {
  4466. var descriptor = new com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl(this._id, this._label, this._description, this._tags);
  4467. var ct = 0;
  4468. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length;
  4469. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4470. var desc = __exp_enFor0[__i_enFor0];
  4471. descriptor._dataSets.push(desc.copy());
  4472. descriptor._setIndexes[desc.id()] = ct++;
  4473. }
  4474. descriptor.setMessages(this._messages);
  4475. return descriptor;
  4476. },
  4477. /**
  4478. * @param (String) dataSetId A set identifier
  4479. * @return (Number) Index of that set in the descriptor array, or -1 if not defined
  4480. */
  4481. dataSetIndex : function(dataSetId) {
  4482. return this._setIndexes[dataSetId];
  4483. }
  4484. });
  4485. /**
  4486. * Create the data model description from the JSON, which conforms to the schema for data models. This code assumes that the JSON has been checked against that schema and is valid (all required fields present, no illegal types or enum values, etc.).
  4487. * @param (Object) json Description of data model
  4488. */
  4489. com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl.create = function(json) {
  4490. var id = (json["id"]);
  4491. var label = (json["label"]);
  4492. var description = (json["description"]);
  4493. var tags = [];
  4494. var a = json["tags"];
  4495. if (a) {
  4496. var l = a.length;
  4497. for (var i = 0; i < l; ++i) {
  4498. tags.push(""+(a[i]));
  4499. }
  4500. }
  4501. var dmd = new com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl(id, label, description, tags);
  4502. a = json["datasets"];
  4503. if (a) {
  4504. var l = a.length;
  4505. for (var i = 0; i < l; ++i) {
  4506. var set = com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl.create(a[i]);
  4507. dmd._dataSets.push(set);
  4508. dmd._setIndexes[set._id] = i;
  4509. }
  4510. }
  4511. return dmd;
  4512. };
  4513. // $source: com/ibm/rave/library/datamodel/DataSetDescriptor
  4514. /************************************************************************
  4515. ** IBM Confidential
  4516. **
  4517. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4518. **
  4519. ** (C) Copyright IBM Corp. 2017
  4520. **
  4521. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4522. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4523. ************************************************************************/
  4524. // GENERATED
  4525. /**
  4526. * <p> Metadata describing a data set within a {@link (com.ibm.rave.library.datamodel.DataModelDescriptor) DataModelDescriptor} . The data set represents a collection of related data. The data set properties include the id, label, description, icon, tags, type, cardinality, and data slots (see {@link (com.ibm.rave.library.datamodel.DataSlotDescriptor) DataSlotDescriptor} ). </p> <p> The type indicates what type of data is expected to be bound to this data set using {@link (com.ibm.rave.library.datamodel.DataModel) DataModel} . The data type is not checked when data is bound, but if the wrong type of data is bound an error will be raised when the chart is run. The supported types are integer constants in this file. </p>
  4527. */
  4528. var com_ibm_rave_library_datamodel_DataSetDescriptor = rave_library_externs["DataSetDescriptor"] = rave['internal']['Declare']({
  4529. /**
  4530. * The id is neither translatable nor intended for display to users. It identifies the data set within a model and is unique within the model. The id will never be null (it is a required property of the schema).
  4531. * @return (String) Data set id
  4532. */
  4533. /** @expose */
  4534. id : function() {},
  4535. /**
  4536. * The label is a translatable string that names or labels the data set, for display to end-users. The label may be null.
  4537. * @return (String) Data set label
  4538. */
  4539. /** @expose */
  4540. label : function() {},
  4541. /**
  4542. * The description is a translatable string with a brief description of the data set, for display to end-users. The description may be null.
  4543. * @return (String) Data set description
  4544. */
  4545. /** @expose */
  4546. description : function() {},
  4547. /**
  4548. * The tags are an array of strings that give various categories or classifiers for the data set, for display to the end-users. If the data set has no tags, an empty array is returned. Do not modify the array or its contents.
  4549. * @return (Array) Data set tags
  4550. */
  4551. /** @expose */
  4552. tags : function() {},
  4553. /**
  4554. * The icon is a reference to resources. TODO: What is the object type, and how would it be used by authors or integrators?
  4555. * @return (Object) Data set icon.
  4556. */
  4557. /** @expose */
  4558. icon : function() {},
  4559. /**
  4560. * The cardinality is one of {@link this.DataSetDescriptor#"0..1"} or {@link this.DataSetDescriptor#"1"} and defines whether data must be bound to the data set. This is a required property of the schema and there is no default value.
  4561. * @return (String) Data set cardinality
  4562. */
  4563. /** @expose */
  4564. cardinality : function() {},
  4565. /**
  4566. * The type is one of {@link this.DataSetDescriptor#"tabular"} or {@link this.DataSetDescriptor#"hierarchy"} , with other types to be implemented. This is a required property of the schema and there is no default value.
  4567. * @return (String) Data set type
  4568. */
  4569. /** @expose */
  4570. type : function() {},
  4571. /**
  4572. * Perform a true deep copy of this descriptor, creating and copying the contents to the new one.
  4573. * @return (com.ibm.rave.library.datamodel.DataSetDescriptor) A copy of this DataSetDescriptor
  4574. */
  4575. /** @expose */
  4576. copy : function() {},
  4577. /**
  4578. * The data slots are the data items of the data set. If the data set has no slots, an empty array is returned. Do not modify the array or its contents.
  4579. * @return (Array) Data set data slots
  4580. */
  4581. /** @expose */
  4582. dataSlots : function() {}
  4583. });
  4584. /**
  4585. * Data set cardinality 0..1. The set takes 0 or 1 value, so is optional and does not have to be set in order to use the model.
  4586. */
  4587. /** @expose */
  4588. com_ibm_rave_library_datamodel_DataSetDescriptor.OPTIONAL = "0..1";
  4589. /**
  4590. * Data slot cardinality 1. The slot takes 1 value, so is required and must be set in order to use the model.
  4591. */
  4592. /** @expose */
  4593. com_ibm_rave_library_datamodel_DataSetDescriptor.REQUIRED = "1";
  4594. /**
  4595. * Data set type tabular. The Object bound to the data set with {@link this.DataModel#this.setData(String, Object)} must be an array of objects. Data slots in the data set are accessors to the objects in that array.
  4596. */
  4597. /** @expose */
  4598. com_ibm_rave_library_datamodel_DataSetDescriptor.TABULAR = "tabular";
  4599. /**
  4600. * Data set type hierarchy. The Object bound to the data set with {@link this.DataModel#this.setData(String, Object)} is a hierarchical structure. The use of data slots in this type of data set is being developed.
  4601. */
  4602. /** @expose */
  4603. com_ibm_rave_library_datamodel_DataSetDescriptor.HIERARCHY = "hierarchy";
  4604. // $source: com/ibm/rave/library/datamodel/DataSlotDescriptor
  4605. /************************************************************************
  4606. ** IBM Confidential
  4607. **
  4608. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4609. **
  4610. ** (C) Copyright IBM Corp. 2017
  4611. **
  4612. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4613. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4614. ************************************************************************/
  4615. // GENERATED
  4616. /**
  4617. * <p> Metadata describing a data slot within a {@link (com.ibm.rave.library.datamodel.DataSetDescriptor) DataSetDescriptor} . The data slot properties include the id, label, description, icon, tags, permitted data types, and cardinality. </p> <p> The data types and cardinality are integer constants defined in this class, and determine the types and number of accessors which may be bound to the slot. </p>
  4618. */
  4619. var com_ibm_rave_library_datamodel_DataSlotDescriptor = rave_library_externs["DataSlotDescriptor"] = rave['internal']['Declare']({
  4620. /**
  4621. * The id is neither translatable nor intended for display to users. It identifies the data slot within a data set and is unique within the data set. The id is never null (it is a required property in the schema).
  4622. * @return (String) Slot id
  4623. */
  4624. /** @expose */
  4625. id : function() {},
  4626. /**
  4627. * The label is a translatable string that names or labels the data slot, for display to end-users. The label may be null.
  4628. * @return (String) Slot label
  4629. */
  4630. /** @expose */
  4631. label : function() {},
  4632. /**
  4633. * The description is a translatable string with a brief description of the data slot, for display to end-users. The description may be null.
  4634. * @return (String) Slot description
  4635. */
  4636. /** @expose */
  4637. description : function() {},
  4638. /**
  4639. * The tags are an array of strings that give various categories or classifiers for the data slot, for display to the end-users. If the slot has no tags, an empty array is returned. Do not modify the array or its contents.
  4640. * @return (Array) Slot tags
  4641. */
  4642. /** @expose */
  4643. tags : function() {},
  4644. /**
  4645. * The icon is a reference to resources. TODO: What is the object type, and how would it be used by authors or integrators?
  4646. * @return (String) Slot icon.
  4647. */
  4648. /** @expose */
  4649. icon : function(type) {},
  4650. /**
  4651. * The cardinality is one of {@link this.DataSlotDescriptor#"0..1"} , {@link this.DataSlotDescriptor#"1"} , {@link this.DataSlotDescriptor#"0..n"} , or {@link this.DataSlotDescriptor#"1..n"} and defines how many data values may/must be set in the data slot. This is a required property of the schema and there is no default value.
  4652. * @return (String) Slot cardinality
  4653. */
  4654. /** @expose */
  4655. cardinality : function() {},
  4656. /**
  4657. * Check if the slot is required, with cardinality {@link this.DataSlotDescriptor#"1"} or {@link this.DataSlotDescriptor#"1..n"}
  4658. * @return (boolean) Whether the slot has required cardinality
  4659. */
  4660. /** @expose */
  4661. isRequired : function() {},
  4662. /**
  4663. * Check if the slot allows multiple values, with cardinality {@link this.DataSlotDescriptor#"0..n"} or {@link this.DataSlotDescriptor#"1..n"}
  4664. * @return (boolean) Whether the slot has multiple cardinality
  4665. */
  4666. /** @expose */
  4667. isMultiple : function() {},
  4668. /**
  4669. * Check if the slot is hidden by the configuration. If so, it will be null and have no accessor.
  4670. * @return (boolean) Whether the slot has multiple cardinality
  4671. */
  4672. /** @expose */
  4673. isHidden : function() {},
  4674. /**
  4675. * The data types are {@link this.DataSlotDescriptor#"numeric"} , {@link this.DataSlotDescriptor#"string"} , {@link this.DataSlotDescriptor#"date"} , {@link this.DataSlotDescriptor#"object"} , and {@link this.DataSlotDescriptor#"array"} . The data slot can be set to any of the types in the array. Setting it to any other type will raise an error. This is a required property of the schema and must have at least one item, so the returned array will never be empty. Do not modify the array or its contents.
  4676. * @return (Array) Allowed data types
  4677. */
  4678. /** @expose */
  4679. dataTypes : function() {},
  4680. /**
  4681. * Create a new DataSlot and perform a deep copy into it
  4682. * @return (com.ibm.rave.library.datamodel.DataSlotDescriptor) A copy of this DataSlotDescriptor
  4683. */
  4684. /** @expose */
  4685. copy : function() {}
  4686. });
  4687. /**
  4688. * Data slot cardinality 0..1. The slot takes 0 or 1 value, so is optional and does not have to be set in order to use the model.
  4689. */
  4690. /** @expose */
  4691. com_ibm_rave_library_datamodel_DataSlotDescriptor.OPTIONAL = "0..1";
  4692. /**
  4693. * Data slot cardinality 1. The slot takes 1 value, so is required and must be set in order to use the model.
  4694. */
  4695. /** @expose */
  4696. com_ibm_rave_library_datamodel_DataSlotDescriptor.REQUIRED = "1";
  4697. /**
  4698. * Data slot cardinality 0..n. The slot takes any number of values, and does not have to be set in order to use the model.
  4699. */
  4700. /** @expose */
  4701. com_ibm_rave_library_datamodel_DataSlotDescriptor.MULTIPLE = "0..n";
  4702. /**
  4703. * Data slot cardinality 1..n. The slot takes any number of values, and must be set in order to use the model.
  4704. */
  4705. /** @expose */
  4706. com_ibm_rave_library_datamodel_DataSlotDescriptor.MULTIPLE_REQUIRED = "1..n";
  4707. /**
  4708. * Data slot type numeric. The slot accessor returns a numeric value (Java Number) and nulls are allowed.
  4709. */
  4710. /** @expose */
  4711. com_ibm_rave_library_datamodel_DataSlotDescriptor.NUMERIC = "numeric";
  4712. /**
  4713. * Data slot type string. The slot accessor returns a string value (Java String) and nulls are allowed.
  4714. */
  4715. /** @expose */
  4716. com_ibm_rave_library_datamodel_DataSlotDescriptor.STRING = "string";
  4717. /**
  4718. * Data slot type date. The slot accessor returns a date value (Java {@link IDate} ) and nulls are allowed.
  4719. */
  4720. /** @expose */
  4721. com_ibm_rave_library_datamodel_DataSlotDescriptor.DATE = "date";
  4722. /**
  4723. * Data slot type object. The slot accessor returns an object value (Java Object) and nulls are allowed. Requirements for the object are documented by the bundle.
  4724. */
  4725. /** @expose */
  4726. com_ibm_rave_library_datamodel_DataSlotDescriptor.OBJECT = "object";
  4727. /**
  4728. * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle.
  4729. */
  4730. /** @expose */
  4731. com_ibm_rave_library_datamodel_DataSlotDescriptor.ARRAY = "array";
  4732. /**
  4733. * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle.
  4734. */
  4735. /** @expose */
  4736. com_ibm_rave_library_datamodel_DataSlotDescriptor.IMAGE = "image";
  4737. /**
  4738. * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle.
  4739. */
  4740. /** @expose */
  4741. com_ibm_rave_library_datamodel_DataSlotDescriptor.SVG = "svg";
  4742. // $source: com/ibm/rave/library/datamodel/internal/DataModelImpl
  4743. /************************************************************************
  4744. ** IBM Confidential
  4745. **
  4746. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4747. **
  4748. ** (C) Copyright IBM Corp. 2017
  4749. **
  4750. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4751. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4752. ************************************************************************/
  4753. // GENERATED
  4754. //@import com/ibm/rave/library/datamodel/internal/DataSetImpl (runtime) // new
  4755. //@import com/ibm/rave/library/Library (runtime) // error
  4756. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  4757. /**
  4758. * <p> Implementation of the data model API. Instances are created by the Controller when an integrator or author requests a data model. The model is constructed with a {@link DataModelDescriptor} which defines the data sets and data slots of the model. </p> <p> In addition to the public API methods, the model has a data-changed flag which is set true when any of the data sets, slots, or entries change. I {@link #this.dataUpdated()} returns the value, and {@link #this.dataUpdated()} can be used to clear it.
  4759. */
  4760. var com_ibm_rave_library_datamodel_internal_DataModelImpl = rave['internal']['Declare']({
  4761. /**
  4762. * The data descriptor of the model.
  4763. */
  4764. //_descriptor : null,
  4765. /**
  4766. * The data sets of the model
  4767. */
  4768. //_dataSets : null,
  4769. /**
  4770. * Whether the data has been changed
  4771. */
  4772. _dataChanged : false,
  4773. /**
  4774. * <p> Construct the model from a descriptor. </p>
  4775. * @param (com.ibm.rave.library.datamodel.DataModelDescriptor) descriptor Descriptor, may not be null
  4776. */
  4777. constructor : function(descriptor) {
  4778. this._descriptor = descriptor;
  4779. this._dataChanged = false;
  4780. this._dataSets = [];
  4781. for (var __i_enFor0 = 0, __exp_enFor0 = descriptor.dataSets(), __len_enFor0 = __exp_enFor0.length;
  4782. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4783. var dsd = __exp_enFor0[__i_enFor0];
  4784. this._dataSets.push(new com_ibm_rave_library_datamodel_internal_DataSetImpl(dsd, this));
  4785. }
  4786. },
  4787. /** @expose */
  4788. error : function(error) {
  4789. com_ibm_rave_library_Library.error(error);
  4790. },
  4791. /** @expose */
  4792. getDescriptor : function() {
  4793. return this._descriptor;
  4794. },
  4795. /** @expose */
  4796. dataset : function(dataSetId) {
  4797. var ix = this._descriptor.dataSetIndex(dataSetId);
  4798. if (ix == null) {
  4799. this.error(com_ibm_rave_library_service_LibraryError.create(106, this._descriptor._id + "." + dataSetId));
  4800. return null;
  4801. }
  4802. return this._dataSets[ix];
  4803. },
  4804. /** @expose */
  4805. datasets : function() {
  4806. return this._dataSets;
  4807. },
  4808. /** @expose */
  4809. validate : function() {
  4810. var OK = true;
  4811. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length;
  4812. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4813. var ds = __exp_enFor0[__i_enFor0];
  4814. if (!((ds).validate())) {
  4815. OK = false;
  4816. }
  4817. }
  4818. return OK;
  4819. },
  4820. /** @expose */
  4821. dataslot : function(dataSetId, dataSlotId) {
  4822. var dataSet = this.dataset(dataSetId);
  4823. return dataSet ? dataSet.slot(dataSlotId) : null;
  4824. },
  4825. /** @expose */
  4826. setData : function(dataSetId, data) {
  4827. var dataSet = this.dataset(dataSetId);
  4828. if (dataSet) {
  4829. dataSet.data(data);
  4830. return true;
  4831. }
  4832. return false;
  4833. },
  4834. /** @expose */
  4835. clearData : function(dataSetId) {
  4836. var dataSet = this.dataset(dataSetId);
  4837. if (dataSet) {
  4838. dataSet.clear();
  4839. return true;
  4840. }
  4841. return false;
  4842. },
  4843. /** @expose */
  4844. getData : function(dataSetId) {
  4845. var dataSet = this.dataset(dataSetId);
  4846. return dataSet ? dataSet.data() : null;
  4847. },
  4848. setDataSlot$0 : function(dataSetId, dataSlotId, type, accessor, domain) {
  4849. var slot = this.dataslot(dataSetId, dataSlotId);
  4850. if (!slot) {
  4851. return -1;
  4852. }
  4853. var entry = slot.push().type$1(type).accessor$1(accessor).domain$1(domain);
  4854. if (!(entry.isValid())) {
  4855. return -1;
  4856. }
  4857. return slot.size() - 1;
  4858. },
  4859. setDataSlot$1 : function(dataSetId, dataSlotId, type, accessor) {
  4860. return this.setDataSlot$0(dataSetId, dataSlotId, type, accessor, null);
  4861. },
  4862. /** @expose */
  4863. clearDataSlot : function(dataSetId, dataSlotId) {
  4864. var slot = this.dataslot(dataSetId, dataSlotId);
  4865. if (slot) {
  4866. slot.clear();
  4867. return true;
  4868. }
  4869. return false;
  4870. },
  4871. /** @expose */
  4872. getDataSlotValue : function(dataSetId, dataSlotId) {
  4873. var slot = this.dataslot(dataSetId, dataSlotId);
  4874. return slot ? slot.entry() : null;
  4875. },
  4876. /** @expose */
  4877. getDataSlotValues : function(dataSetId, dataSlotId) {
  4878. var slot = this.dataslot(dataSetId, dataSlotId);
  4879. return slot ? slot.entries() : null;
  4880. },
  4881. /**
  4882. * Record that the data has changed. This is called by the data sets, slots, and entries belonging to the model.
  4883. */
  4884. dataModelDataChanged : function() {
  4885. this._dataChanged = true;
  4886. },
  4887. /**
  4888. * @return (boolean) The value of the data-changed flag
  4889. */
  4890. dataUpdated$0 : function() {
  4891. return this._dataChanged;
  4892. },
  4893. /**
  4894. * @param (boolean) b The new value of the data-changed flag
  4895. */
  4896. dataUpdated$1 : function(b) {
  4897. this._dataChanged = b;
  4898. },
  4899. /** @expose */
  4900. setDataSlot : function(a0, a1, a2, a3, a4) {
  4901. var args = arguments;
  4902. if (args.length == 4) {
  4903. return this.setDataSlot$1(a0, a1, a2, a3);
  4904. }
  4905. return this.setDataSlot$0(a0, a1, a2, a3, a4);
  4906. },
  4907. dataUpdated : function(a0) {
  4908. var args = arguments;
  4909. if (args.length == 0) {
  4910. return this.dataUpdated$0();
  4911. }
  4912. return this.dataUpdated$1(a0);
  4913. }
  4914. });
  4915. // $source: com/ibm/rave/library/datamodel/internal/DataSetImpl
  4916. /************************************************************************
  4917. ** IBM Confidential
  4918. **
  4919. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4920. **
  4921. ** (C) Copyright IBM Corp. 2017
  4922. **
  4923. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4924. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4925. ************************************************************************/
  4926. // GENERATED
  4927. //@import com/ibm/rave/library/datamodel/internal/DataSlotImpl (runtime) // new
  4928. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  4929. /**
  4930. * Internal implementation of the {@link (com.ibm.rave.library.datamodel.DataSet) DataSet} API.
  4931. */
  4932. var com_ibm_rave_library_datamodel_internal_DataSetImpl = rave['internal']['Declare']({
  4933. /**
  4934. * The data model containing this entry
  4935. */
  4936. //_dataModel : null,
  4937. /**
  4938. * The descriptor
  4939. */
  4940. //_descriptor : null,
  4941. /**
  4942. * The array of data slots
  4943. */
  4944. //_slots : null,
  4945. /**
  4946. * The data set location "modelId.dataSetId" used for error reporting
  4947. */
  4948. //_errorLocation : null,
  4949. /**
  4950. * The data
  4951. */
  4952. //_data : null,
  4953. /**
  4954. * Construct a data set. No arguments may be null.
  4955. * @param (com.ibm.rave.library.datamodel.DataSetDescriptor) descriptor Descriptor for the data set
  4956. * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this data set
  4957. */
  4958. constructor : function(descriptor, dataModel) {
  4959. this._dataModel = dataModel;
  4960. this._descriptor = descriptor;
  4961. this._slots = [];
  4962. for (var __i_enFor0 = 0, __exp_enFor0 = descriptor.dataSlots(), __len_enFor0 = __exp_enFor0.length;
  4963. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4964. var slotDescriptor = __exp_enFor0[__i_enFor0];
  4965. this._slots.push(new com_ibm_rave_library_datamodel_internal_DataSlotImpl(slotDescriptor, this._dataModel, this));
  4966. }
  4967. this._errorLocation = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + this._descriptor._id;
  4968. },
  4969. /** @expose */
  4970. descriptor : function() {
  4971. return this._descriptor;
  4972. },
  4973. /** @expose */
  4974. slot : function(dataSlotId) {
  4975. var ix = this._descriptor.dataSlotIndex(dataSlotId);
  4976. if (ix == null) {
  4977. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(107, this._errorLocation + "." + dataSlotId));
  4978. return null;
  4979. }
  4980. return this._slots[ix];
  4981. },
  4982. /** @expose */
  4983. slots : function() {
  4984. return this._slots;
  4985. },
  4986. data$0 : function() {
  4987. return this._data;
  4988. },
  4989. data$1 : function(data) {
  4990. if (data != null) {
  4991. this._data = data;
  4992. this._dataModel.dataModelDataChanged();
  4993. }
  4994. return this;
  4995. },
  4996. /** @expose */
  4997. clear : function() {
  4998. this._data = null;
  4999. this._dataModel.dataModelDataChanged();
  5000. return this;
  5001. },
  5002. /**
  5003. * Validate the data set. If it is required and does not have data, an error is reported. Each data slot is also validated.
  5004. * @return (boolean) True if the data set and all slots are valid, false otherwise
  5005. */
  5006. validate : function() {
  5007. var OK = true;
  5008. if ("1" == this._descriptor._cardinality && this._data == null) {
  5009. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(109, this._errorLocation));
  5010. OK = false;
  5011. }
  5012. for (var __i_enFor0 = 0, __exp_enFor0 = this._slots, __len_enFor0 = __exp_enFor0.length;
  5013. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5014. var ds = __exp_enFor0[__i_enFor0];
  5015. if (!((ds).validate())) {
  5016. OK = false;
  5017. }
  5018. }
  5019. return OK;
  5020. },
  5021. /** @expose */
  5022. data : function(a0) {
  5023. var args = arguments;
  5024. if (args.length == 0) {
  5025. return this.data$0();
  5026. }
  5027. return this.data$1(a0);
  5028. }
  5029. });
  5030. // $source: com/ibm/rave/library/datamodel/internal/DataSlotImpl
  5031. /************************************************************************
  5032. ** IBM Confidential
  5033. **
  5034. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5035. **
  5036. ** (C) Copyright IBM Corp. 2017
  5037. **
  5038. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5039. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5040. ************************************************************************/
  5041. // GENERATED
  5042. //@import com/ibm/rave/library/datamodel/internal/DataSlotEntryImpl (runtime) // new
  5043. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  5044. /**
  5045. * Implementation of the {@link DataSlot} API.
  5046. */
  5047. var com_ibm_rave_library_datamodel_internal_DataSlotImpl = rave['internal']['Declare']({
  5048. /**
  5049. * The data model containing this entry
  5050. */
  5051. //_dataModel : null,
  5052. /**
  5053. * The data set containing this entry
  5054. */
  5055. //_dataSet : null,
  5056. /**
  5057. * The descriptor
  5058. */
  5059. //_descriptor : null,
  5060. /**
  5061. * The array of entries
  5062. */
  5063. //_entries : null,
  5064. /**
  5065. * The data slot location "modelId.dataSetId.dataSlotId" used for error reporting
  5066. */
  5067. //_errorLocation : null,
  5068. /**
  5069. * Override label for data slot (used when meta label from descriptor is not useful)
  5070. */
  5071. //_overrideLabel : null,
  5072. /**
  5073. * Construct a data slot. No arguments may be null.
  5074. * @param (com.ibm.rave.library.datamodel.DataSlotDescriptor) descriptor Descriptor for the data slot
  5075. * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this slot
  5076. * @param (com.ibm.rave.library.datamodel.internal.DataSetImpl) dataSet Data set containing this slot
  5077. */
  5078. constructor : function(descriptor, dataModel, dataSet) {
  5079. this._descriptor = descriptor;
  5080. this._dataModel = dataModel;
  5081. this._dataSet = dataSet;
  5082. this._entries = [];
  5083. this._errorLocation = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + (this._dataSet ? this._dataSet.descriptor().id() : "null") + "." + this._descriptor._id;
  5084. if ((descriptor).isRequired()) {
  5085. var defaultType = descriptor.dataTypes()[0];
  5086. this._entries.push(new com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl(this._descriptor, this._dataModel, this._dataSet, this, 0).type$1(defaultType).accessor$1(com_ibm_rave_library_datamodel_internal_DataSlotImpl.makeDefaultAccessor(descriptor.id(), defaultType)));
  5087. }
  5088. },
  5089. overrideLabel$0 : function(label) {
  5090. this._overrideLabel = label;
  5091. },
  5092. overrideLabel$1 : function() {
  5093. return this._overrideLabel;
  5094. },
  5095. /** @expose */
  5096. descriptor : function() {
  5097. return this._descriptor;
  5098. },
  5099. /** @expose */
  5100. push : function() {
  5101. if (!(this._descriptor.isMultiple())) {
  5102. this.clear();
  5103. }
  5104. var e = new com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl(this._descriptor, this._dataModel, this._dataSet, this, this._entries.length);
  5105. if (!(this._descriptor._hidden)) {
  5106. this._entries.push(e);
  5107. this._dataModel.dataModelDataChanged();
  5108. }
  5109. return e;
  5110. },
  5111. /** @expose */
  5112. size : function() {
  5113. return this._entries.length;
  5114. },
  5115. /** @expose */
  5116. entries : function() {
  5117. return this._entries;
  5118. },
  5119. entry$0 : function() {
  5120. return this._entries.length > 0 ? this._entries[0] : null;
  5121. },
  5122. entry$1 : function(index) {
  5123. return this._entries.length > index ? this._entries[index] : null;
  5124. },
  5125. /** @expose */
  5126. clear : function() {
  5127. this._entries.length = 0;
  5128. this._dataModel.dataModelDataChanged();
  5129. return this;
  5130. },
  5131. /**
  5132. * Validate the data slot. If it is required and does not have entries, an error is reported. Each data entry is also validated.
  5133. * @return (boolean) True if the data slot and all entries are valid, false otherwise
  5134. */
  5135. validate : function() {
  5136. var OK = true;
  5137. if (this._descriptor.isRequired() && this._entries.length == 0) {
  5138. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(110, this._errorLocation));
  5139. OK = false;
  5140. }
  5141. for (var __i_enFor0 = 0, __exp_enFor0 = this._entries, __len_enFor0 = __exp_enFor0.length;
  5142. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5143. var entry = __exp_enFor0[__i_enFor0];
  5144. if (!((entry).validate())) {
  5145. OK = false;
  5146. }
  5147. }
  5148. return OK;
  5149. },
  5150. /** @expose */
  5151. overrideLabel : function(a0) {
  5152. var args = arguments;
  5153. if (args.length == 0) {
  5154. return this.overrideLabel$1();
  5155. }
  5156. return this.overrideLabel$0(a0);
  5157. },
  5158. /** @expose */
  5159. entry : function(a0) {
  5160. var args = arguments;
  5161. if (args.length == 0) {
  5162. return this.entry$0();
  5163. }
  5164. return this.entry$1(a0);
  5165. }
  5166. });
  5167. com_ibm_rave_library_datamodel_internal_DataSlotImpl.makeDefaultAccessor = function(dataslotId, type) {
  5168. if ("numeric" == type) {
  5169. return function(data) {
  5170. if (data == null) {
  5171. return null;
  5172. }
  5173. var v = (data)[dataslotId];
  5174. return v == null ? null : + (v);
  5175. };
  5176. }
  5177. if ("string" == type) {
  5178. return function(data) {
  5179. if (data == null) {
  5180. return null;
  5181. }
  5182. var v = (data)[dataslotId];
  5183. return v == null ? null : ""+(v);
  5184. };
  5185. }
  5186. if ("date" == type) {
  5187. return function(data) {
  5188. if (data == null) {
  5189. return null;
  5190. }
  5191. var v = (data)[dataslotId];
  5192. return v == null ? null : new Date(v);
  5193. };
  5194. }
  5195. return function(data) {
  5196. return data == null ? null : (data)[dataslotId];
  5197. };
  5198. };
  5199. // $source: com/ibm/rave/library/datamodel/internal/DataSlotEntryImpl
  5200. /************************************************************************
  5201. ** IBM Confidential
  5202. **
  5203. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5204. **
  5205. ** (C) Copyright IBM Corp. 2018
  5206. **
  5207. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5208. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5209. ************************************************************************/
  5210. // GENERATED
  5211. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  5212. /**
  5213. * <p> Implementation of the {@link DataSlotEntry} API. </p> <p> In order to keep the original data model API while still allowing chained setters, the entry has a flag that is set when an invalid value is provided to a setter. </p>
  5214. */
  5215. var com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl = rave['internal']['Declare']({
  5216. /**
  5217. * The data model containing this entry
  5218. */
  5219. //_dataModel : null,
  5220. /**
  5221. * The data set containing this entry
  5222. */
  5223. //_dataSet : null,
  5224. /**
  5225. * The data slot containing this entry
  5226. */
  5227. //_dataSlot : null,
  5228. /**
  5229. * The descriptor for the slot containing this entry
  5230. */
  5231. //_descriptor : null,
  5232. /**
  5233. * The data slot location "modelId.dataSetId.dataSlotId[entryIndex]".
  5234. */
  5235. //_qualifiedId : null,
  5236. /**
  5237. * The type
  5238. */
  5239. //_type : null,
  5240. /**
  5241. * The accessor function
  5242. */
  5243. //_accessor : null,
  5244. /**
  5245. * The domain
  5246. */
  5247. //_domain : null,
  5248. /**
  5249. * The sub domain division, 10 ^ _subDomainMagnitude
  5250. */
  5251. //_subDomainMagnitude : null,
  5252. /**
  5253. * The label
  5254. */
  5255. //_label : null,
  5256. /**
  5257. * The unit
  5258. */
  5259. //_unit : null,
  5260. /**
  5261. * The position index of this data slot entry within it's parent data slot.
  5262. */
  5263. _dataSlotIndex : 0,
  5264. /**
  5265. * Set true when a bad value is provided to a setter
  5266. */
  5267. _badValue : false,
  5268. _$functionClassMethod : function() {
  5269. var _$self = function(data) {
  5270. return _$self._accessor ? _$self._accessor(data) : null;
  5271. };
  5272. return _$self;
  5273. },
  5274. /**
  5275. * Construct; the type, accessor, and domain are undefined.
  5276. * @param (com.ibm.rave.library.datamodel.internal.DataSlotDescriptorImpl) descriptor Descriptor of the slot
  5277. * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this entry
  5278. * @param (com.ibm.rave.library.datamodel.internal.DataSetImpl) dataSet Data set containing this entry
  5279. * @param (com.ibm.rave.library.datamodel.internal.DataSlotImpl) dataSlot Data slot containing this entry
  5280. * @param (int) index The position index of this entry in its parent data slot.
  5281. */
  5282. constructor : function(descriptor, dataModel, dataSet, dataSlot, index) {
  5283. this._dataModel = dataModel;
  5284. this._dataSet = dataSet;
  5285. this._dataSlot = dataSlot;
  5286. this._dataSlotIndex = index;
  5287. this._descriptor = descriptor;
  5288. this._qualifiedId = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + (this._dataSet ? this._dataSet.descriptor().id() : "null") + "." + (this._dataSlot ? this._dataSlot._descriptor.id() : "null") + "[" + this._dataSlotIndex + "]";
  5289. this._type = null;
  5290. this._accessor = null;
  5291. this._domain = null;
  5292. this._label = null;
  5293. this._unit = null;
  5294. this._badValue = false;
  5295. this._subDomainMagnitude = null;
  5296. },
  5297. /** @expose */
  5298. dataModel : function() {
  5299. return this._dataModel;
  5300. },
  5301. /** @expose */
  5302. dataSet : function() {
  5303. return this._dataSet;
  5304. },
  5305. /** @expose */
  5306. dataSlot : function() {
  5307. return this._dataSlot;
  5308. },
  5309. type$0 : function() {
  5310. return this._type;
  5311. },
  5312. type$1 : function(type) {
  5313. if (type == null) {
  5314. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId));
  5315. this._badValue = true;
  5316. } else if (!(this._descriptor.isValidType(type))) {
  5317. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(108, this._qualifiedId));
  5318. this._badValue = true;
  5319. } else {
  5320. this._type = type;
  5321. this._dataModel.dataModelDataChanged();
  5322. }
  5323. return this;
  5324. },
  5325. accessor$0 : function() {
  5326. return this._accessor;
  5327. },
  5328. accessor$1 : function(accessor) {
  5329. if (!accessor) {
  5330. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId));
  5331. this._badValue = true;
  5332. } else {
  5333. this._accessor = accessor;
  5334. this._dataModel.dataModelDataChanged();
  5335. }
  5336. return this;
  5337. },
  5338. domain$0 : function() {
  5339. return this._domain;
  5340. },
  5341. /** @expose */
  5342. subDomainDivision : function() {
  5343. return this._subDomainMagnitude;
  5344. },
  5345. domain$1 : function(domain) {
  5346. if (domain && domain.length == 0) {
  5347. this._domain = null;
  5348. } else {
  5349. this._domain = domain;
  5350. }
  5351. this._dataModel.dataModelDataChanged();
  5352. return this;
  5353. },
  5354. domain$2 : function(domain, subDomainDivision) {
  5355. if (domain && domain.length == 0) {
  5356. this._domain = null;
  5357. } else {
  5358. this._domain = domain;
  5359. }
  5360. this._subDomainMagnitude = subDomainDivision;
  5361. this._dataModel.dataModelDataChanged();
  5362. return this;
  5363. },
  5364. label$0 : function() {
  5365. return this._label;
  5366. },
  5367. label$1 : function(label) {
  5368. this._label = label;
  5369. this._dataModel.dataModelDataChanged();
  5370. return this;
  5371. },
  5372. unit$0 : function() {
  5373. return this._unit;
  5374. },
  5375. unit$1 : function(unit) {
  5376. this._unit = unit;
  5377. this._dataModel.dataModelDataChanged();
  5378. return this;
  5379. },
  5380. /** @expose */
  5381. isValid : function() {
  5382. var b = !this._badValue;
  5383. this._badValue = false;
  5384. return b;
  5385. },
  5386. /** @expose */
  5387. qualifiedId : function() {
  5388. return this._qualifiedId;
  5389. },
  5390. /**
  5391. * Validate the data slot. If the required type or accessor is null, an error is reported. If the type is not valid for the slot, an error is reported.
  5392. * @return (boolean) True if the entry is valid
  5393. */
  5394. validate : function() {
  5395. if (this._type == null || !this._accessor) {
  5396. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId));
  5397. return false;
  5398. }
  5399. if (!(this._descriptor.isValidType(this._type))) {
  5400. this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(108, this._qualifiedId));
  5401. return false;
  5402. }
  5403. return true;
  5404. },
  5405. /** @expose */
  5406. type : function(a0) {
  5407. var args = arguments;
  5408. if (args.length == 0) {
  5409. return this.type$0();
  5410. }
  5411. return this.type$1(a0);
  5412. },
  5413. /** @expose */
  5414. accessor : function(a0) {
  5415. var args = arguments;
  5416. if (args.length == 0) {
  5417. return this.accessor$0();
  5418. }
  5419. return this.accessor$1(a0);
  5420. },
  5421. /** @expose */
  5422. domain : function(a0, a1) {
  5423. var args = arguments;
  5424. if (args.length == 0) {
  5425. return this.domain$0();
  5426. }
  5427. if (args.length == 1) {
  5428. return this.domain$1(a0);
  5429. }
  5430. return this.domain$2(a0, a1);
  5431. },
  5432. /** @expose */
  5433. label : function(a0) {
  5434. var args = arguments;
  5435. if (args.length == 0) {
  5436. return this.label$0();
  5437. }
  5438. return this.label$1(a0);
  5439. },
  5440. /** @expose */
  5441. unit : function(a0) {
  5442. var args = arguments;
  5443. if (args.length == 0) {
  5444. return this.unit$0();
  5445. }
  5446. return this.unit$1(a0);
  5447. }
  5448. });
  5449. // $source: com/ibm/rave/library/framework/meta/internal/BundleConfigurationManager
  5450. /************************************************************************
  5451. ** IBM Confidential
  5452. **
  5453. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5454. **
  5455. ** (C) Copyright IBM Corp. 2017
  5456. **
  5457. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5458. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5459. ************************************************************************/
  5460. // GENERATED
  5461. //@import com/ibm/rave/library/framework/meta/internal/BundleConfigurationImpl (runtime) // new
  5462. /**
  5463. * Stores the ConfigurationImpl objects defined for a bundle. Configurations are defined by JSON files.
  5464. */
  5465. var com_ibm_rave_library_framework_meta_internal_BundleConfigurationManager = rave['internal']['Declare']({
  5466. //_bundle : null,
  5467. /**
  5468. * The BundleInfo for the bundle that owns these configurations
  5469. */
  5470. //_bundleInfo : null,
  5471. /**
  5472. * Map from id to defined configuration
  5473. */
  5474. //_configMap : null,
  5475. /**
  5476. * List of all defined configurations
  5477. */
  5478. //_configList : null,
  5479. /**
  5480. * Create the configuration manager. It has no configurations.
  5481. */
  5482. constructor : function() {
  5483. this._configMap = {};
  5484. this._configList = [];
  5485. this._bundleInfo = null;
  5486. },
  5487. /**
  5488. * Set the BundleInfo of the bundle which owns this configuration manager. This is not done in the constructor to avoid a circular initialization issue in JS.
  5489. * @param (com.ibm.rave.library.framework.BundleInfo) bundleInfo The bundle's info
  5490. */
  5491. setBundleInfo : function(bundle, bundleInfo) {
  5492. this._bundle = bundle;
  5493. this._bundleInfo = bundleInfo;
  5494. },
  5495. /**
  5496. * <p> Populate configurations from the given JSON, which may be a configuration schema. If it does not have a "configurations" property, nothing is done. </p> <p> Otherwise, the "configuration" property is taken as an array of objects describing data models, as in the schema. If the object "id" is already defined, it is skipped (no overwrite of existing configurations). Otherwise a new Configuration for the object is created and added to the collection. </p>
  5497. * @param (Object) json The configuration JSON, not null
  5498. */
  5499. populate : function(json, messages) {
  5500. var v = json["configurations"];
  5501. if (v == null) {
  5502. return;
  5503. }
  5504. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  5505. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5506. var o = __exp_enFor0[__i_enFor0];
  5507. if (o == null) {
  5508. continue;
  5509. }
  5510. var meta = (o)["genericMeta"];
  5511. if (meta == null) {
  5512. continue;
  5513. }
  5514. var id = ((meta)["id"]);
  5515. if (id != null && !(this._configMap.hasOwnProperty(id))) {
  5516. var config = new com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl(this._bundle, this._bundleInfo, o, messages);
  5517. this._configMap[id] = config;
  5518. this._configList.push(config);
  5519. }
  5520. }
  5521. },
  5522. /**
  5523. * Get the list of all defined configurations. The order is that in which configurations were defined.
  5524. * @return (Array) List of configurations
  5525. */
  5526. configurations : function() {
  5527. return this._configList;
  5528. },
  5529. /**
  5530. * Get a configuration by ID. If the ID is not known, returns null.
  5531. * @param (String) id Configuration ID
  5532. * @return (com.ibm.rave.library.framework.meta.BundleConfiguration) Configuration, or null
  5533. */
  5534. configuration : function(id) {
  5535. return this._configMap[id];
  5536. }
  5537. });
  5538. // $source: com/ibm/rave/library/framework/meta/internal/BundleConfigurationImpl
  5539. /************************************************************************
  5540. ** IBM Confidential
  5541. **
  5542. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5543. **
  5544. ** (C) Copyright IBM Corp. 2017
  5545. **
  5546. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5547. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5548. ************************************************************************/
  5549. // GENERATED
  5550. /**
  5551. * Implementation of the BundleConfiguration.
  5552. * @param < (java.lang.Object) S >
  5553. */
  5554. var com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl = rave['internal']['Declare']({
  5555. /**
  5556. * Configuration id
  5557. */
  5558. //_id : null,
  5559. /**
  5560. * Configuration name
  5561. */
  5562. //_label : null,
  5563. /**
  5564. * Configuration description
  5565. */
  5566. //_description : null,
  5567. /**
  5568. * JSON of the configuration
  5569. */
  5570. //_json : null,
  5571. /**
  5572. * Bundle that owns this configuration
  5573. */
  5574. //_bundle : null,
  5575. /**
  5576. * Bundle information for the bundle that owns this configuration
  5577. */
  5578. //_bundleInfo : null,
  5579. /**
  5580. * Non-renderable instance representing this configuration
  5581. */
  5582. //_configInstance : null,
  5583. /**
  5584. * metadata for the instance, computed when first requested
  5585. */
  5586. //_meta : null,
  5587. //_previewsMeta : null,
  5588. /**
  5589. * List of visible property presentation IDs, computed when first requested
  5590. */
  5591. //_propertyPresentations : null,
  5592. /**
  5593. * List of visible data models for the instance, computed when first requested
  5594. */
  5595. //_dataModels : null,
  5596. /**
  5597. * List of modifications to dataSlots across dataModels
  5598. */
  5599. //_dataSlots : null,
  5600. /**
  5601. * List of enabled actions for the instance, computed when first requested
  5602. */
  5603. //_enabledActions : null,
  5604. //_messages : null,
  5605. /**
  5606. * Construct the configuration from a JSON specification. The spec is non-null and assumed to conform to the schema.
  5607. * @param (com.ibm.rave.library.framework.BundleInfo) bundleInfo The bundle info for the bundle that owns this configuration
  5608. * @param (Object) json The configuration spec
  5609. */
  5610. constructor : function(bundle, bundleInfo, json, messages) {
  5611. this._json = json;
  5612. this._bundle = bundle;
  5613. this._bundleInfo = bundleInfo;
  5614. this._messages = messages;
  5615. var meta = json["genericMeta"];
  5616. this._id = (meta["id"]);
  5617. this._label = (meta["label"]);
  5618. this._description = (meta["description"]);
  5619. this._configInstance = null;
  5620. this._meta = null;
  5621. this._previewsMeta = null;
  5622. this._propertyPresentations = null;
  5623. this._dataModels = null;
  5624. this._enabledActions = null;
  5625. },
  5626. /** @expose */
  5627. id : function() {
  5628. return this._id;
  5629. },
  5630. /** @expose */
  5631. name : function() {
  5632. return this.label();
  5633. },
  5634. /** @expose */
  5635. label : function() {
  5636. return (!this._bundle) ? this._label : this.info().meta().id("label");
  5637. },
  5638. /** @expose */
  5639. description : function() {
  5640. return (!this._bundle) ? this._description : this.info().meta().id("description");
  5641. },
  5642. /**
  5643. * @return (Object) The JSON of the configuration
  5644. */
  5645. json : function() {
  5646. return this._json;
  5647. },
  5648. /** @expose */
  5649. toJSON : function() {
  5650. var meta = this.meta();
  5651. var info = this.info();
  5652. var json = {};
  5653. json["bundleId"] = this._bundle._info.meta().id("id");
  5654. var ids = meta.ids();
  5655. for (var i = 0; i < ids.length; ++i) {
  5656. json[ids[i]] = meta.id(ids[i]);
  5657. }
  5658. json["tags"] = this.convertStringArrayEx(meta.tags());
  5659. var preview = info.previews();
  5660. var imageMap = rave['internal']['ES6Map'].create();
  5661. var svgMap = rave['internal']['ES6Map'].create();
  5662. var a = [];
  5663. var path;
  5664. for (var __i_enFor0 = 0, __exp_enFor0 = preview.getAllTags(), __len_enFor0 = __exp_enFor0.length;
  5665. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5666. var s = __exp_enFor0[__i_enFor0];
  5667. a.length = 0;
  5668. a.push(s);
  5669. path = preview.getPreview("image", a);
  5670. if (!(imageMap.has(path))) {
  5671. imageMap.set(path, []);
  5672. }
  5673. imageMap.get(path).push(s);
  5674. path = preview.getPreview("svg", a);
  5675. if (!(svgMap.has(path))) {
  5676. svgMap.set(path, []);
  5677. }
  5678. svgMap.get(path).push(s);
  5679. }
  5680. var jPreviews = {};
  5681. json["previews"] = jPreviews;
  5682. var images = [];
  5683. var svg = [];
  5684. jPreviews["images"] = images;
  5685. jPreviews["svg"] = svg;
  5686. for (var __i_enFor1 = 0, __exp_enFor1 = imageMap.entries(), __len_enFor1 = __exp_enFor1.length;
  5687. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  5688. var entry = __exp_enFor1[__i_enFor1];
  5689. var o = {};
  5690. images.push(o);
  5691. o["file"] = entry.key;
  5692. o["tags"] = entry.value;
  5693. }
  5694. for (var __i_enFor2 = 0, __exp_enFor2 = svgMap.entries(), __len_enFor2 = __exp_enFor2.length;
  5695. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  5696. var entry = __exp_enFor2[__i_enFor2];
  5697. var o = {};
  5698. svg.push(o);
  5699. o["file"] = entry.key;
  5700. o["tags"] = entry.value;
  5701. }
  5702. var jDataModels = [];
  5703. json["dataModels"] = jDataModels;
  5704. for (var __i_enFor3 = 0, __exp_enFor3 = info.dataModels(), __len_enFor3 = __exp_enFor3.length;
  5705. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  5706. var dm = __exp_enFor3[__i_enFor3];
  5707. var jDm = {};
  5708. jDataModels.push(jDm);
  5709. jDm["id"] = dm.id();
  5710. jDm["label"] = dm.label();
  5711. jDm["description"] = dm.description();
  5712. jDm["tags"] = this.convertStringArrayEx(dm.tags());
  5713. var jDss = [];
  5714. jDm["dataSets"] = jDss;
  5715. for (var __i_enFor4 = 0, __exp_enFor4 = dm.dataSets(), __len_enFor4 = __exp_enFor4.length;
  5716. __i_enFor4 < __len_enFor4; ++__i_enFor4) {
  5717. var ds = __exp_enFor4[__i_enFor4];
  5718. var jDs = {};
  5719. jDss.push(jDs);
  5720. jDs["id"] = ds.id();
  5721. jDs["label"] = ds.label();
  5722. jDs["description"] = ds.description();
  5723. jDs["cardinality"] = ds.cardinality();
  5724. jDs["type"] = ds.type();
  5725. jDs["tags"] = this.convertStringArrayEx(ds.tags());
  5726. var jDataSlots = [];
  5727. jDs["dataSlots"] = jDataSlots;
  5728. var slots = ds.dataSlots();
  5729. for (var __i_enFor5 = 0, __exp_enFor5 = slots, __len_enFor5 = __exp_enFor5.length;
  5730. __i_enFor5 < __len_enFor5; ++__i_enFor5) {
  5731. var dsD = __exp_enFor5[__i_enFor5];
  5732. var jSlot = {};
  5733. jDataSlots.push(jSlot);
  5734. jSlot["id"] = dsD.id();
  5735. jSlot["label"] = dsD.label();
  5736. jSlot["description"] = dsD.description();
  5737. jSlot["cardinality"] = dsD.cardinality();
  5738. var o = {};
  5739. jSlot["icon"] = o;
  5740. o["image"] = dsD.icon("image");
  5741. o["svg"] = dsD.icon("svg");
  5742. jSlot["dataTypes"] = this.convertStringArrayEx(dsD.dataTypes());
  5743. jSlot["tags"] = this.convertStringArrayEx(dsD.tags());
  5744. }
  5745. }
  5746. }
  5747. var ap = info.properties();
  5748. var properties = rave['internal']['ES6Map'].create();
  5749. for (var __i_enFor6 = 0, __exp_enFor6 = ap, __len_enFor6 = __exp_enFor6.length;
  5750. __i_enFor6 < __len_enFor6; ++__i_enFor6) {
  5751. var p = __exp_enFor6[__i_enFor6];
  5752. properties.set(p.id(), p);
  5753. }
  5754. var jPps = [];
  5755. json["propertyPresentations"] = jPps;
  5756. for (var __i_enFor7 = 0, __exp_enFor7 = info.propertyPresentations(), __len_enFor7 = __exp_enFor7.length;
  5757. __i_enFor7 < __len_enFor7; ++__i_enFor7) {
  5758. var pp = __exp_enFor7[__i_enFor7];
  5759. var o = {};
  5760. jPps.push(o);
  5761. o["id"] = pp.id();
  5762. o["name"] = pp.name();
  5763. o["description"] = pp.description();
  5764. o["tags"] = this.convertStringArray(pp.tags());
  5765. this.toJsonPresentationItems(properties, o, pp.presentationItems());
  5766. }
  5767. return json;
  5768. },
  5769. toJsonPresentationItems : function(properties, parent, items) {
  5770. if (items.length > 0) {
  5771. var array = [];
  5772. parent["presentationItems"] = array;
  5773. for (var i = 0; i < items.length; ++i) {
  5774. var object = {};
  5775. array.push(object);
  5776. if (items[i].type().localeCompare("reference") == 0) {
  5777. var p = properties.get(items[i].id());
  5778. if (p) {
  5779. var property = {};
  5780. object["property"] = property;
  5781. property["id"] = items[i].id();
  5782. property["name"] = p.name();
  5783. property["description"] = p.description();
  5784. property["type"] = p.type();
  5785. property["defaultValue"] = p.defaultValue();
  5786. property["required"] = p.required();
  5787. property["resetView"] = p.resetView();
  5788. property["tags"] = this.convertStringArrayEx(p.tags());
  5789. }
  5790. } else if (items[i].type().localeCompare("group") == 0) {
  5791. var group = {};
  5792. object["propertyGroup"] = group;
  5793. group["id"] = items[i].id();
  5794. group["name"] = items[i].name();
  5795. group["description"] = items[i].description();
  5796. group["tags"] = this.convertStringArray(items[i].tags());
  5797. this.toJsonPresentationItems(properties, group, items[i].presentationItems());
  5798. }
  5799. }
  5800. }
  5801. },
  5802. /**
  5803. * TODO: Currently used only for testing, so no messages are passed to the configure call. If this is ever used in production code, messages will have to be passed to the meta.configure call!
  5804. */
  5805. /** @expose */
  5806. meta : function() {
  5807. if (!this._bundle) {
  5808. if (!this._meta) {
  5809. this._meta = (this._bundleInfo.meta()).copy();
  5810. (this._meta).populate(this._json);
  5811. (this._meta)._messages = (this._bundleInfo.meta())._messages;
  5812. }
  5813. return this._meta;
  5814. } else {
  5815. return this.info().meta();
  5816. }
  5817. },
  5818. previews : function() {
  5819. if (!this._previewsMeta) {
  5820. this._previewsMeta = (this._bundleInfo.previews()).copy();
  5821. this._previewsMeta.configure(this._json);
  5822. }
  5823. return this._previewsMeta;
  5824. },
  5825. /** @expose */
  5826. propertyPresentations : function() {
  5827. if (!this._propertyPresentations) {
  5828. this._propertyPresentations = [];
  5829. var hidden = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["propertyPresentations"], "hidden", true);
  5830. for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.propertyPresentations(), __len_enFor0 = __exp_enFor0.length;
  5831. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5832. var pp = __exp_enFor0[__i_enFor0];
  5833. if (!(hidden.hasOwnProperty((pp).id()))) {
  5834. this._propertyPresentations.push((pp).id());
  5835. }
  5836. }
  5837. }
  5838. return this._propertyPresentations;
  5839. },
  5840. /** @expose */
  5841. dataModels : function() {
  5842. if (!this._dataModels) {
  5843. this._dataModels = [];
  5844. var hidden = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["datamodels"], "hidden", true);
  5845. for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.dataModels(), __len_enFor0 = __exp_enFor0.length;
  5846. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5847. var dmd = __exp_enFor0[__i_enFor0];
  5848. if (!(hidden.hasOwnProperty(dmd.id()))) {
  5849. this._dataModels.push(dmd.id());
  5850. }
  5851. }
  5852. }
  5853. return this._dataModels;
  5854. },
  5855. /** @expose */
  5856. dataSlots : function() {
  5857. if (!this._dataSlots) {
  5858. this._dataSlots = this._json["dataSlots"];
  5859. }
  5860. return this._dataSlots;
  5861. },
  5862. /** @expose */
  5863. enabledActions : function() {
  5864. if (!this._enabledActions) {
  5865. this._enabledActions = [];
  5866. var disabled = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["actions"], "enabled", false);
  5867. for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.actions(), __len_enFor0 = __exp_enFor0.length;
  5868. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5869. var a = __exp_enFor0[__i_enFor0];
  5870. if (!(disabled.hasOwnProperty(a.id()))) {
  5871. this._enabledActions.push(a.id());
  5872. }
  5873. }
  5874. }
  5875. return this._enabledActions;
  5876. },
  5877. /**
  5878. * Return BundleInfo specific to this configuration. This information is populated 'on demand' when requested from the configuration. In general, this will be a subset of the information contained in the bundle (i.e. _bundleInfo)
  5879. * @return (com.ibm.rave.library.framework.BundleInfo) BundleInfo specific to this configuration
  5880. */
  5881. /** @expose */
  5882. info : function() {
  5883. if (!this._bundle) {
  5884. return null;
  5885. }
  5886. if (!this._configInstance) {
  5887. this._configInstance = this._bundle.create(this._id, false);
  5888. }
  5889. return this._configInstance.info();
  5890. },
  5891. convertStringArrayEx : function(a) {
  5892. var r = [];
  5893. for (var __i_enFor0 = 0, __exp_enFor0 = a, __len_enFor0 = __exp_enFor0.length;
  5894. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5895. var s = __exp_enFor0[__i_enFor0];
  5896. r.push(s);
  5897. }
  5898. return r;
  5899. },
  5900. convertStringArray : function(a) {
  5901. var r = [];
  5902. for (var __i_enFor0 = 0, __len_enFor0 = a.length;
  5903. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5904. var s = a[__i_enFor0];
  5905. r.push(s);
  5906. }
  5907. return r;
  5908. }
  5909. });
  5910. /**
  5911. * Traverse the array which may be null or empty. The objects have a string "id" property, and may have a boolean key property. Collect the IDs of all objects which have the given value as key.
  5912. * @param (Array) array JSON array
  5913. * @param (String) key Boolean-valued property
  5914. * @param (boolean) value Whether the key must be true or false
  5915. * @return (Object) Set of IDs for which the key has the given value
  5916. */
  5917. com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet = function(array, key, value) {
  5918. var result = {};
  5919. if (array) {
  5920. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  5921. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5922. var o = __exp_enFor0[__i_enFor0];
  5923. if (o != null) {
  5924. var id = ((o)["id"]);
  5925. var v = ((o)[key] != null) ? ((o)[key]) : null;
  5926. if (id != null && v != null && v == value) {
  5927. result[id] = 1;
  5928. }
  5929. }
  5930. }
  5931. }
  5932. return result;
  5933. };
  5934. // $source: com/ibm/rave/library/internal/nativeImpl/LoaderNativeUtils
  5935. /************************************************************************
  5936. ** IBM Confidential
  5937. **
  5938. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5939. **
  5940. ** (C) Copyright IBM Corp. 2015
  5941. **
  5942. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5943. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5944. ************************************************************************/
  5945. //@import com/ibm/rave/library/service/LibraryError (runtime) // new
  5946. var com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils = (function () { /* no code, all static */ });
  5947. /** @expose */
  5948. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundleCode = function(
  5949. /* String */ uri,
  5950. /* list of string uris in prerequisite order */ dependencies,
  5951. /* LibraryError.ReportError */ errorReporter) {
  5952. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadPrerequisites(uri, dependencies, errorReporter);
  5953. };
  5954. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundle = function(
  5955. /* String */ uri,
  5956. /* LibraryError.ReportError */ errorReporter) {
  5957. insertScript(uri, null,
  5958. // On successful load, errorReporter with no error
  5959. function() {
  5960. errorReporter(null);
  5961. },
  5962. // On failure load, errorReporter with the error message
  5963. function(e) {
  5964. com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri);
  5965. }
  5966. );
  5967. };
  5968. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadPrerequisites = function(
  5969. /* String */ uri,
  5970. /* list of string uris in prerequisite order */ dependencies,
  5971. /* LibraryError.ReportError */errorReporter) {
  5972. // recursive load
  5973. function load(index) {
  5974. // bottom of the dependencies stack
  5975. if (!dependencies || dependencies.length == index){
  5976. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundle(uri,errorReporter );
  5977. return;
  5978. }
  5979. insertScript(dependencies[index], false,
  5980. function() {
  5981. load(index + 1);
  5982. },
  5983. // On failure load, errorReporter with the error message
  5984. function(e) {
  5985. com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri);
  5986. }
  5987. );
  5988. }
  5989. load(0);
  5990. };
  5991. /** @expose */
  5992. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundleStylesheet = function(
  5993. /*String*/ uri,
  5994. /*LibraryError.ReportError*/ errorReporter) {
  5995. // Add a <link> tag to the document, otherwise similar to loading the code
  5996. var link = document.createElement("link");
  5997. link.setAttribute("rel", "stylesheet");
  5998. link.setAttribute("href", uri);
  5999. link.onload = function() {
  6000. errorReporter(null);
  6001. };
  6002. link.onerror = function(e) {
  6003. com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri);
  6004. };
  6005. document.head.appendChild(link);
  6006. };
  6007. /** @expose */
  6008. com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.getMessagesPath = function(
  6009. /*String*/ locale,
  6010. /*String*/ url) {
  6011. return url + "/i18n/messages_" + locale + ".json";
  6012. };
  6013. var _cachedScripts = [];
  6014. function insertScript(src, async, onLoadFunction, onErrorFunction) {
  6015. var cachedScript = _cachedScripts[src];
  6016. if (!cachedScript) {
  6017. // cache the entry
  6018. _cachedScripts[src] = {status: "loading", onload: [onLoadFunction], onerror: [onErrorFunction]};
  6019. // wrap the onLoad and onError
  6020. var onload = function() {
  6021. // mark script as loaded
  6022. var cached = _cachedScripts[src];
  6023. cached.status = "loaded";
  6024. // run all onLoad functions associated with this script, then remove from stack
  6025. while (cached.onload.length > 0) {
  6026. cached.onload.pop()();
  6027. }
  6028. };
  6029. var onerror = function() {
  6030. // mark script as error
  6031. var cached = _cachedScripts[src];
  6032. cached.status = "error";
  6033. // run all onError functions associated with this script, then remove from stack
  6034. while (cached.onerror.length > 0) {
  6035. cached.onerror.pop()();
  6036. }
  6037. };
  6038. // insert script
  6039. createScriptNode(src, async, onload, onerror);
  6040. } else {
  6041. if (cachedScript.status == "loaded") {
  6042. // the script loaded successfully, run the onLoad function
  6043. onLoadFunction();
  6044. } else if (cachedScript.status == "loading") {
  6045. // the cached script is still loading, save the onLoad and onError functions
  6046. cachedScript.onload.push(onLoadFunction);
  6047. cachedScript.onerror.push(onErrorFunction);
  6048. } else if (cachedScript.status == "error") {
  6049. // the script didn't load, run the onError function
  6050. onErrorFunction();
  6051. }
  6052. }
  6053. };
  6054. function createScriptNode(uri, async, onLoadFunction, onErrorFunction) {
  6055. // Add a <script> tag to the document
  6056. var script = document.createElement("script");
  6057. script.setAttribute("src", uri);
  6058. script.setAttribute("charset", "utf-8");
  6059. script.type = 'text/javascript';
  6060. script.async = async | false;
  6061. script.onload = onLoadFunction;
  6062. script.onerror = onErrorFunction;
  6063. // Add to document head
  6064. document.head.appendChild(script);
  6065. };
  6066. // $source: com/ibm/rave/library/framework/internal/AbstractController
  6067. /************************************************************************
  6068. ** IBM Confidential
  6069. **
  6070. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6071. **
  6072. ** (C) Copyright IBM Corp. 2019
  6073. **
  6074. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6075. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6076. ************************************************************************/
  6077. // GENERATED
  6078. //@import com/ibm/rave/library/framework/internal/TransitionsCompleteMonitor (runtime) // new
  6079. //@import com/ibm/rave/library/i18n/Messages (runtime) // createFromCatalog
  6080. //@import com/ibm/rave/library/internal/nativeImpl/LoaderNativeUtils (runtime) // getMessagesPath
  6081. //@import com/ibm/rave/library/service/LibraryError (runtime) // create
  6082. //@import com/ibm/rave/library/framework/BundleInfo (runtime)
  6083. /**
  6084. * TODO: JavaDoc
  6085. */
  6086. var com_ibm_rave_library_framework_internal_AbstractController = rave['internal']['Declare']({
  6087. /**
  6088. * The bundle name.
  6089. */
  6090. //_bundleName : null,
  6091. /**
  6092. * The bundle context (model of the model-view-controller)
  6093. */
  6094. //_context : null,
  6095. /**
  6096. * The bundle view
  6097. */
  6098. //_view : null,
  6099. /**
  6100. * The bundle metadata info
  6101. */
  6102. //_info : null,
  6103. //_messages : null,
  6104. /**
  6105. * pointer to the callback function for use with LibraryError
  6106. */
  6107. //_errorReporter : null,
  6108. /**
  6109. * pointer that will be passed into various functions that will then call on the callback function to report an error
  6110. */
  6111. //reportError : null,
  6112. //transitionCompleteMonitors : null,
  6113. /**
  6114. * Need to hang on to this for Swift.
  6115. */
  6116. //messageXhr : null,
  6117. localeSet : false,
  6118. constructor : function(bundleName, ctx, view) {
  6119. this.transitionCompleteMonitors = [];
  6120. {
  6121. var self = this;
  6122. this.reportError = function(liberror) {
  6123. liberror.setBundlename(self._bundleName);
  6124. if (self._errorReporter) {
  6125. self._errorReporter(liberror);
  6126. }
  6127. };
  6128. this._bundleName = bundleName;
  6129. this._context = ctx;
  6130. this._messages = ctx._messages;
  6131. this._info = new (rave['internal']['Declare']({
  6132. meta : function() {
  6133. return self._context._metadata;
  6134. },
  6135. properties : function() {
  6136. return self._context.properties.meta();
  6137. },
  6138. propertyPresentations : function() {
  6139. return self._context.propertyPresentations.meta();
  6140. },
  6141. actions : function() {
  6142. return self._context.actions._meta;
  6143. },
  6144. dataModels : function() {
  6145. return self._context.datamodels.getDataModels();
  6146. },
  6147. getPreview$2 : function(format, tags) {
  6148. return self._context._previewsMeta.getPreview(format, tags);
  6149. },
  6150. getPreviewTags : function() {
  6151. return self._context._previewsMeta.getAllTags();
  6152. },
  6153. getPreviews$1 : function(format) {
  6154. return self._context._previewsMeta.getPreviews(format);
  6155. },
  6156. getPreview$1 : function(format) {
  6157. return self._context._previewsMeta.getPreview(format, null);
  6158. },
  6159. getPreview$0 : function() {
  6160. return self._context._previewsMeta.getPreview("svg", null);
  6161. },
  6162. getPreviews$0 : function() {
  6163. return self._context._previewsMeta.getPreviews("svg");
  6164. },
  6165. previews : function() {
  6166. return self._context._previewsMeta;
  6167. },
  6168. getPreview : function(a0, a1) {
  6169. var args = arguments;
  6170. if (args.length == 0) {
  6171. return this.getPreview$0();
  6172. }
  6173. if (args.length == 1) {
  6174. return this.getPreview$1(a0);
  6175. }
  6176. return this.getPreview$2(a0, a1);
  6177. },
  6178. getPreviews : function(a0) {
  6179. var args = arguments;
  6180. if (args.length == 0) {
  6181. return this.getPreviews$0();
  6182. }
  6183. return this.getPreviews$1(a0);
  6184. }
  6185. }))();
  6186. this._view = view;
  6187. if (this._view) {
  6188. this._view.setup();
  6189. }
  6190. }
  6191. },
  6192. render$0 : function() {
  6193. this.render$1(null);
  6194. },
  6195. render$1 : function(callback) {
  6196. this.updateContextSize();
  6197. if (this._view) {
  6198. var dataModel = this._context.datamodels.dataModel();
  6199. if (dataModel._dataChanged) {
  6200. this._view.reset();
  6201. dataModel._dataChanged = false;
  6202. }
  6203. if (!callback) {
  6204. this._view.draw();
  6205. } else {
  6206. rave['internal']['TransitionCollector'].startCollectingTransitions();
  6207. this._view.draw();
  6208. var transitions = rave['internal']['TransitionCollector'].stopCollectingTransitions();
  6209. if (transitions.length == 0) {
  6210. callback();
  6211. } else {
  6212. var self = this;
  6213. var tcc = function(tcm) {
  6214. var i = self.transitionCompleteMonitors.indexOf(tcm);
  6215. if (i >= 0) {
  6216. self.transitionCompleteMonitors.splice(i, 1);
  6217. }
  6218. callback();
  6219. };
  6220. var m = new com_ibm_rave_library_framework_internal_TransitionsCompleteMonitor(tcc);
  6221. this.transitionCompleteMonitors.push(m);
  6222. m.monitor(transitions);
  6223. }
  6224. }
  6225. }
  6226. this.updateActionBindings();
  6227. },
  6228. /** @expose */
  6229. info : function() {
  6230. return this._info;
  6231. },
  6232. /** @expose */
  6233. action : function(id) {
  6234. return this._context.actions.action(id);
  6235. },
  6236. /** @expose */
  6237. getDataModels : function() {
  6238. return this._context.datamodels.getDataModels();
  6239. },
  6240. /** @expose */
  6241. createDataModel : function(modelId) {
  6242. this._view.reset();
  6243. return this._context.datamodels.createDataModel(modelId);
  6244. },
  6245. /**
  6246. * Get the current data model for this bundle.
  6247. * @return (com.ibm.rave.library.datamodel.DataModel) The data model used for rendering
  6248. */
  6249. /** @expose */
  6250. dataModel : function() {
  6251. return this._context.datamodels.dataModel();
  6252. },
  6253. node$0 : function(svg) {
  6254. this._context.node = svg;
  6255. return this;
  6256. },
  6257. /** @expose */
  6258. setMessageCatalog : function(locale, catalog) {
  6259. var message = com_ibm_rave_library_i18n_Messages.createFromCatalog(catalog, locale);
  6260. this._messages.add(locale, message);
  6261. },
  6262. /** @expose */
  6263. setLocale : function(locale, url, userCallback) {
  6264. var self = this;
  6265. var path = com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.getMessagesPath(locale, url);
  6266. if (self._messages.locale(locale)) {
  6267. if (userCallback) {
  6268. userCallback();
  6269. }
  6270. return true;
  6271. }
  6272. self.messageXhr = rave.json(path, function(error, response) {
  6273. if (!error) {
  6274. self.setMessageCatalog(locale, (response));
  6275. self.localeSet = self._messages.locale(locale);
  6276. if (userCallback) {
  6277. userCallback();
  6278. }
  6279. }
  6280. });
  6281. return this.localeSet;
  6282. },
  6283. node$1 : function() {
  6284. return this._context.node;
  6285. },
  6286. property$0 : function(id, value) {
  6287. var p = this._context.properties.property(id);
  6288. if (!p) {
  6289. this.reportError(com_ibm_rave_library_service_LibraryError.create(32, id, this._bundleName));
  6290. } else {
  6291. p.value(value);
  6292. this._view.checkUpdate(id);
  6293. }
  6294. return this;
  6295. },
  6296. property$1 : function(id) {
  6297. var prop = this._context.properties.property(id);
  6298. if (prop) {
  6299. return prop.value();
  6300. }
  6301. return null;
  6302. },
  6303. /**
  6304. * Pass custom formatters to bundleContext, from where they are retrieved by bundle to format elements (axis, legend, etc) of View.
  6305. */
  6306. /** @expose */
  6307. setCustomFormatter : function(target, formatter) {
  6308. this._context.addCustomFormatter(target, formatter);
  6309. this._view.resetRedraw();
  6310. },
  6311. /**
  6312. * Retrieve the custom formatters defined by users.
  6313. * @return (Object) map of custom formatters
  6314. */
  6315. /** @expose */
  6316. getCustomFormatters : function() {
  6317. return this._context._customFormatters;
  6318. },
  6319. /** @expose */
  6320. removeCustomFormatter : function(target) {
  6321. this._context.removeCustomFormatter(target);
  6322. this._view.resetRedraw();
  6323. },
  6324. /**
  6325. * Store a snapshot of the current width and height of the context scene node.
  6326. */
  6327. updateContextSize : function() {
  6328. var _w = ""+(this._context.node.style("width")).replace("px", "");
  6329. var _h = ""+(this._context.node.style("height")).replace("px", "");
  6330. var w = + (_w);
  6331. var h = + (_h);
  6332. if (isNaN(w)) {
  6333. w = 400.0;
  6334. }
  6335. if (isNaN(h)) {
  6336. h = 400.0;
  6337. }
  6338. if (this._context.size.w != w || this._context.size.h != h) {
  6339. this.node$1().attr("__rave_resize__", true).attr("__rave_resize__", null);
  6340. this._view.resetLayout();
  6341. }
  6342. this._context.size.w = w;
  6343. this._context.size.h = h;
  6344. },
  6345. /**
  6346. * Apply all action bindings to the current visualization context.
  6347. */
  6348. updateActionBindings : function() {
  6349. this._context.actions.applyBindings();
  6350. },
  6351. /** @expose */
  6352. onError : function(errorReport) {
  6353. this._errorReporter = errorReport;
  6354. },
  6355. /**
  6356. * Pointer that holds the function that calls the callback function to report an error
  6357. * @return (com.ibm.rave.library.service.LibraryError.ReportError) LibraryError.ReportError
  6358. */
  6359. errorReporter : function() {
  6360. return this.reportError;
  6361. },
  6362. /**
  6363. * Return locale for this bundle instance
  6364. * @return (String) locale for this bundle instance
  6365. */
  6366. locale : function() {
  6367. return this._context.locale();
  6368. },
  6369. /** @expose */
  6370. preExecuteCallback : function(callback) {
  6371. this._context._preExecuteCallback = callback;
  6372. },
  6373. /** @expose */
  6374. preRenderCallback : function(callback) {
  6375. this._context._prerenderCallback = callback;
  6376. },
  6377. /** @expose */
  6378. renderCallback : function(callback) {
  6379. this._context._renderCallback = callback;
  6380. },
  6381. /** @expose */
  6382. postRenderCallback : function(callback) {
  6383. this._context._postrenderCallback = callback;
  6384. },
  6385. /** @expose */
  6386. getSVGImage : function(callback) {
  6387. rave.getSVGImage(this._context.node.node(), callback);
  6388. },
  6389. /** @expose */
  6390. getCoordinateScale : function(role) {
  6391. return this._view ? this._view.getCoordinateScale(role) : null;
  6392. },
  6393. /** @expose */
  6394. dispose : function() {
  6395. if (this._context.node) {
  6396. this._context.node.selectAll("*").interrupt().transition();
  6397. }
  6398. if (this._view) {
  6399. this._view.dispose();
  6400. }
  6401. },
  6402. /** @expose */
  6403. on : function(eventName, callback) {
  6404. if (this._view) {
  6405. this._view.on(eventName, callback);
  6406. }
  6407. return this;
  6408. },
  6409. /** @expose */
  6410. render : function(a0) {
  6411. var args = arguments;
  6412. if (args.length == 0) {
  6413. return this.render$0();
  6414. }
  6415. return this.render$1(a0);
  6416. },
  6417. /** @expose */
  6418. node : function(a0) {
  6419. var args = arguments;
  6420. if (args.length == 0) {
  6421. return this.node$1();
  6422. }
  6423. return this.node$0(a0);
  6424. },
  6425. /** @expose */
  6426. property : function(a0, a1) {
  6427. var args = arguments;
  6428. if (args.length == 1) {
  6429. return this.property$1(a0);
  6430. }
  6431. return this.property$0(a0, a1);
  6432. }
  6433. });
  6434. com_ibm_rave_library_framework_internal_AbstractController.DEFAULT_SIZE_WIDTH = 400.0;
  6435. com_ibm_rave_library_framework_internal_AbstractController.DEFAULT_SIZE_HEIGHT = 400.0;
  6436. // $source: com/ibm/rave/library/framework/internal/TransitionsCompleteMonitor
  6437. /************************************************************************
  6438. ** IBM Confidential
  6439. **
  6440. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6441. **
  6442. ** (C) Copyright IBM Corp. 2017
  6443. **
  6444. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6445. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6446. ************************************************************************/
  6447. // GENERATED
  6448. var com_ibm_rave_library_framework_internal_TransitionsCompleteMonitor = rave['internal']['Declare']({
  6449. //_callback : null,
  6450. monitoredTransitionsCount : 0,
  6451. constructor : function(callback) {
  6452. this._callback = callback;
  6453. this.monitoredTransitionsCount = 0;
  6454. },
  6455. monitor : function(transitions) {
  6456. for (var __i_enFor0 = 0, __exp_enFor0 = transitions, __len_enFor0 = __exp_enFor0.length;
  6457. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6458. var t = __exp_enFor0[__i_enFor0];
  6459. var size = t.size();
  6460. if (size > 0) {
  6461. this.monitoredTransitionsCount++;
  6462. var monitor = new com_ibm_rave_library_framework_internal_TransitionsCompleteMonitor.TransitionCompleteMonitor(this, size);
  6463. t.transitionEndedCallback(monitor);
  6464. }
  6465. }
  6466. if (this.monitoredTransitionsCount == 0) {
  6467. this._callback(this);
  6468. }
  6469. },
  6470. transitionComplete : function() {
  6471. this.monitoredTransitionsCount--;
  6472. if (this.monitoredTransitionsCount == 0) {
  6473. this._callback(this);
  6474. }
  6475. }
  6476. });
  6477. com_ibm_rave_library_framework_internal_TransitionsCompleteMonitor.TransitionCompleteMonitor = rave['internal']['Declare']({
  6478. //monitorsCollection : null,
  6479. _count : 0,
  6480. _$functionClassMethod : function() {
  6481. var _$self = function(args) {
  6482. if (args !== null || arguments.length > 1){
  6483. args = Array.prototype.slice.call(arguments, 0);
  6484. }
  6485. {
  6486. _$self._count--;
  6487. if (_$self._count == 0) {
  6488. _$self.monitorsCollection.transitionComplete();
  6489. }
  6490. return null;
  6491. }
  6492. };
  6493. return _$self;
  6494. },
  6495. constructor : function(collection, count) {
  6496. this._count = count;
  6497. this.monitorsCollection = collection;
  6498. }
  6499. });
  6500. // $source: com/ibm/rave/library/i18n/Messages
  6501. /************************************************************************
  6502. ** IBM Confidential
  6503. **
  6504. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6505. **
  6506. ** (C) Copyright IBM Corp. 2017
  6507. **
  6508. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6509. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6510. ************************************************************************/
  6511. // GENERATED
  6512. /**
  6513. * NLS messages catalog
  6514. */
  6515. var com_ibm_rave_library_i18n_Messages = rave_library_externs["Messages"] = rave['internal']['Declare']({
  6516. //catalog : null,
  6517. //language : null,
  6518. /**
  6519. * Create empty messages catalog
  6520. */
  6521. /** @expose */
  6522. constructor : function() {
  6523. this.catalog = {};
  6524. },
  6525. /**
  6526. * Return nls value for the message key
  6527. * @param (String) key nls key
  6528. * @return (String) nls value
  6529. */
  6530. /** @expose */
  6531. _nls : function(key, alt) {
  6532. var value = (this.catalog[key]);
  6533. return value == null ? alt : value;
  6534. },
  6535. /**
  6536. * Returns language tag (e.g. "fr", "jp", "en", etc)
  6537. * @return (String) language tag
  6538. */
  6539. /** @expose */
  6540. locale : function() {
  6541. return this.language;
  6542. }
  6543. });
  6544. /**
  6545. * Creates a Messages container for a provided messages catalog.
  6546. * @param (Object) messagesCatalog The messages catalog loaded from a bundle's resources.
  6547. * @param (String) locale The language tag (e.g. "en", "fr", etc.) that the catalog contains.
  6548. * @return (com.ibm.rave.library.i18n.Messages) A Messages container.
  6549. */
  6550. /** @expose */
  6551. com_ibm_rave_library_i18n_Messages.createFromCatalog = function(messagesCatalog, locale) {
  6552. var m = new com_ibm_rave_library_i18n_Messages();
  6553. m.catalog = messagesCatalog;
  6554. m.language = locale;
  6555. return m;
  6556. };
  6557. /**
  6558. * Default locale is a root locale
  6559. */
  6560. /** @expose */
  6561. com_ibm_rave_library_i18n_Messages.DEFAULT = "root";
  6562. /** @expose */
  6563. com_ibm_rave_library_i18n_Messages.EMPTY_MESSAGES = new com_ibm_rave_library_i18n_Messages();
  6564. // $source: com/ibm/rave/library/framework/BundleInfo
  6565. /************************************************************************
  6566. ** IBM Confidential
  6567. **
  6568. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6569. **
  6570. ** (C) Copyright IBM Corp. 2017
  6571. **
  6572. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6573. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6574. ************************************************************************/
  6575. // GENERATED
  6576. /**
  6577. * <p> Interface for retrieving meta data information from a bundle ( {@link (com.ibm.rave.library.framework.Bundle) Bundle} ) or bundle instance ( {@link (com.ibm.rave.library.framework.Controller) Controller} ). </p> <p> The BundleInfo reports the metadata, properties, actions, data models, and property presentations provided by the Bundle or Controller. The information from a Controller may differ from that in the Bundle, if a configuration was used to create the instance. </p> <p> When methods return lists, the list is non-null but may be empty. The caller must not modify the list. The sort order of the list is unspecified. </p>
  6578. */
  6579. var com_ibm_rave_library_framework_BundleInfo = rave_library_externs["BundleInfo"] = rave['internal']['Declare'].implement(
  6580. /**
  6581. * @return (com.ibm.rave.library.framework.meta.GenericMetadata) generic metadata information about the bundle (e.g. name, description, tags, previews).
  6582. */
  6583. //meta : function() {},
  6584. /**
  6585. * @return (Array) List of all properties this bundle or instance exposes.
  6586. */
  6587. //properties : function() {},
  6588. /**
  6589. * @return (Array) List of all property presentations this bundle or instance exposes.
  6590. */
  6591. //propertyPresentations : function() {},
  6592. /**
  6593. * @return (Array) List of all available actions, and their default bindings.
  6594. */
  6595. //actions : function() {},
  6596. /**
  6597. * @return (Array) List of all data models this bundle or instance exposes.
  6598. */
  6599. //dataModels : function() {},
  6600. /**
  6601. * @return (com.ibm.rave.library.framework.meta.PreviewsMetadata) generic metadata information about the bundle (e.g. name, description, tags, previews).
  6602. */
  6603. //previews : function() {},
  6604. /**
  6605. * @param (String) format Either 'svg' or 'image'. If this parameter is not set svg is assumed. If a value is provided that is not supported an error is returned.
  6606. * @param (Array) tags A list of tags. Each preview may have one or more tags associated with it. The bundle will try to match the list of tags to the available previews for that format. The preview that matches the most tags will be returned. If it is a tie or if no tags are provided on the call, the first preview (or the first out of the matching tags) is returned.
  6607. * @return (String) A string. If the requested format is svg, the string will be the SVG as a string. It is the contents of the file "resources/svgPreviewNoText.svg" or "resources/svgPreview.svg" depending on the tags. If the requested format is an image, the string will be the relative location of the appropriate image file. This location will be relative to the root of the bundle. In Java this location will be the resource location in the JAR file. In iOS the location will be in the resources of the library. For JavaScript this will be a file inside the bundle.
  6608. */
  6609. //getPreview$2 : function(format, tags) {},
  6610. /**
  6611. * Return a string that represents the preview for the given format.
  6612. * @param (String) format Either "svg" or "image"
  6613. * @return (String) A string represents the preview
  6614. */
  6615. //getPreview$1 : function(format) {},
  6616. /**
  6617. * Return a string that represents the svg preview. Same as getPreview("svg").
  6618. * @return (String) A string represents the svg preview
  6619. */
  6620. //getPreview$0 : function() {},
  6621. /**
  6622. * This returns the union of all tags for all previews for this bundle. This allows integrators to know what tags are available
  6623. * @return (Array) An array of tags.
  6624. */
  6625. //getPreviewTags : function() {},
  6626. /**
  6627. * @param (String) format Either "svg" or "image".
  6628. * @return (Array) A collection of previews for the given format. Default to svg if no format is provided. Return an error if the format is not found.
  6629. */
  6630. //getPreviews$1 : function(format) {},
  6631. /**
  6632. * Same as getPreviews("svg")
  6633. * @return (Array) a collection of svg previews.
  6634. */
  6635. //getPreviews$0 : function() {}
  6636. );
  6637. // $source: com/ibm/rave/library/framework/meta/ActionMeta
  6638. /************************************************************************
  6639. ** IBM Confidential
  6640. **
  6641. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6642. **
  6643. ** (C) Copyright IBM Corp. 2017
  6644. **
  6645. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6646. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6647. ************************************************************************/
  6648. // GENERATED
  6649. /**
  6650. * Container for action meta data.
  6651. */
  6652. var com_ibm_rave_library_framework_meta_ActionMeta = rave['internal']['Declare']({
  6653. //_id : null,
  6654. //_label : null,
  6655. //_description : null,
  6656. //_icon : null,
  6657. //_tags : null,
  6658. //_options : null,
  6659. //_defaultBindings : null,
  6660. //_args : null,
  6661. //_messages : null,
  6662. /** @expose */
  6663. id : function() {
  6664. return this._id;
  6665. },
  6666. /** @expose */
  6667. label : function() {
  6668. return this._messages._nls(this._label, this._label);
  6669. },
  6670. /** @expose */
  6671. description : function() {
  6672. return this._messages._nls(this._description, this._description);
  6673. },
  6674. /** @expose */
  6675. icon : function() {
  6676. return this._icon;
  6677. },
  6678. /** @expose */
  6679. tags : function() {
  6680. var msgTags = [];
  6681. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  6682. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6683. var tag = __exp_enFor0[__i_enFor0];
  6684. msgTags.push(this._messages._nls(tag, tag));
  6685. }
  6686. return msgTags;
  6687. },
  6688. /** @expose */
  6689. options : function() {
  6690. return this._options;
  6691. },
  6692. /** @expose */
  6693. defaultBindings : function() {
  6694. return this._defaultBindings;
  6695. }
  6696. //constructor : function() {}
  6697. });
  6698. /**
  6699. * Builds the action metadata structure defined by the provided action JSON definition.
  6700. */
  6701. /** @expose */
  6702. com_ibm_rave_library_framework_meta_ActionMeta.parse = function(action, messages) {
  6703. var a = new com_ibm_rave_library_framework_meta_ActionMeta();
  6704. var bindings = action["binding"];
  6705. var args = action["args"];
  6706. a._id = (action["id"]);
  6707. a._icon = (action["icon"]);
  6708. a._label = (action["label"]);
  6709. a._description = (action["description"]);
  6710. a._tags = (action["tags"]);
  6711. a._options = (action["options"]);
  6712. a._args = [];
  6713. if (args) {
  6714. for (var i = 0; i < args.length; ++i) {
  6715. a._args.push(com_ibm_rave_library_framework_meta_ActionMeta.ArgumentsMeta.parse(args[i], messages));
  6716. }
  6717. }
  6718. a._defaultBindings = [];
  6719. if (bindings) {
  6720. for (var i = 0; i < bindings.length; ++i) {
  6721. a._defaultBindings.push(com_ibm_rave_library_framework_meta_ActionMeta.BindingMeta.parse(bindings[i]));
  6722. }
  6723. }
  6724. a._messages = messages;
  6725. return a;
  6726. };
  6727. /**
  6728. * Container for a single target-event pair.
  6729. */
  6730. com_ibm_rave_library_framework_meta_ActionMeta.BindingMeta = rave['internal']['Declare']({
  6731. //_target : null,
  6732. //_event : null,
  6733. /** @expose */
  6734. target : function() {
  6735. return this._target;
  6736. },
  6737. /** @expose */
  6738. event : function() {
  6739. return this._event;
  6740. }
  6741. //constructor : function() {}
  6742. });
  6743. /** @expose */
  6744. com_ibm_rave_library_framework_meta_ActionMeta.BindingMeta.parse = function(binding) {
  6745. var b = new com_ibm_rave_library_framework_meta_ActionMeta.BindingMeta();
  6746. b._target = ""+(binding["target"]);
  6747. b._event = ""+(binding["event"]);
  6748. return b;
  6749. };
  6750. /**
  6751. * Container for a single target-event pair.
  6752. */
  6753. com_ibm_rave_library_framework_meta_ActionMeta.ArgumentsMeta = rave['internal']['Declare']({
  6754. //_id : null,
  6755. //_label : null,
  6756. //_description : null,
  6757. //_icon : null,
  6758. //_tags : null,
  6759. //_type : null,
  6760. //_messages : null,
  6761. /** @expose */
  6762. id : function() {
  6763. return this._id;
  6764. },
  6765. /** @expose */
  6766. label : function() {
  6767. return this._messages._nls(this._label, this._label);
  6768. },
  6769. /** @expose */
  6770. description : function() {
  6771. return this._messages._nls(this._description, this._description);
  6772. },
  6773. /** @expose */
  6774. icon : function() {
  6775. return this._icon;
  6776. },
  6777. /** @expose */
  6778. tags : function() {
  6779. var msgTags = [];
  6780. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  6781. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6782. var tag = __exp_enFor0[__i_enFor0];
  6783. msgTags.push(this._messages._nls(tag, tag));
  6784. }
  6785. return msgTags;
  6786. },
  6787. /** @expose */
  6788. type : function() {
  6789. return this._type;
  6790. }
  6791. //constructor : function() {}
  6792. });
  6793. /**
  6794. * Populates the values for the action arguments.
  6795. * @param (Object) args action arguments JSOn.
  6796. * @return (com.ibm.rave.library.framework.meta.ActionMeta.ArgumentsMeta) action "ArgumentsMeta".
  6797. */
  6798. /** @expose */
  6799. com_ibm_rave_library_framework_meta_ActionMeta.ArgumentsMeta.parse = function(args, msgs) {
  6800. var a = new com_ibm_rave_library_framework_meta_ActionMeta.ArgumentsMeta();
  6801. a._id = ""+(args["id"]);
  6802. a._label = ""+(args["label"]);
  6803. a._description = ""+(args["description"]);
  6804. a._icon = ""+(args["icon"]);
  6805. a._tags = (args["tags"]);
  6806. a._type = ""+(args["type"]);
  6807. a._messages = msgs;
  6808. return a;
  6809. };
  6810. // $source: com/ibm/rave/library/framework/meta/internal/PropertyPresentationMetaImpl
  6811. /************************************************************************
  6812. ** IBM Confidential
  6813. **
  6814. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6815. **
  6816. ** (C) Copyright IBM Corp. 2017
  6817. **
  6818. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6819. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6820. ************************************************************************/
  6821. // GENERATED
  6822. //@import com/ibm/rave/library/framework/meta/internal/PropertyReferenceMeta (runtime) // new
  6823. //@import com/ibm/rave/library/framework/meta/internal/PropertyGroupMeta (runtime) // new
  6824. //@import com/ibm/rave/library/i18n/MessagesRegistry (runtime) // EmptyRegistry
  6825. /**
  6826. * A property presentation is a list of properties you want to group together. The PropertyPresentationMeta API stores the given meta data for the property presentation in strings and object arrays which can then be used to present the grouped properties in a user interface. Property Presentations are under development and the API is subject to change.
  6827. */
  6828. var com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl = rave['internal']['Declare']({
  6829. /**
  6830. * ID of the presentation
  6831. */
  6832. //_id : null,
  6833. /**
  6834. * Name of the presentation
  6835. */
  6836. //_name : null,
  6837. /**
  6838. * Description of the presentation
  6839. */
  6840. //_description : null,
  6841. /**
  6842. * String Tags of the presentation
  6843. */
  6844. //_tags : null,
  6845. /**
  6846. * Path to the image icon of the presentation
  6847. */
  6848. //_icon : null,
  6849. /**
  6850. * Localization messages registry
  6851. */
  6852. //messagesRegistry : null,
  6853. /**
  6854. * Object array that holds references to bundle property IDs as well as nested groups
  6855. */
  6856. //_presentationItems : null,
  6857. constructor : function(registry) {
  6858. this.messagesRegistry = registry;
  6859. },
  6860. /**
  6861. * @return (String) Property presentation ID
  6862. */
  6863. /** @expose */
  6864. id : function() {
  6865. return this._id;
  6866. },
  6867. /**
  6868. * @return (String) Property presentation Name
  6869. */
  6870. /** @expose */
  6871. name : function() {
  6872. return this.messagesRegistry._nls(this._name, this._name);
  6873. },
  6874. /**
  6875. * @return (String) Property presentation Description
  6876. */
  6877. /** @expose */
  6878. description : function() {
  6879. return this.messagesRegistry._nls(this._description, this._description);
  6880. },
  6881. /**
  6882. * @return (java.lang.String[]) Property presentation Tags
  6883. */
  6884. /** @expose */
  6885. tags : function() {
  6886. return this._tags;
  6887. },
  6888. /**
  6889. * @return (String) Property presentation path to the image icon
  6890. */
  6891. /** @expose */
  6892. icon : function() {
  6893. return this._icon;
  6894. },
  6895. /**
  6896. * @return (com.ibm.rave.library.framework.meta.PresentationItems[]) Property presentation Items Array
  6897. */
  6898. /** @expose */
  6899. presentationItems : function() {
  6900. var presentationItems = [];
  6901. var i = 0;
  6902. for (var __i_enFor0 = 0, __exp_enFor0 = this._presentationItems, __len_enFor0 = __exp_enFor0.length;
  6903. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6904. var item = __exp_enFor0[__i_enFor0];
  6905. presentationItems[i++] = item;
  6906. }
  6907. return presentationItems;
  6908. },
  6909. /**
  6910. * Builds the property presentation metadata structure defined by the provided JSON definition.
  6911. * @param (Object) json JSON definition of a presentation
  6912. * @return (com.ibm.rave.library.framework.meta.internal.PropertyPresentationMetaImpl) Property presentation
  6913. */
  6914. parse : function(json) {
  6915. var pp = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl(this.messagesRegistry);
  6916. pp._id = ""+(json["id"]);
  6917. pp._name = ""+(json["label"]);
  6918. pp._description = ""+(json["description"]);
  6919. var pTags = json["tags"];
  6920. if (pTags) {
  6921. var len = pTags.length;
  6922. pp._tags = [];
  6923. for (var i = 0; i < len; ++i) {
  6924. pp._tags[i] = (pTags[i]);
  6925. }
  6926. } else {
  6927. pp._tags = null;
  6928. }
  6929. pp._icon = (json["icon"]);
  6930. var pItems = json["presentationItems"];
  6931. if (pItems) {
  6932. var len = pItems.length;
  6933. pp._presentationItems = [];
  6934. for (var i = 0; i < len; ++i) {
  6935. var item = pItems[i];
  6936. var propertyRef = (item["propertyID"]);
  6937. if (propertyRef != null) {
  6938. var property = new com_ibm_rave_library_framework_meta_internal_PropertyReferenceMeta();
  6939. property.setID(propertyRef);
  6940. pp._presentationItems.push(property);
  6941. } else {
  6942. var propertyGroup = new com_ibm_rave_library_framework_meta_internal_PropertyGroupMeta(this.messagesRegistry);
  6943. var propertyGroupMeta = item["propertyGroup"];
  6944. propertyGroup.setID((propertyGroupMeta["id"]));
  6945. propertyGroup.setGroupName((propertyGroupMeta["label"]));
  6946. propertyGroup.setGroupDescription((propertyGroupMeta["description"]));
  6947. propertyGroup.setGroupIcon((propertyGroupMeta["icon"]));
  6948. var groupTags = propertyGroupMeta["tags"];
  6949. if (groupTags) {
  6950. var glen = groupTags.length;
  6951. var groupTagsArray = [];
  6952. for (var j = 0; j < glen; ++j) {
  6953. groupTagsArray[j] = (groupTags[j]);
  6954. }
  6955. propertyGroup.setGroupTags(groupTagsArray);
  6956. } else {
  6957. propertyGroup.setGroupTags(null);
  6958. }
  6959. var groupPItems = propertyGroupMeta["presentationItems"];
  6960. propertyGroup.parse(groupPItems);
  6961. pp._presentationItems.push(propertyGroup);
  6962. }
  6963. }
  6964. } else {
  6965. pp._presentationItems = null;
  6966. }
  6967. return pp;
  6968. },
  6969. /**
  6970. * Perform a deep copy of this object.
  6971. * @return (com.ibm.rave.library.framework.meta.internal.PropertyPresentationMetaImpl) deep copy.
  6972. */
  6973. copy : function() {
  6974. var pp = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl(com_ibm_rave_library_i18n_MessagesRegistry.EmptyRegistry());
  6975. pp._id = this._id;
  6976. pp._name = this._name;
  6977. pp._description = this._description;
  6978. pp._tags = [];
  6979. pp._presentationItems = [];
  6980. pp._icon = this._icon;
  6981. var i = 0;
  6982. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  6983. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6984. var tag = __exp_enFor0[__i_enFor0];
  6985. pp._tags[i++] = tag;
  6986. }
  6987. for (var __i_enFor1 = 0, __exp_enFor1 = this._presentationItems, __len_enFor1 = __exp_enFor1.length;
  6988. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  6989. var item = __exp_enFor1[__i_enFor1];
  6990. if (item.type() == "reference") {
  6991. pp._presentationItems.push(item);
  6992. } else {
  6993. pp._presentationItems.push((item).copy());
  6994. }
  6995. }
  6996. return pp;
  6997. },
  6998. validateProperties : function(properties) {
  6999. var itemsToRemove;
  7000. for (var __i_enFor0 = 0, __exp_enFor0 = this._presentationItems, __len_enFor0 = __exp_enFor0.length;
  7001. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7002. var item = __exp_enFor0[__i_enFor0];
  7003. if (item.type() == "reference") {
  7004. var p = properties.property(item.id());
  7005. if (p._hidden) {
  7006. if (!itemsToRemove) {
  7007. itemsToRemove = [];
  7008. }
  7009. itemsToRemove.push(item);
  7010. }
  7011. } else {
  7012. (item).validateProperties(properties);
  7013. }
  7014. }
  7015. if (itemsToRemove) {
  7016. for (var __i_enFor1 = 0, __exp_enFor1 = itemsToRemove, __len_enFor1 = __exp_enFor1.length;
  7017. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7018. var item = __exp_enFor1[__i_enFor1];
  7019. var index = this._presentationItems.indexOf(item);
  7020. this._presentationItems.splice(index, 1);
  7021. }
  7022. }
  7023. }
  7024. });
  7025. // $source: com/ibm/rave/library/framework/meta/internal/PropertyReferenceMeta
  7026. /************************************************************************
  7027. ** IBM Confidential
  7028. **
  7029. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7030. **
  7031. ** (C) Copyright IBM Corp. 2017
  7032. **
  7033. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7034. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7035. ************************************************************************/
  7036. // GENERATED
  7037. /**
  7038. * The PresentationItems interface stores information about a particular property presentation item. Currently, there can be 2 types of property presentation items. PropertyReferenceMeta is one of those types. PropertyReferenceMeta stores the property ID of the property being presented in a group or individually. The type for this particular object is always 'reference'.
  7039. */
  7040. var com_ibm_rave_library_framework_meta_internal_PropertyReferenceMeta = rave['internal']['Declare']({
  7041. /**
  7042. * ID of the property
  7043. */
  7044. //propertyID : null,
  7045. /** @expose */
  7046. id : function() {
  7047. return this.propertyID;
  7048. },
  7049. /** @expose */
  7050. type : function() {
  7051. return "reference";
  7052. },
  7053. /** @expose */
  7054. name : function() {
  7055. return null;
  7056. },
  7057. /** @expose */
  7058. description : function() {
  7059. return null;
  7060. },
  7061. /** @expose */
  7062. tags : function() {
  7063. return null;
  7064. },
  7065. /** @expose */
  7066. icon : function() {
  7067. return null;
  7068. },
  7069. /** @expose */
  7070. presentationItems : function() {
  7071. return null;
  7072. },
  7073. setID : function(id) {
  7074. this.propertyID = id;
  7075. }
  7076. });
  7077. // $source: com/ibm/rave/library/framework/meta/internal/PropertyGroupMeta
  7078. /************************************************************************
  7079. ** IBM Confidential
  7080. **
  7081. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7082. **
  7083. ** (C) Copyright IBM Corp. 2017
  7084. **
  7085. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7086. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7087. ************************************************************************/
  7088. // GENERATED
  7089. //@import com/ibm/rave/library/framework/meta/internal/PropertyReferenceMeta (runtime) // new
  7090. /**
  7091. * The PresentationItems interface stores information about a particular property presentation item. Currently, there can be 2 types of property presentation items. PropertyGroupMeta is one of those types. PropertyGroupMeta stores meta information about a particular Presentation Item group (such as ID, description, etc) as well as a list of PresentationItems which can consist of Property References or more Groups. The type for this particular object is always 'group'. PropertyGroupMeta is particularly useful when you want to group a bunch of common properties together.
  7092. */
  7093. var com_ibm_rave_library_framework_meta_internal_PropertyGroupMeta = rave['internal']['Declare']({
  7094. /**
  7095. * ID of the presentation group
  7096. */
  7097. //groupID : null,
  7098. /**
  7099. * Name of the presentation group
  7100. */
  7101. //groupName : null,
  7102. /**
  7103. * Description of the presentation group
  7104. */
  7105. //groupDescription : null,
  7106. /**
  7107. * String Tags of the presentation group
  7108. */
  7109. //groupTags : null,
  7110. /**
  7111. * Path to the image icon of the presentation group
  7112. */
  7113. //groupIcon : null,
  7114. /**
  7115. * Localization messages registry
  7116. */
  7117. //messagesRegistry : null,
  7118. /**
  7119. * PresentationItems array that holds references to bundle property IDs as well as nested groups
  7120. */
  7121. //groupPresentationItems : null,
  7122. constructor : function(registry) {
  7123. this.messagesRegistry = registry;
  7124. },
  7125. /** @expose */
  7126. id : function() {
  7127. return this.groupID;
  7128. },
  7129. /** @expose */
  7130. type : function() {
  7131. return "group";
  7132. },
  7133. /** @expose */
  7134. name : function() {
  7135. return this.messagesRegistry._nls(this.groupName, this.groupName);
  7136. },
  7137. /** @expose */
  7138. description : function() {
  7139. return this.messagesRegistry._nls(this.groupDescription, this.groupDescription);
  7140. },
  7141. /** @expose */
  7142. tags : function() {
  7143. return this.groupTags;
  7144. },
  7145. /** @expose */
  7146. icon : function() {
  7147. return this.groupIcon;
  7148. },
  7149. /** @expose */
  7150. presentationItems : function() {
  7151. var presentationItems = [];
  7152. var i = 0;
  7153. for (var __i_enFor0 = 0, __exp_enFor0 = this.groupPresentationItems, __len_enFor0 = __exp_enFor0.length;
  7154. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7155. var item = __exp_enFor0[__i_enFor0];
  7156. presentationItems[i++] = item;
  7157. }
  7158. return presentationItems;
  7159. },
  7160. setID : function(id) {
  7161. this.groupID = id;
  7162. },
  7163. setGroupName : function(group) {
  7164. this.groupName = group;
  7165. },
  7166. setGroupDescription : function(description) {
  7167. this.groupDescription = description;
  7168. },
  7169. setGroupTags : function(tags) {
  7170. this.groupTags = tags;
  7171. },
  7172. setGroupIcon : function(icon) {
  7173. this.groupIcon = icon;
  7174. },
  7175. parse : function(pItems) {
  7176. if (pItems) {
  7177. var len = pItems.length;
  7178. this.groupPresentationItems = [];
  7179. for (var i = 0; i < len; ++i) {
  7180. var item = pItems[i];
  7181. var propertyRef = (item["propertyID"]);
  7182. if (propertyRef != null) {
  7183. var property = new com_ibm_rave_library_framework_meta_internal_PropertyReferenceMeta();
  7184. property.setID(propertyRef);
  7185. this.groupPresentationItems.push(property);
  7186. } else {
  7187. var propertyGroup = new com_ibm_rave_library_framework_meta_internal_PropertyGroupMeta(this.messagesRegistry);
  7188. var propertyGroupMeta = item["propertyGroup"];
  7189. propertyGroup.setID((propertyGroupMeta["id"]));
  7190. propertyGroup.setGroupName((propertyGroupMeta["label"]));
  7191. propertyGroup.setGroupDescription((propertyGroupMeta["description"]));
  7192. propertyGroup.setGroupIcon((propertyGroupMeta["icon"]));
  7193. var gTags = propertyGroupMeta["tags"];
  7194. if (gTags) {
  7195. var glen = gTags.length;
  7196. var groupTagsArray = [];
  7197. for (var j = 0; j < len; ++j) {
  7198. groupTagsArray[i] = (gTags[i]);
  7199. }
  7200. propertyGroup.setGroupTags(groupTagsArray);
  7201. } else {
  7202. propertyGroup.setGroupTags(null);
  7203. }
  7204. var groupPItems = propertyGroupMeta["presentationItems"];
  7205. propertyGroup.parse(groupPItems);
  7206. this.groupPresentationItems.push(propertyGroup);
  7207. }
  7208. }
  7209. } else {
  7210. this.groupPresentationItems = null;
  7211. }
  7212. },
  7213. copy : function() {
  7214. var pgm = new com_ibm_rave_library_framework_meta_internal_PropertyGroupMeta(this.messagesRegistry);
  7215. pgm.groupDescription = this.groupDescription;
  7216. pgm.groupIcon = this.groupIcon;
  7217. pgm.groupID = this.groupID;
  7218. pgm.groupName = this.groupName;
  7219. var i = 0;
  7220. pgm.groupTags = [];
  7221. for (var __i_enFor0 = 0, __exp_enFor0 = this.groupTags, __len_enFor0 = __exp_enFor0.length;
  7222. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7223. var tag = __exp_enFor0[__i_enFor0];
  7224. pgm.groupTags[i++] = tag;
  7225. }
  7226. pgm.groupPresentationItems = [];
  7227. for (var __i_enFor1 = 0, __exp_enFor1 = this.groupPresentationItems, __len_enFor1 = __exp_enFor1.length;
  7228. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7229. var item = __exp_enFor1[__i_enFor1];
  7230. if (item.type() == "reference") {
  7231. pgm.groupPresentationItems.push(item);
  7232. } else {
  7233. pgm.groupPresentationItems.push((item).copy());
  7234. }
  7235. }
  7236. return pgm;
  7237. },
  7238. validateProperties : function(properties) {
  7239. var itemsToRemove;
  7240. for (var __i_enFor0 = 0, __exp_enFor0 = this.groupPresentationItems, __len_enFor0 = __exp_enFor0.length;
  7241. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7242. var item = __exp_enFor0[__i_enFor0];
  7243. if (item.type() == "reference") {
  7244. var p = properties.property(item.id());
  7245. if (p._hidden) {
  7246. if (!itemsToRemove) {
  7247. itemsToRemove = [];
  7248. }
  7249. itemsToRemove.push(item);
  7250. }
  7251. } else {
  7252. (item).validateProperties(properties);
  7253. }
  7254. }
  7255. if (itemsToRemove) {
  7256. for (var __i_enFor1 = 0, __exp_enFor1 = itemsToRemove, __len_enFor1 = __exp_enFor1.length;
  7257. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7258. var item = __exp_enFor1[__i_enFor1];
  7259. var index = this.groupPresentationItems.indexOf(item);
  7260. this.groupPresentationItems.splice(index, 1);
  7261. }
  7262. }
  7263. }
  7264. });
  7265. // $source: com/ibm/rave/library/property/PropertyImpl
  7266. /************************************************************************
  7267. ** IBM Confidential
  7268. **
  7269. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7270. **
  7271. ** (C) Copyright IBM Corp. 2017
  7272. **
  7273. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7274. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7275. ************************************************************************/
  7276. // GENERATED
  7277. //@import com/ibm/rave/library/Library (runtime) // logError
  7278. /**
  7279. * Property Validation Rules: id and type are required type must be one of the permitted values cardinality must be one of the permitted values
  7280. */
  7281. var com_ibm_rave_library_property_PropertyImpl = rave_library_externs["PropertyImpl"] = rave['internal']['Declare']({
  7282. //_value : null,
  7283. //_propertyType : null,
  7284. //_parent : null,
  7285. _readonly : false,
  7286. _hidden : false,
  7287. /** @expose */
  7288. constructor : function(propertyType, parent) {
  7289. this._propertyType = propertyType;
  7290. this._parent = parent;
  7291. if (propertyType.typeId() == 21) {
  7292. this._value = {};
  7293. } else {
  7294. this._value = propertyType.defaultValue();
  7295. }
  7296. },
  7297. /**
  7298. * @return (boolean) Whether the property is readonly
  7299. */
  7300. readonly : function() {
  7301. return this._readonly;
  7302. },
  7303. /**
  7304. * Make the property readonly. It cannot be made writable again.
  7305. */
  7306. setReadonly : function() {
  7307. this._readonly = true;
  7308. },
  7309. /**
  7310. * @return (boolean) Whether the property is hidden
  7311. */
  7312. /** @expose */
  7313. hidden : function() {
  7314. return this._hidden;
  7315. },
  7316. /**
  7317. * Make the property hidden. It cannot be made visible again.
  7318. */
  7319. setHidden : function() {
  7320. this._hidden = true;
  7321. },
  7322. /** @expose */
  7323. meta : function() {
  7324. return this._propertyType;
  7325. },
  7326. /** @expose */
  7327. parent : function() {
  7328. return this._parent;
  7329. },
  7330. /** @expose */
  7331. reset : function() {
  7332. if (!(this._readonly)) {
  7333. var defs = this._propertyType.defaultValue();
  7334. if (defs != null) {
  7335. this.setValue(defs);
  7336. }
  7337. }
  7338. return this._value;
  7339. },
  7340. value$0 : function() {
  7341. return this._value;
  7342. },
  7343. value$1 : function(obj) {
  7344. if (this._readonly) {
  7345. com_ibm_rave_library_Library.logError(35, "Property validate");
  7346. return false;
  7347. }
  7348. if (obj == null) {
  7349. if (this._propertyType.required()) {
  7350. if (this._propertyType.defaultValue() == null) {
  7351. com_ibm_rave_library_Library.logError(40, "Property validate");
  7352. return false;
  7353. }
  7354. if (!(this._propertyType.validateValue(this._propertyType.defaultValue()))) {
  7355. return false;
  7356. }
  7357. this.reset();
  7358. return true;
  7359. }
  7360. } else {
  7361. if (!(this._propertyType.validateValue(obj))) {
  7362. return false;
  7363. }
  7364. }
  7365. return this.setValue(obj);
  7366. },
  7367. setValue : function(obj) {
  7368. this._value = this._propertyType.canonicalValue(obj);
  7369. if (this._parent && this._parent.meta().typeId() == 21) {
  7370. var valueInstance = this._parent.value();
  7371. valueInstance[this._propertyType.simpleId()] = this._value;
  7372. }
  7373. return true;
  7374. },
  7375. /** @expose */
  7376. value : function(a0) {
  7377. var args = arguments;
  7378. if (args.length == 0) {
  7379. return this.value$0();
  7380. }
  7381. return this.value$1(a0);
  7382. }
  7383. });
  7384. // $source: com/ibm/rave/library/action/internal/ActionsManager
  7385. /************************************************************************
  7386. ** IBM Confidential
  7387. **
  7388. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7389. **
  7390. ** (C) Copyright IBM Corp. 2017
  7391. **
  7392. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7393. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7394. ************************************************************************/
  7395. // GENERATED
  7396. //@import com/ibm/rave/library/action/internal/BindingManager (runtime) // new
  7397. //@import com/ibm/rave/library/framework/meta/ActionMeta (runtime) // parse
  7398. //@import com/ibm/rave/library/action/internal/ActionImpl (runtime) // new
  7399. /**
  7400. * ActionManager handles parsing action JSON descriptors and creating corresponding instances. Action metadata is stored separately from the Action instances. Action instances can be retrieved by ID using the {@link #this.action(String)} method. <br /> Action bindings are also populated from the JSON descriptors.
  7401. */
  7402. var com_ibm_rave_library_action_internal_ActionsManager = rave['internal']['Declare']({
  7403. /**
  7404. * Map from action ID to implementation
  7405. */
  7406. //actionMap : null,
  7407. /**
  7408. * List of metadata for all defined actions
  7409. */
  7410. //_meta : null,
  7411. //bindingManager : null,
  7412. //bindingsToRemove : null,
  7413. constructor : function() {
  7414. this.actionMap = {};
  7415. this._meta = [];
  7416. this.bindingManager = new com_ibm_rave_library_action_internal_BindingManager();
  7417. this.bindingsToRemove = [];
  7418. },
  7419. /**
  7420. * Create action instances and record associated bindings for all actions defined in the provided JSON.
  7421. * @param (Array) json JSON array of Action descriptors.
  7422. */
  7423. populate$0 : function(json, messages) {
  7424. var actionList = [];
  7425. for (var i = 0; i < json.length; ++i) {
  7426. actionList.push(com_ibm_rave_library_framework_meta_ActionMeta.parse(json[i], messages));
  7427. }
  7428. this.populate$1(actionList);
  7429. },
  7430. populateFromMeta : function(info) {
  7431. this.actionMap[info.id()] = new com_ibm_rave_library_action_internal_ActionImpl(info);
  7432. if (info.defaultBindings()) {
  7433. for (var j = 0; j < info.defaultBindings().length; ++j) {
  7434. var b = info.defaultBindings()[j];
  7435. this.bindingManager.addBinding(info.id(), b.target(), b.event());
  7436. }
  7437. }
  7438. },
  7439. /**
  7440. * Populate this action manager from a list of existing ActionMeta object.
  7441. * @param (Array) actions
  7442. */
  7443. populate$1 : function(actions) {
  7444. for (var __i_enFor0 = 0, __exp_enFor0 = actions, __len_enFor0 = __exp_enFor0.length;
  7445. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7446. var action = __exp_enFor0[__i_enFor0];
  7447. this.populateFromMeta(action);
  7448. }
  7449. this._meta = [];
  7450. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.actionMap), __len_enFor1 = __exp_enFor1.length;
  7451. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7452. var key = __exp_enFor1[__i_enFor1];
  7453. this._meta.push(this.actionMap[key].meta());
  7454. }
  7455. },
  7456. /**
  7457. * <p> Configure actions from the given JSON. If it does not have a "actions" property, nothing is done. </p> <p> Otherwise, the "actions" is an array of objects describing the actions configuration, as in the schema. The array is traversed and used to mark actions enabled or disabled. An action can be invoked in the following way: {@code Rave.selectAll(".element-shape").on("click", bundle.action("highlight").actionFunction().call(Object... args)} </p>
  7458. */
  7459. configure : function(json) {
  7460. json["actions"];
  7461. },
  7462. /**
  7463. * @return (Array) List of actions metadata
  7464. */
  7465. meta : function() {
  7466. return this._meta;
  7467. },
  7468. /**
  7469. * Retrieve an Action by id.
  7470. * @param (String) id Action id (defined in Actions.json).
  7471. * @return (com.ibm.rave.library.action.internal.ActionImpl) The Action, or null if none exists for the given id.
  7472. */
  7473. action : function(id) {
  7474. return this.actionMap[id];
  7475. },
  7476. /**
  7477. * Apply all bindings to the scene nodes contained in the provided selector. For each bindings, the action is registered as the event listener on each scene node captured by the binding's target selector. <br /> This method should be called after any bindings have been removed/added, in order to reflect that change in the existing visualization.
  7478. */
  7479. applyBindings : function() {
  7480. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.actionMap), __len_enFor0 = __exp_enFor0.length;
  7481. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7482. var actionKey = __exp_enFor0[__i_enFor0];
  7483. if (this.actionMap[actionKey].autoBind$0()) {
  7484. this.actionMap[actionKey].getBinding()();
  7485. }
  7486. }
  7487. },
  7488. populate : function(a0, a1) {
  7489. var args = arguments;
  7490. if (args.length == 1) {
  7491. return this.populate$1(a0);
  7492. }
  7493. return this.populate$0(a0, a1);
  7494. }
  7495. });
  7496. // $source: com/ibm/rave/library/action/internal/BindingManager
  7497. /************************************************************************
  7498. ** IBM Confidential
  7499. **
  7500. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7501. **
  7502. ** (C) Copyright IBM Corp. 2017
  7503. **
  7504. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7505. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7506. ************************************************************************/
  7507. // GENERATED
  7508. //@import com/ibm/rave/library/action/internal/Binding (runtime) // new
  7509. /**
  7510. * BindingManager maintains the mapping between actions and their triggers within the context of the visualization. Duplicate bindings are avoided. <br /> A binding maps an action to an event originating from a particular target. A target is any CSS selector, e.g. ".element-shape". The target must be contained by the visualization container element (i.e. the <svg> node), meaning that this API cannot be used to bind actions to elements outside the visualization.
  7511. */
  7512. var com_ibm_rave_library_action_internal_BindingManager = rave['internal']['Declare']({
  7513. /**
  7514. * The binding map structure follows this form: <pre> { "action_id" : { "target_selector" : [ "event_name1", "event_name2", ... ] }, "highlight" : { ".element-shape" : [ "click", "touch" ], ".legendEntry" : [ "mouseover" ] } } </pre> In the "highlight" example, the action with id "highlight" is bound to two targets: elements with class "element-shape", and elements with class "legendEntry". The "element-shape" target is bound to "click" and "touch" events, while the "legendEntry" target is bound to "mouseover" events. Note the list of events is actually a map, to ensure there are no duplicate events for a target. The mapping value is a flattened container for the full binding: <pre> {action: action_id, target: target_selector, event: event_name1}. </pre>
  7515. */
  7516. //bindingMap : null,
  7517. constructor : function() {
  7518. this.bindingMap = rave['internal']['ES6Map'].create();
  7519. },
  7520. /**
  7521. * Create an entry that maps an action to an event on a particular target context. E.g. Bind the "highlight" action to the "click" event originating from the selection ".element-shape" (i.e. all elements with class "element-shape").
  7522. * @param (String) action Action id.
  7523. * @param (String) target Selector within context of the visualization. e.g. ".elements".
  7524. * @param (String) event SVG event name, e.g. "click".
  7525. */
  7526. addBinding : function(action, target, event) {
  7527. var actionBinding = this.bindingMap.get(action);
  7528. if (!actionBinding) {
  7529. actionBinding = rave['internal']['ES6Map'].create();
  7530. this.bindingMap.set(action, actionBinding);
  7531. }
  7532. var targetEvents = actionBinding.get(target);
  7533. if (!targetEvents) {
  7534. targetEvents = rave['internal']['ES6Map'].create();
  7535. actionBinding.set(target, targetEvents);
  7536. }
  7537. targetEvents.set(event, new com_ibm_rave_library_action_internal_Binding(action, target, event));
  7538. },
  7539. /**
  7540. * Remove a binding.
  7541. * @param (String) action Action id.
  7542. * @param (String) target Selector within context of the visualization. e.g. ".elements".
  7543. * @param (String) event SVG event name, e.g. "click".
  7544. * @return (com.ibm.rave.library.action.internal.Binding) The removed binding info, or null if the binding did not exist.
  7545. */
  7546. removeBinding : function(action, target, event) {
  7547. var existingBinding;
  7548. var actionBinding = this.bindingMap.get(action);
  7549. if (actionBinding) {
  7550. var targetEvents = actionBinding.get(target);
  7551. if (targetEvents) {
  7552. existingBinding = targetEvents.get(event);
  7553. targetEvents.remove(event);
  7554. }
  7555. }
  7556. return existingBinding;
  7557. },
  7558. /**
  7559. * @return (Array) List of <em>all</em> bindings, for all actions.
  7560. */
  7561. getBindings : function() {
  7562. var bindings = [];
  7563. for (var __i_enFor0 = 0, __exp_enFor0 = this.bindingMap.keys(), __len_enFor0 = __exp_enFor0.length;
  7564. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7565. var action = __exp_enFor0[__i_enFor0];
  7566. bindings = bindings.concat(this.getBindingsForAction(action));
  7567. }
  7568. return bindings;
  7569. },
  7570. /**
  7571. * Returns a list of all bindings associated with the provided action id.
  7572. * @param (String) action Action id.
  7573. */
  7574. getBindingsForAction : function(action) {
  7575. var bindings = [];
  7576. var targets = this.bindingMap.get(action);
  7577. if (targets) {
  7578. for (var __i_enFor0 = 0, __exp_enFor0 = targets.entries(), __len_enFor0 = __exp_enFor0.length;
  7579. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7580. var target = __exp_enFor0[__i_enFor0];
  7581. for (var __i_enFor1 = 0, __exp_enFor1 = target.value.entries(), __len_enFor1 = __exp_enFor1.length;
  7582. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7583. var event = __exp_enFor1[__i_enFor1];
  7584. bindings.push(event.value);
  7585. }
  7586. }
  7587. }
  7588. return bindings;
  7589. }
  7590. });
  7591. // $source: com/ibm/rave/library/action/internal/Binding
  7592. /************************************************************************
  7593. ** IBM Confidential
  7594. **
  7595. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7596. **
  7597. ** (C) Copyright IBM Corp. 2017
  7598. **
  7599. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7600. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7601. ************************************************************************/
  7602. // GENERATED
  7603. /**
  7604. * Container for a single binding entry. This contains all information required to add an event listener using the Rave.core API: <pre> node.select(bindingInfo.target()) .on(bindingInfo.event() + "." + bindingInfo.action(), actionCallback); </pre>
  7605. */
  7606. var com_ibm_rave_library_action_internal_Binding = rave['internal']['Declare']({
  7607. //_action : null, //_target : null, //_event : null,
  7608. constructor : function(action, target, event) {
  7609. this._action = action;
  7610. this._target = target;
  7611. this._event = event;
  7612. },
  7613. /**
  7614. * Action id.
  7615. */
  7616. action : function() {
  7617. return this._action;
  7618. },
  7619. /**
  7620. * Target selector string (e.g. ".element-shape").
  7621. */
  7622. target : function() {
  7623. return this._target;
  7624. },
  7625. /**
  7626. * Event name which triggers the action.
  7627. */
  7628. event : function() {
  7629. return this._event;
  7630. }
  7631. });
  7632. // $source: com/ibm/rave/library/action/Action
  7633. /************************************************************************
  7634. ** IBM Confidential
  7635. **
  7636. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7637. **
  7638. ** (C) Copyright IBM Corp. 2017
  7639. **
  7640. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7641. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7642. ************************************************************************/
  7643. // GENERATED
  7644. /**
  7645. * An Action executes a particular function within a bundle visualization. An action can be bound to an event using the Rave 2 event syntax, e.g: <br /><br /> {@code rave.selectAll(".element-shape").on("click", bundle.action("highlight")([args])} <br /><br /> where ".element-shape" references an element class defined by the bundle, "click" is the DOM event type, and bundle.action("highlight") retrieves the "highlight" action that is defined in the bundle.
  7646. */
  7647. var com_ibm_rave_library_action_Action = rave_library_externs["Action"] = rave['internal']['Declare']({
  7648. /**
  7649. * Sets whether automatic binding should be set within the action
  7650. * @param (boolean) bind true to automatically bind action, false to not automatically bind action.
  7651. */
  7652. /** @expose */
  7653. autoBind : function(bind) {},
  7654. /**
  7655. * Overrides the default operation attached to the action
  7656. * @param (com.ibm.rave.library.action.ActionOperation) operation new action operation
  7657. * @return (com.ibm.rave.library.action.Action) this
  7658. */
  7659. /** @expose */
  7660. setOperation : function(operation) {},
  7661. /**
  7662. * @see ActionOperation#this.get(String) Delegates to the actionOperation's get method.
  7663. */
  7664. /** @expose */
  7665. get : function(id) {}
  7666. });
  7667. // $source: com/ibm/rave/library/framework/internal/ContextSize
  7668. /************************************************************************
  7669. ** IBM Confidential
  7670. **
  7671. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7672. **
  7673. ** (C) Copyright IBM Corp. 2017
  7674. **
  7675. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7676. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7677. ************************************************************************/
  7678. // GENERATED
  7679. var com_ibm_rave_library_framework_internal_ContextSize = function(){};
  7680. // $source: com/ibm/rave/library/framework/internal/CustomFormatInfoImpl
  7681. /************************************************************************
  7682. ** IBM Confidential
  7683. **
  7684. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7685. **
  7686. ** (C) Copyright IBM Corp. 2017
  7687. **
  7688. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7689. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7690. ************************************************************************/
  7691. // GENERATED
  7692. /**
  7693. * Internal implementing class for {@link (com.ibm.rave.library.framework.CustomFormatInfo) CustomFormatInfo} .
  7694. */
  7695. var com_ibm_rave_library_framework_internal_CustomFormatInfoImpl = rave['internal']['Declare']({
  7696. /**
  7697. * The type
  7698. */
  7699. //_type : null,
  7700. /**
  7701. * The role
  7702. */
  7703. //_role : null,
  7704. /**
  7705. * The format
  7706. */
  7707. //_format : null,
  7708. /**
  7709. * The array of entries
  7710. */
  7711. //_entries : null,
  7712. /**
  7713. * Constructor. The string arguments are not checked for validity, and all should be non-null. The strings should be allowed values as defined in CustomFormatInfo. If the list is null an empty list is used instead.
  7714. * @param (String) type CustomFormatInfo type
  7715. * @param (String) role CustomFormatInfo role
  7716. * @param (String) format CustomFormatInfo format hint
  7717. * @param (Array) entries Data slot entries associated with the data to be formatted
  7718. */
  7719. constructor : function(type, role, format, entries) {
  7720. this._type = type;
  7721. this._role = role;
  7722. this._format = format;
  7723. this._entries = entries ? entries : [];
  7724. },
  7725. /** @expose */
  7726. type : function() {
  7727. return this._type;
  7728. },
  7729. /** @expose */
  7730. role : function() {
  7731. return this._role;
  7732. },
  7733. /** @expose */
  7734. format : function() {
  7735. return this._format;
  7736. },
  7737. /** @expose */
  7738. entries : function() {
  7739. return this._entries;
  7740. }
  7741. });
  7742. /**
  7743. * Utility to construct a formatter for a single data slot entry, the common case. The string arguments are not checked for validity, and all should be non-null. A list of entries is created and if the entry is non-null, it is added.
  7744. * @param (String) type CustomFormatInfo type
  7745. * @param (String) role CustomFormatInfo role
  7746. * @param (String) format CustomFormatInfo format hint
  7747. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry The single slot entry associated with the data to be formatted
  7748. * @return (com.ibm.rave.library.framework.CustomFormatInfo) CustomFormatInfo with that information
  7749. */
  7750. com_ibm_rave_library_framework_internal_CustomFormatInfoImpl.makeForEntry = function(type, role, format, entry) {
  7751. var entries = [];
  7752. if (entry) {
  7753. entries.push(entry);
  7754. }
  7755. return new com_ibm_rave_library_framework_internal_CustomFormatInfoImpl(type, role, format, entries);
  7756. };
  7757. // $source: com/ibm/rave/library/framework/internal/CSSConverter
  7758. /************************************************************************
  7759. ** IBM Confidential
  7760. **
  7761. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7762. **
  7763. ** (C) Copyright IBM Corp. 2017
  7764. **
  7765. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7766. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7767. ************************************************************************/
  7768. // GENERATED
  7769. /**
  7770. * Utilities to convert CSS size to pixels, or to a formatted "px" string.
  7771. */
  7772. var com_ibm_rave_library_framework_internal_CSSConverter = rave['internal']['Declare']({
  7773. });
  7774. /**
  7775. * Convert a value representing a CSSSize to a length in pixels. "%" depends on the extent, and "em" on the font height. Returns null for null or unparsable string.
  7776. * @param (Object) value The value, may be null, number, or string
  7777. * @param (double) extent Used for "%", the length in pixels for 100%
  7778. * @param (double) em Used for "em", the length in pixels for 1em
  7779. * @return (Number) Size as string ending with "px", or null
  7780. */
  7781. com_ibm_rave_library_framework_internal_CSSConverter.convertCSSSizeToPixelNumber = function(value, extent, em) {
  7782. if (value == null) {
  7783. return null;
  7784. }
  7785. var s = ""+(value);
  7786. var l = s.length;
  7787. if (l == 0) {
  7788. return null;
  7789. }
  7790. var number = s;
  7791. var found = false;
  7792. var multiplier = 1.0;
  7793. if (l > 2) {
  7794. number = s.substring(0, l - 2);
  7795. var u = s.substring(l - 2).toLowerCase();
  7796. if ("px" == u) {
  7797. found = true;
  7798. multiplier = 1.0;
  7799. } else if ("in" == u) {
  7800. found = true;
  7801. multiplier = 96.0;
  7802. } else if ("pt" == u) {
  7803. found = true;
  7804. multiplier = 96.0 / 72.0;
  7805. } else if ("pc" == u) {
  7806. found = true;
  7807. multiplier = 96.0 / 6.0;
  7808. } else if ("em" == u) {
  7809. found = true;
  7810. multiplier = em;
  7811. } else if ("cm" == u) {
  7812. found = true;
  7813. multiplier = 96.0 / 2.54;
  7814. } else if ("mm" == u) {
  7815. found = true;
  7816. multiplier = 96.0 / 25.4;
  7817. }
  7818. }
  7819. if (!found) {
  7820. if (l > 1 && "%" == s.substring(l - 1)) {
  7821. number = s.substring(0, l - 1);
  7822. multiplier = extent / 100.0;
  7823. } else {
  7824. number = s;
  7825. multiplier = 1.0;
  7826. }
  7827. }
  7828. var v = + (number);
  7829. if (isNaN(v)) {
  7830. return null;
  7831. }
  7832. return v * multiplier;
  7833. };
  7834. /**
  7835. * Convert a value representing a CSSSize to a string for the size with "px" units. For example, "0.5in" will become "48px". The number part is rounded to two digits. Returns null for null or an unparsable string.
  7836. * @param (Object) value The value, may be null, number, or string
  7837. * @param (double) extent Used for "%", the length in pixels for 100%
  7838. * @param (double) em Used for "em", the length in pixels for 1em
  7839. * @return (String) Size as string ending with "px", or null
  7840. */
  7841. com_ibm_rave_library_framework_internal_CSSConverter.convertCSSSizeToPixel = function(value, extent, em) {
  7842. var v = com_ibm_rave_library_framework_internal_CSSConverter.convertCSSSizeToPixelNumber(value, extent, em);
  7843. if (v == null) {
  7844. return null;
  7845. }
  7846. return ""+((Math.round(100 * v) / 100.0)) + "px";
  7847. };
  7848. // $source: com/ibm/rave/library/framework/meta/internal/PropertyPresentationManager
  7849. /************************************************************************
  7850. ** IBM Confidential
  7851. **
  7852. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7853. **
  7854. ** (C) Copyright IBM Corp. 2017
  7855. **
  7856. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7857. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7858. ************************************************************************/
  7859. // GENERATED
  7860. //@import com/ibm/rave/library/framework/meta/internal/PropertyPresentationMetaImpl (runtime) // new
  7861. /**
  7862. * Placeholder implementation for property presentation manager. Presentations are represented by PropertyPresentationMetaImpl
  7863. */
  7864. var com_ibm_rave_library_framework_meta_internal_PropertyPresentationManager = rave['internal']['Declare']({
  7865. /**
  7866. * Map from ID to presentation, with all defined property presentations
  7867. */
  7868. //_presentations : null,
  7869. /**
  7870. * Hidden presentation IDs
  7871. */
  7872. //_hiddenPresentations : null,
  7873. /**
  7874. * List of visible presentations, null when it must be created.
  7875. */
  7876. //_visiblePresentations : null,
  7877. /**
  7878. * Localization messages registry
  7879. */
  7880. //_messagesRegistry : null,
  7881. /**
  7882. * Construct. No presentations are defined.
  7883. */
  7884. constructor : function(registry) {
  7885. this._presentations = {};
  7886. this._hiddenPresentations = {};
  7887. this._visiblePresentations = null;
  7888. this._messagesRegistry = registry;
  7889. },
  7890. /**
  7891. * <p> Populate presentations from the given JSON, which may define presentations. If it does not have a "propertyPresentations" property, nothing is done. </p> <p> Otherwise, the "propertyPresentations" property is taken as an array of objects describing presentations. If the object "id" is already defined, it is skipped (no overwrite of existing presentations). Otherwise a new presentation for the object is created and added to the collection. </p>
  7892. * @param (Object) json JSON descriptor
  7893. */
  7894. populate : function(json) {
  7895. var v = json["propertyPresentations"];
  7896. if (v != null) {
  7897. var ppMeta = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl(this._messagesRegistry);
  7898. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  7899. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7900. var o = __exp_enFor0[__i_enFor0];
  7901. var pp = o;
  7902. var id = (pp["id"]);
  7903. if (id != null && !(this._presentations.hasOwnProperty(id))) {
  7904. this._presentations[id] = ppMeta.parse(pp);
  7905. }
  7906. }
  7907. this._visiblePresentations = null;
  7908. }
  7909. },
  7910. /**
  7911. * Configure presentations from the given JSON. If it does not have a "propertyPresentations" property, nothing is done. Otherwise the the "propertyPresentations" property is taken as an array of of objects configuring presentations, with an "id" and "hidden" fields. Any ids with "hidden":true are hidden.
  7912. * @param (Object) json JSON descriptor
  7913. */
  7914. configure : function(json) {
  7915. var v = json["propertyPresentations"];
  7916. if (v != null) {
  7917. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  7918. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7919. var o = __exp_enFor0[__i_enFor0];
  7920. var pp = o;
  7921. var id = (pp["id"]);
  7922. var hidden = (pp["hidden"] != null) ? (pp["hidden"]) : null;
  7923. if (id != null && hidden != null && hidden) {
  7924. this._hiddenPresentations[id] = 1;
  7925. }
  7926. }
  7927. this._visiblePresentations = null;
  7928. }
  7929. },
  7930. /**
  7931. * @return (Array) Metadata for visible property presentations.
  7932. */
  7933. meta : function() {
  7934. if (!this._visiblePresentations) {
  7935. this._visiblePresentations = [];
  7936. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._presentations), __len_enFor0 = __exp_enFor0.length;
  7937. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7938. var id = __exp_enFor0[__i_enFor0];
  7939. if (!(this._hiddenPresentations.hasOwnProperty(id))) {
  7940. this._visiblePresentations.push(this._presentations[id]);
  7941. }
  7942. }
  7943. }
  7944. return this._visiblePresentations;
  7945. },
  7946. /**
  7947. * Add a new presentation meta object by ID to this manager. Will override any existing meta object with this ID.
  7948. * @param (com.ibm.rave.library.framework.meta.internal.PropertyPresentationMetaImpl) presentation Presentation meta object.
  7949. */
  7950. put : function(presentation) {
  7951. this._presentations[presentation.id()] = presentation;
  7952. this._visiblePresentations = null;
  7953. }
  7954. });
  7955. // $source: com/ibm/rave/library/framework/internal/HierarchyUtility
  7956. /************************************************************************
  7957. ** IBM Confidential
  7958. **
  7959. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7960. **
  7961. ** (C) Copyright IBM Corp. 2017
  7962. **
  7963. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7964. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7965. ************************************************************************/
  7966. // GENERATED
  7967. /**
  7968. * <p> Converts data in either of two forms to a tree of T nodes, where T is a subclass of HierarchyNode (ClusterNode, TreemapNode, etc.). The class instance is constructed with a factory that creates new instances of the T subclass. </p> <p> The buildHierarchy method traverses a tree of arbitrary Object nodes and builds a matching tree of T nodes. It is provided with two accessors, both applied to the arbitrary Object nodes. The children accessor is used to traverse the tree, and the value accessor is used to set the HierarchyNode value. </p> <p> The buildTabular method uses an array of arbitrary Object nodes and builds a two-level tree of T nodes. All objects in the array become children of the tree's root. The value accessor is used to set the HierarchyNode value. </p> <p> The result object has the T tree, the original Object tree, a flattened array-list of the T nodes, two flattened lists of the original Object nodes, and the range of values. The array-lists may be used by methods that need to scan all the nodes, for example to build a domain from data values. The tree depth and parent fields are set correctly. </p>
  7969. */
  7970. var com_ibm_rave_library_framework_internal_HierarchyUtility = rave['internal']['Declare']({
  7971. /**
  7972. * The factory passed to the constructor
  7973. */
  7974. //_factory : null,
  7975. constructor : function(factory) {
  7976. this._factory = factory;
  7977. },
  7978. /**
  7979. * <p> Construct a HierarchyNode tree from the given Object tree. If the original root is null, a null tree is returned (the HierarchyNode root is null, all node lists are empty, and the min and max range values are both 1). Otherwise the returned HierarchyNode tree duplicates the structure of the Object tree. </p> <p> The childrenAccessor function is applied to an Object in the tree and returns an array-list of Object (it is simpler in the bundle framework to declare it as returning an Object). It may return null if the object has no children. This is used to traverse the Object tree. If it is null, the returned tree will have only the root node. </p> <p> The valueAccessor function is optional. If provided, it is applied to an Object in the tree and returns a Number (again it is simpler to declare it as returning Object), which is used as the HierarchyNode's value. If the accessor returns null or is null, the node's value is set to the defaultValue. </p> <p> The HierarchyNode data is set to the original node Object, and the parent and depth fields are set correctly. </p>
  7980. * @param (Object) originalRoot Original root; if null, a null tree is returned
  7981. * @param (rave['internal']['SingleValueFunction']) childrenAccessor Children accessor; if null, the returned tree has only the root
  7982. * @param (rave['internal']['SingleValueFunction']) valueAccessor Optional value accessor
  7983. * @param (double) defaultValue Default value if accessor returns null, or if there is no accessor
  7984. * @return (com.ibm.rave.library.framework.internal.HierarchyUtility.HUResult) HUResult with the tree
  7985. */
  7986. buildHierarchy : function(originalRoot, childrenAccessor, valueAccessor, defaultValue) {
  7987. var result = new com_ibm_rave_library_framework_internal_HierarchyUtility.HUResult();
  7988. if (originalRoot == null) {
  7989. result._minValue = 1.0;
  7990. result._maxValue = 1.0;
  7991. return result;
  7992. }
  7993. var vf = this.valueFunction(valueAccessor, defaultValue);
  7994. result._root = this.make(result, originalRoot, vf, null);
  7995. if (!childrenAccessor) {
  7996. result._originalLeaves.push(originalRoot);
  7997. return result;
  7998. }
  7999. this.processTree(result, result._root, childrenAccessor, vf);
  8000. return result;
  8001. },
  8002. /**
  8003. * Process a node to add its children to the tree, recursively processing each of those nodes. All arguments are non-null. The node may or may not have children. It has already been added to the result, but not to the leaf list in the result; it is added to that list only if it has no non-null children.
  8004. * @param (com.ibm.rave.library.framework.internal.HierarchyUtility.HUResult) result Result being built
  8005. * @param (Object) node The HierarchyNode being processed; its data is the Object from the original tree
  8006. * @param (rave['internal']['SingleValueFunction']) childrenAccessor Non-null children accessor
  8007. * @param (rave['internal']['SingleValueFunction']) valueAccessor Non-null value accessor
  8008. */
  8009. processTree : function(result, node, childrenAccessor, valueAccessor) {
  8010. var oChildren = childrenAccessor(node["data"]);
  8011. if (oChildren) {
  8012. var children = [];
  8013. for (var __i_enFor0 = 0, __exp_enFor0 = oChildren, __len_enFor0 = __exp_enFor0.length;
  8014. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8015. var oChild = __exp_enFor0[__i_enFor0];
  8016. if (oChild != null) {
  8017. var child = this.make(result, oChild, valueAccessor, node);
  8018. children.push(child);
  8019. this.processTree(result, child, childrenAccessor, valueAccessor);
  8020. }
  8021. }
  8022. if (children.length != 0) {
  8023. node["children"] = children;
  8024. }
  8025. }
  8026. if (!node["children"]) {
  8027. result._originalLeaves.push(node["data"]);
  8028. }
  8029. },
  8030. /**
  8031. * <p> Construct a HierarchyNode tree from the given array-list of objects. If the array-list is null or empty, a null tree is returned (the HierarchyNode root is null, all node lists are empty, and the min and max range values are both 1). Otherwise the returned HierarchyNode tree is a single root node, with one child per non-null array entry. </p> <p> The valueAccessor function is optional. If provided, it is applied to an Object in the tree and returns a Number (again it is simpler to declare it as returning Object), which is used as the HierarchyNode's value. If the accessor returns null or is null, the node's value is set to the defaultValue. </p> <p> The HierarchyNode data is set to the original node Object, and the parent and depth fields are set correctly. The root has no data. </p>
  8032. * @param (Array) objects Array-lis tof objects
  8033. * @param (rave['internal']['SingleValueFunction']) valueAccessor Optional value accessor
  8034. * @param (double) defaultValue Default value if accessor returns null, or if there is no accessor
  8035. * @return (com.ibm.rave.library.framework.internal.HierarchyUtility.HUResult) HUResult with the tree
  8036. */
  8037. buildTabular : function(objects, valueAccessor, defaultValue) {
  8038. var result = new com_ibm_rave_library_framework_internal_HierarchyUtility.HUResult();
  8039. if (!objects || objects.length == 0) {
  8040. result._minValue = 1.0;
  8041. result._maxValue = 1.0;
  8042. return result;
  8043. }
  8044. var vf = this.valueFunction(valueAccessor, defaultValue);
  8045. var root = this._factory();
  8046. result._root = root;
  8047. root["data"] = null;
  8048. root["value"] = defaultValue;
  8049. root["parent"] = null;
  8050. root["depth"] = 0;
  8051. var children = [];
  8052. root["children"] = children;
  8053. for (var __i_enFor0 = 0, __exp_enFor0 = objects, __len_enFor0 = __exp_enFor0.length;
  8054. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8055. var oChild = __exp_enFor0[__i_enFor0];
  8056. if (oChild != null) {
  8057. var child = this.make(result, oChild, vf, root);
  8058. children.push(child);
  8059. result._originalLeaves.push(oChild);
  8060. }
  8061. }
  8062. return result;
  8063. },
  8064. /**
  8065. * Make a tree node for the given original node which must be non-null. The tree node's data is the object o, its value is the result of applying vf to o (the vf is one that does not return null), its parent is the given parent node, and its depth is the parent's depth plus 1 (0 if the parent is null). The node and original node are added to the lists in the result and the value range is updated.
  8066. * @param (com.ibm.rave.library.framework.internal.HierarchyUtility.HUResult) result Result being build
  8067. * @param (Object) o Original tree object
  8068. * @param (rave['internal']['SingleValueFunction']) vf Value function
  8069. * @param (Object) parent Parent node
  8070. * @return (Object) Tree node for the object
  8071. */
  8072. make : function(result, o, vf, parent) {
  8073. var node = this._factory();
  8074. node["data"] = o;
  8075. node["value"] = + (vf(o));
  8076. node["parent"] = parent;
  8077. node["depth"] = parent ? parent["depth"] + 1 : 0;
  8078. node["children"] = null;
  8079. result._nodes.push(node);
  8080. result._originalNodes.push(o);
  8081. result._minValue = Math.min(result._minValue, node["value"]);
  8082. result._maxValue = Math.max(result._maxValue, node["value"]);
  8083. return node;
  8084. },
  8085. /**
  8086. * Returns an value function to set the values of tree nodes. If the value accessor is non-null, the function returns the accessor applied to the tree datum, returning defaultValue if the accessor returns null. If the value accessor is null, the function always returns defaultValue.
  8087. * @param (rave['internal']['SingleValueFunction']) valueAccessor The value accessor to apply to the Object nodes
  8088. * @param (double) defaultValue Default value to use
  8089. * @return (rave['internal']['SingleValueFunction']) Non-null value function
  8090. */
  8091. valueFunction : function(valueAccessor, defaultValue) {
  8092. if (valueAccessor) {
  8093. return function(o) {
  8094. var v = + (valueAccessor(o));
  8095. return v != null ? v : defaultValue;
  8096. };
  8097. }
  8098. return function(o) {
  8099. return defaultValue;
  8100. };
  8101. }
  8102. });
  8103. /**
  8104. * Factory class to create a new instance of the HierarchyNode subclass.
  8105. */
  8106. com_ibm_rave_library_framework_internal_HierarchyUtility.HUFactory = rave['internal']['Declare']({
  8107. });
  8108. /**
  8109. * Result of calling build.
  8110. */
  8111. com_ibm_rave_library_framework_internal_HierarchyUtility.HUResult = rave['internal']['Declare']({
  8112. /**
  8113. * The tree of HierarchyNodes
  8114. */
  8115. //_root : null,
  8116. /**
  8117. * Array-list of all HierarchyNode in the tree
  8118. */
  8119. //_nodes : null,
  8120. /**
  8121. * Array-list of all Object nodes in the original tree or array
  8122. */
  8123. //_originalNodes : null,
  8124. /**
  8125. * Array-list of leaf Object nodes in the original tree
  8126. */
  8127. //_originalLeaves : null,
  8128. /**
  8129. * Minimum value assigned to any tree node
  8130. */
  8131. _minValue : 0,
  8132. /**
  8133. * Maximum value assigned to any tree node
  8134. */
  8135. _maxValue : 0,
  8136. /**
  8137. * Construct an instance. The hierarchy root is null, all lists are empty, and the range min/max are positive and negative infinity respectively.
  8138. */
  8139. constructor : function() {
  8140. this._root = null;
  8141. this._nodes = [];
  8142. this._originalNodes = [];
  8143. this._originalLeaves = [];
  8144. this._minValue = Infinity;
  8145. this._maxValue = -Infinity;
  8146. }
  8147. });
  8148. // $source: com/ibm/rave/library/framework/CustomFormatter
  8149. /************************************************************************
  8150. ** IBM Confidential
  8151. **
  8152. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8153. **
  8154. ** (C) Copyright IBM Corp. 2017
  8155. **
  8156. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8157. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8158. ************************************************************************/
  8159. // GENERATED
  8160. /**
  8161. * <p> API for custom formatting functions. Formatting functions are used for the text items in a chart, generically called "labels". A label starts with a data value which may be numeric, string, or date, and must be converted into a string for use in the text item. The RAVE core has code to do this conversion. Integrators may define their own custom formatters to change the formatting behavior. </p> <p> Integrators implement this interface and register an instance using {@link this.Controller#this.setCustomFormatter(String, com_ibm_rave_library_framework_CustomFormatter)} . Java example: </p> <pre> chart.setCustomFormatter(CustomFormatterFunction.ALL, new CustomFormatterFunction() { public String getValue(Object context, Object value, int index, int group, CustomFormatInfo info) { // convert value to a string and return it } }); </pre> <p> In JavaScript the interface translates to a function which is invoked with the Java <code>context</code> argument as the <code>this</code> reference, and the other four Java arguments as function arguments. Example: </p> <pre> chart.setCustomFormatter("all", function(value, index, group, info) { // convert value to a string and return it }); </pre> <h3>Targets</h3> <p> The target strings are defined in this class. A custom formatter function may be registered for each possible target. At runtime, the chart searches the registered custom formatters to find the one which is to be used, given the context in which the formatted value is used. If no registered formatter applies, the default RAVE core formatter is used for the value. </p> <p> The targets are searched as follows. In each case the first non-null registered formatter found is used. </p> <dl> <dt>Element label</dt> <dd> {@link #"label"} , {@link #"all"} </dd> <dt>Axis title or axis tick label</dt> <dd> The axis has a logical <I>role</I> in the chart; it is the first X (independent) axis, or the first Y (dependent axis), etc. It also has a physical <I>position</I> in the chart; it is on the bottom, the left, etc. The search order is the role, the position, {@link #"axis"} , and finally {@link #"all"} . For example in a non-transposed scatterplot, the first X axis is on the bottom, so the search order is {@link #"ROLE_X1"} , {@link #"bottom"} , {@link #"axis"} , {@link #"all"} . </dd> <dt>Legend title or legend label</dt> <dd> {@link #"legend"} , {@link #"all"} </dd> </dl>
  8162. */
  8163. var com_ibm_rave_library_framework_CustomFormatter = rave_library_externs["CustomFormatter"] = rave['internal']['Declare']({
  8164. });
  8165. /**
  8166. * Target: The first X (independent) axis.
  8167. */
  8168. /** @expose */
  8169. com_ibm_rave_library_framework_CustomFormatter.X1_AXIS = "ROLE_X1";
  8170. /**
  8171. * Target: The first Y (dependent) axis.
  8172. */
  8173. /** @expose */
  8174. com_ibm_rave_library_framework_CustomFormatter.Y1_AXIS = "ROLE_Y1";
  8175. /**
  8176. * Target: The second X (independent) axis. (Not currently used in any RAVE bundles.)
  8177. */
  8178. /** @expose */
  8179. com_ibm_rave_library_framework_CustomFormatter.X2_AXIS = "ROLE_X2";
  8180. /**
  8181. * Target: The secon Y (dependent) axis. (Used in the composite bundle.)
  8182. */
  8183. /** @expose */
  8184. com_ibm_rave_library_framework_CustomFormatter.Y2_AXIS = "ROLE_Y2";
  8185. /**
  8186. * Target: The axis at the bottom of the chart.
  8187. */
  8188. /** @expose */
  8189. com_ibm_rave_library_framework_CustomFormatter.BOTTOM_AXIS = "bottom";
  8190. /**
  8191. * Target: The axis at the top of the chart.
  8192. */
  8193. /** @expose */
  8194. com_ibm_rave_library_framework_CustomFormatter.TOP_AXIS = "top";
  8195. /**
  8196. * Target: The axis at the left of the chart.
  8197. */
  8198. /** @expose */
  8199. com_ibm_rave_library_framework_CustomFormatter.LEFT_AXIS = "left";
  8200. /**
  8201. * Target: The axis at the right of the chart.
  8202. */
  8203. /** @expose */
  8204. com_ibm_rave_library_framework_CustomFormatter.RIGHT_AXIS = "right";
  8205. /**
  8206. * Target: All axes.
  8207. */
  8208. /** @expose */
  8209. com_ibm_rave_library_framework_CustomFormatter.AXIS = "axis";
  8210. /**
  8211. * Target: An element label.
  8212. */
  8213. /** @expose */
  8214. com_ibm_rave_library_framework_CustomFormatter.LABEL = "label";
  8215. /**
  8216. * Target: A legend label.
  8217. */
  8218. /** @expose */
  8219. com_ibm_rave_library_framework_CustomFormatter.LEGEND = "legend";
  8220. /**
  8221. * Target: All labels.
  8222. */
  8223. /** @expose */
  8224. com_ibm_rave_library_framework_CustomFormatter.ALL = "all";
  8225. // $source: com/ibm/rave/library/bundleData/ChordBundleChordDatum
  8226. /************************************************************************
  8227. ** IBM Confidential
  8228. **
  8229. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8230. **
  8231. ** (C) Copyright IBM Corp. 2017
  8232. **
  8233. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8234. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8235. ************************************************************************/
  8236. // GENERATED
  8237. /**
  8238. * Datum object representing a chord
  8239. */
  8240. var com_ibm_rave_library_bundleData_ChordBundleChordDatum = rave_library_externs["ChordBundleChordDatum"] = rave['internal']['Declare']({
  8241. //_chordData : null,
  8242. //_chordOriginalData : null,
  8243. /** @expose */
  8244. originalData : function() {
  8245. return this._chordOriginalData;
  8246. },
  8247. /** @expose */
  8248. originalDataList : function() {
  8249. var list = [];
  8250. list.push(this._chordOriginalData);
  8251. return list;
  8252. },
  8253. /**
  8254. * Set chord original data
  8255. */
  8256. /** @expose */
  8257. setChordOriginalData : function(originalData) {
  8258. this._chordOriginalData = originalData;
  8259. },
  8260. /**
  8261. * Set the ChordData for this datum object
  8262. */
  8263. /** @expose */
  8264. setChordData : function(chordData) {
  8265. this._chordData = chordData;
  8266. },
  8267. /**
  8268. * Get the ChordData from this datum object
  8269. */
  8270. /** @expose */
  8271. getChordData : function() {
  8272. return this._chordData;
  8273. }
  8274. });
  8275. // $source: com/ibm/rave/library/framework/BundleConfigPropertyIDs
  8276. /************************************************************************
  8277. ** IBM Confidential
  8278. **
  8279. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8280. **
  8281. ** (C) Copyright IBM Corp. 2017
  8282. **
  8283. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8284. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8285. ************************************************************************/
  8286. // GENERATED
  8287. /**
  8288. * Constant strings for the common property IDs defined in the object passed in to {@link this.Bundle#this.configure(Object, com_ibm_rave_library_framework_Controller.Callback)} The code uses these strings, so this file must be kept in sync with the JSON files declaring the properties. The convention used here is that the string constant name is the property ID in all-caps, with "_" between words
  8289. */
  8290. var com_ibm_rave_library_framework_BundleConfigPropertyIDs = rave_library_externs["BundleConfigPropertyIDs"] = rave['internal']['Declare']({
  8291. });
  8292. /**
  8293. * They mapbox access token used for accessing styles on the account
  8294. */
  8295. /** @expose */
  8296. com_ibm_rave_library_framework_BundleConfigPropertyIDs.MAPBOX_SECRET_TOKEN = "Mapbox.secretToken";
  8297. /**
  8298. * The Mapbox account token used for rendering mapbox
  8299. */
  8300. /** @expose */
  8301. com_ibm_rave_library_framework_BundleConfigPropertyIDs.MAPBOX_TOKEN = "Mapbox.token";
  8302. /**
  8303. * The Mapbox account name used
  8304. */
  8305. /** @expose */
  8306. com_ibm_rave_library_framework_BundleConfigPropertyIDs.MAPBOX_ACCOUNT_NAME = "Mapbox.accountName";
  8307. // $source: com/ibm/rave/library/action/SelectionManager
  8308. /************************************************************************
  8309. ** IBM Confidential
  8310. **
  8311. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8312. **
  8313. ** (C) Copyright IBM Corp. 2017
  8314. **
  8315. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8316. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8317. ************************************************************************/
  8318. // GENERATED
  8319. /**
  8320. * TODO: DOCS! Note: It is up to the client of this class to ensure that any selection passed to highlight/select/etc. contains scene nodes that are members of the provided context. If they are not, then this manager will not detect changes to "selected" or "deemphasized" states.
  8321. */
  8322. var com_ibm_rave_library_action_SelectionManager = rave_library_externs["SelectionManager"] = rave['internal']['Declare']({
  8323. //_context : null,
  8324. //_stateChangeCallback : null,
  8325. constructor : function() {
  8326. this._context = rave.selection();
  8327. this._stateChangeCallback = function(args) {
  8328. if (args !== null || arguments.length > 1){
  8329. args = Array.prototype.slice.call(arguments, 0);
  8330. }
  8331. {
  8332. return null;
  8333. }
  8334. };
  8335. {}
  8336. },
  8337. /**
  8338. * Set the selection of scene nodes which can be "highlighted" or "selected". If a scene changes (i.e. the set of highlightable/selectable nodes), and scene nodes are added/removed, then the context must be updated. Otherwise this selection manager will be using a stale selection of nodes which may or may not still exist in the scene.
  8339. * @param (rave['internal']['Selection']) context Selection of scene nodes that can be highlighted/selected.
  8340. */
  8341. /** @expose */
  8342. updateContext : function(context) {
  8343. this._context = context;
  8344. var selected = com_ibm_rave_library_action_SelectionManager.filterSelected(this._context, true);
  8345. if (selected.empty()) {
  8346. this._context.each(com_ibm_rave_library_action_SelectionManager.REMOVE_DEEMPHASIZED_STATE);
  8347. } else {
  8348. com_ibm_rave_library_action_SelectionManager.filterSelected(this._context, false).each(com_ibm_rave_library_action_SelectionManager.APPLY_DEEMPHASIZED_STATE);
  8349. }
  8350. this.stateChanged();
  8351. return this;
  8352. },
  8353. /** @expose */
  8354. onStateChange : function(callback) {
  8355. this._stateChangeCallback = callback;
  8356. return this;
  8357. },
  8358. /** @expose */
  8359. highlight : function(selection) {
  8360. selection.each(com_ibm_rave_library_action_SelectionManager.APPLY_HIGHLIGHTED_STATE);
  8361. this.stateChanged();
  8362. },
  8363. /** @expose */
  8364. unHighlight : function(selection) {
  8365. selection.each(com_ibm_rave_library_action_SelectionManager.REMOVE_HIGHLIGHTED_STATE);
  8366. this.stateChanged();
  8367. },
  8368. /** @expose */
  8369. toggleHighlight : function(selection) {
  8370. var self = this;
  8371. selection.each(function(data, index, groupIndex) {
  8372. var ctx = rave.select(this);
  8373. if ((ctx.property(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG))) {
  8374. self.unHighlight(selection);
  8375. } else {
  8376. self.highlight(selection);
  8377. }
  8378. });
  8379. this.stateChanged();
  8380. },
  8381. /** @expose */
  8382. select : function(selection) {
  8383. var unSelected = com_ibm_rave_library_action_SelectionManager.filterSelected(this._context, false);
  8384. unSelected.each(com_ibm_rave_library_action_SelectionManager.APPLY_DEEMPHASIZED_STATE);
  8385. selection.each(com_ibm_rave_library_action_SelectionManager.APPLY_SELECTED_STATE).each(com_ibm_rave_library_action_SelectionManager.REMOVE_DEEMPHASIZED_STATE);
  8386. this.stateChanged();
  8387. },
  8388. /** @expose */
  8389. deSelect : function(selection) {
  8390. selection.each(com_ibm_rave_library_action_SelectionManager.REMOVE_SELECTED_STATE);
  8391. var selected = com_ibm_rave_library_action_SelectionManager.filterSelected(this._context, true);
  8392. if (selected.empty()) {
  8393. this._context.each(com_ibm_rave_library_action_SelectionManager.REMOVE_DEEMPHASIZED_STATE);
  8394. } else {
  8395. selection.each(com_ibm_rave_library_action_SelectionManager.APPLY_DEEMPHASIZED_STATE);
  8396. }
  8397. this.stateChanged();
  8398. },
  8399. /** @expose */
  8400. toggleSelect : function(selection) {
  8401. var self = this;
  8402. selection.each(function(data, index, groupIndex) {
  8403. if ((rave.select(this).property("selected"))) {
  8404. self.deSelect(selection);
  8405. } else {
  8406. self.select(selection);
  8407. }
  8408. });
  8409. this.stateChanged();
  8410. },
  8411. /** @expose */
  8412. getHighlighted : function() {
  8413. return com_ibm_rave_library_action_SelectionManager.filterHighlighted(this._context, true);
  8414. },
  8415. /** @expose */
  8416. getSelected : function() {
  8417. return com_ibm_rave_library_action_SelectionManager.filterSelected(this._context, true);
  8418. },
  8419. stateChanged : function() {
  8420. this._context.call(this._stateChangeCallback);
  8421. }
  8422. });
  8423. com_ibm_rave_library_action_SelectionManager.filterHighlighted = function(context, highlighted) {
  8424. return context.filter(function(data, index, groupIndex) {
  8425. return !!((rave.select(this).property(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG))) == highlighted;
  8426. });
  8427. };
  8428. com_ibm_rave_library_action_SelectionManager.filterSelected = function(context, selected) {
  8429. return context.filter(function(data, index, groupIndex) {
  8430. return !!((rave.select(this).property("selected"))) == selected;
  8431. });
  8432. };
  8433. /** @expose */
  8434. com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG = "highlighted";
  8435. /** @expose */
  8436. com_ibm_rave_library_action_SelectionManager.SELECTED_FLAG = "selected";
  8437. /** @expose */
  8438. com_ibm_rave_library_action_SelectionManager.DEEMPHASIZED_FLAG = "deemphasized";
  8439. com_ibm_rave_library_action_SelectionManager.APPLY_HIGHLIGHTED_STATE = function(data, index, groupIndex) {
  8440. rave.select(this).property(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG, true).classed(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG, true);
  8441. };
  8442. com_ibm_rave_library_action_SelectionManager.REMOVE_HIGHLIGHTED_STATE = function(data, index, groupIndex) {
  8443. rave.select(this).property(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG, false).classed(com_ibm_rave_library_action_SelectionManager.HIGHLIGHED_FLAG, false);
  8444. };
  8445. com_ibm_rave_library_action_SelectionManager.APPLY_SELECTED_STATE = function(data, index, groupIndex) {
  8446. rave.select(this).property("selected", true).classed("selected", true);
  8447. };
  8448. com_ibm_rave_library_action_SelectionManager.APPLY_DEEMPHASIZED_STATE = function(data, index, groupIndex) {
  8449. rave.select(this).property(com_ibm_rave_library_action_SelectionManager.DEEMPHASIZED_FLAG, true).classed(com_ibm_rave_library_action_SelectionManager.DEEMPHASIZED_FLAG, true);
  8450. };
  8451. com_ibm_rave_library_action_SelectionManager.REMOVE_SELECTED_STATE = function(data, index, groupIndex) {
  8452. rave.select(this).property("selected", false).classed("selected", false);
  8453. };
  8454. com_ibm_rave_library_action_SelectionManager.REMOVE_DEEMPHASIZED_STATE = function(data, index, groupIndex) {
  8455. rave.select(this).property(com_ibm_rave_library_action_SelectionManager.DEEMPHASIZED_FLAG, false).classed(com_ibm_rave_library_action_SelectionManager.DEEMPHASIZED_FLAG, false);
  8456. };
  8457. // $source: com/ibm/rave/library/framework/internal/CommonPropertyIDs
  8458. /************************************************************************
  8459. ** IBM Confidential
  8460. **
  8461. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8462. **
  8463. ** (C) Copyright IBM Corp. 2017
  8464. **
  8465. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8466. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8467. ************************************************************************/
  8468. // GENERATED
  8469. /**
  8470. * Constant strings for the common property IDs defined in the properties files. The code uses these strings, so this file must be kept in sync with the JSON files declaring the properties. The convention used here is that the string constant name is the property ID in all-caps, with "." replaced with "_".
  8471. */
  8472. var com_ibm_rave_library_framework_internal_CommonPropertyIDs = rave['internal']['Declare']({
  8473. });
  8474. /**
  8475. * Overall padding, defined in layoutProperties.json
  8476. */
  8477. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_PADDING = "layout.padding";
  8478. /**
  8479. * Left chart padding, defined in layoutProperties.json
  8480. */
  8481. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_CHART_PADDING_LEFT = "layout.chart.padding.left";
  8482. /**
  8483. * Top chart padding, defined in layoutProperties.json
  8484. */
  8485. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_CHART_PADDING_TOP = "layout.chart.padding.top";
  8486. /**
  8487. * Right chart padding, defined in layoutProperties.json
  8488. */
  8489. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_CHART_PADDING_RIGHT = "layout.chart.padding.right";
  8490. /**
  8491. * Bottom chart padding, defined in layoutProperties.json
  8492. */
  8493. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_CHART_PADDING_BOTTOM = "layout.chart.padding.bottom";
  8494. /**
  8495. * Space between the chart and the legend, defined in layoutProperties.json
  8496. */
  8497. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_LEGEND_CHART_GAP = "layout.legendchart.gap";
  8498. /**
  8499. * Whether the legend should align with the chart elements, defined in layoutProperties.json
  8500. */
  8501. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_LEGEND_CHART_ALIGN = "layout.legendchart.align";
  8502. /**
  8503. * Legend minimum size, defined in layoutProperties.json
  8504. */
  8505. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_LEGENDSIZE_MIN = "layout.legendsize.min";
  8506. /**
  8507. * Legend preferred size, defined in layoutProperties.json
  8508. */
  8509. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_LEGENDSIZE_PREFERRED = "layout.legendsize.preferred";
  8510. /**
  8511. * Legend maximum size, defined in layoutProperties.json
  8512. */
  8513. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_LEGENDSIZE_MAX = "layout.legendsize.max";
  8514. /**
  8515. * Top axis minimum size, defined in layoutProperties.json
  8516. */
  8517. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_TOP_MIN = "layout.axissize.top.min";
  8518. /**
  8519. * Top axis preferred size, defined in layoutProperties.json
  8520. */
  8521. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_TOP_PREFERRED = "layout.axissize.top.preferred";
  8522. /**
  8523. * Top axis maximum size, defined in layoutProperties.json
  8524. */
  8525. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_TOP_MAX = "layout.axissize.top.max";
  8526. /**
  8527. * Left axis minimum size, defined in layoutProperties.json
  8528. */
  8529. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_LEFT_MIN = "layout.axissize.left.min";
  8530. /**
  8531. * Left axis preferred size, defined in layoutProperties.json
  8532. */
  8533. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_LEFT_PREFERRED = "layout.axissize.left.preferred";
  8534. /**
  8535. * Left axis maximum size, defined in layoutProperties.json
  8536. */
  8537. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_LEFT_MAX = "layout.axissize.left.max";
  8538. /**
  8539. * Bottom axis minimum size, defined in layoutProperties.json
  8540. */
  8541. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_BOTTOM_MIN = "layout.axissize.bottom.min";
  8542. /**
  8543. * Bottom axis preferred size, defined in layoutProperties.json
  8544. */
  8545. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_BOTTOM_PREFERRED = "layout.axissize.bottom.preferred";
  8546. /**
  8547. * Bottom axis maximum size, defined in layoutProperties.json
  8548. */
  8549. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_BOTTOM_MAX = "layout.axissize.bottom.max";
  8550. /**
  8551. * Right axis minimum size, defined in layoutProperties.json
  8552. */
  8553. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_RIGHT_MIN = "layout.axissize.right.min";
  8554. /**
  8555. * Right axis preferred size, defined in layoutProperties.json
  8556. */
  8557. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_RIGHT_PREFERRED = "layout.axissize.right.preferred";
  8558. /**
  8559. * Right axis maximum size, defined in layoutProperties.json
  8560. */
  8561. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LAYOUT_AXISSIZE_RIGHT_MAX = "layout.axissize.right.max";
  8562. /**
  8563. * Chart background color, defined in backgroundProperties.json
  8564. */
  8565. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.BACKGROUND_CHART_COLOR = "background.chart.color";
  8566. /**
  8567. * Elements background color, defined in backgroundProperties.json
  8568. */
  8569. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.BACKGROUND_ELEMENTS_COLOR = "background.elements.color";
  8570. /**
  8571. * Whether to transpose a two-axis chart, defined in dualAxisProperties.json
  8572. */
  8573. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.TRANSPOSE = "transpose";
  8574. /**
  8575. * Whether to display the legend, defined in legendProperties.json
  8576. */
  8577. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_DISPLAY = "legend.display";
  8578. /**
  8579. * Legend position, defined in legendProperties.json
  8580. */
  8581. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_POSITION = "legend.position";
  8582. /**
  8583. * Legend title, defined in legendProperties.json
  8584. */
  8585. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_TITLE = "legend.title";
  8586. /**
  8587. * Legend title fill, defined in legendProperties.json
  8588. */
  8589. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_TITLESTYLE_FILL = "legend.titlestyle.fill";
  8590. /**
  8591. * Legend title font style, defined in legendProperties.json
  8592. */
  8593. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_TITLESTYLE_FONT = "legend.titlestyle.font";
  8594. /**
  8595. * Legend entry font style, defined in legendProperties.json
  8596. */
  8597. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_ENTRYSTYLE_FONT = "legend.entrystyle.font";
  8598. /**
  8599. * Legend title font size, defined in legendProperties.json
  8600. */
  8601. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_TITLESTYLE_FONTSIZE = "legend.titlestyle.fontsize";
  8602. /**
  8603. * Legend title font family, defined in legendProperties.json
  8604. */
  8605. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LEGEND_TITLESTYLE_FONTFAMILY = "legend.titlestyle.fontfamily";
  8606. /**
  8607. * Color palette ID, defined in colorProperties.json
  8608. */
  8609. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.COLOR_PALETTE = "color.palette";
  8610. /**
  8611. * null color for palettes
  8612. */
  8613. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.COLOR_NULL = "color.null";
  8614. /**
  8615. * Color for minimum data value in dynamic palettes
  8616. */
  8617. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.COLOR_DYNAMICPALETTE_MIN = "color.dynamicPalette.min";
  8618. /**
  8619. * Color for middle data value in dynamic palettes
  8620. */
  8621. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.COLOR_DYNAMICPALETTE_MID = "color.dynamicPalette.mid";
  8622. /**
  8623. * Color for maximum data value in dynamic palettes
  8624. */
  8625. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.COLOR_DYNAMICPALETTE_MAX = "color.dynamicPalette.max";
  8626. /**
  8627. * Size scale first value, defined in individual bundle property files (since the defaults differ)
  8628. */
  8629. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.SIZESCALE_FIRST = "sizeScale.first";
  8630. /**
  8631. * Size scale second value, defined in individual bundle property files (since the defaults differ)
  8632. */
  8633. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.SIZESCALE_SECOND = "sizeScale.second";
  8634. /**
  8635. * Effect name, defined in individual bundle property files (since the effect options differ)
  8636. */
  8637. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.EFFECT_NAME = "effect.name";
  8638. /**
  8639. * Effect duration, defined in individual bundle property files (to keep it with the effect duration)
  8640. */
  8641. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.EFFECT_DURATION = "effect.duration";
  8642. /**
  8643. * The font padding, defined in individual bundle property files (used for the word cloud)
  8644. */
  8645. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.FONT_PADDING = "font.padding";
  8646. /**
  8647. * The font minimum size, defined in individual bundle property files (used for the word cloud)
  8648. */
  8649. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.FONT_MIN_SIZE = "font.minSize";
  8650. /**
  8651. * The font maximum size, defined in individual bundle property files (used for the word cloud)
  8652. */
  8653. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.FONT_MAX_SIZE = "font.maxSize";
  8654. /**
  8655. * The orientation of the words (used for the word cloud)
  8656. */
  8657. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.WORD_ORIENTATION = "word.orientation";
  8658. /**
  8659. * The font family, defined in individual bundle property files
  8660. */
  8661. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.FONT_FAMILY = "font.family";
  8662. /**
  8663. * The way the data is used to build the chart (ie. simple, stacked, stack 100%, etc.)
  8664. */
  8665. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.DATA_HANDLING = "data.handling";
  8666. /**
  8667. * Zoom property. Zoom a chart for either axes, or both
  8668. */
  8669. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.ZOOM = "zoom";
  8670. /**
  8671. * sort property
  8672. */
  8673. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.SORT_PROPERTY_ID = "sort";
  8674. /**
  8675. * When we have a third axis, align the ticks
  8676. */
  8677. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.GRID_ALIGN_DEPENDENT_AXES = "grid.alignaxes";
  8678. /**
  8679. * Display shadow or not
  8680. */
  8681. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.SHADOW_DISPLAY = "shadow.display";
  8682. /**
  8683. * Shadow style
  8684. */
  8685. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.SHADOW_STYLE = "shadow.style";
  8686. /**
  8687. * Line pattern
  8688. */
  8689. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LINE_PATTERN = "line.pattern";
  8690. /**
  8691. * Font properties for item labels
  8692. */
  8693. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.LABEL_FONTSTYLE = "labelstyle.font";
  8694. /**
  8695. * Data labels
  8696. */
  8697. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.DATA_LABEL = "data.label.display";
  8698. /**
  8699. * Type of data labels
  8700. */
  8701. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.DATA_LABEL_TYPE = "data.label.type";
  8702. /**
  8703. * Type of data labels
  8704. */
  8705. //com_ibm_rave_library_framework_internal_CommonPropertyIDs.CONTRAST_LABEL_COLOR = "contrast.label.color";
  8706. // $source: com/ibm/rave/library/datamodel/ext/Rave1Importer
  8707. /************************************************************************
  8708. ** IBM Confidential
  8709. **
  8710. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8711. **
  8712. ** (C) Copyright IBM Corp. 2017
  8713. **
  8714. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8715. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8716. ************************************************************************/
  8717. // GENERATED
  8718. //@import com/ibm/rave/library/service/ErrorDispatcher (static) // ErrorDispatcher
  8719. /**
  8720. * <p> A base class for data importers which load a RAVE 1 data table (as JSONObject) into a data model data set. The methods are common code for working with the RAVE 1 <code>"data"</code> specification and creating data accessors. </p> <h3>The Map</h3> <p> Slots are set by the {@link #this.fieldToSlot(com_ibm_rave_library_datamodel_DataModel, String, Object, Object)} or {@link #this.slotToField(com_ibm_rave_library_datamodel_DataModel, String, Object, Object)} methods. These do not clear any slots. The map used by these methods defines how fields are assigned to slots. {@link #this.makeMap(com_ibm_rave_library_datamodel_DataModel, Object, , Object, com_ibm_rave_library_datamodel_DataSetDescriptor)} is used to make this map. </p> <p> The default mode for a RAVE 1 importer is to assign each VisJSON field to the data slot with the same ID. VisJSON fields that do not have a matching ID are ignored, and slots which do not have a matching field are not set. When used without an input map, makeMap creates a map to produce this behavior. </p> <p> makeMap may be passed an optional input map and reversed flag to modify this behavior. The map is from strings (IDs) to objects, which may be either strings or arrays of strings (ArrayEx&lt;String&gt; in Java). </p> <p> When the input map is non-null, each field ID is first looked up in the map; if the field ID is not in the map, it is not assigned to any slot. Otherwise the string(s) from the map are the IDs of data slots. The field accessor is bound to each of these slots in the order they appear in the array. If several field IDs include the same slot ID in their map value, they are all bound to the slot in the order in which the fields appear in the VisJSON. </p> <p> When a input map is non-null and the reversed flag is true, the map is instead treated as being from slot ID to field ID(s). Slots not appearing in the map are not assigned accessors. Those appearing in the map are assigned the accessors for the listed field(s), in the order in which the fields appear in the map. The reversed flag has no effect when the map is not used. </p> <h3>Field Conversion</h3> <p> Fields are converted to {@link DataSlotEntry} as follows: </p> <ul> <li> Fields with <code>"categories"</code> become string accessors, where the string value is found by looking up the data value in the categories array as done in RAVE 1. Null and out-of-range values become null strings. </li> <li> Fields with <code>"unit":"categorical"</code> become string accessors, where the string value is found by rounding the data value to and integer and converting the integer to string. Null and negative values become null strings (this approximately reproduces the RAVE 1 behavior). </li> <li> Fields with <code>"unit":"string"</code> become string accessors, where the string is the data value. With this unit, the value in the row is a string; null remains null, and anything else is converted to a string with the ObjectConverter. Note that this is <i>not</i> a supported unit in RAVE 1, nor is the <code>"rows"</code> syntax. </li> <li> Fields with <code>"unit":"timestamp"</code> or <code>"unit":"date"</code> become date accessors, where the is are found by treating the data value as seconds ("timestamp") or days ("date") after the epoch, as done in RAVE 1. Null values become null dates. </li> <li> Fields with <code>"unit":"object"</code> become object accessors, where the object is the data value. With this unit, the value in the row can be any JSON type (primitive, object, or array). Note that this is <i>not</i> a supported unit in RAVE 1, nor is the <code>"rows"</code> syntax. </li> <li> All other fields become numeric datum, where the number is the data value. Null values become null numbers. </li> </ul>
  8721. */
  8722. var com_ibm_rave_library_datamodel_ext_Rave1Importer = rave_library_externs["Rave1Importer"] = rave['internal']['Declare']({
  8723. /** @expose */
  8724. importData : function(model, data) {}
  8725. });
  8726. /**
  8727. * <p> Build a map from keys to arrays of values, for use with the fieldToSlot and slotToField methods. If reversed is false, the map is from RAVE 1 field identifiers to slot identifiers and should be used If reversed is true, it is from slot identifiers to RAVE 1 field identifiers. </p> <p> If the input map is null, the result map keys are those IDs which are both field and data slot identifiers. Each key's value is an array of the single (same) ID. </p> <p> Otherwise the result map is build from the input map. The result map keys are the input map keys, and the result map values are the input map values as arrays of strings. Invalid field IDs are ignored, since a RAVE 1 table might not use the field; they are not included as keys or values. Invalid slot IDs raise errors. </p> <p> If an error is raised, null is returned. </p>
  8728. * @param (com.ibm.rave.library.datamodel.DataModel) model The data model to which errors are reported
  8729. * @param (Object) map The map between slots and fields, may be null
  8730. * @param (boolean) reversed If true, the map is from slot names to fields; otherwise from fields to slots
  8731. * @param (Object) raveTable RAVE 1 table
  8732. * @param (com.ibm.rave.library.datamodel.DataSetDescriptor) setDescriptor Descriptor for the data set
  8733. * @return (Object) Map of keys to arrays of values, or null
  8734. */
  8735. /** @expose */
  8736. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeMap = function(model, map, reversed, raveTable, setDescriptor) {
  8737. var result = {};
  8738. var valueSet = {};
  8739. for (var __i_enFor0 = 0, __exp_enFor0 = setDescriptor.dataSlots(), __len_enFor0 = __exp_enFor0.length;
  8740. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8741. var s = __exp_enFor0[__i_enFor0];
  8742. valueSet[s.id()] = 1;
  8743. }
  8744. var keySet = {};
  8745. var fields = raveTable["fields"];
  8746. var nFields = fields.length;
  8747. for (var i = 0; i < nFields; ++i) {
  8748. var field = fields[i];
  8749. if (field) {
  8750. var id = (field["id"]);
  8751. if (id != null) {
  8752. if (map) {
  8753. keySet[id] = 1;
  8754. } else {
  8755. if (valueSet.hasOwnProperty(id)) {
  8756. var values = [];
  8757. values.push(id);
  8758. result[id] = values;
  8759. }
  8760. }
  8761. }
  8762. }
  8763. }
  8764. if (!map) {
  8765. return result;
  8766. }
  8767. if (reversed) {
  8768. var t = keySet;
  8769. keySet = valueSet;
  8770. valueSet = t;
  8771. }
  8772. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(map), __len_enFor1 = __exp_enFor1.length;
  8773. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  8774. var key = __exp_enFor1[__i_enFor1];
  8775. if (!(keySet.hasOwnProperty(key))) {
  8776. if (reversed) {
  8777. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 405, key);
  8778. return null;
  8779. }
  8780. } else {
  8781. var values = com_ibm_rave_library_datamodel_ext_Rave1Importer.mapEntries(key, map);
  8782. if (values) {
  8783. if (!reversed) {
  8784. for (var __i_enFor2 = 0, __exp_enFor2 = values, __len_enFor2 = __exp_enFor2.length;
  8785. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  8786. var value = __exp_enFor2[__i_enFor2];
  8787. if (!(valueSet.hasOwnProperty(value))) {
  8788. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 405, value);
  8789. return null;
  8790. }
  8791. }
  8792. }
  8793. result[key] = values;
  8794. }
  8795. }
  8796. }
  8797. return result;
  8798. };
  8799. /**
  8800. * Get the values associated with a key in the map, which is not null. The value in the map is either a single string or an array of strings, and is returned as an array of strings. If there are no entries, returns null (because of the way this method is used, that will happen only if a user adds a key with a null value).
  8801. * @param (String) key Key
  8802. * @param (Object) map Map
  8803. * @return (Array) List of values, or null
  8804. */
  8805. com_ibm_rave_library_datamodel_ext_Rave1Importer.mapEntries = function(key, map) {
  8806. var o = map[key];
  8807. if (o != null) {
  8808. if ((typeof o === "string" || o instanceof String)) {
  8809. var result = [];
  8810. result.push((o));
  8811. return result;
  8812. }
  8813. return o;
  8814. }
  8815. return null;
  8816. };
  8817. /**
  8818. * Set the data slots. All arguments must be non-null and valid. All slots are first cleared. Each slot is then assigned fields using the map, which is one created by {@link #this.makeMap(com_ibm_rave_library_datamodel_DataModel, Object, , Object, com_ibm_rave_library_datamodel_DataSetDescriptor)} .
  8819. * @param (com.ibm.rave.library.datamodel.DataModel) model The data model
  8820. * @param (com.ibm.rave.library.datamodel.DataSetDescriptor) dataSet The data set descriptor
  8821. * @param (Object) raveTable The RAVE 1 table
  8822. * @param (Object) map The map from makeMap
  8823. * @param (boolean) reversed Whether the map is reversed (the original import had a map and the reverseMap flag)
  8824. * @return (boolean) Whether there was a failure when setting slots (usually a bad data type)
  8825. */
  8826. /** @expose */
  8827. com_ibm_rave_library_datamodel_ext_Rave1Importer.setSlots = function(model, dataSet, raveTable, map, reversed) {
  8828. var dataSetId = dataSet.id();
  8829. for (var __i_enFor0 = 0, __exp_enFor0 = dataSet.dataSlots(), __len_enFor0 = __exp_enFor0.length;
  8830. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8831. var dsd = __exp_enFor0[__i_enFor0];
  8832. model.clearDataSlot(dataSetId, dsd.id());
  8833. }
  8834. return reversed ? com_ibm_rave_library_datamodel_ext_Rave1Importer.slotToField(model, dataSetId, raveTable, map) : com_ibm_rave_library_datamodel_ext_Rave1Importer.fieldToSlot(model, dataSetId, raveTable, map);
  8835. };
  8836. /**
  8837. * Set the data slots. Each field is bound to one or more slots as given by the map.
  8838. * @param (com.ibm.rave.library.datamodel.DataModel) model The data model
  8839. * @param (String) dataSetId The ID of the data set
  8840. * @param (Object) raveTable The RAVE 1 table from which fields are taken
  8841. * @param (Object) map The map from field ID to data slots
  8842. * @return (boolean) True for success, false for failure
  8843. */
  8844. com_ibm_rave_library_datamodel_ext_Rave1Importer.fieldToSlot = function(model, dataSetId, raveTable, map) {
  8845. var fields = raveTable["fields"];
  8846. var nFields = fields.length;
  8847. for (var i = 0; i < nFields; ++i) {
  8848. var fieldSpec = fields[i];
  8849. if (fieldSpec) {
  8850. var fieldId = (fieldSpec["id"]);
  8851. var values = map[fieldId];
  8852. if (values) {
  8853. var info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeAccessor(fieldSpec, i);
  8854. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  8855. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8856. var slotId = __exp_enFor0[__i_enFor0];
  8857. var slotEntry = model.dataset(dataSetId).slot(slotId).push().type$1(info["type"]).accessor$1(info["accessor"]).label$1(info["label"]);
  8858. if (!(slotEntry.isValid())) {
  8859. return false;
  8860. }
  8861. }
  8862. }
  8863. }
  8864. }
  8865. return true;
  8866. };
  8867. /**
  8868. * Set the data slots. Each slot is assigned one or more fields as given by the map.
  8869. * @param (com.ibm.rave.library.datamodel.DataModel) model The data model
  8870. * @param (String) dataSetId The ID of the data set
  8871. * @param (Object) raveTable The RAVE 1 table from which fields are taken
  8872. * @param (Object) map The map from field ID to data slots
  8873. * @return (boolean) True for success, false for failure
  8874. */
  8875. com_ibm_rave_library_datamodel_ext_Rave1Importer.slotToField = function(model, dataSetId, raveTable, map) {
  8876. var fieldsMap = {};
  8877. var fieldIdSet = {};
  8878. var fields = raveTable["fields"];
  8879. var nFields = fields.length;
  8880. for (var i = 0; i < nFields; ++i) {
  8881. var field = fields[i];
  8882. if (field) {
  8883. var id = (field["id"]);
  8884. if (id != null) {
  8885. fieldsMap[id] = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeAccessor(field, i);
  8886. fieldIdSet[id] = 1;
  8887. }
  8888. }
  8889. }
  8890. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(map), __len_enFor0 = __exp_enFor0.length;
  8891. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  8892. var slotId = __exp_enFor0[__i_enFor0];
  8893. var fieldIds = map[slotId];
  8894. for (var __i_enFor1 = 0, __exp_enFor1 = fieldIds, __len_enFor1 = __exp_enFor1.length;
  8895. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  8896. var fieldId = __exp_enFor1[__i_enFor1];
  8897. var info = fieldsMap[fieldId];
  8898. if (info) {
  8899. var slotEntry = model.dataset(dataSetId).slot(slotId).push().type$1(info["type"]).accessor$1(info["accessor"]).label$1(info["label"]);
  8900. if (!(slotEntry.isValid())) {
  8901. return false;
  8902. }
  8903. }
  8904. }
  8905. }
  8906. return true;
  8907. };
  8908. /**
  8909. * Create an AccessorInfo for the given field specification, which is at index fieldIndex in the fields. The type of accessor is determined as in the class documentation.
  8910. * @param (Object) fieldSpec VisJSON field specification
  8911. * @param (int) fieldIndex Index of field
  8912. * @return (Object) Datum for the field
  8913. */
  8914. /** @expose */
  8915. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeAccessor = function(fieldSpec, fieldIndex) {
  8916. var info;
  8917. var categories = fieldSpec["categories"];
  8918. var unit = (fieldSpec["unit"]);
  8919. if (categories) {
  8920. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeCategoriesAccessor(fieldIndex, categories);
  8921. } else if ("categorical" == unit) {
  8922. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeCategoricalAccessor(fieldIndex);
  8923. } else if ("timestamp" == unit) {
  8924. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeDateAccessor(fieldIndex, 1000);
  8925. } else if ("date" == unit) {
  8926. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeDateAccessor(fieldIndex, 86400 * 1000);
  8927. } else if ("string" == unit) {
  8928. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeStringAccessor(fieldIndex);
  8929. } else if ("object" == unit) {
  8930. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeObjectAccessor(fieldIndex);
  8931. } else {
  8932. info = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeNumericAccessor(fieldIndex);
  8933. }
  8934. info["label"] = (fieldSpec["label"]);
  8935. return info;
  8936. };
  8937. /**
  8938. * All accessors are applied to a row, which is a JSONArray. This method gets the value from the row, returning null for null rows or out-of-range indexes.
  8939. * @param (Array) row The row
  8940. * @param (int) fieldIndex Index of value in the row
  8941. * @return (Object) The value
  8942. */
  8943. /** @expose */
  8944. com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue = function(row, fieldIndex) {
  8945. return (row && fieldIndex < row.length) ? row[fieldIndex] : null;
  8946. };
  8947. /**
  8948. * Return accessor info for a field with "categories".
  8949. * @param (int) fieldIndex The field index
  8950. * @param (Array) categories The categories array
  8951. * @return (Object) Accessor info
  8952. */
  8953. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeCategoriesAccessor = function(fieldIndex, categories) {
  8954. var result = {};
  8955. result["type"] = "string";
  8956. result["accessor"] = function(row) {
  8957. if ((typeof row === "array" || row instanceof Array)) {
  8958. var v = (com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex));
  8959. if (v == null) {
  8960. return null;
  8961. }
  8962. var ix = ~~ (Math.round(v));
  8963. return (ix < 0 || ix >= categories.length) ? null : ""+(categories[ix]);
  8964. } else {
  8965. return null;
  8966. }
  8967. };
  8968. return result;
  8969. };
  8970. /**
  8971. * Return accessor info for a field with "unit":"categorical".
  8972. * @param (int) fieldIndex The field index
  8973. * @return (Object) Accessor info
  8974. */
  8975. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeCategoricalAccessor = function(fieldIndex) {
  8976. var result = {};
  8977. result["type"] = "string";
  8978. result["accessor"] = function(row) {
  8979. var v = (com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex));
  8980. if (v == null) {
  8981. return null;
  8982. }
  8983. var ix = ~~ (Math.round(v));
  8984. return (ix < 0) ? null : ("" + ix);
  8985. };
  8986. return result;
  8987. };
  8988. /**
  8989. * Return accessor info for a field with "unit":"timestamp" or "unit":"date.
  8990. * @param (int) fieldIndex The field index
  8991. * @param (long) msPer Milliseconds per unit
  8992. * @return (Object) Accessor info
  8993. */
  8994. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeDateAccessor = function(fieldIndex, msPer) {
  8995. var result = {};
  8996. result["type"] = "date";
  8997. result["accessor"] = function(row) {
  8998. if ((typeof row === "array" || row instanceof Array)) {
  8999. var v = (com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex));
  9000. return v != null ? new Date((v * msPer)) : null;
  9001. } else {
  9002. return null;
  9003. }
  9004. };
  9005. return result;
  9006. };
  9007. /**
  9008. * Return accessor info for a field with "unit":"string".
  9009. * @param (int) fieldIndex The field index
  9010. * @return (Object) Accessor info
  9011. */
  9012. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeStringAccessor = function(fieldIndex) {
  9013. var result = {};
  9014. result["type"] = "string";
  9015. result["accessor"] = function(row) {
  9016. if ((typeof row === "array" || row instanceof Array)) {
  9017. var v = com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex);
  9018. return v != null ? ""+(v) : null;
  9019. } else {
  9020. return null;
  9021. }
  9022. };
  9023. return result;
  9024. };
  9025. /**
  9026. * Return accessor info for a field with "unit":"object".
  9027. * @param (int) fieldIndex The field index
  9028. * @return (Object) Accessor info
  9029. */
  9030. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeObjectAccessor = function(fieldIndex) {
  9031. var result = {};
  9032. result["type"] = "object";
  9033. result["accessor"] = function(row) {
  9034. if ((typeof row === "array" || row instanceof Array)) {
  9035. return com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex);
  9036. } else {
  9037. return null;
  9038. }
  9039. };
  9040. return result;
  9041. };
  9042. /**
  9043. * Return accessor info for a field which is numeric.
  9044. * @param (int) fieldIndex The field index
  9045. * @return (Object) Accessor info
  9046. */
  9047. com_ibm_rave_library_datamodel_ext_Rave1Importer.makeNumericAccessor = function(fieldIndex) {
  9048. var result = {};
  9049. result["type"] = "numeric";
  9050. result["accessor"] = function(row) {
  9051. if ((typeof row === "array" || row instanceof Array)) {
  9052. return com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, fieldIndex);
  9053. } else {
  9054. return null;
  9055. }
  9056. };
  9057. return result;
  9058. };
  9059. /**
  9060. * Report an error with given code and location.
  9061. * @param (com.ibm.rave.library.datamodel.DataModel) model The model
  9062. * @param (int) code The error code
  9063. * @param (String) location The location
  9064. */
  9065. /** @expose */
  9066. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError = function(model, code, location) {
  9067. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.logError(code, location);
  9068. };
  9069. // $source: com/ibm/rave/library/datamodel/ext/Rave1TableImporter
  9070. /************************************************************************
  9071. ** IBM Confidential
  9072. **
  9073. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9074. **
  9075. ** (C) Copyright IBM Corp. 2017
  9076. **
  9077. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9078. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9079. ************************************************************************/
  9080. // GENERATED
  9081. //@import com/ibm/rave/library/datamodel/ext/Rave1Importer (loadtime) // setSlots, superclass, reportError, makeMap
  9082. /**
  9083. * <p> An importer which loads a single RAVE 1 data table (as JSONObject) into a data model tabular data set. The importer may be used repeatedly to load all the tables in a VisJSON <code>"data"</code> section into data sets of a model. </p> <p> This importer can only handle simple data tables with fields and rows. If the table has no fields an error is raised. If it has fields but no rows, processing is normal and the data is empty. </p> <p> The converter is passed the data model to be populated and an {@link (Object) ImportData} which controls the conversion. The ImportData is annotated as JsonObject, so in JavaScript may be declared as a simple object. </p> <p> The {@link this.ImportData#this.visJSONData} is the <code>"data"</code> section of the VisJson specification, an array of objects. {@link this.ImportData#this.index} selects the table to be imported from the array, and {@link this.ImportData#this.dataSetId} selects the data set from the model. These ImportData fields are all required. </p> <p> For use of the ImportData map and reverseMap options, and for the conversion of VisJSON fields to data slot accessors, see the base class {@link (com.ibm.rave.library.datamodel.ext.Rave1Importer) Rave1Importer} documentation. </p> <p> The <code>"rows"</code> of the selected VisJSON table are bound as the data array of the selected data set, which must be tabular. All data slots are cleared. The map (see {@link (com.ibm.rave.library.datamodel.ext.Rave1Importer) Rave1Importer} ) is then used to define accessors for the data slots of the data set. </p> <h3>Return Value and Errors</h3> <p> The importer runs synchronously, returning either true for success or false for failure. Errors are reported through the data model, so passing a null data model returns false but no error is reported. </p> <p> Errors are raised if the ImportData does not have valid information, with code {@link this.ErrorCodes#102} and one of the error messages defined in the class; the location is either null or a slot ID. Errors can also be reported by the model when the importer assigns slot data, for example an invalid data type. </p>
  9084. */
  9085. var com_ibm_rave_library_datamodel_ext_Rave1TableImporter = rave_library_externs["Rave1TableImporter"] = rave['internal']['Declare'](com_ibm_rave_library_datamodel_ext_Rave1Importer, {
  9086. /**
  9087. * Construct.
  9088. */
  9089. /** @expose */
  9090. constructor : function() {},
  9091. /**
  9092. * Import data into a model as described in the class documentation.
  9093. * @param (com.ibm.rave.library.datamodel.DataModel) model The model
  9094. * @param (Object) data The information controlling the import
  9095. * @return (boolean) True for success, false if an error is raised
  9096. */
  9097. /** @expose */
  9098. importData : function(model, data) {
  9099. var idata = data;
  9100. if (!model) {
  9101. return false;
  9102. }
  9103. if (!idata || !idata["visJSONData"] || idata["index"] == null || idata["dataSetId"] == null) {
  9104. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 401, null);
  9105. return false;
  9106. }
  9107. var index = idata["index"];
  9108. if (index < 0 || index >= idata["visJSONData"].length) {
  9109. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 402, null);
  9110. return false;
  9111. }
  9112. var raveTable = idata["visJSONData"][index];
  9113. if (!raveTable || raveTable["fields"] == null) {
  9114. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 403, null);
  9115. return false;
  9116. }
  9117. var modelDescriptor = model.getDescriptor();
  9118. var setDescriptor;
  9119. for (var __i_enFor0 = 0, __exp_enFor0 = modelDescriptor.dataSets(), __len_enFor0 = __exp_enFor0.length;
  9120. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9121. var dsd = __exp_enFor0[__i_enFor0];
  9122. if (idata["dataSetId"] == dsd.id()) {
  9123. setDescriptor = dsd;
  9124. break;
  9125. }
  9126. }
  9127. if (!setDescriptor) {
  9128. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 404, null);
  9129. return false;
  9130. }
  9131. if (!("tabular" == setDescriptor.type())) {
  9132. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 406, null);
  9133. return false;
  9134. }
  9135. var reversed = idata["map"] && idata["reverseMap"] != null && idata["reverseMap"];
  9136. var map = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeMap(model, idata["map"], reversed, raveTable, setDescriptor);
  9137. if (!map) {
  9138. return false;
  9139. }
  9140. var rows = [];
  9141. var specRows = raveTable["rows"];
  9142. if (specRows) {
  9143. var len = specRows.length;
  9144. for (var i = 0; i < len; ++i) {
  9145. rows.push(specRows[i]);
  9146. }
  9147. }
  9148. model.setData(idata["dataSetId"], rows);
  9149. return com_ibm_rave_library_datamodel_ext_Rave1Importer.setSlots(model, setDescriptor, raveTable, map, reversed);
  9150. }
  9151. });
  9152. // $source: com/ibm/rave/library/datamodel/ext/Rave1HierarchyImporter
  9153. /************************************************************************
  9154. ** IBM Confidential
  9155. **
  9156. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9157. **
  9158. ** (C) Copyright IBM Corp. 2017
  9159. **
  9160. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9161. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9162. ************************************************************************/
  9163. // GENERATED
  9164. //@import com/ibm/rave/library/datamodel/ext/Rave1Importer (loadtime) // setSlots, makeAccessor, getRowValue, superclass, reportError, makeMap
  9165. /**
  9166. * <p> An importer which loads a single RAVE 1 data table (as JSONObject) into a data model hierarchical data set. The importer may be used repeatedly to load all the tables in a VisJSON <code>"data"</code> section into data sets of a model. </p> <p> This importer can only handle simple data tables with fields and rows. If the table has no fields an error is raised. If it has fields but no rows, processing is normal and the data is empty. </p> <p> The converter is passed the data model to be populated and an {@link (Object) ImportData} which controls the conversion. The ImportData is annotated as JsonObject, so in JavaScript may be declared as a simple object. </p> <p> The {@link this.ImportData#this.visJSONData} is the <code>"data"</code> section of the VisJson specification, an array of objects. {@link this.ImportData#this.index} selects the table to be imported from the array, and {@link this.ImportData#this.dataSetId} selects the data set from the model. These ImportData fields are all required. The {@link this.ImportData#this.levels} field defines the levels used to construct the hierarchy as described below, and is also required. It must have at least one entry. </p> <p> For use of the ImportData map and reverseMap options, and for the conversion of VisJSON fields to data slot accessors, see the base class {@link (com.ibm.rave.library.datamodel.ext.Rave1Importer) Rave1Importer} documentation. </p> <h3>Hierarchical Structure</h3> <p> The <code>"rows"</code> of the selected VisJSON table are converted into a hierarchical structure. The hierarchy structure is defined by the required {@link this.ImportData#this.levels} , which is an array-list of VisJSON field names. If any of these fields are not defined an error is raised. The tree will have L+1 levels, where L is the number of entries in the levels array. All leaves are at the last level, and each row of data becomes a leaf. Internal leaves are created as necessary. </p> <p> The first level is the root. It has one child for each distinct value of the first levels field. Each of its children has a child for each distinct value of the second levels field (given the value of the first field from the child), and so on. At the last internal level L-1, the children are the leaf nodes with one per distinct value of the final levels field. If two rows of data have exactly the same values for all levels field, the second one is ignored and the leaf will be the first one. </p> <p> The data nodes in the hierarchy are JSONArrays. Each of the original rows becomes one of the leaf nodes, so in the scene tree the scene-node datum is the original row. Extra JSONArray objects are created for the internal nodes, so their scene-node datum objects do not appear in the original data. </p> <p> All the row JSONArrays have N+2 entries, where N is the number of VisJSON fields (the original rows are expanded to this length). The two extra entries are used to hold the row's level-key (the unique value of the level field for that node) and children. Leaf nodes have their original values in the first N entries of the array, a non-null level-key (from the last of the levels), and null children. Internal nodes have nulls in the first N entries (the VisJSON fields, for which no data is available), a non-null level-key (except for the root which is null), and non-null children. </p> <p> The resulting tree is bound as the data hierarchy of the selected data set, which must be hierarchical. All data slots are cleared. The map (see {@link (com.ibm.rave.library.datamodel.ext.Rave1Importer) Rave1Importer} ) is then used to define accessors for the data slots of the data set. Note that these will return null for all internal nodes, since the data values in the table are all null. </p> <p> The slot {@link this.ImportData#this.childrenSlotId} , default "children", is then set to an accessor that returns the children of the node as an array-list. If {@link this.ImportData#this.levelKeySlotIds} is defined, the data slot(s) in that array are each set to an accessor that returns the data value from the level-key (this may overwrite an accessor set from the fields). </p> <h3>Return Value and Errors</h3> <p> The importer runs synchronously, returning either true for success or false for failure. Errors are reported through the data model, so passing a null data model returns false but no error is reported. </p> <p> Errors are raised if the ImportData does not have valid information, with code {@link this.ErrorCodes#102} and one of the error messages defined in the class; the location is either null or a slot ID. Errors can also be reported by the model when the importer assigns slot data, for example an invalid data type. </p>
  9167. */
  9168. var com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter = rave_library_externs["Rave1HierarchyImporter"] = rave['internal']['Declare'](com_ibm_rave_library_datamodel_ext_Rave1Importer, {
  9169. /**
  9170. * Construct.
  9171. */
  9172. /** @expose */
  9173. constructor : function() {},
  9174. /**
  9175. * Import data into a model as described in the class documentation.
  9176. * @param (com.ibm.rave.library.datamodel.DataModel) model The model
  9177. * @param (Object) data The information controlling the import
  9178. * @return (boolean) True for success, false if an error is raised
  9179. */
  9180. /** @expose */
  9181. importData : function(model, data) {
  9182. var idata = data;
  9183. if (!model) {
  9184. return false;
  9185. }
  9186. if (!idata || !idata["visJSONData"] || idata["index"] == null || idata["dataSetId"] == null || !idata["levels"] || idata["levels"].length == 0) {
  9187. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 401, null);
  9188. return false;
  9189. }
  9190. var index = idata["index"];
  9191. if (index < 0 || index >= idata["visJSONData"].length) {
  9192. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 402, null);
  9193. return false;
  9194. }
  9195. var raveTable = idata["visJSONData"][index];
  9196. if (!raveTable || raveTable["fields"] == null) {
  9197. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 403, null);
  9198. return false;
  9199. }
  9200. var modelDescriptor = model.getDescriptor();
  9201. var setDescriptor;
  9202. for (var __i_enFor0 = 0, __exp_enFor0 = modelDescriptor.dataSets(), __len_enFor0 = __exp_enFor0.length;
  9203. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9204. var dsd = __exp_enFor0[__i_enFor0];
  9205. if (idata["dataSetId"] == dsd.id()) {
  9206. setDescriptor = dsd;
  9207. break;
  9208. }
  9209. }
  9210. if (!setDescriptor) {
  9211. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 404, null);
  9212. return false;
  9213. }
  9214. if (!("hierarchy" == setDescriptor.type())) {
  9215. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 406, null);
  9216. return false;
  9217. }
  9218. var reversed = idata["map"] && idata["reverseMap"] != null && idata["reverseMap"];
  9219. var map = com_ibm_rave_library_datamodel_ext_Rave1Importer.makeMap(model, idata["map"], reversed, raveTable, setDescriptor);
  9220. if (!map) {
  9221. return false;
  9222. }
  9223. var levels = com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeLevelsInfo(model, raveTable, idata["levels"]);
  9224. if (!levels) {
  9225. return false;
  9226. }
  9227. var numFields = (raveTable["fields"]).length;
  9228. var root = com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeNode(null, numFields, null);
  9229. var rows = raveTable["rows"];
  9230. if (rows) {
  9231. var numRows = rows.length;
  9232. for (var i = 0; i < numRows; ++i) {
  9233. var row = rows[i];
  9234. var keyValues = com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeKeyValues(row, levels);
  9235. if (keyValues) {
  9236. com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.addNode(root, keyValues, row, numFields);
  9237. }
  9238. }
  9239. }
  9240. model.setData(idata["dataSetId"], root);
  9241. var result = com_ibm_rave_library_datamodel_ext_Rave1Importer.setSlots(model, setDescriptor, raveTable, map, reversed);
  9242. if (result) {
  9243. var childrenSlotId = idata["childrenSlotId"] != null ? idata["childrenSlotId"] : "children";
  9244. var childrenAccessor = function(row) {
  9245. if ((typeof row === "array" || row instanceof Array)) {
  9246. var children = com_ibm_rave_library_datamodel_ext_Rave1Importer.getRowValue(row, numFields + 1);
  9247. if (!children) {
  9248. return null;
  9249. }
  9250. var r = [];
  9251. for (var __i_enFor0 = 0, __exp_enFor0 = children, __len_enFor0 = __exp_enFor0.length;
  9252. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9253. var o = __exp_enFor0[__i_enFor0];
  9254. r.push(o);
  9255. }
  9256. return r;
  9257. } else {
  9258. return null;
  9259. }
  9260. };
  9261. if (model.setDataSlot(idata["dataSetId"], childrenSlotId, "object", childrenAccessor) < 0) {
  9262. result = false;
  9263. }
  9264. if (idata["levelKeySlotIds"]) {
  9265. var levelKeyAccessor = function(row) {
  9266. if ((typeof row === "array" || row instanceof Array)) {
  9267. var r = (row);
  9268. var o = null;
  9269. if (r.length > numFields) {
  9270. o = r[numFields];
  9271. }
  9272. return o;
  9273. } else {
  9274. return null;
  9275. }
  9276. };
  9277. for (var __i_enFor0 = 0, __exp_enFor0 = idata["levelKeySlotIds"], __len_enFor0 = __exp_enFor0.length;
  9278. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9279. var key = __exp_enFor0[__i_enFor0];
  9280. if (model.setDataSlot(idata["dataSetId"], key, "string", levelKeyAccessor) < 0) {
  9281. result = false;
  9282. }
  9283. }
  9284. }
  9285. }
  9286. return result;
  9287. }
  9288. });
  9289. /**
  9290. * Add a row from the RAVE 1 table to the tree. The keyValues are the values (data values, not RAVE 1 numbers) for the levels, and all are non-null. The row has not been extended to add the level-key and children.
  9291. * @param (Array) root The root of the tree being built
  9292. * @param (Array) keyValues Array of key values, all non-null
  9293. * @param (Array) row The data row, non-null
  9294. */
  9295. com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.addNode = function(root, keyValues, row, numFields) {
  9296. var currentNode = root;
  9297. var numLevels = keyValues.length;
  9298. for (var levelIndex = 0; levelIndex < numLevels; ++levelIndex) {
  9299. var children = currentNode[numFields + 1];
  9300. if (!children) {
  9301. children = [];
  9302. currentNode[numFields + 1] = children;
  9303. }
  9304. var child = null;
  9305. var keyValue = keyValues[levelIndex];
  9306. for (var cnum = 0; cnum < children.length; ++cnum) {
  9307. if (keyValue == (children[cnum])[numFields]) {
  9308. child = children[cnum];
  9309. break;
  9310. }
  9311. }
  9312. if (!child) {
  9313. child = com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeNode(levelIndex == numLevels - 1 ? row : null, numFields, keyValue);
  9314. children.push(child);
  9315. }
  9316. currentNode = child;
  9317. }
  9318. };
  9319. /**
  9320. * Build an array-list of AccessorInfo for the given levels and RAVE 1 table. If any of the levels are not the ID of a table field, raises an error through the model and returns null.
  9321. * @param (com.ibm.rave.library.datamodel.DataModel) model Data model (used for error reporting)
  9322. * @param (Object) raveTable The RAVE 1 table, known to be non-null and have non-null fields
  9323. * @param (Array) levels The levels array, known to be non-null and have at least one entry
  9324. * @return (Array) Array of accessors, or null
  9325. */
  9326. com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeLevelsInfo = function(model, raveTable, levels) {
  9327. var fieldMap = {};
  9328. var fields = raveTable["fields"];
  9329. for (var i = 0; i < fields.length; ++i) {
  9330. var field = fields[i];
  9331. var id = (field) ? ""+(field["id"]) : null;
  9332. if (id != null) {
  9333. fieldMap[id] = i;
  9334. }
  9335. }
  9336. var result = [];
  9337. for (var __i_enFor0 = 0, __exp_enFor0 = levels, __len_enFor0 = __exp_enFor0.length;
  9338. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9339. var level = __exp_enFor0[__i_enFor0];
  9340. var index = fieldMap[level];
  9341. if (index == null) {
  9342. com_ibm_rave_library_datamodel_ext_Rave1Importer.reportError(model, 407, level);
  9343. return null;
  9344. }
  9345. result.push(com_ibm_rave_library_datamodel_ext_Rave1Importer.makeAccessor(fields[index], index));
  9346. }
  9347. return result;
  9348. };
  9349. /**
  9350. * Apply the accessors to the row and return the array of values. If the row is null or any accessor returns null, returns null. All accessors are non-null and valid. All vaues are coerced to strings.
  9351. * @param (Array) row Data row from the RAVE 1 table
  9352. * @param (Array) levels Accessors array
  9353. * @return (Array) Array of values, or null
  9354. */
  9355. com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeKeyValues = function(row, levels) {
  9356. if (!row) {
  9357. return null;
  9358. }
  9359. var result = [];
  9360. for (var __i_enFor0 = 0, __exp_enFor0 = levels, __len_enFor0 = __exp_enFor0.length;
  9361. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9362. var info = __exp_enFor0[__i_enFor0];
  9363. var value = info["accessor"](row);
  9364. if (value == null) {
  9365. return null;
  9366. }
  9367. result.push(""+(value));
  9368. }
  9369. return result;
  9370. };
  9371. /**
  9372. * Create a new node, either by creating a new JSONArray for the node, or by extending an existing JSONArray (from the table rows). The array will have numFields+2 entries. The value at index numFields is keyValue; the value at index numFields+2, which is the children slot, is null.
  9373. * @param (Array) array Either an existing array, or null if a new (internal) node is to be created
  9374. * @param (int) numFields Number of fields in the RAVE 1 table; the returned array has numFields+2 entries
  9375. * @param (Object) keyValue Value of the entry at index numFields
  9376. * @return (Array) The array
  9377. */
  9378. com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter.makeNode = function(array, numFields, keyValue) {
  9379. var result = (array) ? array : [];
  9380. var targetLength = numFields + 2;
  9381. while (result.length < targetLength) {
  9382. result.push(null);
  9383. }
  9384. result[numFields] = keyValue;
  9385. result[numFields + 1] = null;
  9386. return result;
  9387. };
  9388. // $source: com/ibm/rave/library/Library
  9389. /************************************************************************
  9390. ** IBM Confidential
  9391. **
  9392. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9393. **
  9394. ** (C) Copyright IBM Corp. 2017
  9395. **
  9396. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9397. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9398. ************************************************************************/
  9399. // GENERATED
  9400. //@import com/ibm/rave/library/service/ErrorDispatcher (static) // ErrorDispatcher
  9401. //@import com/ibm/rave/library/datamodel/ext/Rave1TableImporter (static) // new
  9402. //@import com/ibm/rave/library/datamodel/ext/Rave1HierarchyImporter (static) // new
  9403. //@import com/ibm/rave/library/service/BundleService (static) // BundleService
  9404. //@import com/ibm/rave/library/service/LibraryExtensionService (static) // LibraryExtensionService
  9405. //@import com/ibm/rave/library/palette/internal/PaletteManager (static) // new
  9406. /**
  9407. * Service to manage loaded bundles and provide common utilities.
  9408. */
  9409. var com_ibm_rave_library_Library = rave['internal']['Declare']({
  9410. //constructor : function() {}
  9411. });
  9412. com_ibm_rave_library_Library.getLibraryData = function() {
  9413. var libraryData = rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().getData("LIBRARY_DATA_KEY");
  9414. if (!libraryData) {
  9415. libraryData = new com_ibm_rave_library_Library.LibraryData();
  9416. rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().putData("LIBRARY_DATA_KEY", libraryData);
  9417. }
  9418. return libraryData;
  9419. };
  9420. /**
  9421. * Set the error code and corresponding error message (using the standard error message for that error code).
  9422. * @param (int) code Error code
  9423. */
  9424. com_ibm_rave_library_Library.logError$0 = function(code) {
  9425. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.logError$0(code);
  9426. };
  9427. /**
  9428. * Set the error code and corresponding error message, and the location.
  9429. * @param (int) code Error code
  9430. * @param (String) location Error location
  9431. */
  9432. com_ibm_rave_library_Library.logError$1 = function(code, location) {
  9433. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.logError$1(code, location);
  9434. };
  9435. com_ibm_rave_library_Library.logError$2 = function(code, location, bundleName) {
  9436. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.logError$2(code, location, bundleName);
  9437. };
  9438. /**
  9439. * Retrieve a data importer that has been registered with the Library. DataImporter's are a convenience utility included with some bundles to enable specific data format conversions and/or input methods.
  9440. */
  9441. /** @expose */
  9442. com_ibm_rave_library_Library.getDataImporter = function(importerName) {
  9443. return com_ibm_rave_library_Library.getLibraryData()._dataImporters[importerName];
  9444. };
  9445. /**
  9446. * Register a data importer with a given name.
  9447. */
  9448. /** @expose */
  9449. com_ibm_rave_library_Library.registerDataImporter = function(importerName, dataImporter) {
  9450. com_ibm_rave_library_Library.getLibraryData()._dataImporters[importerName] = dataImporter;
  9451. };
  9452. /**
  9453. * Set an error handler callback. The provided callback function will be invoked when an error occurs
  9454. * @param (com.ibm.rave.library.service.LibraryError.ReportError) errorReporter
  9455. */
  9456. /** @expose */
  9457. com_ibm_rave_library_Library.onError = function(errorReporter) {
  9458. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.setReporter(errorReporter);
  9459. };
  9460. /**
  9461. * Dispatch error
  9462. * @param (com.ibm.rave.library.service.LibraryError) error
  9463. */
  9464. /** @expose */
  9465. com_ibm_rave_library_Library.error = function(error) {
  9466. com_ibm_rave_library_service_ErrorDispatcher.INSTANCE.error(error);
  9467. };
  9468. /**
  9469. * Builds the data importer map. Includes registration of data importers included with the library.
  9470. */
  9471. com_ibm_rave_library_Library.buildImporterMap = function() {
  9472. var importers = {};
  9473. importers["rave1"] = new com_ibm_rave_library_datamodel_ext_Rave1TableImporter();
  9474. importers[com_ibm_rave_library_Library.RAVE1_HIERARCHY_IMPORTER_KEY] = new com_ibm_rave_library_datamodel_ext_Rave1HierarchyImporter();
  9475. return importers;
  9476. };
  9477. /**
  9478. * Utility method to generate a unique id. This will typically be used by the {@link this.Bundle#this.create()} method to generate an ID for each Bundle Instance.
  9479. */
  9480. /** @expose */
  9481. com_ibm_rave_library_Library._generateId = function() {
  9482. return "_raveLibId_" + (com_ibm_rave_library_Library.getLibraryData().idCounter++) + "_";
  9483. };
  9484. /** @expose */
  9485. com_ibm_rave_library_Library.logError = function(a0, a1, a2) {
  9486. var args = arguments;
  9487. if (args.length == 1) {
  9488. return com_ibm_rave_library_Library.logError$0(a0);
  9489. }
  9490. if (args.length == 2) {
  9491. return com_ibm_rave_library_Library.logError$1(a0, a1);
  9492. }
  9493. return com_ibm_rave_library_Library.logError$2(a0, a1, a2);
  9494. };
  9495. com_ibm_rave_library_Library.LibraryData = rave['internal']['Declare']({
  9496. //_dataImporters : null,
  9497. idCounter : 0,
  9498. constructor : function() {
  9499. this._dataImporters = com_ibm_rave_library_Library.buildImporterMap();
  9500. }
  9501. });
  9502. com_ibm_rave_library_Library.RAVE1_TABULAR_IMPORTER_KEY = "rave1";
  9503. com_ibm_rave_library_Library.RAVE1_HIERARCHY_IMPORTER_KEY = "rave1hierarchy";
  9504. //com_ibm_rave_library_Library.LIBRARY_DATA_KEY = "LIBRARY_DATA_KEY";
  9505. /**
  9506. * Registry where loaded bundles are made accessible.
  9507. */
  9508. /** @expose */
  9509. com_ibm_rave_library_Library.bundle = com_ibm_rave_library_service_BundleService.INSTANCE;
  9510. /**
  9511. * Registry where loaded extensions are made accessible.
  9512. */
  9513. /** @expose */
  9514. com_ibm_rave_library_Library.extensions = com_ibm_rave_library_service_LibraryExtensionService.INSTANCE;
  9515. /**
  9516. * Manager for palette information.
  9517. * @see (com.ibm.rave.library.palette.internal.PaletteManager) PaletteManager
  9518. */
  9519. /** @expose */
  9520. com_ibm_rave_library_Library.palettes = new com_ibm_rave_library_palette_internal_PaletteManager();
  9521. // $source: com/ibm/rave/library/palette/internal/CategoricalPalette
  9522. /************************************************************************
  9523. ** IBM Confidential
  9524. **
  9525. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9526. **
  9527. ** (C) Copyright IBM Corp. 2017
  9528. **
  9529. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9530. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9531. ************************************************************************/
  9532. // GENERATED
  9533. //@import com/ibm/rave/library/palette/Palette (loadtime) // INVALID_DOMAIN_NULL, VALID_DOMAIN, superclass
  9534. /**
  9535. * A Simple palette object Colors are stored in a simple Array and the value returned us indexed by the data
  9536. */
  9537. var com_ibm_rave_library_palette_internal_CategoricalPalette = rave['internal']['Declare'](com_ibm_rave_library_palette_Palette, {
  9538. /**
  9539. * the scale for the color
  9540. */
  9541. //colors : null,
  9542. /**
  9543. * the domain to use when domain is invalid
  9544. */
  9545. invalidDomainEntry : "",
  9546. _$functionClassMethod : function() {
  9547. var _$self = /**
  9548. * Get a color value for the given data will return null if the data is null
  9549. * @param (rave['internal']['SceneNode']) this the context in which this method is invoked
  9550. * @param (Object) data a data value, may be <code>null</code>
  9551. * @param (int) index the index of the current scene node
  9552. * @param (int) groupIndex the group index of the current scene node
  9553. * @return (Object) a computed value
  9554. */
  9555. function(data, index, groupIndex) {
  9556. var dataValue;
  9557. if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.VALID_DOMAIN) {
  9558. dataValue = _$self.dataAccessor(data);
  9559. } else if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL) {
  9560. dataValue = _$self.invalidDomainEntry;
  9561. } else {
  9562. dataValue = null;
  9563. }
  9564. return dataValue != null ? _$self.colors.call(this, dataValue, index, groupIndex) : _$self.nullColor;
  9565. };
  9566. return _$self;
  9567. },
  9568. /**
  9569. * @param (Object) jsonPalette
  9570. */
  9571. constructor : function(jsonPalette) {
  9572. this.type = com_ibm_rave_library_palette_internal_CategoricalPalette.Type;
  9573. this.colors = rave.scale.ordinal();
  9574. this.addAllColors(jsonPalette["fills"]);
  9575. },
  9576. /** @expose */
  9577. addColor : function(color) {
  9578. var range = this.colors.range();
  9579. range.push(""+(color));
  9580. this.colors.range(range);
  9581. },
  9582. /** @expose */
  9583. removeColor : function(color) {
  9584. var range = this.colors.range();
  9585. var index = range.indexOf(""+(color));
  9586. if (index != -1) {
  9587. range.splice(index, 1);
  9588. }
  9589. this.colors.range(range);
  9590. },
  9591. /** @expose */
  9592. addAllColors : function(colorArray) {
  9593. var range = [];
  9594. for (var __i_enFor0 = 0, __exp_enFor0 = colorArray, __len_enFor0 = __exp_enFor0.length;
  9595. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  9596. var color = __exp_enFor0[__i_enFor0];
  9597. range.push(""+(color));
  9598. }
  9599. this.colors.range(range);
  9600. },
  9601. /** @expose */
  9602. domain : function(domain) {
  9603. this.colors.domain(domain);
  9604. },
  9605. /** @expose */
  9606. getScale : function() {
  9607. return this.colors;
  9608. },
  9609. setData$0 : function(domain, dataSet, slot) {
  9610. this.setInvalidDomainEntry(dataSet, slot);
  9611. com_ibm_rave_library_palette_Palette.prototype.setData$0.call(this, domain, dataSet, slot);
  9612. },
  9613. setData$1 : function(dataSet, slot) {
  9614. this.setInvalidDomainEntry(dataSet, slot);
  9615. com_ibm_rave_library_palette_Palette.prototype.setData$1.call(this, dataSet, slot);
  9616. },
  9617. /**
  9618. * Set the invalid domain entry
  9619. * @param (com.ibm.rave.library.datamodel.DataSet) dataSet the data set
  9620. * @param (String) slot the slot name
  9621. */
  9622. setInvalidDomainEntry : function(dataSet, slot) {
  9623. var dataSlot = dataSet.slot(slot);
  9624. if (dataSlot) {
  9625. this.invalidDomainEntry = dataSlot.overrideLabel();
  9626. if (this.invalidDomainEntry == null) {
  9627. this.invalidDomainEntry = dataSlot.descriptor().label();
  9628. }
  9629. } else {
  9630. this.invalidDomainEntry = dataSet.descriptor().label();
  9631. }
  9632. },
  9633. /** @expose */
  9634. invalidateDomain : function() {
  9635. this.domain([this.invalidDomainEntry]);
  9636. },
  9637. /**
  9638. * Can the palette handle the data type
  9639. * @return (boolean) whether the palette can handle the data type
  9640. */
  9641. /** @expose */
  9642. canHandleDataType : function(type) {
  9643. return true;
  9644. },
  9645. /** @expose */
  9646. setData : function(a0, a1, a2) {
  9647. var args = arguments;
  9648. if (args.length == 2) {
  9649. return this.setData$1(a0, a1);
  9650. }
  9651. return this.setData$0(a0, a1, a2);
  9652. }
  9653. });
  9654. /**
  9655. * the palette type
  9656. */
  9657. com_ibm_rave_library_palette_internal_CategoricalPalette.Type = "categorical";
  9658. // $source: com/ibm/rave/library/framework/internal/LinearCoordinateScale
  9659. /************************************************************************
  9660. ** IBM Confidential
  9661. **
  9662. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9663. **
  9664. ** (C) Copyright IBM Corp. 2018
  9665. **
  9666. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9667. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9668. ************************************************************************/
  9669. // GENERATED
  9670. //@import com/ibm/rave/library/framework/internal/CoordinateScaleImpl (loadtime) // superclass
  9671. /**
  9672. * <p> CoordinateScale implementation wrapping a linear scale with a numeric domain. The domain of the scale is passed to the constructor, and must be a non-null array of at least two numbers or the core scale will throw an exception. </p> <p> {@link #this.setWidth()} sets the band width, and {@link #this.width()} returns it. {@link #this.center(Object)} returns the value of the linear scale applied to the argument, and {@link #this.lower(Object)} and {@link #this.upper(Object)} return the center value minus or plus half the width. The domain-modification methods ( {@link #this.includeZero()} etc.) modify the domain. </p>
  9673. */
  9674. var com_ibm_rave_library_framework_internal_LinearCoordinateScale = rave['internal']['Declare'](com_ibm_rave_library_framework_internal_CoordinateScaleImpl, {
  9675. /**
  9676. * The internal linear scale
  9677. */
  9678. //_scale : null,
  9679. /**
  9680. * The width in pixels; <I>half</I> the value passed to setWidth, to speed scale calculations.
  9681. */
  9682. _width : 0,
  9683. /**
  9684. * Private, use factory method.
  9685. */
  9686. constructor : function(domain) {
  9687. this._scale = rave.scale.linear().domain(domain);
  9688. this._width = 0.0;
  9689. },
  9690. /** @expose */
  9691. scale : function() {
  9692. return this._scale;
  9693. },
  9694. isContinuous : function() {
  9695. return true;
  9696. },
  9697. /** @expose */
  9698. isLinear : function() {
  9699. return true;
  9700. },
  9701. range : function(v1, v2, padding, outerPadding) {
  9702. this._scale.range([v1, v2]);
  9703. return this;
  9704. },
  9705. /** @expose */
  9706. center : function(data) {
  9707. return + (this._scale.call(null, data, 0, 0));
  9708. },
  9709. /** @expose */
  9710. lower : function(data) {
  9711. return + (this._scale.call(null, data, 0, 0)) - this._width;
  9712. },
  9713. /** @expose */
  9714. upper : function(data) {
  9715. return + (this._scale.call(null, data, 0, 0)) + this._width;
  9716. },
  9717. /** @expose */
  9718. width : function() {
  9719. return 2.0 * this._width;
  9720. },
  9721. setWidth : function(width) {
  9722. if (width >= 0.0) {
  9723. this._width = width / 2.0;
  9724. }
  9725. },
  9726. expandFraction : function(fraction, keepZero) {
  9727. if (fraction > 0.0) {
  9728. var d = this._scale.domain();
  9729. var d0 = (+ (d[0]));
  9730. var d1 = (+ (d[d.length - 1]));
  9731. var dd = fraction * (d1 - d0);
  9732. if (!keepZero || (+ (d[0])) != 0.0) {
  9733. d[0] = d0 - dd;
  9734. }
  9735. if (!keepZero || (+ (d[d.length - 1])) != 0.0) {
  9736. d[d.length - 1] = d1 + dd;
  9737. }
  9738. this._scale.domain(d);
  9739. }
  9740. return this;
  9741. },
  9742. expandPixels : function(pixels, keepZero) {
  9743. if (pixels > 0) {
  9744. var r = this._scale.range();
  9745. var dr = Math.abs((+ (r[0])) - (+ (r[r.length - 1])));
  9746. var reduction = 2.0 * pixels;
  9747. if (keepZero) {
  9748. var d = this._scale.domain();
  9749. if ((+ (d[0])) == 0.0 || (+ (d[d.length - 1])) == 0.0) {
  9750. reduction = pixels;
  9751. }
  9752. }
  9753. if (dr > reduction) {
  9754. return this.expandFraction(pixels / (dr - reduction), keepZero);
  9755. }
  9756. }
  9757. return this;
  9758. },
  9759. includeZero : function() {
  9760. var d = this._scale.domain();
  9761. var d0 = (+ (d[0]));
  9762. var d1 = (+ (d[d.length - 1]));
  9763. if (d0 * d1 > 0.0) {
  9764. if (Math.abs(d0) <= Math.abs(d1)) {
  9765. d[0] = 0.0;
  9766. } else {
  9767. d[d.length - 1] = 0.0;
  9768. }
  9769. this._scale.domain(d);
  9770. }
  9771. return this;
  9772. },
  9773. expandZeroExtent : function(keepZero) {
  9774. var d = this._scale.domain();
  9775. var extent = rave.extent(d);
  9776. var d0 = (+ (extent[0]));
  9777. var d1 = (+ (extent[1]));
  9778. if (d0 == d1) {
  9779. if (d0 == 0.0) {
  9780. if (!keepZero) {
  9781. d[0] = -1.0;
  9782. }
  9783. d[d.length - 1] = 1.0;
  9784. } else {
  9785. var del = Math.max(1.0, Math.abs(d0 / 100.0));
  9786. d[0] = d0 - del;
  9787. d[d.length - 1] = d0 + del;
  9788. }
  9789. this._scale.domain(d);
  9790. }
  9791. return this;
  9792. },
  9793. nice$1 : function() {
  9794. this._scale.nice();
  9795. return this;
  9796. },
  9797. nice$0 : function(magnitude) {
  9798. if (magnitude == null) {
  9799. this._scale.nice();
  9800. } else {
  9801. this._scale.nice(10, magnitude);
  9802. }
  9803. return this;
  9804. },
  9805. nice : function(a0) {
  9806. var args = arguments;
  9807. if (args.length == 0) {
  9808. return this.nice$1();
  9809. }
  9810. return this.nice$0(a0);
  9811. }
  9812. });
  9813. /**
  9814. * Construct a CoordinateScale wrapping a linear scale with the given domain. The domain must be a non-empty array of numbers and have at least two values; otherwise a RAVE core exception will be thrown as the internal linear scale is constructed. If the domain is null, returns null.
  9815. * @param (Array) domain The domain
  9816. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) Linear coordinate scale
  9817. */
  9818. com_ibm_rave_library_framework_internal_LinearCoordinateScale.create = function(domain) {
  9819. return domain ? new com_ibm_rave_library_framework_internal_LinearCoordinateScale(domain) : null;
  9820. };
  9821. // $source: com/ibm/rave/library/framework/internal/OrdinalCoordinateScale
  9822. /************************************************************************
  9823. ** IBM Confidential
  9824. **
  9825. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9826. **
  9827. ** (C) Copyright IBM Corp. 2017
  9828. **
  9829. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9830. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9831. ************************************************************************/
  9832. // GENERATED
  9833. //@import com/ibm/rave/library/framework/internal/CoordinateScaleImpl (loadtime) // useRounding, superclass
  9834. /**
  9835. * <p> CoordinateScale implementation wrapping an ordinal scale. The domain of the scale is passed to the constructor, and must be non-null. </p> <p> The scale is configured with bands, and the coordinate methods ( {@link #this.center(Object)} etc.) return the coordinates for those bands. The domain-modification methods ( {@link #this.includeZero()} etc.) do nothing. </p>
  9836. */
  9837. var com_ibm_rave_library_framework_internal_OrdinalCoordinateScale = rave['internal']['Declare'](com_ibm_rave_library_framework_internal_CoordinateScaleImpl, {
  9838. /**
  9839. * The internal ordinal scale
  9840. */
  9841. //_scale : null,
  9842. //_originalDomain : null,
  9843. //_originalDomainLabelAccessor : null,
  9844. /**
  9845. * The width in pixels; <I>half</I> the value passed to setWidth, to speed scale calculations.
  9846. */
  9847. _width : 0.0,
  9848. /**
  9849. * width has effect only if this is set true, otherwise we revert to default behavior
  9850. */
  9851. _applyWidth : false,
  9852. /**
  9853. * Private, use factory method.
  9854. */
  9855. constructor : function(domain, originalDomain) {
  9856. this._scale = rave.scale.ordinal().domain(domain);
  9857. this._originalDomain = originalDomain;
  9858. },
  9859. /** @expose */
  9860. scale : function() {
  9861. return this._scale;
  9862. },
  9863. /** @expose */
  9864. isOrdinal : function() {
  9865. return true;
  9866. },
  9867. range : function(v1, v2, padding, outerPadding) {
  9868. if (com_ibm_rave_library_framework_internal_CoordinateScaleImpl.useRounding(v1, v2, this._scale.domain().length, padding, outerPadding)) {
  9869. this._scale.rangeRoundBands([v1, v2], padding, outerPadding);
  9870. } else {
  9871. this._scale.rangeBands([v1, v2], padding, outerPadding);
  9872. }
  9873. return this;
  9874. },
  9875. /**
  9876. * The center is actually the scale value plus half the rangeBand value.
  9877. */
  9878. /** @expose */
  9879. center : function(data) {
  9880. var v = (this._scale.call(null, data, 0, 0));
  9881. if (v != null) {
  9882. return v + + (this._scale.rangeBand()) / 2.0;
  9883. }
  9884. return v;
  9885. },
  9886. /**
  9887. * If the width has been set (it is greater than 0) then we return the center minus the width (actually, half the width), otherwise, we return the scale value, which is actually at the bottom of the element.
  9888. */
  9889. /** @expose */
  9890. lower : function(data) {
  9891. var v = (this._scale.call(null, data, 0, 0) != null) ? + (this._scale.call(null, data, 0, 0)) : null;
  9892. if (v != null) {
  9893. if (this._applyWidth && this._width > 0.0) {
  9894. return v + (+ (this._scale.rangeBand()) / 2.0) - this._width;
  9895. }
  9896. return (this._scale.call(null, data, 0, 0) != null) ? + (this._scale.call(null, data, 0, 0)) : null;
  9897. }
  9898. return v;
  9899. },
  9900. /**
  9901. * If the width has been set (it is greater than 0) then we return the center plus the width (actually, half the width), otherwise, we return the scale value plus the rangeBand value.
  9902. */
  9903. /** @expose */
  9904. upper : function(data) {
  9905. var v = (this._scale.call(null, data, 0, 0));
  9906. if (v != null) {
  9907. if (this._applyWidth && this._width > 0.0) {
  9908. return v + (+ (this._scale.rangeBand()) / 2.0) + this._width;
  9909. }
  9910. return v + + (this._scale.rangeBand());
  9911. }
  9912. return v;
  9913. },
  9914. /** @expose */
  9915. width : function() {
  9916. if (this._applyWidth && this._width > 0.0) {
  9917. return 2.0 * this._width;
  9918. }
  9919. return + (this._scale.rangeBand());
  9920. },
  9921. setWidth : function(width) {
  9922. if (width >= 0.0) {
  9923. this._width = width / 2.0;
  9924. } else {
  9925. this._width = 0.0;
  9926. }
  9927. },
  9928. applyWidth : function(apply) {
  9929. this._applyWidth = apply;
  9930. },
  9931. originalDomain : function() {
  9932. return this._originalDomain;
  9933. },
  9934. originalDomainLabelAccessor$0 : function(format) {
  9935. this._originalDomainLabelAccessor = format;
  9936. },
  9937. originalDomainLabelAccessor$1 : function() {
  9938. return this._originalDomainLabelAccessor;
  9939. },
  9940. originalDomainLabelAccessor : function(a0) {
  9941. var args = arguments;
  9942. if (args.length == 0) {
  9943. return this.originalDomainLabelAccessor$1();
  9944. }
  9945. return this.originalDomainLabelAccessor$0(a0);
  9946. }
  9947. });
  9948. com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create$0 = function(domain, originalDomain) {
  9949. return domain ? new com_ibm_rave_library_framework_internal_OrdinalCoordinateScale(domain, originalDomain) : null;
  9950. };
  9951. /**
  9952. * Construct a CoordinateScale wrapping an ordinal scale with the given domain. If the domain is null, returns null.
  9953. * @param (Array) domain The domain
  9954. * @return (com.ibm.rave.library.framework.internal.OrdinalCoordinateScale) Ordinal coordinate scale
  9955. */
  9956. com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create$1 = function(domain) {
  9957. return domain ? new com_ibm_rave_library_framework_internal_OrdinalCoordinateScale(domain, null) : null;
  9958. };
  9959. com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create = function(a0, a1) {
  9960. var args = arguments;
  9961. if (args.length == 1) {
  9962. return com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create$1(a0);
  9963. }
  9964. return com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create$0(a0, a1);
  9965. };
  9966. // $source: com/ibm/rave/library/framework/internal/TimeCoordinateScale
  9967. /************************************************************************
  9968. ** IBM Confidential
  9969. **
  9970. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  9971. **
  9972. ** (C) Copyright IBM Corp. 2017
  9973. **
  9974. ** The source code for this program is not published or otherwise divested of its trade secrets,
  9975. ** irrespective of what has been deposited with the U.S. Copyright Office.
  9976. ************************************************************************/
  9977. // GENERATED
  9978. //@import com/ibm/rave/library/framework/internal/CoordinateScaleImpl (loadtime) // superclass
  9979. /**
  9980. * <p> CoordinateScale implementation wrapping a linear scale with a time domain. The domain of the scale is passed to the constructor, and must be a non-null array of at least two times or the core scale will throw an exception. </p> <p> {@link #this.setWidth()} sets the band width, and {@link #this.width()} returns it. {@link #this.center(Object)} returns the value of the linear scale applied to the argument, and {@link #this.lower(Object)} and {@link #this.upper(Object)} return the center value minus or plus half the width. </p> <p> {@link #this.expandPixels(, )} and {@link #this.expandFraction(, )} work by converting the dates to numbers with getTime(), expanding the number range, and constructing dates from the resulting times. The boolean keepZero argument does nothing in these methods since zero has no meaning in time data. {@link #this.includeZero()} does nothing, for the same reason. </p>
  9981. */
  9982. var com_ibm_rave_library_framework_internal_TimeCoordinateScale = rave['internal']['Declare'](com_ibm_rave_library_framework_internal_CoordinateScaleImpl, {
  9983. /**
  9984. * The internal linear time scale
  9985. */
  9986. //_scale : null,
  9987. /**
  9988. * The width in pixels; <I>half</I> the value passed to setWidth.
  9989. */
  9990. _width : 0,
  9991. /**
  9992. * Private, use factory method.
  9993. */
  9994. constructor : function(domain) {
  9995. this._scale = rave.time.scale();
  9996. this._scale.domain(domain);
  9997. this._width = 0.0;
  9998. },
  9999. /** @expose */
  10000. scale : function() {
  10001. return this._scale;
  10002. },
  10003. isContinuous : function() {
  10004. return true;
  10005. },
  10006. /** @expose */
  10007. isTime : function() {
  10008. return true;
  10009. },
  10010. range : function(v1, v2, padding, outerPadding) {
  10011. this._scale.range([v1, v2]);
  10012. return this;
  10013. },
  10014. /** @expose */
  10015. center : function(data) {
  10016. return + (this._scale.call(null, data, 0, 0));
  10017. },
  10018. /** @expose */
  10019. lower : function(data) {
  10020. return + (this._scale.call(null, data, 0, 0)) - this._width;
  10021. },
  10022. /** @expose */
  10023. upper : function(data) {
  10024. return + (this._scale.call(null, data, 0, 0)) + this._width;
  10025. },
  10026. /** @expose */
  10027. width : function() {
  10028. return 2.0 * this._width;
  10029. },
  10030. setWidth : function(width) {
  10031. if (width >= 0.0) {
  10032. this._width = width / 2.0;
  10033. }
  10034. },
  10035. expandFraction : function(fraction, keepZero) {
  10036. if (fraction > 0.0) {
  10037. var d = this._scale.domain();
  10038. var d0 = (d[0]).getTime();
  10039. var d1 = (d[d.length - 1]).getTime();
  10040. var dd = Math.round(fraction * (d1 - d0));
  10041. d[0] = new Date(d0 - dd);
  10042. d[d.length - 1] = new Date(d1 + dd);
  10043. this._scale.domain(d);
  10044. }
  10045. return this;
  10046. },
  10047. expandPixels : function(pixels, keepZero) {
  10048. if (pixels > 0) {
  10049. var r = this._scale.range();
  10050. var dr = Math.abs((+ (r[0])) - (+ (r[r.length - 1])));
  10051. var reduction = 2.0 * pixels;
  10052. if (dr > reduction) {
  10053. return this.expandFraction(pixels / (dr - reduction), keepZero);
  10054. }
  10055. }
  10056. return this;
  10057. },
  10058. expandZeroExtent : function(keepZero) {
  10059. var d = this._scale.domain();
  10060. var extent = rave.extent(d);
  10061. var d0 = (extent[0]).getTime();
  10062. var d1 = (extent[1]).getTime();
  10063. if (d0 == d1) {
  10064. d[0] = new Date(d0 - 1000);
  10065. d[d.length - 1] = new Date(d0 + 1000);
  10066. this._scale.domain(d);
  10067. }
  10068. return this;
  10069. },
  10070. nice : function() {
  10071. this._scale.nice();
  10072. return this;
  10073. }
  10074. });
  10075. /**
  10076. * Construct a CoordinateScale wrapping a linear time scale with the given domain. The domain must be a non-empty array of numbers and have at least two values; otherwise a RAVE core exception will be thrown as the internal linear scale is constructed. If the domain is null, returns null.
  10077. * @param (Array) domain The domain
  10078. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) Linear coordinate scale
  10079. */
  10080. com_ibm_rave_library_framework_internal_TimeCoordinateScale.create = function(domain) {
  10081. return domain ? new com_ibm_rave_library_framework_internal_TimeCoordinateScale(domain) : null;
  10082. };
  10083. // $source: com/ibm/rave/library/framework/internal/ScaleManager
  10084. /************************************************************************
  10085. ** IBM Confidential
  10086. **
  10087. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10088. **
  10089. ** (C) Copyright IBM Corp. 2017
  10090. **
  10091. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10092. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10093. ************************************************************************/
  10094. // GENERATED
  10095. //@import com/ibm/rave/library/framework/internal/LinearCoordinateScale (static) // create
  10096. //@import com/ibm/rave/library/framework/internal/OrdinalCoordinateScaleDatum (static) // new
  10097. //@import com/ibm/rave/library/framework/internal/OrdinalCoordinateScale (runtime) // create
  10098. //@import com/ibm/rave/library/framework/internal/TimeCoordinateScale (static) // create
  10099. //@import com/ibm/rave/library/framework/internal/ClusteredCoordinateScale (runtime) // create
  10100. var com_ibm_rave_library_framework_internal_ScaleManager = rave['internal']['Declare']({
  10101. });
  10102. /**
  10103. * <p> Get the numeric domain of a value function applied to an array of data. The value function must be one that returns numbers or dates. </p> <p> If the data or value function is null, or if all values returned by applying the function to the data are null, returns null. </p> <p> Otherwise returns the pair [min,max] of minimum and maximum numbers or dates in the data. This is declared as an Object array to satisfy Java. </p>
  10104. * @param (Array) data Data array
  10105. * @param (rave['internal']['SingleValueFunction']) valueFunction Value function
  10106. * @return (Array) Domain as [min,max], or null
  10107. */
  10108. com_ibm_rave_library_framework_internal_ScaleManager.numericDomainWithValueFunction = function(data, valueFunction) {
  10109. if (!data || !valueFunction) {
  10110. return null;
  10111. }
  10112. var vf = function(d, i, g) {
  10113. return valueFunction(d);
  10114. };
  10115. var min = rave.min(data, vf);
  10116. if (min != null) {
  10117. return [min, rave.max(data, vf)];
  10118. }
  10119. return null;
  10120. };
  10121. /**
  10122. * <p> Get the numeric domain of a DataAccessor applied to an array of data. </p> <p> If the data or accessor is null, or if the accessor type is not NUMERIC or TIME, or if all values returned by applying the accessor to the data are null, returns null. </p> <p> If the data accessor defines a domain, returns that domain. </p> <p> Otherwise returns the pair [min,max] of minimum and maximum numbers in the data. This is declared as an Object array to satisfy Java. </p>
  10123. * @param (Array) data The data set's tabular data
  10124. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) accessor The typed accessor
  10125. * @return (Array) Domain as [min,max], or null
  10126. */
  10127. com_ibm_rave_library_framework_internal_ScaleManager.numericDomain = function(data, accessor) {
  10128. if (!data || !accessor || (!("numeric" == accessor.type$0()) && !("date" == accessor.type$0()))) {
  10129. return null;
  10130. }
  10131. if (accessor.domain$0()) {
  10132. return accessor.domain$0();
  10133. }
  10134. return com_ibm_rave_library_framework_internal_ScaleManager.numericDomainWithValueFunction(data, accessor.accessor$0());
  10135. };
  10136. /**
  10137. * <p> Get the ordinal domain of a value function applied to an array of data. The value function must be one that returns numbers, strings, or date. The dataType indicates the type, one of "numeric", "string", or "date" </p> <p> If the data or value function is null, or if all values returned by applying the function to the data are null, returns null. </p> <p> Otherwise returns a list of unique non-null values returned by the accessor. If sort is true they are sorted by their natural sort order. </p>
  10138. * @param (Array) data Data array
  10139. * @param (String) dataType Data type, one of "numeric", "string", or "date"
  10140. * @param (rave['internal']['SingleValueFunction']) valueFunction Value function
  10141. * @param (boolean) sort Whether to sort the returned domain
  10142. * @return (Array) list of values (possibly null)
  10143. */
  10144. com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomainWithValueFunction = function(data, dataType, valueFunction, sort) {
  10145. if (!data || !valueFunction) {
  10146. return null;
  10147. }
  10148. var set = {};
  10149. var list = [];
  10150. if ("date" == dataType) {
  10151. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  10152. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10153. var o = __exp_enFor0[__i_enFor0];
  10154. var v = valueFunction(o);
  10155. if (v != null) {
  10156. var t = (v).getTime();
  10157. if (!(set.hasOwnProperty(t))) {
  10158. set[t] = 1;
  10159. list.push(v);
  10160. }
  10161. }
  10162. }
  10163. } else {
  10164. for (var __i_enFor1 = 0, __exp_enFor1 = data, __len_enFor1 = __exp_enFor1.length;
  10165. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  10166. var o = __exp_enFor1[__i_enFor1];
  10167. var v = valueFunction(o);
  10168. if (v != null && !(set.hasOwnProperty(v))) {
  10169. set[v] = 1;
  10170. list.push(v);
  10171. }
  10172. }
  10173. }
  10174. if (sort) {
  10175. if ("numeric" == dataType) {
  10176. list.sort(function(o1, o2) {
  10177. return (+ (o1)) < (+ (o2)) ? -1 : 1;
  10178. });
  10179. } else if ("date" == dataType) {
  10180. list.sort(function(o1, o2) {
  10181. return (o1).getTime() < (o2).getTime() ? -1 : 1;
  10182. });
  10183. } else {
  10184. list.sort();
  10185. }
  10186. }
  10187. return list;
  10188. };
  10189. /**
  10190. * <p> Get the ordinal domain of a DataAccessor applied to an array of data. </p> <p> If the data or accessor is null, or if the accessor type is not NUMERIC, STRING, or TIME, or if all values returned by applying the accessor to the data are null, returns null. </p> <p> If the DataAccessor defines a domain, returns that domain. </p> <p> Otherwise returns a list of unique non-null values returned by the accessor, sorted by their natural sort order. </p>
  10191. * @param (Array) data The data
  10192. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) accessor The accessor
  10193. * @param (boolean) sort If true sort the ordinal data
  10194. * @return (Array) Domain as sorted unique non-null values, or null
  10195. */
  10196. com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0 = function(data, accessor, sort) {
  10197. if (!data || !accessor) {
  10198. return null;
  10199. }
  10200. var type = accessor.type$0();
  10201. if ("object" == type || "array" == type) {
  10202. return null;
  10203. }
  10204. if (accessor.domain$0()) {
  10205. return accessor.domain$0();
  10206. }
  10207. return com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomainWithValueFunction(data, type, accessor.accessor$0(), sort);
  10208. };
  10209. /**
  10210. * Same as ordinalDomain(data, accessor, false).
  10211. * @param (Array) data The data
  10212. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) accessor The accessor
  10213. * @return (Array) Domain as sorted unique non-null values, or null
  10214. */
  10215. com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$1 = function(data, accessor) {
  10216. return com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, accessor, false);
  10217. };
  10218. /**
  10219. * <p> Create a CoordinateScale for a DataAccessor applied to a tabular data set. The data is the tabular array from the data set. </p> <p> If the data or accessor is null, or if the accessor type is not STRING, NUMERIC, or DATE, returns null. Otherwise the domain is obtained from the accessor. </p> <p> The domain is the accessor's {@link this.DataSlotEntry#this.domain()} if that is non-null. Otherwise it is obtained by applying the accessor all data values. For continuous (numeric and date) accessors this gives the [min,max] of the non-null values produced. For string accessors it gives the list of unique non-null values, optionally sorted. </p> <p> If the domain is empty (all values are null, or the data is an empty array) a null scale is returned. Otherwise a non-null scale using the domain is returned. If the accessor is numeric, the scale wraps a core linear scale; if the accessor is string, the scale wraps a core ordinal scale; if the accessor is date, the scale wraps a core time scale. </p>
  10220. * @param (Array) data The tabular data
  10221. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) accessor The accessor
  10222. * @param (boolean) sortOrdinalDomain If true, ordinal (string) domains are sorted
  10223. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) CoordinateScale for the data, or null
  10224. */
  10225. com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$0 = function(data, accessor, sortOrdinalDomain) {
  10226. if (!data || !accessor) {
  10227. return null;
  10228. }
  10229. if ("numeric" == accessor.type$0()) {
  10230. var domain = com_ibm_rave_library_framework_internal_ScaleManager.numericDomain(data, accessor);
  10231. return domain ? com_ibm_rave_library_framework_internal_LinearCoordinateScale.create(domain) : null;
  10232. }
  10233. if ("string" == accessor.type$0()) {
  10234. var domain = null;
  10235. var originalDomain = null;
  10236. if (data && accessor) {
  10237. if (accessor.domain$0()) {
  10238. domain = accessor.domain$0();
  10239. var originalDomainMap = rave['internal']['ES6Map'].create();
  10240. for (var __i_enFor0 = 0, __exp_enFor0 = domain, __len_enFor0 = __exp_enFor0.length;
  10241. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10242. var key = __exp_enFor0[__i_enFor0];
  10243. originalDomainMap.set(key, new com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum(key));
  10244. }
  10245. for (var __i_enFor1 = 0, __exp_enFor1 = data, __len_enFor1 = __exp_enFor1.length;
  10246. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  10247. var o = __exp_enFor1[__i_enFor1];
  10248. var key = accessor(o);
  10249. var datum = originalDomainMap.get(key);
  10250. if (datum) {
  10251. datum.push(o);
  10252. }
  10253. }
  10254. originalDomain = [];
  10255. for (var __i_enFor2 = 0, __exp_enFor2 = domain, __len_enFor2 = __exp_enFor2.length;
  10256. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  10257. var d = __exp_enFor2[__i_enFor2];
  10258. originalDomain.push(originalDomainMap.get(d));
  10259. }
  10260. } else {
  10261. var set = {};
  10262. var list = [];
  10263. var originalDomainMap = rave['internal']['ES6Map'].create();
  10264. for (var __i_enFor3 = 0, __exp_enFor3 = data, __len_enFor3 = __exp_enFor3.length;
  10265. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  10266. var o = __exp_enFor3[__i_enFor3];
  10267. var v = accessor(o);
  10268. if (v != null) {
  10269. if (!(set.hasOwnProperty(v))) {
  10270. set[v] = 1;
  10271. list.push(v);
  10272. originalDomainMap.set(v, new com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum(v));
  10273. }
  10274. originalDomainMap.get(v).push(o);
  10275. }
  10276. }
  10277. if (sortOrdinalDomain) {
  10278. list.sort();
  10279. }
  10280. domain = list;
  10281. originalDomain = [];
  10282. for (var __i_enFor4 = 0, __exp_enFor4 = domain, __len_enFor4 = __exp_enFor4.length;
  10283. __i_enFor4 < __len_enFor4; ++__i_enFor4) {
  10284. var d = __exp_enFor4[__i_enFor4];
  10285. originalDomain.push(originalDomainMap.get(d));
  10286. }
  10287. }
  10288. }
  10289. var s = com_ibm_rave_library_framework_internal_OrdinalCoordinateScale.create$0(domain, originalDomain);
  10290. s.originalDomainLabelAccessor$0(function(data, index, groupIndex) {
  10291. var key = (data).key();
  10292. return ""+(key);
  10293. });
  10294. return domain.length > 0 ? s : null;
  10295. }
  10296. if ("date" == accessor.type$0()) {
  10297. var domain = com_ibm_rave_library_framework_internal_ScaleManager.numericDomain(data, accessor);
  10298. return domain ? com_ibm_rave_library_framework_internal_TimeCoordinateScale.create(domain) : null;
  10299. }
  10300. return null;
  10301. };
  10302. /**
  10303. * Same as makeCoordinateScale(data, accessor, false).
  10304. * @param (Array) data The tabular data
  10305. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) accessor The accessor
  10306. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) CoordinateScale for the data, or null
  10307. */
  10308. com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$1 = function(data, accessor) {
  10309. return com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$0(data, accessor, false);
  10310. };
  10311. /**
  10312. * <p> Create a clustered CoordinateScale for an array of DataAccessors applied to a tabular data set. The data is the tabular array from the data set. The accessors are used to get ordinal domains for scales with {@link #this.ordinalDomain(Array, com_ibm_rave_library_datamodel_DataSlotEntry)} , and the clustered scale has one internal scale per accessor in order. </p> <p> If the data or accessor array is null, or if there are no non-null accessors, or if any accessor produces a null ordinal domain, returns null. </p> <p> TODO. This assumes that all accessors are for the same data set so we only need one data array. </p>
  10313. * @param (Array) data The tabular data
  10314. * @param (Array) accessors The accessors
  10315. * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) CoordinateScale for the clustered data, or null
  10316. */
  10317. com_ibm_rave_library_framework_internal_ScaleManager.makeClusteredScale = function(data, accessors) {
  10318. if (!data || !accessors || accessors.length == 0) {
  10319. return null;
  10320. }
  10321. var domains = [];
  10322. for (var __i_enFor0 = 0, __exp_enFor0 = accessors, __len_enFor0 = __exp_enFor0.length;
  10323. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10324. var accessor = __exp_enFor0[__i_enFor0];
  10325. var domain = com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, accessor, false);
  10326. if (!domain || domain.length == 0) {
  10327. return null;
  10328. }
  10329. domains.push(domain);
  10330. }
  10331. var domain = domains[0];
  10332. var originalDomainMap = rave['internal']['ES6Map'].create();
  10333. for (var __i_enFor1 = 0, __exp_enFor1 = domain, __len_enFor1 = __exp_enFor1.length;
  10334. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  10335. var key = __exp_enFor1[__i_enFor1];
  10336. originalDomainMap.set(key, new com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum(key));
  10337. }
  10338. for (var __i_enFor2 = 0, __exp_enFor2 = data, __len_enFor2 = __exp_enFor2.length;
  10339. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  10340. var o = __exp_enFor2[__i_enFor2];
  10341. var key = accessors[0](o);
  10342. var datum = originalDomainMap.get(key);
  10343. if (datum) {
  10344. datum.push(o);
  10345. }
  10346. }
  10347. var originalDomain = [];
  10348. for (var __i_enFor3 = 0, __exp_enFor3 = domain, __len_enFor3 = __exp_enFor3.length;
  10349. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  10350. var key = __exp_enFor3[__i_enFor3];
  10351. originalDomain.push(originalDomainMap.get(key));
  10352. }
  10353. var s = com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$1(domains, originalDomain);
  10354. s.originalDomainLabelAccessor$0(function(data, index, groupIndex) {
  10355. var key = (data).key();
  10356. return ""+(key);
  10357. });
  10358. return s;
  10359. };
  10360. com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain = function(a0, a1, a2) {
  10361. var args = arguments;
  10362. if (args.length == 2) {
  10363. return com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$1(a0, a1);
  10364. }
  10365. return com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(a0, a1, a2);
  10366. };
  10367. com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale = function(a0, a1, a2) {
  10368. var args = arguments;
  10369. if (args.length == 2) {
  10370. return com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$1(a0, a1);
  10371. }
  10372. return com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$0(a0, a1, a2);
  10373. };
  10374. // $source: com/ibm/rave/library/framework/internal/ClusteredCoordinateScale
  10375. /************************************************************************
  10376. ** IBM Confidential
  10377. **
  10378. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10379. **
  10380. ** (C) Copyright IBM Corp. 2017
  10381. **
  10382. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10383. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10384. ************************************************************************/
  10385. // GENERATED
  10386. //@import com/ibm/rave/library/framework/internal/CoordinateScaleImpl (loadtime) // useRounding, superclass
  10387. /**
  10388. * <p> CoordinateScale implementation wrapping a series of ordinal scales. This creates a clustered or nested scale, where the first scale defines bands, then the second defines bands within each of those bands, and so forth. The data arguments for the scale methods are arrays of values, one per scale. </p> <p> For example if the scale is created with the domains ["A","B","C"] and ["Y","Z"], the first scale will split the range into three parts, then the second will split each of those parts into two parts, for a total of six parts. The data argument ["A","Y"] will return the first part, ["A","Z"] the second, ["B","Y"] the third, and so on. </p> <p> Any null domains passed to the constructor are ignored. If the scale has no non-null domains, it is created as a single-level scale with an empty domain and all coordinate methods will return null. (This is never used in the library because the domains are pre-filtered by the factory method in CoordinateScale.) </p> <p> The {@link #this.scale()} method returns the first of the scales. This must be used with care, but is safe to use with the pan-zoom methods. </p> <p> The {@link #this.range(, , Number, Number)} method configures each of the internal scales with range bands. The first scale is configured with the given range [v1,v2]. Each subsequent scale is configured with the range [0,width] where width is the width of the previous scale (this range is reversed to [width,0] if the original v1 > v2, so that all ordinal scales run in the same direction). </p> <p> The {@link #this.width()} method returns the width of the last or innermost scale. This is the width of all bands at that level. </p> <p> The coordinate methods ( {@link #this.center(Object)} etc. all expect that their argument is an array of ordinal values. Each input value is used, in order, to get the coordinate from the corresponding scale, and these coordinates are summed to get the result (if any are null, null is returned). If the number of input values is less than the number of scales, the returned result is for the last scale used. However, an empty array always produces null. </p> <p> For example, in the previous example with scales using ["A","B","C"] and ["Y","Z"] and creating three first-level and six second-level bands, center(["B","Z"]) will return the center point of the fourth of the second-level bands. center(["B"]) will return the center point of the second of the first-level bands. center([]) is null. </p> <p> Although all the scales are ordinal, {@link #this.isOrdinal()} returns false. This is because the argument to the coordinates methods must be an array (ArrayEx in Java) of values. </p> <p> The domain-modification methods ( {@link #this.includeZero()} etc.) do nothing. </p> <p> When the scale is pan-zoomed using the RAVE core Zoom behavior, the {@link #this.width()} method returns the zoomed width of the innermost bands, and the coordinate methods return the pan-zoomed lower, center, and upper coordinates. </p>
  10389. */
  10390. var com_ibm_rave_library_framework_internal_ClusteredCoordinateScale = rave['internal']['Declare'](com_ibm_rave_library_framework_internal_CoordinateScaleImpl, {
  10391. /**
  10392. * The scales.
  10393. */
  10394. //_scales : null,
  10395. //_originalDomain : null,
  10396. //_originalDomainLabelAccessor : null,
  10397. /**
  10398. * The initial width of the first scale when range was applied.
  10399. */
  10400. _firstWidth : 0,
  10401. /**
  10402. * Private, use factory method.
  10403. */
  10404. constructor : function(domains, originalDomain) {
  10405. this._scales = [];
  10406. for (var __i_enFor0 = 0, __exp_enFor0 = domains, __len_enFor0 = __exp_enFor0.length;
  10407. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10408. var domain = __exp_enFor0[__i_enFor0];
  10409. this._scales.push(rave.scale.ordinal().domain(domain));
  10410. }
  10411. this._originalDomain = originalDomain;
  10412. this._firstWidth = 1.0;
  10413. },
  10414. /** @expose */
  10415. scale : function() {
  10416. return this._scales[0];
  10417. },
  10418. /** @expose */
  10419. isClustered : function() {
  10420. return true;
  10421. },
  10422. range : function(v1, v2, padding, outerPadding) {
  10423. var scale = this._scales[0];
  10424. if (com_ibm_rave_library_framework_internal_CoordinateScaleImpl.useRounding(v1, v2, scale.domain().length, padding, outerPadding)) {
  10425. scale.rangeRoundBands([v1, v2], padding, outerPadding);
  10426. } else {
  10427. scale.rangeBands([v1, v2], padding, outerPadding);
  10428. }
  10429. var width = + (scale.rangeBand());
  10430. this._firstWidth = width;
  10431. var rev = v2 < v1;
  10432. var s = this._scales.length;
  10433. for (var i = 1; i < s; ++i) {
  10434. scale = this._scales[i];
  10435. if (com_ibm_rave_library_framework_internal_CoordinateScaleImpl.useRounding(0.0, width, scale.domain().length, padding, outerPadding)) {
  10436. scale.rangeRoundBands(rev ? [width, 0] : [0, width], padding, outerPadding);
  10437. } else {
  10438. scale.rangeBands(rev ? [width, 0] : [0, width], padding, outerPadding);
  10439. }
  10440. width = + (scale.rangeBand());
  10441. }
  10442. return this;
  10443. },
  10444. /** @expose */
  10445. center : function(data) {
  10446. return this.getCoord(com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.toArray(data), 0.5);
  10447. },
  10448. /** @expose */
  10449. lower : function(data) {
  10450. return this.getCoord(com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.toArray(data), 0.0);
  10451. },
  10452. /** @expose */
  10453. upper : function(data) {
  10454. return this.getCoord(com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.toArray(data), 1.0);
  10455. },
  10456. /**
  10457. * Used by coordinate methods; get the lower coordinate for the given array of input values, then add wmult times the width. If any scale along the way produces null, null is returned. This does work with prefixes, where there are fewer data values than scales; but returns null if the data array is empty or null.
  10458. * @param (Array) data Array of data values
  10459. * @param (double) wmult Width multiplier, using width of last scale applied
  10460. * @return (Number) Scaled value
  10461. */
  10462. getCoord : function(data, wmult) {
  10463. if (!data || data.length == 0) {
  10464. return null;
  10465. }
  10466. var scale = this._scales[0];
  10467. var sum = 0.0;
  10468. var l = data.length < this._scales.length ? data.length : this._scales.length;
  10469. var zoomFactor = + (this._scales[0].rangeBand()) / this._firstWidth;
  10470. for (var i = 0; i < l; ++i) {
  10471. scale = this._scales[i];
  10472. var v = (scale.call(null, data[i], 0, 0) != null) ? + (scale.call(null, data[i], 0, 0)) : null;
  10473. if (v == null) {
  10474. return v;
  10475. }
  10476. sum += v * (i == 0 ? 1.0 : zoomFactor);
  10477. }
  10478. sum += wmult * + (scale.rangeBand()) * (data.length == 1 ? 1.0 : zoomFactor);
  10479. return sum;
  10480. },
  10481. /** @expose */
  10482. width : function() {
  10483. var v = + (this._scales[this._scales.length - 1].rangeBand());
  10484. if (this._scales.length > 1) {
  10485. v *= + (this._scales[0].rangeBand()) / this._firstWidth;
  10486. }
  10487. return v;
  10488. },
  10489. originalDomain : function() {
  10490. return this._originalDomain;
  10491. },
  10492. originalDomainLabelAccessor$0 : function(accessor) {
  10493. this._originalDomainLabelAccessor = accessor;
  10494. },
  10495. originalDomainLabelAccessor$1 : function() {
  10496. return this._originalDomainLabelAccessor;
  10497. },
  10498. originalDomainLabelAccessor : function(a0) {
  10499. var args = arguments;
  10500. if (args.length == 0) {
  10501. return this.originalDomainLabelAccessor$1();
  10502. }
  10503. return this.originalDomainLabelAccessor$0(a0);
  10504. }
  10505. });
  10506. /**
  10507. * Construct a CoordinateScale wrapping a clustered scale, using ordinal scales with the given domains. If the list is null or all the domains in the list are null, returns null.
  10508. * @param (Array) domains The domains
  10509. * @return (com.ibm.rave.library.framework.internal.ClusteredCoordinateScale) Clustered coordinate scale
  10510. */
  10511. com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$0 = function(domains) {
  10512. return com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$1(domains, null);
  10513. };
  10514. com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$1 = function(domains, originalDomain) {
  10515. if (!domains) {
  10516. return null;
  10517. }
  10518. var nonNullDomains = [];
  10519. for (var __i_enFor0 = 0, __exp_enFor0 = domains, __len_enFor0 = __exp_enFor0.length;
  10520. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10521. var domain = __exp_enFor0[__i_enFor0];
  10522. if (domain) {
  10523. nonNullDomains.push(domain);
  10524. }
  10525. }
  10526. return (nonNullDomains.length == 0) ? null : new com_ibm_rave_library_framework_internal_ClusteredCoordinateScale(nonNullDomains, originalDomain);
  10527. };
  10528. /**
  10529. * Convert an object into a single element array (if it's not already a list). <p> For clustered single-element accessors (like lines). We are only concerned with the outer scale. Create a single element array from our single data point - this will be mapped to coordinates in the outer scale.
  10530. */
  10531. com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.toArray = function(data) {
  10532. var arrayData;
  10533. if (!((typeof data === "array" || data instanceof Array))) {
  10534. arrayData = [];
  10535. arrayData.push(data);
  10536. } else {
  10537. arrayData = data;
  10538. }
  10539. return arrayData;
  10540. };
  10541. com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create = function(a0, a1) {
  10542. var args = arguments;
  10543. if (args.length == 1) {
  10544. return com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$0(a0);
  10545. }
  10546. return com_ibm_rave_library_framework_internal_ClusteredCoordinateScale.create$1(a0, a1);
  10547. };
  10548. // $source: com/ibm/rave/library/palette/internal/ContinuousPalette
  10549. /************************************************************************
  10550. ** IBM Confidential
  10551. **
  10552. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10553. **
  10554. ** (C) Copyright IBM Corp. 2017
  10555. **
  10556. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10557. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10558. ************************************************************************/
  10559. // GENERATED
  10560. //@import com/ibm/rave/library/palette/Palette (loadtime) // INVALID_DOMAIN_NULL, INVALID_DOMAIN_EMPTY, superclass, INVALID_DOMAIN_DATATYPE
  10561. /**
  10562. * A continuous palette object The continuous palette will use either a linearscale or a threshold scale to interpolate the color value
  10563. */
  10564. var com_ibm_rave_library_palette_internal_ContinuousPalette = rave['internal']['Declare'](com_ibm_rave_library_palette_Palette, {
  10565. /**
  10566. * the scale for the color
  10567. */
  10568. //colorScale : null,
  10569. /**
  10570. * normalized or absolute value type
  10571. */
  10572. //valueType : null,
  10573. /**
  10574. * continuous or discrete fill type
  10575. */
  10576. //fillType : null,
  10577. /**
  10578. * upper color
  10579. */
  10580. //upper : null,
  10581. /**
  10582. * lower color
  10583. */
  10584. //lower : null,
  10585. /**
  10586. * the normalized values
  10587. */
  10588. //normalizedValues : null,
  10589. /**
  10590. * minimum value
  10591. */
  10592. minValue : 1.7976931348623157E308,
  10593. /**
  10594. * maximum value
  10595. */
  10596. maxValue : 4.9E-324,
  10597. _$functionClassMethod : function() {
  10598. var _$self = function(data, index, groupIndex) {
  10599. var dataValue = _$self.dataAccessor ? _$self.dataAccessor(data) : null;
  10600. if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL) {
  10601. dataValue = 0.5;
  10602. } else if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_EMPTY) {
  10603. dataValue = null;
  10604. } else if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_DATATYPE) {
  10605. dataValue = (dataValue != null || _$self.nullColor == null) ? 0.5 : null;
  10606. }
  10607. if (dataValue != null) {
  10608. var isContinuous = "continuous" == _$self.fillType;
  10609. var doubleValue = + (dataValue);
  10610. if (doubleValue < _$self.minValue && _$self.lower != null && isContinuous) {
  10611. return _$self.lower;
  10612. } else if (doubleValue > _$self.maxValue && _$self.upper != null) {
  10613. return _$self.upper;
  10614. } else if (doubleValue >= _$self.maxValue && !isContinuous) {
  10615. return _$self.colorScale.range()[_$self.colorScale.range().length - 1];
  10616. } else if (isContinuous && (doubleValue > _$self.maxValue)) {
  10617. return _$self.colorScale.call(this, _$self.maxValue, index, groupIndex);
  10618. } else if (isContinuous && (doubleValue < _$self.minValue)) {
  10619. return _$self.colorScale.call(this, _$self.minValue, index, groupIndex);
  10620. } else {
  10621. return _$self.colorScale.call(this, doubleValue, index, groupIndex);
  10622. }
  10623. } else {
  10624. return _$self.nullColor;
  10625. }
  10626. };
  10627. return _$self;
  10628. },
  10629. constructor : function(jsonPalette) {
  10630. this.valueType = "absolute";
  10631. this.fillType = "continuous";
  10632. this.normalizedValues = [];
  10633. /**
  10634. * Constructor for the continuous palette this constructor takes an array of colors represented by a json array
  10635. */
  10636. {
  10637. var fType = ""+(jsonPalette["fillType"]);
  10638. if ("discrete" == fType || "continuous" == fType) {
  10639. this.fillType = fType;
  10640. }
  10641. this.type = this.fillType;
  10642. if ("discrete" == this.fillType) {
  10643. this.colorScale = rave.scale.threshold();
  10644. } else {
  10645. this.colorScale = rave.scale.linear();
  10646. }
  10647. var vType = (jsonPalette["valueType"]);
  10648. if (vType != null) {
  10649. this.valueType = vType;
  10650. }
  10651. if (this.colorScale) {
  10652. this.addAllColors(jsonPalette["fills"]);
  10653. }
  10654. }
  10655. },
  10656. /**
  10657. * @return (String) the valueType
  10658. */
  10659. getValueType : function() {
  10660. return this.valueType;
  10661. },
  10662. /**
  10663. * @param colors
  10664. */
  10665. setupColorScale : function(domain, range) {
  10666. this.colorScale.range(range);
  10667. this.colorScale.domain(domain);
  10668. },
  10669. /** @expose */
  10670. addColor : function(color) {
  10671. var domain = this.colorScale.domain();
  10672. var range = this.colorScale.range();
  10673. this.addColorImpl(color, domain, range);
  10674. this.setupColorScale(domain, range);
  10675. },
  10676. addColorImpl : function(jsonColor, domain, range) {
  10677. var atValue = jsonColor["at"];
  10678. if ((typeof atValue === "string" || atValue instanceof String)) {
  10679. if ("lower" == atValue) {
  10680. this.lower = ""+(jsonColor["fill"]);
  10681. } else if ("upper" == atValue) {
  10682. this.upper = ""+(jsonColor["fill"]);
  10683. }
  10684. } else {
  10685. var doubleAtValue = + (jsonColor["at"]);
  10686. if (this.valueType == "absolute") {
  10687. this.minValue = Math.min(this.minValue, doubleAtValue);
  10688. this.maxValue = Math.max(this.maxValue, doubleAtValue);
  10689. var previousIndex = 0;
  10690. for (var __i_enFor0 = 0, __exp_enFor0 = domain, __len_enFor0 = __exp_enFor0.length;
  10691. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10692. var o = __exp_enFor0[__i_enFor0];
  10693. var domainValue = + (o);
  10694. if (doubleAtValue < domainValue) {
  10695. break;
  10696. } else {
  10697. previousIndex++;
  10698. }
  10699. }
  10700. range.splice(previousIndex, 0, jsonColor["fill"]);
  10701. domain.splice(previousIndex, 0, doubleAtValue);
  10702. } else {
  10703. range.push(jsonColor["fill"]);
  10704. domain.push(doubleAtValue);
  10705. this.normalizedValues.push(doubleAtValue);
  10706. }
  10707. }
  10708. },
  10709. /** @expose */
  10710. addAllColors : function(colors) {
  10711. var domain = [];
  10712. var range = [];
  10713. for (var __i_enFor0 = 0, __exp_enFor0 = colors, __len_enFor0 = __exp_enFor0.length;
  10714. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10715. var color = __exp_enFor0[__i_enFor0];
  10716. this.addColorImpl(color, domain, range);
  10717. }
  10718. this.setupColorScale(domain, range);
  10719. },
  10720. /** @expose */
  10721. removeColor : function(color) {
  10722. var domain = this.colorScale.domain();
  10723. var range = this.colorScale.range();
  10724. var jsonColor = color;
  10725. var atValue = jsonColor["at"];
  10726. if ("lower" == atValue) {
  10727. this.lower = null;
  10728. } else if ("upper" == atValue) {
  10729. this.upper = null;
  10730. } else {
  10731. var atIndex;
  10732. if (this.valueType == "absolute") {
  10733. atIndex = domain.indexOf(+ (atValue));
  10734. } else {
  10735. var value = + (atValue);
  10736. atIndex = domain.indexOf(this.minValue + value * (this.maxValue - this.minValue));
  10737. }
  10738. if (atIndex != -1) {
  10739. domain.splice(atIndex, 1);
  10740. range.splice(atIndex, 1);
  10741. this.minValue = + (rave.min(domain));
  10742. this.maxValue = + (rave.max(domain));
  10743. this.setupColorScale(domain, range);
  10744. }
  10745. }
  10746. },
  10747. /** @expose */
  10748. domain : function(domain) {
  10749. this.minValue = + (rave.min(domain));
  10750. this.maxValue = + (rave.max(domain));
  10751. if (this.valueType == "normalized") {
  10752. var dm = [];
  10753. var dmRange = this.maxValue - this.minValue;
  10754. for (var i = 0; i < this.normalizedValues.length; ++i) {
  10755. var domainValue = + (this.normalizedValues[i]);
  10756. dm[i] = this.minValue + domainValue * dmRange;
  10757. }
  10758. this.colorScale.domain(dm);
  10759. }
  10760. },
  10761. /** @expose */
  10762. getScale : function() {
  10763. return this.colorScale;
  10764. },
  10765. /**
  10766. * Invalidate the domain which indicates we need to use the nullDomain and nullAccessor
  10767. */
  10768. /** @expose */
  10769. invalidateDomain : function() {
  10770. var domain = [];
  10771. domain.push(0.0);
  10772. domain.push(1.0);
  10773. this.domain(domain);
  10774. },
  10775. /**
  10776. * Can the palette handle the data type
  10777. * @return (boolean) whether the palette can handle the data type
  10778. */
  10779. /** @expose */
  10780. canHandleDataType : function(type) {
  10781. return "numeric" == type;
  10782. }
  10783. });
  10784. /**
  10785. * Fill Types
  10786. */
  10787. //com_ibm_rave_library_palette_internal_ContinuousPalette.CONTINUOUS_TYPE = "continuous";
  10788. //com_ibm_rave_library_palette_internal_ContinuousPalette.DISCRETE_TYPE = "discrete";
  10789. //com_ibm_rave_library_palette_internal_ContinuousPalette.DATATYPE_NUMERIC = "numeric";
  10790. /**
  10791. * the domain to use when domain is invalid
  10792. */
  10793. com_ibm_rave_library_palette_internal_ContinuousPalette.INVALID_DOMAIN_START = 0.0;
  10794. com_ibm_rave_library_palette_internal_ContinuousPalette.INVALID_DOMAIN_MID = 0.5;
  10795. com_ibm_rave_library_palette_internal_ContinuousPalette.INVALID_DOMAIN_END = 1.0;
  10796. /**
  10797. * Value Types
  10798. */
  10799. //com_ibm_rave_library_palette_internal_ContinuousPalette.NORMALIZED_VALUE_TYPE = "normalized";
  10800. //com_ibm_rave_library_palette_internal_ContinuousPalette.ABSOLUTE_VALUE_TYPE = "absolute";
  10801. // $source: com/ibm/rave/library/palette/internal/ConditionalPalette
  10802. /************************************************************************
  10803. ** IBM Confidential
  10804. **
  10805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10806. **
  10807. ** (C) Copyright IBM Corp. 2017
  10808. **
  10809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10811. ************************************************************************/
  10812. // GENERATED
  10813. //@import com/ibm/rave/library/palette/Palette (loadtime) // INVALID_DOMAIN_NULL, VALID_DOMAIN, superclass
  10814. /**
  10815. * <p> A Palette type which maps string values to colors, often called "Fred is red". Each value must be unique, but multiple values can be mapped to the same color. </p> An example of a JSON string for a conditional palette: { "id": "ConditionalPalette", "label" : "Conditional Palette", "description" : "A Conditional Palette.", "icon" : "someicon", "fillType": "conditional", "default" : "white", "fills": [ { "values": ["Fred", "Coke", "Canada" ], "fill": "red"}, { "values": [ "Sweden", "Moscow", "Molson" ], "fill" : "blue"}, { "values": ["Ireland", "Boston", "Ginger Ale"}, "fill" : "green"}, { "values": [ "Australia", "Miami", "Corona" ], "fill" : "yellow" } ] } <p> When creating a conditional palette using a JSONObject, the values and colors are added internally to a map, and both the domain and range are set for the OrdinalScale used by the palette. Adding or removing a color changes the map and the range and domain. </p> <p> When adding a new color, we pass in a JSON object like one of the fills in the JSON above, with an array of values and a fill color. The array of values may only have a single value. If a value already has a color, the value is not entered, and the color is not changed. If we wish to change an entry in the palette, we must remove and re-add it. </p> <p> When removing a color, we pass in a JSON object like one of the fills in the JSON above, with an array of values and a fill color. The array of values may only have a single value. If both the value and the color do not match the entry for that value, the color is not removed. Both must match for the value-color pair to be removed from the palette. </p>
  10816. */
  10817. var com_ibm_rave_library_palette_internal_ConditionalPalette = rave['internal']['Declare'](com_ibm_rave_library_palette_Palette, {
  10818. //colors : null,
  10819. //paletteMap : null,
  10820. _$functionClassMethod : function() {
  10821. var _$self = /**
  10822. * Get a color value for the given data will return null if the data is null
  10823. * @param (rave['internal']['SceneNode']) this the context in which this method is invoked
  10824. * @param (Object) data a data value, may be <code>null</code>
  10825. * @param (int) index the index of the current scene node
  10826. * @param (int) groupIndex the group index of the current scene node
  10827. * @return (Object) a computed value
  10828. */
  10829. function(data, index, groupIndex) {
  10830. var dataValue;
  10831. if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.VALID_DOMAIN) {
  10832. dataValue = _$self.dataAccessor(data);
  10833. } else if (_$self.getDomainValidity() == com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL) {
  10834. dataValue = "";
  10835. } else {
  10836. dataValue = null;
  10837. }
  10838. return dataValue != null ? _$self.paletteMap[dataValue] : _$self.nullColor;
  10839. };
  10840. return _$self;
  10841. },
  10842. /**
  10843. * Sets up the internal mapping from string values to color, and sets up the range and domain of the OrdinalScale returned by getScale().
  10844. * @param (Object) jsonPalette A JSONObject describing the palette
  10845. */
  10846. constructor : function(jsonPalette) {
  10847. this.type = com_ibm_rave_library_palette_internal_ConditionalPalette.Type;
  10848. this.paletteMap = {};
  10849. this.colors = rave.scale.ordinal();
  10850. this.addAllColors(jsonPalette["fills"]);
  10851. },
  10852. /** @expose */
  10853. addAllColors : function(fills) {
  10854. var domain = [];
  10855. var range = [];
  10856. for (var __i_enFor0 = 0, __exp_enFor0 = fills, __len_enFor0 = __exp_enFor0.length;
  10857. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10858. var fill = __exp_enFor0[__i_enFor0];
  10859. var color = ""+((fill)["fill"]);
  10860. var values = (fill)["values"];
  10861. for (var __i_enFor1 = 0, __exp_enFor1 = values, __len_enFor1 = __exp_enFor1.length;
  10862. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  10863. var value = __exp_enFor1[__i_enFor1];
  10864. if (!(this.paletteMap.hasOwnProperty(""+(value)))) {
  10865. var strVal = ""+(value);
  10866. this.paletteMap[strVal] = color;
  10867. domain.push(strVal);
  10868. range.push(color);
  10869. }
  10870. }
  10871. }
  10872. this.colors.domain(domain);
  10873. this.colors.range(range);
  10874. },
  10875. /**
  10876. * @param colors
  10877. */
  10878. setupColorScale : function(domain, range) {
  10879. this.colors.domain(domain).range(range);
  10880. },
  10881. /** @expose */
  10882. addColor : function(color) {
  10883. var domain = this.colors.domain();
  10884. var range = this.colors.range();
  10885. this.addColorImpl(color, domain, range);
  10886. this.setupColorScale(domain, range);
  10887. },
  10888. addColorImpl : function(jsonColor, domain, range) {
  10889. var color = ""+(jsonColor["fill"]);
  10890. var values = jsonColor["values"];
  10891. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  10892. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10893. var value = __exp_enFor0[__i_enFor0];
  10894. if (!(this.paletteMap.hasOwnProperty(""+(value)))) {
  10895. var strVal = ""+(value);
  10896. this.paletteMap[strVal] = color;
  10897. domain.push(strVal);
  10898. range.push(color);
  10899. }
  10900. }
  10901. },
  10902. /** @expose */
  10903. removeColor : function(colorObj) {
  10904. var domain = this.colors.domain();
  10905. var range = this.colors.range();
  10906. var jsonColor = colorObj;
  10907. var color = ""+(jsonColor["fill"]);
  10908. var values = jsonColor["values"];
  10909. for (var __i_enFor0 = 0, __exp_enFor0 = values, __len_enFor0 = __exp_enFor0.length;
  10910. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  10911. var value = __exp_enFor0[__i_enFor0];
  10912. var ind = domain.indexOf(value);
  10913. if (ind > -1 && (""+(range[ind])) == color) {
  10914. delete this.paletteMap[value];
  10915. domain.splice(ind, 1);
  10916. range.splice(ind, 1);
  10917. }
  10918. }
  10919. this.setupColorScale(domain, range);
  10920. },
  10921. /** @expose */
  10922. domain : function(domain) {},
  10923. /** @expose */
  10924. getScale : function() {
  10925. return this.colors;
  10926. },
  10927. /**
  10928. * Invalidate the domain
  10929. */
  10930. /** @expose */
  10931. invalidateDomain : function() {},
  10932. /**
  10933. * Can the palette handle the data type
  10934. * @return (boolean) whether the palette can handle the data type
  10935. */
  10936. /** @expose */
  10937. canHandleDataType : function(type) {
  10938. return true;
  10939. }
  10940. });
  10941. /**
  10942. * the domain to use when domain is invalid
  10943. */
  10944. com_ibm_rave_library_palette_internal_ConditionalPalette.INVALID_DOMAIN = "";
  10945. com_ibm_rave_library_palette_internal_ConditionalPalette.Type = "conditional";
  10946. // $source: com/ibm/rave/library/framework/internal/AbstractView
  10947. /************************************************************************
  10948. ** IBM Confidential
  10949. **
  10950. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  10951. **
  10952. ** (C) Copyright IBM Corp. 2019
  10953. **
  10954. ** The source code for this program is not published or otherwise divested of its trade secrets,
  10955. ** irrespective of what has been deposited with the U.S. Copyright Office.
  10956. ************************************************************************/
  10957. // GENERATED
  10958. //@import com/ibm/rave/library/action/internal/OperationsUtil (runtime) // unhighlight, deselectAll, toggleSelection
  10959. //@import com/ibm/rave/library/Library (static) // Library
  10960. //@import com/ibm/rave/library/palette/internal/ContinuousPalette (static) // new
  10961. //@import com/ibm/rave/library/framework/internal/ScaleManager (runtime) // makeCoordinateScale
  10962. /**
  10963. * An abstract view class that handles common code between the bundle 'views'.
  10964. */
  10965. var com_ibm_rave_library_framework_internal_AbstractView = rave['internal']['Declare']({
  10966. /**
  10967. * The context (model) used by this view, as passed to the constructor.
  10968. */
  10969. //context : null,
  10970. updateType : 0,
  10971. /**
  10972. * All subclasses must provide a constructor (used by the view's controller) that takes a BundleContext as its first argument.
  10973. * @param (com.ibm.rave.library.framework.internal.BundleContext) context The bundle context (model) used by the view
  10974. */
  10975. constructor : function(context) {
  10976. this.context = context;
  10977. },
  10978. /**
  10979. * Override this method with any setup required for the view, e.g. retrieving properties for use in the draw() method. The base implementation does nothing.
  10980. */
  10981. setup : function() {},
  10982. /**
  10983. * Override this method with any teardown required for the view, e.g. destroying a map cache The base implementation does nothing.
  10984. */
  10985. dispose : function() {},
  10986. /**
  10987. * Get the coordinate scale for a given role (X1, Y1, etc.) in the chart. The scale is only valid after the chart has rendered. The method will return null if the chart does not have that role, or if the role was not used in the last render (for example in the bubble bundle, if the input data did not include the "x" or "y" slots and a hierarchical packed bubble was rendered). The roles are declared in AxisComponent. The base class always returns null and must be overridden in views that have coordinate scales.
  10988. * @param (String) role ROLE_X1, ROLE_Y1, ROLE_X2, or ROLE_Y2 from AxisComponent
  10989. * @return (com.ibm.rave.library.framework.CoordinateScale) A coordinate scale, or null
  10990. */
  10991. getCoordinateScale : function(role) {
  10992. return null;
  10993. },
  10994. /**
  10995. * Retrieve internationalized text message for the key, if not found use alternative value
  10996. * @param (String) key nls key
  10997. * @param (String) alt alternative value, if the key is not present in the catalog
  10998. * @return (String) internationalized text message
  10999. */
  11000. message : function(key, alt) {
  11001. return this.context.message(key, alt);
  11002. },
  11003. /**
  11004. * Does the property change require redrawing the chart? It returns one of four values: 1) UPDATE_RESET_DATA --- recalculate data & scales and redraw components; 2) UPDATE_RESET_LAYOUT --- no data change, but need to recalculate layout (scales) and therefore redraw components; 3) UPDATE_REDRAW --- no data or scales recalculation but needs redrawing components; 4) UPDATE_NOTHING --- do nothing
  11005. * @param (String) property The property name
  11006. * @return (int) the type of update required
  11007. */
  11008. requireUpdate : function(property) {
  11009. if (property == "axis.x.title.text" && this.isInvisible("axis.x.title.display")) {
  11010. return 4;
  11011. }
  11012. if (property == "axis.y.title.text" && this.isInvisible("axis.y.title.display")) {
  11013. return 4;
  11014. }
  11015. if (property == "axis.x.title.style.fill" && this.isInvisible("axis.x.title.display")) {
  11016. return 4;
  11017. }
  11018. if (property == "axis.y.title.style.fill" && this.isInvisible("axis.y.title.display")) {
  11019. return 4;
  11020. }
  11021. if ((property == "axis.y.gridlines.style.stroke" || property == "axis.y.gridlines.style.stroke-dasharray") && this.isInvisible("axis.y.gridlines.display")) {
  11022. return 4;
  11023. }
  11024. if ((property == "axis.x.gridlines.style.stroke" || property == "axis.x.gridlines.style.stroke-dasharray") && this.isInvisible("axis.x.gridlines.display")) {
  11025. return 4;
  11026. }
  11027. if ((property == "axis.y2.gridlines.style.stroke" || property == "axis.y2.gridlines.style.stroke-dasharray") && this.isInvisible("axis.y2.gridlines.display")) {
  11028. return 4;
  11029. }
  11030. if (property == "legend.position" && this.isInvisible("legend.display")) {
  11031. return 4;
  11032. }
  11033. if (property == "legend.title" && this.isInvisible("legend.display")) {
  11034. return 4;
  11035. }
  11036. if (property == "effect.duration" || property == "effect.name") {
  11037. return 4;
  11038. }
  11039. if (this.isInvisible("shadow.display") && property == "shadow.style") {
  11040. return 4;
  11041. }
  11042. var p = this.context.properties.property(property);
  11043. if (!p) {
  11044. return 4;
  11045. }
  11046. var reset = p.meta().resetView();
  11047. if (reset == "data") {
  11048. return 0;
  11049. } else if (reset == "layout") {
  11050. return 1;
  11051. } else {
  11052. return (reset == "zoom" ? 2 : 3);
  11053. }
  11054. },
  11055. isInvisible : function(id) {
  11056. var obj = this.context.getPropertyValue(id);
  11057. if (obj != null) {
  11058. return !((obj));
  11059. }
  11060. return false;
  11061. },
  11062. /**
  11063. * Set the minimum update level update that needs to be performed based on the property id.
  11064. * @param (String) id The property id
  11065. */
  11066. checkUpdate : function(id) {
  11067. this.updateType = Math.min(this.updateType, this.requireUpdate(id));
  11068. },
  11069. /**
  11070. * Reset the update level to the lowest possible level.
  11071. */
  11072. reset : function() {
  11073. this.updateType = 0;
  11074. },
  11075. /**
  11076. * Reset the update level to redraw the chart.
  11077. */
  11078. resetRedraw : function() {
  11079. this.updateType = 3;
  11080. },
  11081. /**
  11082. * Register an event with the bundle view. This implementation will be mainly the same across all bundles, however any bundle that wishes to add additional event listeners may do so by extending this method. It's recommended that any extending class should call super, to ensure the default behaviours are maintained.
  11083. * @param (String) eventName
  11084. * @param (com.ibm.rave.library.framework.Controller.BundleEventCallback) callback
  11085. */
  11086. on : function(eventName, callback) {},
  11087. /**
  11088. * Reset the update level to reset the layout.
  11089. */
  11090. resetLayout : function() {
  11091. this.updateType = 1;
  11092. },
  11093. setBorder : function(width, color) {
  11094. var borderWidth = this.context.convertCSSSizeToPixels(this.context.getPropertyValue(width));
  11095. var borderColor = (this.context.getPropertyValue(color));
  11096. var style = {};
  11097. style["stroke-width"] = borderWidth;
  11098. style["stroke"] = borderColor;
  11099. this.context.actions.action("unhighlight").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.unhighlight(style));
  11100. this.context.actions.action("deselectAll").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.deselectAll(style));
  11101. this.context.actions.action("toggleSelect").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.toggleSelection(style));
  11102. }
  11103. /**
  11104. * Implement this method to perform Rave 2 enter-update-exit pattern. The chart root node is the bundle context node, e.g. Selector updateSelection = context.node.data(context.data); Selector enterSelection = updateSelection.enter(); Selector exitSelection = updateSelection.exit();
  11105. */
  11106. //draw : function() {}
  11107. });
  11108. /**
  11109. * <p> Create a structure of nodes in the given selector. The enter-append paradigm is used so the structure is created only as needed. A &lt;defs&gt; node is always created first. The structure is defined by an array of strings. </p> <p> A "(" indicates that the nodes are to be children of the last-created group node (using recursion), while ")" indicates return from the recursion. </p> <p> Other strings create a node as a child of the current node. The string specifies the node type-name, class-name(s), and id, all optional. The string is parsed as: <code><i>type-name</i>.<i>class-names</i>#<code>id</code>. </p> <p> The type-name, class-names, and id are all optional. If the type-name is missing or "", "g" is used. Class-names are separated by spaces. If the id is missing or "", the node's id is not set. If the class-name(s) are missing or "", the node's class is not set. Examples: </p> <ul> <li>"" creates &lt;g&gt;</li> <li>".left" creates&lt;g class="left"&gt;</li> <li>".axis left" creates &lt;g class="axis left"&gt;</li> <li>"rect.background" creates &lt;rect class="background"&gt;</li> <li>"rect.vizlibrary-background#background" creates &lt;rect class="vizlibrary-background" id="background"&gt;</li> </ul> <p> Note that a "." begins the class-names, but class-names are separated by spaces. </p> <p> For example the array </p> <pre> "defs", ".vizlibrary", "(", ".vizlibrary-bubble", "(", "rect.background", ".axis left", ".axis bottom", ".element-group", ")", ".legend", ")" </pre> <p> would create, under the provided node, the structure </p> <pre> &lt;defs&gt;&lt;/defs&gt; &lt;g class="vizlibrary"&gt; &lt;g class="vizlibrary-bubble"&gt; &lt;rect class="background"/&gt; &lt;g class="axis left"&gt;&lt;/g&gt; &lt;g class="axis bottom"&gt;&lt;/g&gt; &lt;g class="element-group"&gt;&lt;/g&gt; &lt;/g&gt; &lt;g class="legend"&gt;&lt;/g&gt; &lt;/g&gt; </pre> <p> Three rules must be followed. If they are not, the code will run but the results are not defined. </p> <ol> <li> The "(" and ")" strings must form nested parentheses, except that it is not necessary to "close" all the ")" strings at the end although it makes the structure more readable. </li> <li> The string may have at most one "." and one "#". </li> <li> Do not use any CSS special characters including ".", "&gt;", or "#" in the class-names. </li> <li> All children of a given node must have different combinations of type-name and class-names, and if a node has no classes there must be no other nodes of that type-name. </li> </ol> <p> As examples of the last rule, each of these arrays of strings should not be used: </p> <pre> [ ".left", ".left" ] [ "g.left", ".left" ] [ "rect", "rect." ] [ "rect", "rect.left" ] </pre> <p> The first requests two nodes with the type-name "g" and the class-name "left", as does the second. The third requests two nodes with the type-name "rect" and no class-name. The last requests a node with type-name "rect" and no class-name, so the other node with type-name "rect" is not allowed. </p>
  11110. * @param (rave['internal']['Selector']) node The selector in which groups are created
  11111. * @param (java.lang.String[]) list The list of strings defining the structure
  11112. */
  11113. com_ibm_rave_library_framework_internal_AbstractView.createGroupStructure = function(node, list) {
  11114. com_ibm_rave_library_framework_internal_AbstractView.createGroupStructureRecursive(node, list, [0]);
  11115. };
  11116. /**
  11117. * Worker method for createGroupStructure.
  11118. * @param (rave['internal']['Selector']) node The selector in which groups are created
  11119. * @param (java.lang.String[]) list The list of strings defining the structure
  11120. * @param length The length of the list
  11121. * @param (int[]) index The modifiable index (TODO: Should we mark this with UnwrapArray for JS? If so, how?)
  11122. */
  11123. com_ibm_rave_library_framework_internal_AbstractView.createGroupStructureRecursive = function(node, list, index) {
  11124. var last = node;
  11125. while (index[0] < list.length) {
  11126. var cs = list[index[0]++];
  11127. if (cs == null) {
  11128. } else if ("(" == cs) {
  11129. com_ibm_rave_library_framework_internal_AbstractView.createGroupStructureRecursive(last, list, index);
  11130. } else if (")" == cs) {
  11131. return;
  11132. } else {
  11133. var id = null;
  11134. var p = cs.indexOf("#");
  11135. if (p >= 0) {
  11136. id = cs.substring(p + 1);
  11137. if ("" == id) {
  11138. id = null;
  11139. }
  11140. cs = cs.substring(0, p);
  11141. }
  11142. var classnames = null;
  11143. p = cs.indexOf(".");
  11144. if (p >= 0) {
  11145. classnames = cs.substring(p + 1);
  11146. if ("" == classnames) {
  11147. classnames = null;
  11148. }
  11149. cs = cs.substring(0, p);
  11150. }
  11151. var type = cs;
  11152. if ("" == type) {
  11153. type = "g";
  11154. }
  11155. var s;
  11156. if (classnames == null) {
  11157. s = node.selectAll(type).data(com_ibm_rave_library_framework_internal_AbstractView.ONEDATA).enter().append(type);
  11158. } else {
  11159. s = node.selectAll(type + "." + classnames.replace(new RegExp(" ","g"), ".")).data(com_ibm_rave_library_framework_internal_AbstractView.ONEDATA).enter().append(type).attr("class", classnames);
  11160. }
  11161. if (id != null) {
  11162. s.attr("id", id);
  11163. }
  11164. last = s;
  11165. }
  11166. }
  11167. };
  11168. /**
  11169. * Get a palette. If the fills array is non-null, has at least two entries, and all entries are non-null and non-"", a continuous normalized palette will be created using the fill values as stops. For example if the fills array is ["red","white","green"], the palette will have stops at 0.0 red, 0.5 white, 1.0 green. Otherwise the paletteID is looked up in Library.palettes and returned. If the paletteID is not fould, the default palette is returned.
  11170. * @param (String) paletteID The palette ID
  11171. * @param (Array) fills Array of colors
  11172. * @return (com.ibm.rave.library.palette.Palette) Palette
  11173. */
  11174. com_ibm_rave_library_framework_internal_AbstractView.getPalette = function(paletteID, fills) {
  11175. var colorPalette = com_ibm_rave_library_framework_internal_AbstractView.getFillPalette(fills);
  11176. if (colorPalette) {
  11177. return colorPalette;
  11178. }
  11179. colorPalette = com_ibm_rave_library_Library.palettes.getPalette(paletteID);
  11180. if (colorPalette) {
  11181. return colorPalette;
  11182. }
  11183. return com_ibm_rave_library_Library.palettes.getDefaultPalette();
  11184. };
  11185. /**
  11186. * If the fills array is non-null, has at least two entries, and all entries are non-null and non-"", a continuous normalized palette will be created using the fill values as stops. For example if the fills array is ["red","white","green"], the palette will have stops at 0.0 red, 0.5 white, 1.0 green. If the fills array does not meet the criteria, null is returned.
  11187. * @param (Array) fills Array of colors
  11188. * @return (com.ibm.rave.library.palette.Palette) Palette, or null
  11189. */
  11190. com_ibm_rave_library_framework_internal_AbstractView.getFillPalette = function(fills) {
  11191. if (!fills || fills.length < 2) {
  11192. return null;
  11193. }
  11194. for (var __i_enFor0 = 0, __exp_enFor0 = fills, __len_enFor0 = __exp_enFor0.length;
  11195. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11196. var s = __exp_enFor0[__i_enFor0];
  11197. if (s == null || "" == s) {
  11198. return null;
  11199. }
  11200. }
  11201. var paletteJSON = {};
  11202. paletteJSON["fillType"] = "continuous";
  11203. paletteJSON["valueType"] = "normalized";
  11204. var nfills = fills.length;
  11205. var fillsJSON = [];
  11206. for (var i = 0; i < nfills; ++i) {
  11207. var stop = {};
  11208. stop["at"] = i / (nfills - 1.0);
  11209. stop["fill"] = fills[i];
  11210. fillsJSON.push(stop);
  11211. }
  11212. paletteJSON["fills"] = fillsJSON;
  11213. return new com_ibm_rave_library_palette_internal_ContinuousPalette(paletteJSON);
  11214. };
  11215. /**
  11216. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry A data slot entry, possibly null
  11217. * @return (rave['internal']['SingleValueFunction']) The accessor function of the accessor, or null if it is null
  11218. */
  11219. com_ibm_rave_library_framework_internal_AbstractView.accessorOf = function(entry) {
  11220. return entry ? entry.accessor$0() : null;
  11221. };
  11222. /**
  11223. * The data-processing utilities receive a SingleValueFunction to check that data is in the domain of a scale. If the function is null, or returns non-null when applied to the data value (as in a scale), the data is valid; otherwise it is not. This method returns null for null, numeric, and date data, and a value function using the slot's domain for string data. TODO: A Domain class available from the entry would allow some reuse.
  11224. * @param (Array) data The data, used to compute domain when necessary
  11225. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry A data slot entry, possibly null
  11226. * @return (rave['internal']['SingleValueFunction']) A validation function, possibly null
  11227. */
  11228. com_ibm_rave_library_framework_internal_AbstractView.domainCheckerOf = function(data, entry) {
  11229. if (!entry) {
  11230. return null;
  11231. }
  11232. if ("string" == entry.type$0()) {
  11233. var scale = com_ibm_rave_library_framework_internal_ScaleManager.makeCoordinateScale$1(data, entry);
  11234. if (scale) {
  11235. scale.range(1.0, 2.0, null, null);
  11236. var sscale = scale.scale();
  11237. return function(d) {
  11238. return sscale.call(null, d, 0, 0);
  11239. };
  11240. }
  11241. return null;
  11242. }
  11243. return null;
  11244. };
  11245. /**
  11246. * <p> Registers new symbols with Rave.svg for use by views and legends. This may be called repeatedly, and by different bundles. </p> <p> {@link #"compositeViewLegendLineSymbol"} : A zig-zag line resembling a line chart </p>
  11247. */
  11248. com_ibm_rave_library_framework_internal_AbstractView.registerBundleSymbols = function() {
  11249. rave.svg.symbolCreator("compositeViewLegendLineSymbol", function(size) {
  11250. var len = Math.sqrt(size) / 2.0;
  11251. var l3 = len / 3;
  11252. return "M" + (-len) + "," + (len) + "L" + (-l3) + "," + (-l3 + 1.5) + " " + (l3) + "," + (l3 + 1.5) + " " + (len) + "," + (-len + 3) + " " + (len) + "," + (-len) + " " + (l3) + "," + (l3 - 1.5) + " " + (-l3) + "," + (-l3 - 1.15) + " " + (-len) + "," + (len - 3) + "Z";
  11253. });
  11254. };
  11255. /**
  11256. * <p> Given a slot accessor that takes original (integrator) data objects as argument, returns an accessor function that takes a BundleDatum as argument and applies the slot accessor to the BundleDatum original data. If the argument BundleDatum is null or has null original data, the accessor returns null. </p> <p> If the original accessor is null, returns a null accessor. </p>
  11257. * @param (rave['internal']['SingleValueFunction']) accessor Original-datum accessor
  11258. * @return (rave['internal']['SingleValueFunction']) BundleDatum accessor, or null
  11259. */
  11260. com_ibm_rave_library_framework_internal_AbstractView.originalDatumAccessor = function(accessor) {
  11261. return accessor ? function(datum) {
  11262. var d = datum != null ? (datum).originalData() : null;
  11263. return d != null ? accessor(d) : null;
  11264. } : null;
  11265. };
  11266. /**
  11267. * CSS class-name for the container of the whole visualization
  11268. */
  11269. //com_ibm_rave_library_framework_internal_AbstractView.VIZLIBRARY_CLASS = "vizlibrary";
  11270. /**
  11271. * CSS class-name for the elements containing the shapes.
  11272. */
  11273. //com_ibm_rave_library_framework_internal_AbstractView.ELEMENT_GROUP_CLASS = "element-group";
  11274. /**
  11275. * CSS class for shapes inside an element and legend.
  11276. */
  11277. //com_ibm_rave_library_framework_internal_AbstractView.BUNDLE_SHAPE_CLASS = "bundle-shape";
  11278. /**
  11279. * CSS class for shapes inside an element.
  11280. */
  11281. //com_ibm_rave_library_framework_internal_AbstractView.ELEMENT_SHAPE_CLASS = "element-shape";
  11282. //com_ibm_rave_library_framework_internal_AbstractView.ELEMENT_LABEL_CLASS = "element-label";
  11283. /**
  11284. * CSS class for elements.
  11285. */
  11286. //com_ibm_rave_library_framework_internal_AbstractView.ELEMENT_CLASS = "element";
  11287. /**
  11288. * CSS class for elements that are lines
  11289. */
  11290. //com_ibm_rave_library_framework_internal_AbstractView.ELEMENT_LINE_CLASS = "element-line";
  11291. /**
  11292. * CSS class describing a 'dim' style (typically lowering the opacity?).
  11293. */
  11294. //com_ibm_rave_library_framework_internal_AbstractView.DIM_CLASS = "dim";
  11295. /**
  11296. * Symbol used by line-type legends. Before using in a legend, call registerLegendSymbols.
  11297. */
  11298. //com_ibm_rave_library_framework_internal_AbstractView.LEGENDLINESYMBOL = "compositeViewLegendLineSymbol";
  11299. /**
  11300. * Reset view of data (need to recalculate data and redraw components)
  11301. */
  11302. //com_ibm_rave_library_framework_internal_AbstractView.RESET_DATA = "data";
  11303. /**
  11304. * Reset view of layout (no data recalculation is required, but need to reset layout/scales and redraw components)
  11305. */
  11306. //com_ibm_rave_library_framework_internal_AbstractView.RESET_LAYOUT = "layout";
  11307. /**
  11308. * Reset zoom view
  11309. */
  11310. //com_ibm_rave_library_framework_internal_AbstractView.RESET_ZOOM = "zoom";
  11311. /**
  11312. * Common name for clip viewport.
  11313. */
  11314. //com_ibm_rave_library_framework_internal_AbstractView.CLIP_VIEWPORT_NAME = "clipViewport";
  11315. com_ibm_rave_library_framework_internal_AbstractView.UPDATE_RESET_DATA = 0;
  11316. com_ibm_rave_library_framework_internal_AbstractView.UPDATE_RESET_LAYOUT = 1;
  11317. com_ibm_rave_library_framework_internal_AbstractView.UPDATE_ZOOM = 2;
  11318. com_ibm_rave_library_framework_internal_AbstractView.UPDATE_REDRAW = 3;
  11319. com_ibm_rave_library_framework_internal_AbstractView.UPDATE_NOTHING = 4;
  11320. //com_ibm_rave_library_framework_internal_AbstractView.HIGHLIGHT_ACTION_NAME = "highlight";
  11321. //com_ibm_rave_library_framework_internal_AbstractView.UNHIGHLIGHT_ACTION_NAME = "unhighlight";
  11322. //com_ibm_rave_library_framework_internal_AbstractView.TRANSITION_NAME = "transition";
  11323. /**
  11324. * The array [0], for creating nodes with the enter-append paradigm.
  11325. */
  11326. com_ibm_rave_library_framework_internal_AbstractView.ONEDATA = [new Number(0)];
  11327. // $source: com/ibm/rave/library/action/internal/SetAttributes
  11328. /************************************************************************
  11329. ** IBM Confidential
  11330. **
  11331. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11332. **
  11333. ** (C) Copyright IBM Corp. 2017
  11334. **
  11335. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11336. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11337. ************************************************************************/
  11338. // GENERATED
  11339. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11340. /**
  11341. * Base class of the the setAttribute operation, The run function for this class assumes one selector, and may accept a map of attributes for said selector. Children of this class are: setAttributes HighlightOperation UnhighlightOperation
  11342. */
  11343. var com_ibm_rave_library_action_internal_SetAttributes = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11344. //primaryStyleDefault : null,
  11345. _$functionClassMethod : function() {
  11346. var _$self = /**
  11347. * This is the run function for the operation it accepts multiple arguments but assumes the first argument to be a selector and the following argument(if provided), to be a map of styles(String attributeName: Object Value), and finally transition duration as the final argument (if provided.) to override the default transition duration.
  11348. */
  11349. function(args) {
  11350. if (args !== null || arguments.length > 1){
  11351. args = Array.prototype.slice.call(arguments);
  11352. }
  11353. {
  11354. var selected = (args[0]);
  11355. if ((selected.property("selected"))) {
  11356. return;
  11357. }
  11358. var primaryStyles;
  11359. primaryStyles = (args.length > 1 && args[1] != null && !((typeof args[1] === "number" || args[1] instanceof Number)) ? args[1] : _$self.primaryStyleDefault);
  11360. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11361. var t = (args[0]).transition("__rave_bundle_action_highlight__").duration(duration);
  11362. var attr = primaryStyles;
  11363. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(attr), __len_enFor0 = __exp_enFor0.length;
  11364. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11365. var key = __exp_enFor0[__i_enFor0];
  11366. t.style(key, attr[key]);
  11367. }
  11368. }
  11369. };
  11370. return _$self;
  11371. },
  11372. constructor : function() {
  11373. this.primaryStyleDefault = {};
  11374. }
  11375. });
  11376. // $source: com/ibm/rave/library/action/internal/HighlightOperation
  11377. /************************************************************************
  11378. ** IBM Confidential
  11379. **
  11380. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11381. **
  11382. ** (C) Copyright IBM Corp. 2017
  11383. **
  11384. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11385. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11386. ************************************************************************/
  11387. // GENERATED
  11388. //@import com/ibm/rave/library/action/internal/SetAttributes (loadtime) // superclass
  11389. var com_ibm_rave_library_action_internal_HighlightOperation = rave['internal']['Declare'](com_ibm_rave_library_action_internal_SetAttributes, {
  11390. constructor : function() {
  11391. this.primaryStyleDefault["stroke"] = function(data, index, groupIndex) {
  11392. return rave.rgb(this.rave_getComputedStyle("fill")).darker(0.3);
  11393. };
  11394. this.primaryStyleDefault["stroke-width"] = "2px";
  11395. }
  11396. });
  11397. // $source: com/ibm/rave/library/action/internal/UnhighlightOperation
  11398. /************************************************************************
  11399. ** IBM Confidential
  11400. **
  11401. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11402. **
  11403. ** (C) Copyright IBM Corp. 2017
  11404. **
  11405. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11406. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11407. ************************************************************************/
  11408. // GENERATED
  11409. //@import com/ibm/rave/library/action/internal/SetAttributes (loadtime) // superclass
  11410. var com_ibm_rave_library_action_internal_UnhighlightOperation = rave['internal']['Declare'](com_ibm_rave_library_action_internal_SetAttributes, {
  11411. constructor : function(originalStyle) {
  11412. if (originalStyle) {
  11413. this.primaryStyleDefault = originalStyle;
  11414. }
  11415. }
  11416. });
  11417. // $source: com/ibm/rave/library/action/internal/ChordHighlightOperation
  11418. /************************************************************************
  11419. ** IBM Confidential
  11420. **
  11421. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11422. **
  11423. ** (C) Copyright IBM Corp. 2017
  11424. **
  11425. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11426. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11427. ************************************************************************/
  11428. // GENERATED
  11429. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11430. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11431. /**
  11432. * Chord Highlight is used to draw focus to all the chords that reach a specific chord segment. This operation is only active when there's no toggleselection operation in progress. Here we loop over all the chords and find ones that dont have either their target or source values equal to the current highlighted chord segment, then these chords are faded out
  11433. */
  11434. var com_ibm_rave_library_action_internal_ChordHighlightOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11435. _$functionClassMethod : function() {
  11436. var _$self = function(args) {
  11437. if (args !== null || arguments.length > 1){
  11438. args = Array.prototype.slice.call(arguments);
  11439. }
  11440. {
  11441. if (args.length == 0) {
  11442. return;
  11443. }
  11444. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11445. var selected = (args[0]);
  11446. var selectedItems = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], false);
  11447. if (selectedItems.size() == 0) {
  11448. (args[1]).filter(function(data, i, groupIndext) {
  11449. var currentChord = (data).getChordData();
  11450. var currentGroupSegmentData = selected.datum();
  11451. if (((currentChord.source.datum).sourceID) == (currentGroupSegmentData.datum).label || ((currentChord.source.datum).targetID) == (currentGroupSegmentData.datum).label) {
  11452. return false;
  11453. }
  11454. return true;
  11455. }).transition().duration(duration).style("opacity", ".1");
  11456. }
  11457. }
  11458. };
  11459. return _$self;
  11460. }
  11461. //constructor : function() {}
  11462. });
  11463. // $source: com/ibm/rave/library/action/internal/ChordUnhighlightOperation
  11464. /************************************************************************
  11465. ** IBM Confidential
  11466. **
  11467. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11468. **
  11469. ** (C) Copyright IBM Corp. 2017
  11470. **
  11471. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11472. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11473. ************************************************************************/
  11474. // GENERATED
  11475. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11476. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11477. /**
  11478. * This operation is only active when there's no toggleselection in process. All chords will be returned to their original opacity
  11479. */
  11480. var com_ibm_rave_library_action_internal_ChordUnhighlightOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11481. //_chordOriginalStyleDefault : null,
  11482. _$functionClassMethod : function() {
  11483. var _$self = function(args) {
  11484. if (args !== null || arguments.length > 1){
  11485. args = Array.prototype.slice.call(arguments);
  11486. }
  11487. {
  11488. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11489. var selectedItems = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], false);
  11490. if (selectedItems.size() == 0) {
  11491. (args[1]).property("stroke", null).transition().duration(duration).style("opacity", _$self._chordOriginalStyleDefault["opacity"]);
  11492. }
  11493. }
  11494. };
  11495. return _$self;
  11496. },
  11497. constructor : function(chordOriginalStyle, groupsOriginalStyle) {
  11498. this._chordOriginalStyleDefault = {};
  11499. {
  11500. if (chordOriginalStyle) {
  11501. this._chordOriginalStyleDefault = chordOriginalStyle;
  11502. } else {
  11503. this._chordOriginalStyleDefault["opacity"] = 0.8;
  11504. }
  11505. }
  11506. }
  11507. });
  11508. // $source: com/ibm/rave/library/action/internal/ChordToggleSelectionOperation
  11509. /************************************************************************
  11510. ** IBM Confidential
  11511. **
  11512. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11513. **
  11514. ** (C) Copyright IBM Corp. 2017
  11515. **
  11516. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11517. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11518. ************************************************************************/
  11519. // GENERATED
  11520. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11521. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11522. /**
  11523. * Handles selection and unselection of chords in chord chat. When you select a chord its two ends which are segments are tagged and remain visible and emphasized with a stroke and a reference counter on its two related segments is incremented. All other chords and chord segments are faded out. If a chord is unselected it is faded out and the reference counter on its two segments is reduced if that reference counter reaches zero that means no other selected chords are reaching that segment therefore it will fade out. Finally if all chords are unselected. all chords return back to their original colors and all segments as well
  11524. */
  11525. var com_ibm_rave_library_action_internal_ChordToggleSelectionOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11526. //primaryStyleDefault : null,
  11527. //secondaryStyleDefault : null,
  11528. //_chordsOriginalStyleDefault : null,
  11529. //_groupsOriginalStyleDefault : null,
  11530. _$functionClassMethod : function() {
  11531. var _$self = function(args) {
  11532. if (args !== null || arguments.length > 1){
  11533. args = Array.prototype.slice.call(arguments);
  11534. }
  11535. {
  11536. var primaryStyles;
  11537. var secondaryStyles;
  11538. primaryStyles = (args.length > 2 && args[2] != null && !((typeof args[2] === "number" || args[2] instanceof Number)) ? args[2] : _$self.primaryStyleDefault);
  11539. secondaryStyles = (args.length > 3 && args[3] != null && !((typeof args[3] === "number" || args[3] instanceof Number)) ? args[3] : _$self.secondaryStyleDefault);
  11540. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 50;
  11541. var allShapes = (args[1]);
  11542. var chordsSelection = allShapes.filter(".chord");
  11543. var selectedChord = (args[0]);
  11544. var chordData = (selectedChord.datum()).getChordData();
  11545. var sourceStruct = chordData.source.datum;
  11546. var targetStruct = chordData.target.datum;
  11547. var allGroupsSelection = allShapes.filter(".groupPath");
  11548. var filteredGroupsAttachedToSelectedChord = allGroupsSelection.filter(function(data, i, groupIndex) {
  11549. var groupData = data;
  11550. var groupLabel = ((groupData.datum).label);
  11551. return (groupLabel == sourceStruct.sourceID || groupLabel == targetStruct.sourceID);
  11552. });
  11553. if ((selectedChord.property("selected"))) {
  11554. selectedChord.property("selected", null);
  11555. var selectedItems = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(chordsSelection, false);
  11556. if (selectedItems.size() == 0) {
  11557. var tAll = chordsSelection.transition(".transitionAllChords").duration(duration);
  11558. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._chordsOriginalStyleDefault), __len_enFor0 = __exp_enFor0.length;
  11559. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11560. var key = __exp_enFor0[__i_enFor0];
  11561. tAll.style(key, _$self._chordsOriginalStyleDefault[key]);
  11562. }
  11563. } else {
  11564. var deselectSelectedChordTransition = selectedChord.transition(".deselectSelectedChordTransition").duration(duration);
  11565. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(secondaryStyles), __len_enFor1 = __exp_enFor1.length;
  11566. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11567. var key = __exp_enFor1[__i_enFor1];
  11568. deselectSelectedChordTransition.style(key, secondaryStyles[key]);
  11569. }
  11570. }
  11571. filteredGroupsAttachedToSelectedChord.each(function(data, index, groupIndex) {
  11572. var element = rave.select(this);
  11573. var chordReferenceCounter;
  11574. if (element.property("chordReferenceCounter") == null) {
  11575. chordReferenceCounter = 0;
  11576. } else {
  11577. chordReferenceCounter = (element.property("chordReferenceCounter"));
  11578. }
  11579. if (chordReferenceCounter > 0) {
  11580. element.property("chordReferenceCounter", (chordReferenceCounter - 1));
  11581. }
  11582. });
  11583. } else {
  11584. selectedChord.property("selected", true);
  11585. var unselectedChords = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(chordsSelection, true);
  11586. var applyDeselectionToUnselectedChordsTransition = unselectedChords.transition("deselect").duration(duration);
  11587. var attr = secondaryStyles;
  11588. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(attr), __len_enFor0 = __exp_enFor0.length;
  11589. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11590. var key = __exp_enFor0[__i_enFor0];
  11591. applyDeselectionToUnselectedChordsTransition.style(key, attr[key]);
  11592. }
  11593. var selectChordTransition = selectedChord.transition("selectChord").duration(duration);
  11594. attr = primaryStyles;
  11595. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(attr), __len_enFor1 = __exp_enFor1.length;
  11596. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11597. var key = __exp_enFor1[__i_enFor1];
  11598. selectChordTransition.style(key, attr[key]);
  11599. }
  11600. filteredGroupsAttachedToSelectedChord.each(function(data, index, groupIndex) {
  11601. var group = rave.select(this);
  11602. var chordReferenceCounter;
  11603. if (group.property("chordReferenceCounter") == null) {
  11604. chordReferenceCounter = 0;
  11605. } else {
  11606. chordReferenceCounter = (group.property("chordReferenceCounter"));
  11607. }
  11608. group.property("chordReferenceCounter", (chordReferenceCounter + 1));
  11609. });
  11610. }
  11611. var selectedChords = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(chordsSelection, false);
  11612. if (selectedChords.size() == 0) {
  11613. var originalT = allGroupsSelection.transition(".originalT").duration(duration);
  11614. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._groupsOriginalStyleDefault), __len_enFor0 = __exp_enFor0.length;
  11615. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11616. var key = __exp_enFor0[__i_enFor0];
  11617. originalT.style(key, _$self._groupsOriginalStyleDefault[key]);
  11618. }
  11619. } else {
  11620. var self = _$self;
  11621. allGroupsSelection.each(function(data, index, indexGroup) {
  11622. var group = rave.select(this);
  11623. var chordReferenceCounter;
  11624. if (group.property("chordReferenceCounter") == null) {
  11625. chordReferenceCounter = 0;
  11626. } else {
  11627. chordReferenceCounter = (group.property("chordReferenceCounter"));
  11628. }
  11629. var tAll = rave.select(this).transition(".tAll").duration(duration);
  11630. if (chordReferenceCounter == 0) {
  11631. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(self.secondaryStyleDefault), __len_enFor0 = __exp_enFor0.length;
  11632. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11633. var key = __exp_enFor0[__i_enFor0];
  11634. tAll.style(key, self.secondaryStyleDefault[key]);
  11635. }
  11636. } else {
  11637. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(self._groupsOriginalStyleDefault), __len_enFor1 = __exp_enFor1.length;
  11638. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11639. var key = __exp_enFor1[__i_enFor1];
  11640. tAll.style(key, self._groupsOriginalStyleDefault[key]);
  11641. }
  11642. }
  11643. });
  11644. }
  11645. }
  11646. };
  11647. return _$self;
  11648. },
  11649. constructor : function(chordsOriginalStyle, groupsOriginalStyle) {
  11650. this.primaryStyleDefault = {};
  11651. this.secondaryStyleDefault = {};
  11652. this._chordsOriginalStyleDefault = {};
  11653. this._groupsOriginalStyleDefault = {};
  11654. {
  11655. this.primaryStyleDefault["stroke"] = function(data, index, groupIndex) {
  11656. var color = this.rave_getProperty("_rave_initialColor");
  11657. if (color == null) {
  11658. if ("path" == this.rave_getName()) {
  11659. color = this.rave_getStyle("stroke");
  11660. if (((typeof color === "string" || color instanceof String)) && ((""+(color)).length == 0)) {
  11661. color = this.rave_getStyle("fill");
  11662. }
  11663. } else {
  11664. color = this.rave_getStyle("fill");
  11665. }
  11666. if (color != null) {
  11667. this.rave_setProperty("_rave_initialColor", color.toString());
  11668. }
  11669. }
  11670. return rave.rgb(color).darker(0.3);
  11671. };
  11672. this.primaryStyleDefault["stroke-width"] = "1pt";
  11673. this.primaryStyleDefault["opacity"] = 0.8;
  11674. this.secondaryStyleDefault["opacity"] = 0.3;
  11675. this.secondaryStyleDefault["stroke"] = null;
  11676. if (chordsOriginalStyle) {
  11677. this._chordsOriginalStyleDefault = chordsOriginalStyle;
  11678. }
  11679. if (groupsOriginalStyle) {
  11680. this._groupsOriginalStyleDefault = groupsOriginalStyle;
  11681. }
  11682. }
  11683. }
  11684. });
  11685. // $source: com/ibm/rave/library/action/internal/ChordDeselectAllOperation
  11686. /************************************************************************
  11687. ** IBM Confidential
  11688. **
  11689. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11690. **
  11691. ** (C) Copyright IBM Corp. 2017
  11692. **
  11693. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11694. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11695. ************************************************************************/
  11696. // GENERATED
  11697. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11698. var com_ibm_rave_library_action_internal_ChordDeselectAllOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11699. //chordsOriginalStyleDefault : null,
  11700. //groupsOriginalStyleDefault : null,
  11701. _$functionClassMethod : function() {
  11702. var _$self = /**
  11703. * Overrides the action run function, to restore all values to the default the bundle author specified for the chord bundle, takes a single parameter (Selector).
  11704. * @param (java.lang.Object[]) args all the elements to be deselected.
  11705. */
  11706. function(args) {
  11707. if (args !== null || arguments.length > 1){
  11708. args = Array.prototype.slice.call(arguments);
  11709. }
  11710. {
  11711. if (!args) {
  11712. return;
  11713. }
  11714. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11715. var allShapes = (args[0]);
  11716. var chordsSelection = allShapes.filter(".chord");
  11717. chordsSelection.property("selected", null).property("_rave_initialColor", null);
  11718. var t = chordsSelection.transition("deselectAllChords").duration(duration);
  11719. var attr = _$self.chordsOriginalStyleDefault;
  11720. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(attr), __len_enFor0 = __exp_enFor0.length;
  11721. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11722. var key = __exp_enFor0[__i_enFor0];
  11723. t.style(key, attr[key]);
  11724. }
  11725. var groupsSelection = allShapes.filter(".groupPath");
  11726. groupsSelection.property("chordReferenceCounter", null);
  11727. var t2 = groupsSelection.transition("deselectAllGroups").duration(duration);
  11728. attr = _$self.groupsOriginalStyleDefault;
  11729. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(attr), __len_enFor1 = __exp_enFor1.length;
  11730. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11731. var key = __exp_enFor1[__i_enFor1];
  11732. t2.style(key, attr[key]);
  11733. }
  11734. }
  11735. };
  11736. return _$self;
  11737. },
  11738. constructor : function(chordsOriginalStyle, groupsOriginalStyle) {
  11739. this.chordsOriginalStyleDefault = {};
  11740. this.groupsOriginalStyleDefault = {};
  11741. {
  11742. if (chordsOriginalStyle) {
  11743. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(chordsOriginalStyle), __len_enFor0 = __exp_enFor0.length;
  11744. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11745. var key = __exp_enFor0[__i_enFor0];
  11746. this.chordsOriginalStyleDefault[key] = chordsOriginalStyle[key];
  11747. }
  11748. } else {
  11749. this.chordsOriginalStyleDefault["opacity"] = 0.8;
  11750. this.chordsOriginalStyleDefault["stroke"] = null;
  11751. }
  11752. if (groupsOriginalStyle) {
  11753. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(groupsOriginalStyle), __len_enFor1 = __exp_enFor1.length;
  11754. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11755. var key = __exp_enFor1[__i_enFor1];
  11756. this.groupsOriginalStyleDefault[key] = groupsOriginalStyle[key];
  11757. }
  11758. } else {
  11759. this.groupsOriginalStyleDefault["opacity"] = 1.0;
  11760. this.groupsOriginalStyleDefault["stroke"] = null;
  11761. }
  11762. }
  11763. }
  11764. });
  11765. // $source: com/ibm/rave/library/action/internal/SelectOperation
  11766. /************************************************************************
  11767. ** IBM Confidential
  11768. **
  11769. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11770. **
  11771. ** (C) Copyright IBM Corp. 2017
  11772. **
  11773. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11774. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11775. ************************************************************************/
  11776. // GENERATED
  11777. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11778. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11779. var com_ibm_rave_library_action_internal_SelectOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11780. //primaryStyleDefault : null,
  11781. //secondaryStyleDefault : null,
  11782. _$functionClassMethod : function() {
  11783. var _$self = /**
  11784. * Overrides the action call function
  11785. * @param (java.lang.Object[]) args
  11786. */
  11787. function(args) {
  11788. if (args !== null || arguments.length > 1){
  11789. args = Array.prototype.slice.call(arguments);
  11790. }
  11791. {
  11792. var primaryStyles;
  11793. var secondaryStyles;
  11794. primaryStyles = (args.length > 2 && args[2] != null && !((typeof args[2] === "number" || args[2] instanceof Number)) ? args[2] : _$self.primaryStyleDefault);
  11795. secondaryStyles = (args.length > 3 && args[3] != null && !((typeof args[3] === "number" || args[3] instanceof Number)) ? args[3] : _$self.secondaryStyleDefault);
  11796. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11797. (args[0]).property("selected", true);
  11798. var context = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], true);
  11799. var t = (args[0]).transition("__rave_bundle_action_selection__").duration(duration);
  11800. var attr = primaryStyles;
  11801. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(attr), __len_enFor0 = __exp_enFor0.length;
  11802. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11803. var key = __exp_enFor0[__i_enFor0];
  11804. t.style(key, attr[key]);
  11805. }
  11806. var t2 = context.transition("__rave_bundle_action_selection__").duration(duration);
  11807. attr = secondaryStyles;
  11808. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(attr), __len_enFor1 = __exp_enFor1.length;
  11809. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11810. var key = __exp_enFor1[__i_enFor1];
  11811. t2.style(key, attr[key]);
  11812. }
  11813. }
  11814. };
  11815. return _$self;
  11816. },
  11817. constructor : function() {
  11818. this.primaryStyleDefault = {};
  11819. this.secondaryStyleDefault = {};
  11820. {
  11821. this.primaryStyleDefault["stroke"] = function(data, index, groupIndex) {
  11822. return rave.rgb(rave.select(this).style("fill")).darker(0.3);
  11823. };
  11824. this.primaryStyleDefault["stroke-width"] = "2px";
  11825. this.primaryStyleDefault["opacity"] = 1.0;
  11826. this.secondaryStyleDefault["opacity"] = 0.3;
  11827. }
  11828. }
  11829. });
  11830. // $source: com/ibm/rave/library/action/internal/DeselectOperation
  11831. /************************************************************************
  11832. ** IBM Confidential
  11833. **
  11834. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11835. **
  11836. ** (C) Copyright IBM Corp. 2017
  11837. **
  11838. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11839. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11840. ************************************************************************/
  11841. // GENERATED
  11842. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11843. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11844. var com_ibm_rave_library_action_internal_DeselectOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11845. //primaryStyleDefault : null,
  11846. //originalStyleDefault : null,
  11847. _$functionClassMethod : function() {
  11848. var _$self = /**
  11849. * Overrides the action call function.
  11850. * @param (java.lang.Object[]) args
  11851. */
  11852. function(args) {
  11853. if (args !== null || arguments.length > 1){
  11854. args = Array.prototype.slice.call(arguments);
  11855. }
  11856. {
  11857. var primaryStyles;
  11858. var originalStyles;
  11859. primaryStyles = (args.length > 2 && args[2] != null && !((typeof args[2] === "number" || args[2] instanceof Number)) ? args[2] : _$self.primaryStyleDefault);
  11860. originalStyles = _$self.originalStyleDefault;
  11861. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11862. (args[0]).property("selected", null);
  11863. var selectedItems = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], false);
  11864. if (selectedItems.size() == 0) {
  11865. var context = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], true);
  11866. context.transition("__rave_bundle_action_selection__").duration(duration).style(originalStyles);
  11867. } else {
  11868. (args[0]).transition("__rave_bundle_action_selection__").duration(duration).style(primaryStyles);
  11869. }
  11870. }
  11871. };
  11872. return _$self;
  11873. },
  11874. constructor : function() {
  11875. this.primaryStyleDefault = {};
  11876. this.originalStyleDefault = {};
  11877. {
  11878. this.primaryStyleDefault["opacity"] = 0.3;
  11879. this.originalStyleDefault["opacity"] = 1.0;
  11880. }
  11881. }
  11882. });
  11883. // $source: com/ibm/rave/library/action/internal/DeselectAllOperation
  11884. /************************************************************************
  11885. ** IBM Confidential
  11886. **
  11887. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11888. **
  11889. ** (C) Copyright IBM Corp. 2017
  11890. **
  11891. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11892. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11893. ************************************************************************/
  11894. // GENERATED
  11895. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11896. var com_ibm_rave_library_action_internal_DeselectAllOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11897. //originalStyleDefault : null,
  11898. _$functionClassMethod : function() {
  11899. var _$self = /**
  11900. * Overrides the action run function, to restore all values to the default the bundle author specified for the bundle, takes a single parameter (Selector).
  11901. * @param (java.lang.Object[]) args all the elements to be deselected.
  11902. */
  11903. function(args) {
  11904. if (args !== null || arguments.length > 1){
  11905. args = Array.prototype.slice.call(arguments);
  11906. }
  11907. {
  11908. if (!args) {
  11909. return;
  11910. }
  11911. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 100;
  11912. (args[0]).property("selected", null).property("_rave_initialColor", null);
  11913. var t = (args[0]).transition("__rave_bundle_action_selection__").duration(duration);
  11914. var attr = _$self.originalStyleDefault;
  11915. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(attr), __len_enFor0 = __exp_enFor0.length;
  11916. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11917. var key = __exp_enFor0[__i_enFor0];
  11918. t.style(key, attr[key]);
  11919. }
  11920. }
  11921. };
  11922. return _$self;
  11923. },
  11924. constructor : function(originalStyle) {
  11925. this.originalStyleDefault = {};
  11926. {
  11927. if (originalStyle) {
  11928. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(originalStyle), __len_enFor0 = __exp_enFor0.length;
  11929. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11930. var key = __exp_enFor0[__i_enFor0];
  11931. this.originalStyleDefault[key] = originalStyle[key];
  11932. }
  11933. }
  11934. this.originalStyleDefault["opacity"] = 1.0;
  11935. }
  11936. }
  11937. });
  11938. // $source: com/ibm/rave/library/action/internal/ToggleSelectionOperation
  11939. /************************************************************************
  11940. ** IBM Confidential
  11941. **
  11942. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  11943. **
  11944. ** (C) Copyright IBM Corp. 2017
  11945. **
  11946. ** The source code for this program is not published or otherwise divested of its trade secrets,
  11947. ** irrespective of what has been deposited with the U.S. Copyright Office.
  11948. ************************************************************************/
  11949. // GENERATED
  11950. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  11951. //@import com/ibm/rave/library/action/FiltersUtil (runtime) // FiltersUtil
  11952. var com_ibm_rave_library_action_internal_ToggleSelectionOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  11953. //primaryStyleDefault : null,
  11954. //secondaryStyleDefault : null,
  11955. //originalStyleDefault : null,
  11956. _$functionClassMethod : function() {
  11957. var _$self = /**
  11958. * Overrides the action run function. This is the default selection action for bundles. This adds a toggle selection to the bundle. When an item is clicked, it's marked as selected and emphasized, when it is clicked again the selected flag is turned off and the item is deemphasized. The default style fade the unselected elements.
  11959. * @param (java.lang.Object[]) args
  11960. */
  11961. function(args) {
  11962. if (args !== null || arguments.length > 1){
  11963. args = Array.prototype.slice.call(arguments);
  11964. }
  11965. {
  11966. var primaryStyles;
  11967. var secondaryStyles;
  11968. primaryStyles = (args.length > 2 && args[2] != null && !((typeof args[2] === "number" || args[2] instanceof Number)) ? args[2] : _$self.primaryStyleDefault);
  11969. secondaryStyles = (args.length > 3 && args[3] != null && !((typeof args[3] === "number" || args[3] instanceof Number)) ? args[3] : _$self.secondaryStyleDefault);
  11970. var duration = args[args.length - 1] != null && (typeof args[args.length - 1] === "number" || args[args.length - 1] instanceof Number) ? + (args[args.length - 1]) : 50;
  11971. var selected = (args[0]);
  11972. if ((selected.property("selected"))) {
  11973. selected.property("selected", null);
  11974. var selectedItems = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], false);
  11975. if (selectedItems.size() == 0) {
  11976. var tAll = (args[1]).transition("__rave_bundle_action_selection__").duration(duration);
  11977. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self.originalStyleDefault), __len_enFor0 = __exp_enFor0.length;
  11978. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  11979. var key = __exp_enFor0[__i_enFor0];
  11980. tAll.style(key, _$self.originalStyleDefault[key]);
  11981. }
  11982. } else {
  11983. var t = selected.transition("__rave_bundle_action_selection__").duration(duration);
  11984. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(secondaryStyles), __len_enFor1 = __exp_enFor1.length;
  11985. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  11986. var key = __exp_enFor1[__i_enFor1];
  11987. t.style(key, secondaryStyles[key]);
  11988. }
  11989. }
  11990. } else {
  11991. selected.property("selected", true);
  11992. var context = com_ibm_rave_library_action_FiltersUtil.INSTANCE.selectionFilter(args[1], true);
  11993. var t = context.transition("__rave_bundle_action_selection__").duration(duration);
  11994. var attr = secondaryStyles;
  11995. for (var __i_enFor2 = 0, __exp_enFor2 = Object.keys(attr), __len_enFor2 = __exp_enFor2.length;
  11996. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  11997. var key = __exp_enFor2[__i_enFor2];
  11998. t.style(key, attr[key]);
  11999. }
  12000. var t2 = selected.transition("__rave_bundle_action_selection__").duration(duration);
  12001. attr = primaryStyles;
  12002. for (var __i_enFor3 = 0, __exp_enFor3 = Object.keys(attr), __len_enFor3 = __exp_enFor3.length;
  12003. __i_enFor3 < __len_enFor3; ++__i_enFor3) {
  12004. var key = __exp_enFor3[__i_enFor3];
  12005. t2.style(key, attr[key]);
  12006. }
  12007. }
  12008. }
  12009. };
  12010. return _$self;
  12011. },
  12012. constructor : function(originalStyle) {
  12013. this.primaryStyleDefault = {};
  12014. this.secondaryStyleDefault = {};
  12015. this.originalStyleDefault = {};
  12016. {
  12017. this.primaryStyleDefault["stroke"] = function(data, index, groupIndex) {
  12018. var color = this.rave_getProperty("_rave_initialColor");
  12019. if (color == null) {
  12020. if ("path" == this.rave_getName() || "polygon" == this.rave_getName()) {
  12021. color = this.rave_getStyle("fill");
  12022. if (((typeof color === "string" || color instanceof String)) && ((""+(color)).length == 0)) {
  12023. color = this.rave_getStyle("stroke");
  12024. if (((typeof color === "string" || color instanceof String)) && ((""+(color)).length == 0)) {
  12025. color = rave.rgb(this.rave_getComputedStyle("fill")).darker(0.3);
  12026. }
  12027. }
  12028. } else {
  12029. color = this.rave_getStyle("fill");
  12030. }
  12031. if (color != null) {
  12032. this.rave_setProperty("_rave_initialColor", color.toString());
  12033. }
  12034. }
  12035. return rave.rgb(color).darker(0.3);
  12036. };
  12037. this.primaryStyleDefault["stroke-width"] = "2px";
  12038. this.primaryStyleDefault["opacity"] = 1.0;
  12039. this.secondaryStyleDefault["opacity"] = 0.3;
  12040. if (originalStyle) {
  12041. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(originalStyle), __len_enFor0 = __exp_enFor0.length;
  12042. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12043. var key = __exp_enFor0[__i_enFor0];
  12044. this.originalStyleDefault[key] = originalStyle[key];
  12045. }
  12046. }
  12047. this.originalStyleDefault["opacity"] = 1.0;
  12048. }
  12049. }
  12050. });
  12051. // $source: com/ibm/rave/library/action/internal/PanZoomOperation
  12052. /************************************************************************
  12053. ** IBM Confidential
  12054. **
  12055. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12056. **
  12057. ** (C) Copyright IBM Corp. 2017
  12058. **
  12059. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12060. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12061. ************************************************************************/
  12062. // GENERATED
  12063. //@import com/ibm/rave/library/action/ActionOperation (loadtime) // superclass
  12064. var com_ibm_rave_library_action_internal_PanZoomOperation = rave['internal']['Declare'](com_ibm_rave_library_action_ActionOperation, {
  12065. //_zoom : null,
  12066. //_contextSelectionFn : null,
  12067. _$functionClassMethod : function() {
  12068. var _$self = /**
  12069. * Execute the Zoom Operation to apply any changes to the translate/scale parameters of the underlying Zoom instance. To retrieve the Zoom instance, call <pre> get("zoom"). </pre>
  12070. */
  12071. function(args) {
  12072. if (args !== null || arguments.length > 1){
  12073. args = Array.prototype.slice.call(arguments);
  12074. }
  12075. {
  12076. if (!_$self._zoom) {
  12077. return;
  12078. }
  12079. var scaleFactor = 1;
  12080. var translate_x = 0;
  12081. var translate_y = 0;
  12082. if (args.length > 0) {
  12083. var scaleBy = (args[0]);
  12084. scaleFactor = scaleBy != null ? scaleBy : 1;
  12085. }
  12086. if (args.length > 1) {
  12087. translate_x = + (args[1]);
  12088. }
  12089. if (args.length > 2) {
  12090. translate_y = + (args[2]);
  12091. }
  12092. var t = _$self._zoom.translate();
  12093. _$self._zoom.translate([t[0] - translate_x, t[1] - translate_y]);
  12094. var center0 = _$self._zoom.center() ? _$self._zoom.center() : [_$self._zoom.size()[0] / 2, _$self._zoom.size()[1] / 2];
  12095. var translate0 = _$self._zoom.translate();
  12096. var coordinates0 = _$self.coordinates(center0);
  12097. var extent = _$self._zoom.scaleExtent();
  12098. var scaleTo = Math.max(extent[0], Math.min(extent[1], _$self._zoom.scale() * scaleFactor));
  12099. _$self._zoom.scale(scaleTo);
  12100. var center1 = _$self.point(coordinates0);
  12101. _$self._zoom.translate([translate0[0] + center0[0] - center1[0], translate0[1] + center0[1] - center1[1]]);
  12102. var zoomContext = _$self._contextSelectionFn();
  12103. _$self._zoom.event.call(null, zoomContext);
  12104. }
  12105. };
  12106. return _$self;
  12107. },
  12108. constructor : function(z, selectionContext) {
  12109. this._zoom = z;
  12110. this._contextSelectionFn = selectionContext;
  12111. },
  12112. /** @expose */
  12113. get : function(id) {
  12114. if (id == "zoom") {
  12115. return this._zoom;
  12116. }
  12117. return null;
  12118. },
  12119. coordinates : function(point) {
  12120. var scale = this._zoom.scale();
  12121. var translate = this._zoom.translate();
  12122. return [(point[0] - translate[0]) / scale, (point[1] - translate[1]) / scale];
  12123. },
  12124. point : function(coordinates) {
  12125. var scale = this._zoom.scale();
  12126. var translate = this._zoom.translate();
  12127. return [coordinates[0] * scale + translate[0], coordinates[1] * scale + translate[1]];
  12128. }
  12129. });
  12130. // $source: com/ibm/rave/library/action/internal/OperationsUtil
  12131. /************************************************************************
  12132. ** IBM Confidential
  12133. **
  12134. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12135. **
  12136. ** (C) Copyright IBM Corp. 2017
  12137. **
  12138. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12139. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12140. ************************************************************************/
  12141. // GENERATED
  12142. //@import com/ibm/rave/library/action/internal/HighlightOperation (static) // new
  12143. //@import com/ibm/rave/library/action/internal/UnhighlightOperation (static) // new
  12144. //@import com/ibm/rave/library/action/internal/ChordHighlightOperation (static) // new
  12145. //@import com/ibm/rave/library/action/internal/ChordUnhighlightOperation (static) // new
  12146. //@import com/ibm/rave/library/action/internal/ChordToggleSelectionOperation (static) // new
  12147. //@import com/ibm/rave/library/action/internal/ChordDeselectAllOperation (static) // new
  12148. //@import com/ibm/rave/library/action/internal/SelectOperation (static) // new
  12149. //@import com/ibm/rave/library/action/internal/DeselectOperation (static) // new
  12150. //@import com/ibm/rave/library/action/internal/DeselectAllOperation (static) // new
  12151. //@import com/ibm/rave/library/action/internal/ToggleSelectionOperation (static) // new
  12152. //@import com/ibm/rave/library/action/internal/PanZoomOperation (static) // new
  12153. var com_ibm_rave_library_action_internal_OperationsUtil = rave['internal']['Declare']({
  12154. });
  12155. /**
  12156. * Getter for the highlight operation
  12157. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the highlight operation
  12158. */
  12159. com_ibm_rave_library_action_internal_OperationsUtil.highlight = function() {
  12160. return new com_ibm_rave_library_action_internal_HighlightOperation();
  12161. };
  12162. /**
  12163. * Getter for the unhighlight operation
  12164. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the unhighlight operation
  12165. */
  12166. com_ibm_rave_library_action_internal_OperationsUtil.unhighlight = function(originalStyle) {
  12167. return new com_ibm_rave_library_action_internal_UnhighlightOperation(originalStyle);
  12168. };
  12169. /**
  12170. * Getter for the chord highlight operation
  12171. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the chord highlight operation
  12172. */
  12173. com_ibm_rave_library_action_internal_OperationsUtil.chordHighlight = function() {
  12174. return new com_ibm_rave_library_action_internal_ChordHighlightOperation();
  12175. };
  12176. /**
  12177. * Getter for the chord unhighlight operation
  12178. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the unhighlight operation
  12179. */
  12180. com_ibm_rave_library_action_internal_OperationsUtil.chordUnhighlight = function(chordsOriginalStyle, groupsOriginalStyle) {
  12181. return new com_ibm_rave_library_action_internal_ChordUnhighlightOperation(chordsOriginalStyle, groupsOriginalStyle);
  12182. };
  12183. /**
  12184. * Getter for the chordToggle operation
  12185. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the chordToggle operation
  12186. */
  12187. com_ibm_rave_library_action_internal_OperationsUtil.chordToggle = function(chordsOriginalStyle, groupsOriginalStyle) {
  12188. return new com_ibm_rave_library_action_internal_ChordToggleSelectionOperation(chordsOriginalStyle, groupsOriginalStyle);
  12189. };
  12190. /**
  12191. * Getter for the chord deselectAll operation
  12192. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the chord deselectAll operation
  12193. */
  12194. com_ibm_rave_library_action_internal_OperationsUtil.chordDeselectAll = function(chordsOriginalStyle, groupsOriginalStyle) {
  12195. return new com_ibm_rave_library_action_internal_ChordDeselectAllOperation(chordsOriginalStyle, groupsOriginalStyle);
  12196. };
  12197. /**
  12198. * Getter for the select operation
  12199. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the select operation
  12200. */
  12201. com_ibm_rave_library_action_internal_OperationsUtil.select = function() {
  12202. return new com_ibm_rave_library_action_internal_SelectOperation();
  12203. };
  12204. /**
  12205. * Getter for the deselect operation
  12206. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the deselect operation
  12207. */
  12208. com_ibm_rave_library_action_internal_OperationsUtil.deselect = function() {
  12209. return new com_ibm_rave_library_action_internal_DeselectOperation();
  12210. };
  12211. /**
  12212. * Getter for the deselectAll operation
  12213. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the deselectAll operation
  12214. */
  12215. com_ibm_rave_library_action_internal_OperationsUtil.deselectAll = function(originalStyle) {
  12216. return new com_ibm_rave_library_action_internal_DeselectAllOperation(originalStyle);
  12217. };
  12218. /**
  12219. * Getter for the toggleSelection operation
  12220. * @return (com.ibm.rave.library.action.ActionOperation) new instance of the toggleSelection operation
  12221. */
  12222. com_ibm_rave_library_action_internal_OperationsUtil.toggleSelection = function(originalStyle) {
  12223. return new com_ibm_rave_library_action_internal_ToggleSelectionOperation(originalStyle);
  12224. };
  12225. /**
  12226. * Create a new operation instance for the pan zoom action.
  12227. * @param (rave['internal']['Zoom']) zoom A Core Zoom behaviour.
  12228. * @param (com.ibm.rave.library.action.internal.PanZoomOperation.ZoomContextFunction) contextSelection A function which returns the selection of elements which "zoom" events have been registered on.
  12229. */
  12230. com_ibm_rave_library_action_internal_OperationsUtil.panZoom = function(zoom, contextSelection) {
  12231. return new com_ibm_rave_library_action_internal_PanZoomOperation(zoom, contextSelection);
  12232. };
  12233. // $source: com/ibm/rave/library/property/PropertyProcessor
  12234. /************************************************************************
  12235. ** IBM Confidential
  12236. **
  12237. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12238. **
  12239. ** (C) Copyright IBM Corp. 2017
  12240. **
  12241. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12242. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12243. ************************************************************************/
  12244. // GENERATED
  12245. //@import com/ibm/rave/library/property/PropertyProcessingInfo (static) // new
  12246. //@import com/ibm/rave/library/property/PropertyUtil (static) // PropertyUtil
  12247. //@import com/ibm/rave/library/property/PropertyUnknownType (runtime) // new
  12248. //@import com/ibm/rave/library/property/PropertyObjectType (runtime) // new
  12249. //@import com/ibm/rave/library/Library (static) // logError
  12250. //@import com/ibm/rave/library/property/PropertyArrayType (runtime) // new
  12251. //@import com/ibm/rave/library/property/PropertyBooleanType (runtime) // new
  12252. //@import com/ibm/rave/library/property/PropertyColorType (runtime) // new
  12253. //@import com/ibm/rave/library/property/PropertyEnumType (runtime) // new
  12254. //@import com/ibm/rave/library/property/PropertyFontType (runtime) // new
  12255. //@import com/ibm/rave/library/property/PropertyNumericType (runtime) // new
  12256. //@import com/ibm/rave/library/property/PropertyPaletteType (runtime) // new
  12257. //@import com/ibm/rave/library/property/PropertyLengthType (runtime) // new
  12258. //@import com/ibm/rave/library/property/PropertyPaddingType (runtime) // new
  12259. //@import com/ibm/rave/library/property/PropertyDashArrayType (runtime) // new
  12260. //@import com/ibm/rave/library/property/PropertyStringType (runtime) // new
  12261. //@import com/ibm/rave/library/property/PropertyJSONObjectType (runtime) // new
  12262. //@import com/ibm/rave/library/property/PropertyGeoJsonType (runtime) // new
  12263. //@import com/ibm/rave/library/property/PropertyShadowType (runtime) // new
  12264. //@import com/ibm/rave/library/i18n/MessagesRegistry (runtime) // EmptyRegistry
  12265. /**
  12266. * A helper class that is responsible for parsing JSON propeties and creating a meta property object for them. Also, it is responsible for validating these JSON files.
  12267. */
  12268. var com_ibm_rave_library_property_PropertyProcessor = rave['internal']['Declare']({
  12269. //constructor : function() {}
  12270. });
  12271. /**
  12272. * Goes through a properties JSOn file and creates meta properties out of it. If error parameter was not not null, then the validation will be conducted while parsing the JSON object and the process will abort with failure the minutes it discovers an invalid property, if the error parameter was null, then the loader will continue creating meta properties without validation. If loading with no validation, then depending on the nature of the problem with a given property, it might be either skipped altogether or a meta property of type PropertyUnknownType will be created for it
  12273. * @param (Object) props the JSOn file holding the properties to load
  12274. * @param (boolean) validate whether or not validation should be on.
  12275. * @return (com.ibm.rave.library.property.PropertyProcessingInfo) the processing result
  12276. * @see (com.ibm.rave.library.property.PropertyProcessingInfo) PropertyProcessingInfo
  12277. */
  12278. /** @expose */
  12279. com_ibm_rave_library_property_PropertyProcessor.processProperties = function(props, messages, validate) {
  12280. var info = new com_ibm_rave_library_property_PropertyProcessingInfo(validate);
  12281. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(props), __len_enFor0 = __exp_enFor0.length;
  12282. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12283. var propertyId = __exp_enFor0[__i_enFor0];
  12284. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validatePropertySimpleId(""+(propertyId)))) {
  12285. info.processError();
  12286. }
  12287. var propertyJSON = com_ibm_rave_library_property_PropertyUtil.INSTANCE.propertyEntry(props, ""+(propertyId));
  12288. if (!propertyJSON) {
  12289. var property = new com_ibm_rave_library_property_PropertyUnknownType(""+(propertyId), ""+(propertyId), null, messages);
  12290. info.properties.push(property);
  12291. info.processError();
  12292. if (info.validate) {
  12293. break;
  12294. }
  12295. } else {
  12296. var property = com_ibm_rave_library_property_PropertyProcessor.processProperty$3(propertyJSON, ""+(propertyId), ""+(propertyId), null, info, messages);
  12297. info.properties.push(property);
  12298. if (info.validate && info.hasInvalidProperties) {
  12299. break;
  12300. }
  12301. }
  12302. }
  12303. return info;
  12304. };
  12305. /**
  12306. * Process a JSON object for a single property and creates a meta property object for it. It is done with no validation and the property will have no parent
  12307. * @param (Object) propertyJSON the JSON object representing the property to process
  12308. * @param (String) propertyId the simple id of the property
  12309. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) the newly created meta property, which could be of type PropertyUnknownType if the JSON object is doesn't have enough to figure out which kind of property to create
  12310. */
  12311. com_ibm_rave_library_property_PropertyProcessor.processProperty$0 = function(propertyJSON, propertyId, messages) {
  12312. return com_ibm_rave_library_property_PropertyProcessor.processProperty$2(propertyJSON, propertyId, null, messages, false);
  12313. };
  12314. /**
  12315. * Process a JSON object for a single property and creates a meta property object for it. It is done with no validation
  12316. * @param (Object) propertyJSON the JSOn object representing the property to process
  12317. * @param (String) propertyId the simple id of the property
  12318. * @param (com.ibm.rave.library.framework.meta.PropertyMeta) parent the parent property if any, could be null
  12319. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) the newly created meta property, which could be of type PropertyUnknownType if the JSON object is doesn't have enough to figure out which kind of property to create
  12320. */
  12321. com_ibm_rave_library_property_PropertyProcessor.processProperty$1 = function(propertyJSON, propertyId, parent, messages) {
  12322. return com_ibm_rave_library_property_PropertyProcessor.processProperty$2(propertyJSON, propertyId, parent, messages, false);
  12323. };
  12324. /**
  12325. * Process a JSON object for a single property and creates a meta property object for it.
  12326. * @param (Object) propertyJSON the JSOn object representing the property to process
  12327. * @param (String) propertyId the simple id of the property
  12328. * @param (com.ibm.rave.library.framework.meta.PropertyMeta) parent the parent property if any, could be null
  12329. * @param (boolean) validate whether or not validation is on.
  12330. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) the newly created meta property, which could be of type PropertyUnknownType if the JSON object is doesn't have enough to figure out which kind of property to create
  12331. */
  12332. com_ibm_rave_library_property_PropertyProcessor.processProperty$2 = function(propertyJSON, propertyId, parent, messages, validate) {
  12333. var info = new com_ibm_rave_library_property_PropertyProcessingInfo(validate);
  12334. var qualifiedId = (parent) ? parent.id() + "." + propertyId : propertyId;
  12335. return com_ibm_rave_library_property_PropertyProcessor.processProperty$3(propertyJSON, propertyId, qualifiedId, parent, info, messages);
  12336. };
  12337. com_ibm_rave_library_property_PropertyProcessor.processProperty$3 = function(propertyJSON, propertyId, qualifiedId, parent, info, messages) {
  12338. var type = com_ibm_rave_library_property_PropertyUtil.INSTANCE.type(propertyJSON);
  12339. if (type == null) {
  12340. var property = new com_ibm_rave_library_property_PropertyUnknownType(propertyId, qualifiedId, parent, messages);
  12341. info.processError();
  12342. return property;
  12343. } else if ("object" == type) {
  12344. var property = new com_ibm_rave_library_property_PropertyObjectType(propertyId, qualifiedId, parent, messages);
  12345. var objectPropertiesEntry = com_ibm_rave_library_property_PropertyUtil.INSTANCE.propertyEntry(propertyJSON, "properties");
  12346. if (!objectPropertiesEntry) {
  12347. info.processError();
  12348. return property;
  12349. }
  12350. if (Object.keys(objectPropertiesEntry).length == 0) {
  12351. if (info.validate) {
  12352. com_ibm_rave_library_Library.logError(28, "Property entry '" + propertyId + " @PropertyProcessor.processProperty");
  12353. }
  12354. info.processError();
  12355. return property;
  12356. }
  12357. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objectPropertiesEntry), __len_enFor0 = __exp_enFor0.length;
  12358. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12359. var childPropertyId = __exp_enFor0[__i_enFor0];
  12360. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validatePropertySimpleId(""+(childPropertyId)))) {
  12361. info.processError();
  12362. return property;
  12363. }
  12364. var childQualifiedId = qualifiedId + "." + ""+(childPropertyId);
  12365. var childPropertyEntry = com_ibm_rave_library_property_PropertyUtil.INSTANCE.propertyEntry(objectPropertiesEntry, ""+(childPropertyId));
  12366. if (!childPropertyEntry) {
  12367. var unknownChildProperty = new com_ibm_rave_library_property_PropertyUnknownType(""+(childPropertyId), childQualifiedId, property, messages);
  12368. property._childProperties[""+(childPropertyId)] = unknownChildProperty;
  12369. info.processError();
  12370. if (info.validate) {
  12371. return property;
  12372. }
  12373. } else {
  12374. var childProperty = com_ibm_rave_library_property_PropertyProcessor.processProperty$3(childPropertyEntry, ""+(childPropertyId), childQualifiedId, property, info, messages);
  12375. property._childProperties[""+(childPropertyId)] = childProperty;
  12376. if (info.validate && info.hasInvalidProperties) {
  12377. return property;
  12378. }
  12379. }
  12380. }
  12381. property.initType(propertyJSON, info);
  12382. return property;
  12383. } else if ("array" == type) {
  12384. var property = new com_ibm_rave_library_property_PropertyArrayType(propertyId, qualifiedId, parent, messages);
  12385. var itemsQualifiedId = qualifiedId + ".items";
  12386. var itemsObj = com_ibm_rave_library_property_PropertyUtil.INSTANCE.propertyEntry(propertyJSON, "items");
  12387. if (!itemsObj) {
  12388. var unknownItemsProperty = new com_ibm_rave_library_property_PropertyUnknownType("items", itemsQualifiedId, property, messages);
  12389. property._items = unknownItemsProperty;
  12390. info.processError();
  12391. return property;
  12392. }
  12393. var itemsProperty = com_ibm_rave_library_property_PropertyProcessor.processProperty$3(itemsObj, "items", itemsQualifiedId, property, info, messages);
  12394. property._items = itemsProperty;
  12395. if (info.validate && info.hasInvalidProperties) {
  12396. return property;
  12397. }
  12398. property.initType(propertyJSON, info);
  12399. return property;
  12400. } else if ("boolean" == type) {
  12401. var property = new com_ibm_rave_library_property_PropertyBooleanType(propertyId, qualifiedId, parent, messages);
  12402. property.initType(propertyJSON, info);
  12403. return property;
  12404. } else if ("color" == type) {
  12405. var property = new com_ibm_rave_library_property_PropertyColorType(propertyId, qualifiedId, parent, messages);
  12406. property.initType(propertyJSON, info);
  12407. return property;
  12408. } else if ("enum" == type) {
  12409. var property = new com_ibm_rave_library_property_PropertyEnumType(propertyId, qualifiedId, parent, messages);
  12410. property.initType(propertyJSON, info);
  12411. return property;
  12412. } else if ("font" == type) {
  12413. var property = new com_ibm_rave_library_property_PropertyFontType(propertyId, qualifiedId, parent, messages);
  12414. property.initType(propertyJSON, info);
  12415. return property;
  12416. } else if ("numeric" == type) {
  12417. var property = new com_ibm_rave_library_property_PropertyNumericType(propertyId, qualifiedId, parent, messages);
  12418. property.initType(propertyJSON, info);
  12419. return property;
  12420. } else if ("palette" == type) {
  12421. var property = new com_ibm_rave_library_property_PropertyPaletteType(propertyId, qualifiedId, parent, messages);
  12422. property.initType(propertyJSON, info);
  12423. return property;
  12424. } else if ("length" == type) {
  12425. var property = new com_ibm_rave_library_property_PropertyLengthType(propertyId, qualifiedId, parent, messages);
  12426. property.initType(propertyJSON, info);
  12427. return property;
  12428. } else if ("padding" == type) {
  12429. var property = new com_ibm_rave_library_property_PropertyPaddingType(propertyId, qualifiedId, parent, messages);
  12430. property.initType(propertyJSON, info);
  12431. return property;
  12432. } else if ("dasharray" == type) {
  12433. var property = new com_ibm_rave_library_property_PropertyDashArrayType(propertyId, qualifiedId, parent, messages);
  12434. property.initType(propertyJSON, info);
  12435. return property;
  12436. } else if ("string" == type) {
  12437. var property = new com_ibm_rave_library_property_PropertyStringType(propertyId, qualifiedId, parent, messages);
  12438. property.initType(propertyJSON, info);
  12439. return property;
  12440. } else if ("jsonobject" == type) {
  12441. var property = new com_ibm_rave_library_property_PropertyJSONObjectType(propertyId, qualifiedId, parent, messages);
  12442. property.initType(propertyJSON, info);
  12443. return property;
  12444. } else if ("geojson" == type) {
  12445. var property = new com_ibm_rave_library_property_PropertyGeoJsonType(propertyId, qualifiedId, parent, messages);
  12446. property.initType(propertyJSON, info);
  12447. return property;
  12448. } else if ("shadow" == type) {
  12449. var property = new com_ibm_rave_library_property_PropertyShadowType(propertyId, qualifiedId, parent, messages);
  12450. property.initType(propertyJSON, info);
  12451. return property;
  12452. }
  12453. var property = new com_ibm_rave_library_property_PropertyUnknownType(propertyId, qualifiedId, parent, messages);
  12454. if (info.validate) {
  12455. com_ibm_rave_library_Library.logError(29, "Property entry '" + propertyId + "' with unknown type: " + type + " @PropertyProcessor.processProperty");
  12456. }
  12457. info.processError();
  12458. return property;
  12459. };
  12460. /**
  12461. * Validates the properties JSON object. If an error occurs, the validation will stop immediately and the cause of the error will be stored in the error object.
  12462. * @param (Object) props A JSONArray of properties as JSONObjects
  12463. * @param (boolean) validate TODO Whether or not validation is on.
  12464. */
  12465. com_ibm_rave_library_property_PropertyProcessor.validate$0 = function(props, validate) {
  12466. var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(props, com_ibm_rave_library_i18n_MessagesRegistry.EmptyRegistry(), validate);
  12467. return !info.hasInvalidProperties;
  12468. };
  12469. /**
  12470. * Validates a group of properties JSON files. Each file is validated on its own and if they all pass, the validation process will proceed to check for id collision amongst the properties and will fail validation in case two properties in two different JSON file had the same qualified id but of different type.
  12471. * @param (Array) propsArray
  12472. * @param (boolean) validate TODO
  12473. * @return (boolean) true if validation succeeds
  12474. */
  12475. com_ibm_rave_library_property_PropertyProcessor.validate$1 = function(propsArray, validate) {
  12476. var infos = [];
  12477. for (var i = 0; i < propsArray.length; ++i) {
  12478. var props = propsArray[i];
  12479. var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(props, com_ibm_rave_library_i18n_MessagesRegistry.EmptyRegistry(), validate);
  12480. if (info.hasInvalidProperties) {
  12481. return false;
  12482. }
  12483. infos.push(info);
  12484. }
  12485. if (infos.length > 1) {
  12486. var flattennedPropTypeMap = {};
  12487. var info = infos[0];
  12488. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$0(info, flattennedPropTypeMap);
  12489. for (var i = 1; i < infos.length; ++i) {
  12490. var map = {};
  12491. info = infos[i];
  12492. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$0(info, map);
  12493. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(map), __len_enFor0 = __exp_enFor0.length;
  12494. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12495. var id = __exp_enFor0[__i_enFor0];
  12496. var newProp = map[id];
  12497. var existingProp = flattennedPropTypeMap[id];
  12498. if (!existingProp || newProp.typeId() == existingProp.typeId()) {
  12499. flattennedPropTypeMap[id] = newProp;
  12500. } else {
  12501. com_ibm_rave_library_Library.logError(30, "Property entry '" + id + " @PropertyProcessor.validate");
  12502. return false;
  12503. }
  12504. }
  12505. }
  12506. }
  12507. return true;
  12508. };
  12509. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$0 = function(info, flattennedPropTypeMap) {
  12510. for (var __i_enFor0 = 0, __exp_enFor0 = info.properties, __len_enFor0 = __exp_enFor0.length;
  12511. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12512. var propertyMeta = __exp_enFor0[__i_enFor0];
  12513. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$1(propertyMeta, flattennedPropTypeMap);
  12514. }
  12515. };
  12516. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$1 = function(propertyType, flattennedPropTypeMap) {
  12517. flattennedPropTypeMap[propertyType.id()] = propertyType;
  12518. if (propertyType.typeId() == 21) {
  12519. var objPropType = propertyType;
  12520. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objPropType._childProperties), __len_enFor0 = __exp_enFor0.length;
  12521. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12522. var key = __exp_enFor0[__i_enFor0];
  12523. var childProperty = objPropType._childProperties[key];
  12524. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$1(childProperty, flattennedPropTypeMap);
  12525. }
  12526. }
  12527. };
  12528. /** @expose */
  12529. com_ibm_rave_library_property_PropertyProcessor.processProperty = function(a0, a1, a2, a3, a4, a5) {
  12530. var args = arguments;
  12531. if (args.length == 3) {
  12532. return com_ibm_rave_library_property_PropertyProcessor.processProperty$0(a0, a1, a2);
  12533. }
  12534. if (args.length == 4) {
  12535. return com_ibm_rave_library_property_PropertyProcessor.processProperty$1(a0, a1, a2, a3);
  12536. }
  12537. if (args.length == 5) {
  12538. return com_ibm_rave_library_property_PropertyProcessor.processProperty$2(a0, a1, a2, a3, a4);
  12539. }
  12540. return com_ibm_rave_library_property_PropertyProcessor.processProperty$3(a0, a1, a2, a3, a4, a5);
  12541. };
  12542. /** @expose */
  12543. com_ibm_rave_library_property_PropertyProcessor.validate = function(a0, a1) {
  12544. var args = arguments;
  12545. if (args.length == 2 && (a0 == null || Object.prototype.toString.call(a0) === "[object Array]")) {
  12546. return com_ibm_rave_library_property_PropertyProcessor.validate$1(a0, a1);
  12547. }
  12548. return com_ibm_rave_library_property_PropertyProcessor.validate$0(a0, a1);
  12549. };
  12550. com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType = function(a0, a1) {
  12551. var args = arguments;
  12552. if (args.length == 2 && (a0 == null || rave['internal']['Object'].isInstanceOf(a0, com_ibm_rave_library_property_PropertyProcessingInfo))) {
  12553. return com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$0(a0, a1);
  12554. }
  12555. return com_ibm_rave_library_property_PropertyProcessor.flattenPropertyType$1(a0, a1);
  12556. };
  12557. // $source: com/ibm/rave/library/property/PropertyType
  12558. /************************************************************************
  12559. ** IBM Confidential
  12560. **
  12561. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12562. **
  12563. ** (C) Copyright IBM Corp. 2017
  12564. **
  12565. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12566. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12567. ************************************************************************/
  12568. // GENERATED
  12569. //@import com/ibm/rave/library/framework/meta/PropertyMeta (loadtime) // superclass
  12570. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  12571. //@import com/ibm/rave/library/Library (runtime) // logError
  12572. /**
  12573. * <p> The parent class for all of the propertyTypes
  12574. * @param < (java.lang.Object) E > Type of options allowed in this type.
  12575. */
  12576. var com_ibm_rave_library_property_PropertyType = rave_library_externs["PropertyType"] = rave['internal']['Declare'](com_ibm_rave_library_framework_meta_PropertyMeta, {
  12577. //_name : null,
  12578. //_description : null,
  12579. //_icon : null,
  12580. //_defaultValue : null,
  12581. //_tags : null,
  12582. //_parent : null,
  12583. //_qualifiedId : null,
  12584. //_simpleId : null,
  12585. /** @expose */
  12586. _options : null,
  12587. /** @expose */
  12588. _messages : null,
  12589. _required : false,
  12590. _resetView : "redraw",
  12591. constructor : function(propertyId, qualifiedId, parent, messages) {
  12592. this._options = [];
  12593. {
  12594. this._messages = messages;
  12595. this._simpleId = propertyId;
  12596. this._qualifiedId = qualifiedId;
  12597. this._parent = parent;
  12598. this._tags = [];
  12599. }
  12600. },
  12601. /** @expose */
  12602. initType : function(propertyJSON, info) {
  12603. var obj = propertyJSON["name"];
  12604. if (obj != null) {
  12605. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  12606. info.processError();
  12607. return;
  12608. }
  12609. this._name = ""+(obj);
  12610. }
  12611. obj = propertyJSON["description"];
  12612. if (obj != null) {
  12613. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  12614. info.processError();
  12615. return;
  12616. }
  12617. this._description = ""+(obj);
  12618. }
  12619. obj = propertyJSON["icon"];
  12620. if (obj != null) {
  12621. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  12622. info.processError();
  12623. return;
  12624. }
  12625. this._icon = ""+(obj);
  12626. }
  12627. if (this.typeId() == 21) {
  12628. this._defaultValue = {};
  12629. return;
  12630. }
  12631. if (this._parent && this._parent.typeId() == 20) {
  12632. return;
  12633. }
  12634. obj = propertyJSON["default"];
  12635. if (obj != null) {
  12636. this._defaultValue = obj;
  12637. }
  12638. obj = propertyJSON["required"];
  12639. if (obj != null) {
  12640. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 12))) {
  12641. info.processError();
  12642. return;
  12643. }
  12644. this._required = (obj);
  12645. }
  12646. if (info.validate && this._required && (this._defaultValue == null)) {
  12647. com_ibm_rave_library_Library.logError(39, "Property Validator");
  12648. info.processError();
  12649. return;
  12650. }
  12651. obj = propertyJSON["resetView"];
  12652. if (obj != null) {
  12653. this._resetView = ""+(obj);
  12654. }
  12655. obj = propertyJSON["tags"];
  12656. if (obj != null) {
  12657. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20)) {
  12658. var tagsArray = obj;
  12659. for (var i = 0; i < tagsArray.length; ++i) {
  12660. this._tags.push(""+(tagsArray[i]));
  12661. }
  12662. }
  12663. }
  12664. },
  12665. /** @expose */
  12666. required : function() {
  12667. return this._required;
  12668. },
  12669. /** @expose */
  12670. simpleId : function() {
  12671. return this._simpleId;
  12672. },
  12673. /** @expose */
  12674. id : function() {
  12675. return this._qualifiedId;
  12676. },
  12677. /** @expose */
  12678. name : function() {
  12679. return this._messages._nls(this._name, this._name);
  12680. },
  12681. /** @expose */
  12682. description : function() {
  12683. return this._messages._nls(this._description, this._description);
  12684. },
  12685. /** @expose */
  12686. icon : function() {
  12687. return this._icon;
  12688. },
  12689. /** @expose */
  12690. defaultValue : function() {
  12691. return this._defaultValue;
  12692. },
  12693. /** @expose */
  12694. setDefaultValue : function(defaultValue) {
  12695. this._defaultValue = defaultValue;
  12696. },
  12697. /** @expose */
  12698. parent : function() {
  12699. return this._parent;
  12700. },
  12701. /**
  12702. * Get the value to be stored in a property. This allows property types to convert input values, for example the color type can convert the color to a canonical form, or an integer type can round a number. The default implementation returns the input value.
  12703. * @param (Object) value The input value
  12704. * @return (Object) The value to be stored as the property value
  12705. */
  12706. /** @expose */
  12707. canonicalValue : function(value) {
  12708. return value;
  12709. },
  12710. /**
  12711. * Returns list of allowable localized string values this property is to have. For localized non-strings returns nls keys. NOTE: This method does real time catalog lookup, for optimal performance it recommended to call it to obtain all the values , unless locale is switched. E.g. instead of <code> property.options().get(0); property.options().get(1)</code> use <code> List<String> values = property.options(); values.get{0); values.get(1);</code>
  12712. * @return (Array) the list of allowable localized string values this property is to have
  12713. */
  12714. /** @expose */
  12715. options : function() {
  12716. return this._options;
  12717. },
  12718. /** @expose */
  12719. tags : function() {
  12720. return this._tags;
  12721. },
  12722. /** @expose */
  12723. resetView : function() {
  12724. return this._resetView;
  12725. },
  12726. /** @expose */
  12727. pTypeCopy : function(pType) {
  12728. pType._required = this._required;
  12729. pType._name = this._name;
  12730. pType._description = this._description;
  12731. pType._icon = this._icon;
  12732. pType._defaultValue = this._defaultValue;
  12733. pType._resetView = this._resetView;
  12734. pType._options = [];
  12735. for (var __i_enFor0 = 0, __exp_enFor0 = this._options, __len_enFor0 = __exp_enFor0.length;
  12736. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12737. var option = __exp_enFor0[__i_enFor0];
  12738. pType._options.push(option);
  12739. }
  12740. pType._tags = [];
  12741. for (var __i_enFor1 = 0, __exp_enFor1 = this._tags, __len_enFor1 = __exp_enFor1.length;
  12742. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  12743. var tag = __exp_enFor1[__i_enFor1];
  12744. pType._tags.push(tag);
  12745. }
  12746. }
  12747. });
  12748. // $source: com/ibm/rave/library/property/PropertyUnknownType
  12749. /************************************************************************
  12750. ** IBM Confidential
  12751. **
  12752. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12753. **
  12754. ** (C) Copyright IBM Corp. 2017
  12755. **
  12756. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12757. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12758. ************************************************************************/
  12759. // GENERATED
  12760. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  12761. //@import com/ibm/rave/library/framework/meta/PropertyMeta (runtime) // PropertyMeta
  12762. //@import com/ibm/rave/library/Library (runtime) // logError
  12763. /**
  12764. * A property type that is created if the JSON object representing it didn't have a type specified. They can act as a place holder for these ill-formed properties. Unknown type will always fail validation
  12765. */
  12766. var com_ibm_rave_library_property_PropertyUnknownType = rave_library_externs["PropertyUnknownType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  12767. /** @expose */
  12768. constructor : function(propertyId, qualifiedId, parent, messages) {
  12769. },
  12770. /** @expose */
  12771. type : function() {
  12772. return com_ibm_rave_library_framework_meta_PropertyMeta.UNKNOWN_TYPE;
  12773. },
  12774. /** @expose */
  12775. typeId : function() {
  12776. return -1;
  12777. },
  12778. /** @expose */
  12779. validateValue : function(obj) {
  12780. com_ibm_rave_library_Library.logError(38, "Property Id" + this.id() + " @PropertyImpl.value");
  12781. return false;
  12782. },
  12783. /** @expose */
  12784. copy : function(parent) {
  12785. var put = new com_ibm_rave_library_property_PropertyUnknownType(this.simpleId(), this.id(), parent, this._messages);
  12786. this.pTypeCopy(put);
  12787. return put;
  12788. }
  12789. });
  12790. // $source: com/ibm/rave/library/property/PropertyObjectType
  12791. /************************************************************************
  12792. ** IBM Confidential
  12793. **
  12794. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12795. **
  12796. ** (C) Copyright IBM Corp. 2017
  12797. **
  12798. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12799. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12800. ************************************************************************/
  12801. // GENERATED
  12802. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  12803. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  12804. //@import com/ibm/rave/library/Library (runtime) // logError
  12805. /**
  12806. * <p> PropertyBooleanType </p> <p> Handles the boolean type for properties, allowing for any or all of the following: </p> <p> -a true label </p> <p> -a false label </p> <p> -a default boolean value </p> <p> The boolean property type supports only a single value, not an array of values. </p>
  12807. */
  12808. var com_ibm_rave_library_property_PropertyObjectType = rave_library_externs["PropertyObjectType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  12809. //_childProperties : null,
  12810. constructor : function(propertyId, qualifiedId, parent, messages) {
  12811. this._childProperties = {};
  12812. /**
  12813. * @param (String) propertyId
  12814. * @param (String) qualifiedId
  12815. * @param (com.ibm.rave.library.property.PropertyType) parent
  12816. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages
  12817. */
  12818. {
  12819. }
  12820. },
  12821. /** @expose */
  12822. type : function() {
  12823. return "object";
  12824. },
  12825. /** @expose */
  12826. typeId : function() {
  12827. return 21;
  12828. },
  12829. /**
  12830. * Gets a map of child properties the key of which is the simpleId of each child This map should be treated as read-only map and should not be modified
  12831. * @return (Object) the child properties of this object property
  12832. */
  12833. /** @expose */
  12834. childProperties : function() {
  12835. return this._childProperties;
  12836. },
  12837. /** @expose */
  12838. validateValue : function(obj) {
  12839. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 21))) {
  12840. return false;
  12841. }
  12842. var objJson = obj;
  12843. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objJson), __len_enFor0 = __exp_enFor0.length;
  12844. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12845. var propertyId = __exp_enFor0[__i_enFor0];
  12846. var childProperty = this._childProperties[""+(propertyId)];
  12847. if (!childProperty) {
  12848. com_ibm_rave_library_Library.logError(36, "Property Validator");
  12849. return false;
  12850. }
  12851. var propVal = objJson[propertyId];
  12852. if (!(childProperty.validateValue(propVal))) {
  12853. return false;
  12854. }
  12855. }
  12856. return true;
  12857. },
  12858. /** @expose */
  12859. initType : function(propertyJSON, info) {
  12860. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  12861. if (!(info.validate && info.hasInvalidProperties)) {
  12862. this.buildDefaultValue();
  12863. }
  12864. },
  12865. buildDefaultValue : function() {
  12866. var defaultInstance = this.defaultValue();
  12867. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._childProperties), __len_enFor0 = __exp_enFor0.length;
  12868. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12869. var propertyId = __exp_enFor0[__i_enFor0];
  12870. var childProperty = this._childProperties[propertyId];
  12871. defaultInstance[propertyId] = childProperty.defaultValue();
  12872. }
  12873. },
  12874. /** @expose */
  12875. copy : function(parent) {
  12876. var pot = new com_ibm_rave_library_property_PropertyObjectType(this.simpleId(), this.id(), parent, this._messages);
  12877. this.pTypeCopy(pot);
  12878. pot._childProperties = {};
  12879. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._childProperties), __len_enFor0 = __exp_enFor0.length;
  12880. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  12881. var key = __exp_enFor0[__i_enFor0];
  12882. pot._childProperties[key] = (this._childProperties[key].copy(pot));
  12883. }
  12884. return pot;
  12885. }
  12886. });
  12887. // $source: com/ibm/rave/library/property/PropertyArrayType
  12888. /************************************************************************
  12889. ** IBM Confidential
  12890. **
  12891. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  12892. **
  12893. ** (C) Copyright IBM Corp. 2017
  12894. **
  12895. ** The source code for this program is not published or otherwise divested of its trade secrets,
  12896. ** irrespective of what has been deposited with the U.S. Copyright Office.
  12897. ************************************************************************/
  12898. // GENERATED
  12899. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  12900. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  12901. /**
  12902. * <p> The PropertyArrayType allows us to create properties that are arrays of other properties. These properties should be all the same type.
  12903. */
  12904. var com_ibm_rave_library_property_PropertyArrayType = rave_library_externs["PropertyArrayType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  12905. //_items : null,
  12906. _minLen : 0,
  12907. _maxLen : 0,
  12908. /** @expose */
  12909. constructor : function(propertyId, qualifiedId, parent, messages) {
  12910. this._minLen = -1;
  12911. this._maxLen = -1;
  12912. },
  12913. /** @expose */
  12914. type : function() {
  12915. return "array";
  12916. },
  12917. /** @expose */
  12918. typeId : function() {
  12919. return 20;
  12920. },
  12921. /**
  12922. * Gets the minimum length of the array
  12923. * @return (int) the minimum length of the array or -1 if it wasn't specified
  12924. */
  12925. /** @expose */
  12926. minLength : function() {
  12927. return this._minLen;
  12928. },
  12929. /**
  12930. * Gets the maximum length of the array
  12931. * @return (int) the maximum length of the array or -1 if it wasn't specified
  12932. */
  12933. /** @expose */
  12934. maxLength : function() {
  12935. return this._maxLen;
  12936. },
  12937. /**
  12938. * Gets the property meta type of the array's elements
  12939. * @return (com.ibm.rave.library.property.PropertyType) the property meta type of the array's elements
  12940. */
  12941. /** @expose */
  12942. items : function() {
  12943. return this._items;
  12944. },
  12945. /** @expose */
  12946. validateValue : function(obj) {
  12947. if (!this._items) {
  12948. return false;
  12949. }
  12950. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20))) {
  12951. return false;
  12952. }
  12953. var maxNum = (this._maxLen != -1) ? this._maxLen : null;
  12954. var minNum = (this._minLen != -1) ? this._minLen : null;
  12955. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxPropertyValue(minNum, maxNum, false, (obj).length))) {
  12956. return false;
  12957. }
  12958. var list = obj;
  12959. var len = list.length;
  12960. for (var i = 0; i < len; ++i) {
  12961. var entry = list[i];
  12962. if (!(this._items.validateValue(entry))) {
  12963. return false;
  12964. }
  12965. }
  12966. return true;
  12967. },
  12968. /** @expose */
  12969. initType : function(propertyJSON, info) {
  12970. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  12971. if (!(info.validate && info.hasInvalidProperties)) {
  12972. var minObj = propertyJSON["minLength"];
  12973. var maxObj = propertyJSON["maxLength"];
  12974. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxProperties(minObj, maxObj, false, false))) {
  12975. info.processError();
  12976. return;
  12977. }
  12978. if (minObj != null) {
  12979. this._minLen = ~~ (minObj);
  12980. }
  12981. if (maxObj != null) {
  12982. this._maxLen = ~~ (maxObj);
  12983. }
  12984. if (this.defaultValue() != null) {
  12985. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  12986. info.processError();
  12987. return;
  12988. }
  12989. }
  12990. }
  12991. },
  12992. /** @expose */
  12993. copy : function(parent) {
  12994. var pat = new com_ibm_rave_library_property_PropertyArrayType(this.simpleId(), this.id(), parent, this._messages);
  12995. this.pTypeCopy(pat);
  12996. pat._minLen = this._minLen;
  12997. pat._maxLen = this._maxLen;
  12998. pat._items = this._items.copy(parent);
  12999. return pat;
  13000. }
  13001. });
  13002. // $source: com/ibm/rave/library/property/PropertyBooleanType
  13003. /************************************************************************
  13004. ** IBM Confidential
  13005. **
  13006. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13007. **
  13008. ** (C) Copyright IBM Corp. 2017
  13009. **
  13010. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13011. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13012. ************************************************************************/
  13013. // GENERATED
  13014. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13015. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13016. //@import com/ibm/rave/library/Library (runtime) // logError
  13017. /**
  13018. * <p> PropertyBooleanType </p> <p> Handles the boolean type for properties, allowing for any or all of the following: </p> <p> -a true label </p> <p> -a false label </p> <p> -a default boolean value </p> <p> The boolean property type supports only a single value, not an array of values. </p>
  13019. */
  13020. var com_ibm_rave_library_property_PropertyBooleanType = rave_library_externs["PropertyBooleanType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13021. //_truLabel : null,
  13022. //_falsLabel : null,
  13023. /**
  13024. * Constructor
  13025. */
  13026. /** @expose */
  13027. constructor : function(propertyId, qualifiedId, parent, messages) {
  13028. },
  13029. /**
  13030. * @return (String) the false label
  13031. */
  13032. /** @expose */
  13033. falseLabel : function() {
  13034. return this._falsLabel;
  13035. },
  13036. /**
  13037. * @return (String) the true label
  13038. */
  13039. /** @expose */
  13040. trueLabel : function() {
  13041. return this._truLabel;
  13042. },
  13043. /** @expose */
  13044. validateValue : function(obj) {
  13045. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 12);
  13046. },
  13047. /** @expose */
  13048. type : function() {
  13049. return "boolean";
  13050. },
  13051. /** @expose */
  13052. typeId : function() {
  13053. return 12;
  13054. },
  13055. /** @expose */
  13056. initType : function(propertyJSON, info) {
  13057. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13058. if (!(info.validate && info.hasInvalidProperties)) {
  13059. var obj = propertyJSON["trueLabel"];
  13060. var obj2 = propertyJSON["falseLabel"];
  13061. if (info.validate) {
  13062. if ((obj != null || obj2 != null) && (obj == null || obj2 == null)) {
  13063. com_ibm_rave_library_Library.logError(33, "PropertyBooleanType Constructor");
  13064. info.processError();
  13065. return;
  13066. }
  13067. if (obj != null && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  13068. info.processError();
  13069. return;
  13070. }
  13071. if (obj2 != null && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj2, 10))) {
  13072. info.processError();
  13073. return;
  13074. }
  13075. }
  13076. if (obj != null) {
  13077. this._truLabel = ""+(obj);
  13078. this._truLabel = this._messages._nls(this._truLabel, this._truLabel);
  13079. }
  13080. if (obj2 != null) {
  13081. this._falsLabel = ""+(obj2);
  13082. this._falsLabel = this._messages._nls(this._falsLabel, this._falsLabel);
  13083. }
  13084. if (this.defaultValue() != null) {
  13085. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13086. info.processError();
  13087. return;
  13088. }
  13089. }
  13090. }
  13091. },
  13092. /** @expose */
  13093. copy : function(parent) {
  13094. var pbt = new com_ibm_rave_library_property_PropertyBooleanType(this.simpleId(), this.id(), parent, this._messages);
  13095. this.pTypeCopy(pbt);
  13096. pbt._truLabel = this._truLabel;
  13097. pbt._falsLabel = this._falsLabel;
  13098. return pbt;
  13099. }
  13100. });
  13101. // $source: com/ibm/rave/library/property/PropertyColorType
  13102. /************************************************************************
  13103. ** IBM Confidential
  13104. **
  13105. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13106. **
  13107. ** (C) Copyright IBM Corp. 2017
  13108. **
  13109. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13110. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13111. ************************************************************************/
  13112. // GENERATED
  13113. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13114. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13115. /**
  13116. * PropertyColorType Handles the color type for properties, allowing for any or all of the following: -a default color (default) -a color type
  13117. */
  13118. var com_ibm_rave_library_property_PropertyColorType = rave_library_externs["PropertyColorType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13119. //_colorType : null,
  13120. /**
  13121. * Takes a type object that is actually a CSS string for color. This can be and rgb value or a string name for a standard color. An error occurs if the color objects does not meet these criteria.
  13122. */
  13123. /** @expose */
  13124. constructor : function(propertyId, qualifiedId, parent, messages) {
  13125. },
  13126. /**
  13127. * Returns the object (converted to a string) or returns the default if the object is null. If the object is the wrong type or null and there is no default, the error is set.
  13128. * @param (Object) obj - a color object.
  13129. * @return (boolean) the object converted to a string, the default if there is no object, or null if there is neither an object or a default.
  13130. */
  13131. /** @expose */
  13132. validateValue : function(obj) {
  13133. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  13134. },
  13135. /**
  13136. * Converts the input value to a canonical color. Invalid color-names become black. Returns null for null, and "" for "", to preserve existing GUI behavior.
  13137. */
  13138. /** @expose */
  13139. canonicalValue : function(value) {
  13140. if (value == null || "" == value) {
  13141. return value;
  13142. }
  13143. return rave.rgb(value).toString();
  13144. },
  13145. /** @expose */
  13146. type : function() {
  13147. return "color";
  13148. },
  13149. /** @expose */
  13150. typeId : function() {
  13151. return 15;
  13152. },
  13153. /** @expose */
  13154. initType : function(propertyJSON, info) {
  13155. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13156. if (!(info.validate && info.hasInvalidProperties)) {
  13157. var obj = propertyJSON["colorType"];
  13158. if (obj != null) {
  13159. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  13160. info.processError();
  13161. return;
  13162. }
  13163. this._colorType = ""+(obj);
  13164. }
  13165. if (this.defaultValue() != null) {
  13166. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13167. info.processError();
  13168. return;
  13169. }
  13170. }
  13171. }
  13172. },
  13173. /**
  13174. * gets the a string identifiying the color type. Could be any of the following: "rgb", "hsl", "hcl", "lab"
  13175. * @return (String) the color type identifier
  13176. */
  13177. /** @expose */
  13178. colorType : function() {
  13179. return this._colorType;
  13180. },
  13181. /** @expose */
  13182. copy : function(parent) {
  13183. var pct = new com_ibm_rave_library_property_PropertyColorType(this.simpleId(), this.id(), parent, this._messages);
  13184. this.pTypeCopy(pct);
  13185. pct._colorType = this._colorType;
  13186. return pct;
  13187. }
  13188. });
  13189. // $source: com/ibm/rave/library/property/PropertyEnumType
  13190. /************************************************************************
  13191. ** IBM Confidential
  13192. **
  13193. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13194. **
  13195. ** (C) Copyright IBM Corp. 2017
  13196. **
  13197. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13198. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13199. ************************************************************************/
  13200. // GENERATED
  13201. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13202. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13203. //@import com/ibm/rave/library/Library (runtime) // logError
  13204. //@import com/ibm/rave/library/property/EnumPropertyOption (runtime) // new
  13205. /**
  13206. * PropertyEnumType Handles the enum type for properties, allowing for any or all of the following: -an array of enums mapped to strings -a default enum TODO: This shows the TODO: We don't have any uses of enums in the bundles yet. This assumes that they will be internationalized, meaning that the string labels will be message IDs.
  13207. */
  13208. var com_ibm_rave_library_property_PropertyEnumType = rave_library_externs["PropertyEnumType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13209. //_enums : null,
  13210. /**
  13211. * Constructor
  13212. */
  13213. /** @expose */
  13214. constructor : function(propertyId, qualifiedId, parent, messages) {
  13215. this._enums = {};
  13216. },
  13217. /**
  13218. * Value validation rules An error occurs if: 1) The enum object is the wrong type 2) The enumValue is not found in the options array 3) The object is null and there is no default
  13219. * @param (Object) obj the enum value (should be an Integer)
  13220. */
  13221. /** @expose */
  13222. validateValue : function(obj) {
  13223. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumeric(obj, false))) {
  13224. return false;
  13225. }
  13226. if (this._enums[(~~ (obj))] == null) {
  13227. com_ibm_rave_library_Library.logError(34, "Property Validator");
  13228. return false;
  13229. }
  13230. return true;
  13231. },
  13232. /**
  13233. * Returns the corresponding string value for the enum, or null if the enum is invalid
  13234. * @param (int) num the enum number
  13235. * @return (String) the corresponding string
  13236. */
  13237. /** @expose */
  13238. enumValue : function(num) {
  13239. return this._enums[num];
  13240. },
  13241. /** @expose */
  13242. type : function() {
  13243. return "enum";
  13244. },
  13245. /** @expose */
  13246. typeId : function() {
  13247. return 13;
  13248. },
  13249. /** @expose */
  13250. initType : function(propertyJSON, info) {
  13251. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13252. if (!(info.validate && info.hasInvalidProperties)) {
  13253. var obj = propertyJSON["options"];
  13254. if (obj == null) {
  13255. if (info.validate) {
  13256. com_ibm_rave_library_Library.logError(41, "Property Validator");
  13257. }
  13258. info.processError();
  13259. return;
  13260. }
  13261. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20))) {
  13262. info.processError();
  13263. return;
  13264. }
  13265. var optionsArray = obj;
  13266. var len = optionsArray.length;
  13267. for (var i = 0; i < len; ++i) {
  13268. var optionObj = optionsArray[i];
  13269. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(optionObj, 21))) {
  13270. info.processError();
  13271. if (info.validate) {
  13272. return;
  13273. }
  13274. continue;
  13275. }
  13276. var valueObj = (optionObj)["enum"];
  13277. var labelObj = (optionObj)["enumLabel"];
  13278. if (valueObj == null || labelObj == null) {
  13279. if (info.validate) {
  13280. com_ibm_rave_library_Library.logError(42, "Property Validator");
  13281. }
  13282. info.processError();
  13283. if (info.validate) {
  13284. return;
  13285. }
  13286. continue;
  13287. }
  13288. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumeric(valueObj, false))) {
  13289. info.processError();
  13290. return;
  13291. }
  13292. var value = ~~ (valueObj);
  13293. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(labelObj, 10))) {
  13294. info.processError();
  13295. return;
  13296. }
  13297. var label = ""+(labelObj);
  13298. if (this._enums[value] != null) {
  13299. if (info.validate) {
  13300. com_ibm_rave_library_Library.logError(43, "Property Validator");
  13301. }
  13302. info.processError();
  13303. if (info.validate) {
  13304. return;
  13305. }
  13306. continue;
  13307. }
  13308. this._enums[value] = label;
  13309. this._options.push(new com_ibm_rave_library_property_EnumPropertyOption(value, label, this._messages));
  13310. }
  13311. }
  13312. if (this.defaultValue() != null) {
  13313. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumeric(this.defaultValue(), false)) {
  13314. com_ibm_rave_library_property_PropertyType.prototype.setDefaultValue.call(this, ~~ (this.defaultValue()));
  13315. }
  13316. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13317. info.processError();
  13318. return;
  13319. }
  13320. }
  13321. },
  13322. /** @expose */
  13323. copy : function(parent) {
  13324. var pet = new com_ibm_rave_library_property_PropertyEnumType(this.simpleId(), this.id(), parent, this._messages);
  13325. this.pTypeCopy(pet);
  13326. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._enums), __len_enFor0 = __exp_enFor0.length;
  13327. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  13328. var key = __exp_enFor0[__i_enFor0];
  13329. pet._enums[key] = this._enums[key];
  13330. }
  13331. return pet;
  13332. }
  13333. });
  13334. // $source: com/ibm/rave/library/property/PropertyFontType
  13335. /************************************************************************
  13336. ** IBM Confidential
  13337. **
  13338. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13339. **
  13340. ** (C) Copyright IBM Corp. 2017
  13341. **
  13342. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13343. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13344. ************************************************************************/
  13345. // GENERATED
  13346. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13347. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13348. /**
  13349. * <p> PropertyFontType </p> <p> Handles the font type for properties, which can only have a default field, stored as a single comma separated string, as in CSS font styles. </p>
  13350. */
  13351. var com_ibm_rave_library_property_PropertyFontType = rave_library_externs["PropertyFontType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13352. /**
  13353. * Constructor
  13354. */
  13355. /** @expose */
  13356. constructor : function(propertyId, qualifiedId, parent, messages) {
  13357. },
  13358. /**
  13359. * Validation rules An error is triggered if: 1) The font family is not a string a String array 2) The object is null and there is no default to return.
  13360. */
  13361. /** @expose */
  13362. validateValue : function(obj) {
  13363. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  13364. },
  13365. /** @expose */
  13366. type : function() {
  13367. return "font";
  13368. },
  13369. /** @expose */
  13370. typeId : function() {
  13371. return 14;
  13372. },
  13373. /** @expose */
  13374. initType : function(propertyJSON, info) {
  13375. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13376. if (!(info.validate && info.hasInvalidProperties)) {
  13377. if (this.defaultValue() != null) {
  13378. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13379. info.processError();
  13380. return;
  13381. }
  13382. }
  13383. }
  13384. },
  13385. /** @expose */
  13386. copy : function(parent) {
  13387. var pft = new com_ibm_rave_library_property_PropertyFontType(this.simpleId(), this.id(), parent, this._messages);
  13388. this.pTypeCopy(pft);
  13389. return pft;
  13390. }
  13391. });
  13392. // $source: com/ibm/rave/library/property/PropertyNumericType
  13393. /************************************************************************
  13394. ** IBM Confidential
  13395. **
  13396. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13397. **
  13398. ** (C) Copyright IBM Corp. 2017
  13399. **
  13400. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13401. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13402. ************************************************************************/
  13403. // GENERATED
  13404. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13405. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13406. //@import com/ibm/rave/library/property/NumberPropertyOption (runtime) // new
  13407. /**
  13408. * <p> PropertyNumericType </p> <p> Numeric types can be whole or decimal, can be limited by a minimum and maximum, can have a default value, and may be limited to a set selection of values. Although the values may be limited to whole numbers (integers or longs) all particulars within this class are declared as doubles. </p> <p> Numeric types may have the following metadata that restricts permitted values: </p> <p> - the minimum value - the maximum value - the subtype: "whole" or "decimal" - an array of permitted options - the default value </p>
  13409. */
  13410. var com_ibm_rave_library_property_PropertyNumericType = rave_library_externs["PropertyNumericType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13411. _minVal : 0,
  13412. _maxVal : 0,
  13413. _decimal : false,
  13414. /** @expose */
  13415. constructor : function(propertyId, qualifiedId, parent, messages) {
  13416. this._decimal = true;
  13417. this._minVal = NaN;
  13418. this._maxVal = NaN;
  13419. },
  13420. /**
  13421. * @return (Array) the list of allowable numbers. Could be null if nothing was specified
  13422. */
  13423. /** @expose */
  13424. options : function() {
  13425. return this._options;
  13426. },
  13427. /**
  13428. * Validation rules An error will be triggered if there is an error object and: 1) there is no numeric object, and no default value 2) the object type is not numeric 3) the value is below the minimum (if the min is specified.) 4) the value is above the maximum (if the max is specified.) 5) the value is decimal when the subtype is "whole" 6) the value is not amongst the specified options
  13429. * @param (Object) obj A numeric object for validation
  13430. * @return (boolean) the original object, or the default if it exists and the object passed in does not.
  13431. */
  13432. /** @expose */
  13433. validateValue : function(obj) {
  13434. var maxNum = (isNaN(this._maxVal)) ? null : this._maxVal;
  13435. var minNum = (isNaN(this._minVal)) ? null : this._minVal;
  13436. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumeric(obj, this._decimal)) || !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxPropertyValue(minNum, maxNum, this._decimal, + (obj)))) {
  13437. return false;
  13438. }
  13439. if (this._options && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumericProperties(this._options, + (obj), this._decimal))) {
  13440. return false;
  13441. }
  13442. return true;
  13443. },
  13444. /**
  13445. * @return (double) the minimum value, which will be NaN if none was set
  13446. */
  13447. /** @expose */
  13448. min : function() {
  13449. return this._minVal;
  13450. },
  13451. /**
  13452. * @return (double) the maximum value, which will be NaN if none was set
  13453. */
  13454. /** @expose */
  13455. max : function() {
  13456. return this._maxVal;
  13457. },
  13458. /**
  13459. * @return (boolean) when true it means that this numeric property can have a fractional part, else it is an an integer
  13460. */
  13461. /** @expose */
  13462. decimal : function() {
  13463. return this._decimal;
  13464. },
  13465. /** @expose */
  13466. type : function() {
  13467. return "numeric";
  13468. },
  13469. /** @expose */
  13470. typeId : function() {
  13471. return 11;
  13472. },
  13473. /** @expose */
  13474. initType : function(propertyJSON, info) {
  13475. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13476. if (!(info.validate && info.hasInvalidProperties)) {
  13477. var obj = propertyJSON["decimal"];
  13478. if (obj != null) {
  13479. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 12))) {
  13480. info.processError();
  13481. return;
  13482. }
  13483. this._decimal = (obj);
  13484. }
  13485. var minObj = propertyJSON["min"];
  13486. var maxObj = propertyJSON["max"];
  13487. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxProperties(minObj, maxObj, this._decimal, true))) {
  13488. info.processError();
  13489. return;
  13490. }
  13491. if (minObj != null) {
  13492. this._minVal = + (minObj);
  13493. }
  13494. if (maxObj != null) {
  13495. this._maxVal = + (maxObj);
  13496. }
  13497. obj = propertyJSON["options"];
  13498. if (obj != null) {
  13499. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20)) {
  13500. var optionsArray = obj;
  13501. if (info.validate) {
  13502. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateSimpleOptions(optionsArray, this))) {
  13503. info.processError();
  13504. return;
  13505. }
  13506. }
  13507. var len = optionsArray.length;
  13508. this._options = [];
  13509. for (var i = 0; i < len; ++i) {
  13510. var t = (this._decimal) ? + (optionsArray[i]) : ~~ (optionsArray[i]);
  13511. this._options.push(new com_ibm_rave_library_property_NumberPropertyOption(t));
  13512. }
  13513. } else {
  13514. info.processError();
  13515. if (info.validate) {
  13516. return;
  13517. }
  13518. }
  13519. }
  13520. if (this.defaultValue() != null) {
  13521. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateNumeric(this.defaultValue(), this._decimal)) {
  13522. com_ibm_rave_library_property_PropertyType.prototype.setDefaultValue.call(this, (this._decimal) ? + (this.defaultValue()) : ~~ (this.defaultValue()));
  13523. }
  13524. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13525. info.processError();
  13526. return;
  13527. }
  13528. }
  13529. }
  13530. },
  13531. /** @expose */
  13532. copy : function(parent) {
  13533. var pnt = new com_ibm_rave_library_property_PropertyNumericType(this.simpleId(), this.id(), parent, this._messages);
  13534. this.pTypeCopy(pnt);
  13535. pnt._minVal = this._minVal;
  13536. pnt._maxVal = this._maxVal;
  13537. pnt._decimal = this._decimal;
  13538. return pnt;
  13539. }
  13540. });
  13541. // $source: com/ibm/rave/library/property/PropertyPaletteType
  13542. /************************************************************************
  13543. ** IBM Confidential
  13544. **
  13545. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13546. **
  13547. ** (C) Copyright IBM Corp. 2017
  13548. **
  13549. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13550. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13551. ************************************************************************/
  13552. // GENERATED
  13553. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13554. //@import com/ibm/rave/library/Library (runtime) // Library
  13555. //@import com/ibm/rave/library/property/PalettePropertyOption (runtime) // new
  13556. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13557. /**
  13558. * <p> Handles the palette type for properties, which is an extended string type that pulls some of it's option from the library's palette manager as well as the bundles properties
  13559. */
  13560. var com_ibm_rave_library_property_PropertyPaletteType = rave_library_externs["PropertyPaletteType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13561. /**
  13562. * based on these types we will get all palettes that are of the types listed in the options
  13563. */
  13564. //paletteTypes : null,
  13565. /**
  13566. * @param (String) propertyId
  13567. * @param (String) qualifiedId
  13568. * @param (com.ibm.rave.library.property.PropertyType) parent
  13569. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages
  13570. */
  13571. /** @expose */
  13572. constructor : function(propertyId, qualifiedId, parent, messages) {
  13573. },
  13574. /**
  13575. * Creates a new list of PropertyOption objects from the library's palette manager. These objects can be used to retrieve the pallet Id and localized label. TODO. All palettes should use IDs for the label and description, and those strings should be defined in the messages.
  13576. * @return (Array) list of palette property option objects
  13577. */
  13578. /** @expose */
  13579. options : function() {
  13580. var dynamicOptions = [];
  13581. var libraryOptions = com_ibm_rave_library_Library.palettes.getAllPalettes();
  13582. for (var __i_enFor0 = 0, __exp_enFor0 = libraryOptions, __len_enFor0 = __exp_enFor0.length;
  13583. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  13584. var palette = __exp_enFor0[__i_enFor0];
  13585. if (this.paletteTypes.indexOf(palette.type)> -1) {
  13586. dynamicOptions.push(new com_ibm_rave_library_property_PalettePropertyOption(palette._id, palette._label, this._messages));
  13587. }
  13588. }
  13589. return dynamicOptions;
  13590. },
  13591. /**
  13592. * Gets the default value for the property if there is no default we get the library's default value
  13593. * @return (Object) the valid options
  13594. */
  13595. /** @expose */
  13596. defaultValue : function() {
  13597. var defaultValue = com_ibm_rave_library_property_PropertyType.prototype.defaultValue.call(this);
  13598. if (defaultValue == null) {
  13599. return com_ibm_rave_library_Library.palettes.getPaletteManagerData().defaultPalette;
  13600. }
  13601. return defaultValue;
  13602. },
  13603. /** @expose */
  13604. type : function() {
  13605. return "palette";
  13606. },
  13607. /** @expose */
  13608. typeId : function() {
  13609. return 16;
  13610. },
  13611. /** @expose */
  13612. initType : function(propertyJSON, info) {
  13613. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13614. if (!(info.validate && info.hasInvalidProperties)) {
  13615. var obj = propertyJSON["options"];
  13616. if (obj != null) {
  13617. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20)) {
  13618. var optionsArray = obj;
  13619. var len = optionsArray.length;
  13620. this.paletteTypes = [];
  13621. for (var i = 0; i < len; ++i) {
  13622. this.paletteTypes.push(""+(optionsArray[i]));
  13623. }
  13624. if (info.validate) {
  13625. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateSimpleOptions(optionsArray, this))) {
  13626. info.processError();
  13627. return;
  13628. }
  13629. }
  13630. } else {
  13631. info.processError();
  13632. if (info.validate) {
  13633. return;
  13634. }
  13635. }
  13636. }
  13637. if (this.defaultValue() != null) {
  13638. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13639. info.processError();
  13640. return;
  13641. }
  13642. }
  13643. }
  13644. },
  13645. /** @expose */
  13646. validateValue : function(obj) {
  13647. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10) || !this.paletteTypes || this.paletteTypes.length < 1 || com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateObjectExistInList(this.paletteTypes, obj);
  13648. },
  13649. /** @expose */
  13650. copy : function(parent) {
  13651. var ppt = new com_ibm_rave_library_property_PropertyPaletteType(this.simpleId(), this.id(), parent, this._messages);
  13652. this.pTypeCopy(ppt);
  13653. ppt.paletteTypes = [];
  13654. for (var __i_enFor0 = 0, __exp_enFor0 = this.paletteTypes, __len_enFor0 = __exp_enFor0.length;
  13655. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  13656. var palette = __exp_enFor0[__i_enFor0];
  13657. ppt.paletteTypes.push(palette);
  13658. }
  13659. return ppt;
  13660. }
  13661. });
  13662. // $source: com/ibm/rave/library/property/PropertyLengthType
  13663. /************************************************************************
  13664. ** IBM Confidential
  13665. **
  13666. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13667. **
  13668. ** (C) Copyright IBM Corp. 2017
  13669. **
  13670. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13671. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13672. ************************************************************************/
  13673. // GENERATED
  13674. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13675. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13676. /**
  13677. * <p> PropertyLengthType </p> <p> Handles the css length type for properties. </p>
  13678. */
  13679. var com_ibm_rave_library_property_PropertyLengthType = rave_library_externs["PropertyLengthType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13680. /**
  13681. * Constructor
  13682. */
  13683. /** @expose */
  13684. constructor : function(propertyId, qualifiedId, parent, messages) {
  13685. },
  13686. /**
  13687. * Validation rules An error is triggered if: 1) The property is not a string 2) The object is null and there is no default to return.
  13688. */
  13689. /** @expose */
  13690. validateValue : function(obj) {
  13691. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  13692. },
  13693. /** @expose */
  13694. type : function() {
  13695. return "length";
  13696. },
  13697. /** @expose */
  13698. typeId : function() {
  13699. return 17;
  13700. },
  13701. /** @expose */
  13702. initType : function(propertyJSON, info) {
  13703. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13704. if (!(info.validate && info.hasInvalidProperties)) {
  13705. if (this.defaultValue() != null) {
  13706. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13707. info.processError();
  13708. return;
  13709. }
  13710. }
  13711. }
  13712. },
  13713. /** @expose */
  13714. copy : function(parent) {
  13715. var pft = new com_ibm_rave_library_property_PropertyLengthType(this.simpleId(), this.id(), parent, this._messages);
  13716. this.pTypeCopy(pft);
  13717. return pft;
  13718. }
  13719. });
  13720. // $source: com/ibm/rave/library/property/PropertyPaddingType
  13721. /************************************************************************
  13722. ** IBM Confidential
  13723. **
  13724. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13725. **
  13726. ** (C) Copyright IBM Corp. 2017
  13727. **
  13728. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13729. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13730. ************************************************************************/
  13731. // GENERATED
  13732. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13733. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13734. /**
  13735. * <p> PropertyPaddingType </p> <p> Handles the css padding type for properties. Example: "padding-left:10px; padding-top:15px; padding-right:5px; padding-bottom:10px" For backwards compatibility, a single "length" can be specfied (eg. "10px") and this applies to all 4 </p>
  13736. */
  13737. var com_ibm_rave_library_property_PropertyPaddingType = rave_library_externs["PropertyPaddingType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13738. /**
  13739. * Constructor
  13740. */
  13741. /** @expose */
  13742. constructor : function(propertyId, qualifiedId, parent, messages) {
  13743. },
  13744. /**
  13745. * Validation rules An error is triggered if: 1) The property is not a string 2) The object is null and there is no default to return.
  13746. */
  13747. /** @expose */
  13748. validateValue : function(obj) {
  13749. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  13750. },
  13751. /** @expose */
  13752. type : function() {
  13753. return "padding";
  13754. },
  13755. /** @expose */
  13756. typeId : function() {
  13757. return 18;
  13758. },
  13759. /** @expose */
  13760. initType : function(propertyJSON, info) {
  13761. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13762. if (!(info.validate && info.hasInvalidProperties)) {
  13763. if (this.defaultValue() != null) {
  13764. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13765. info.processError();
  13766. return;
  13767. }
  13768. }
  13769. }
  13770. },
  13771. /** @expose */
  13772. copy : function(parent) {
  13773. var pft = new com_ibm_rave_library_property_PropertyPaddingType(this.simpleId(), this.id(), parent, this._messages);
  13774. this.pTypeCopy(pft);
  13775. return pft;
  13776. }
  13777. });
  13778. // $source: com/ibm/rave/library/property/PropertyDashArrayType
  13779. /************************************************************************
  13780. ** IBM Confidential
  13781. **
  13782. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13783. **
  13784. ** (C) Copyright IBM Corp. 2017
  13785. **
  13786. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13787. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13788. ************************************************************************/
  13789. // GENERATED
  13790. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13791. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13792. /**
  13793. * <p> PropertyDashArrayType </p> <p> Handles the css stroke-dasharray type for properties. A comma separated list of stroke,gap (stroke,gap...) for a line. Examples: "1,5" is dot "5,5" is dash "5,5,1,5" is dash-dot </p>
  13794. */
  13795. var com_ibm_rave_library_property_PropertyDashArrayType = rave_library_externs["PropertyDashArrayType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13796. /**
  13797. * Constructor
  13798. */
  13799. /** @expose */
  13800. constructor : function(propertyId, qualifiedId, parent, messages) {
  13801. },
  13802. /**
  13803. * Validation rules An error is triggered if: 1) The property is not a string 2) The object is null and there is no default to return.
  13804. */
  13805. /** @expose */
  13806. validateValue : function(obj) {
  13807. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  13808. },
  13809. /** @expose */
  13810. type : function() {
  13811. return "dasharray";
  13812. },
  13813. /** @expose */
  13814. typeId : function() {
  13815. return 19;
  13816. },
  13817. /** @expose */
  13818. initType : function(propertyJSON, info) {
  13819. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13820. if (!(info.validate && info.hasInvalidProperties)) {
  13821. if (this.defaultValue() != null) {
  13822. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13823. info.processError();
  13824. return;
  13825. }
  13826. }
  13827. }
  13828. },
  13829. /** @expose */
  13830. copy : function(parent) {
  13831. var pft = new com_ibm_rave_library_property_PropertyDashArrayType(this.simpleId(), this.id(), parent, this._messages);
  13832. this.pTypeCopy(pft);
  13833. return pft;
  13834. }
  13835. });
  13836. // $source: com/ibm/rave/library/property/PropertyStringType
  13837. /************************************************************************
  13838. ** IBM Confidential
  13839. **
  13840. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  13841. **
  13842. ** (C) Copyright IBM Corp. 2017
  13843. **
  13844. ** The source code for this program is not published or otherwise divested of its trade secrets,
  13845. ** irrespective of what has been deposited with the U.S. Copyright Office.
  13846. ************************************************************************/
  13847. // GENERATED
  13848. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  13849. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  13850. //@import com/ibm/rave/library/property/StringPropertyOption (runtime) // new
  13851. //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // stringMatchesRexExp
  13852. //@import com/ibm/rave/library/Library (runtime) // logError
  13853. /**
  13854. * <p> Handles the string type for properties, allowing for any or all of the following: </p> -a minimum length (minLength) -a maximum length (maxLength) -a regular expression the string should match (regExp) -a flag which indicates whether the string is to be localized (localize) -an array of options, one of which any string value must match (options) -a default string value (default)
  13855. */
  13856. var com_ibm_rave_library_property_PropertyStringType = rave_library_externs["PropertyStringType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  13857. //_regExp : null,
  13858. _minLen : 0,
  13859. _maxLen : 0,
  13860. _localize : false,
  13861. /**
  13862. * Constructor This does no error or type checking. It is assumed that the JSONObject has already been validated.
  13863. */
  13864. /** @expose */
  13865. constructor : function(propertyId, qualifiedId, parent, messages) {
  13866. this._minLen = -1;
  13867. this._maxLen = -1;
  13868. },
  13869. /**
  13870. * @return (int) the minimum length of the string or -1 if this constraint wasn't specified
  13871. */
  13872. /** @expose */
  13873. minLength : function() {
  13874. return this._minLen;
  13875. },
  13876. /**
  13877. * @return (int) the maximum length of the string or -1 if this constraint wasn't specified
  13878. */
  13879. /** @expose */
  13880. maxLength : function() {
  13881. return this._maxLen;
  13882. },
  13883. optionsIDs : function() {
  13884. var ids = [];
  13885. if (this._options) {
  13886. for (var __i_enFor0 = 0, __exp_enFor0 = this._options, __len_enFor0 = __exp_enFor0.length;
  13887. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  13888. var option = __exp_enFor0[__i_enFor0];
  13889. ids.push(option.value());
  13890. }
  13891. }
  13892. return ids;
  13893. },
  13894. /**
  13895. * @return (String) the regular expression -if any- which values of this property must match
  13896. */
  13897. /** @expose */
  13898. regularExpression : function() {
  13899. return this._regExp;
  13900. },
  13901. /** @expose */
  13902. type : function() {
  13903. return "string";
  13904. },
  13905. /** @expose */
  13906. typeId : function() {
  13907. return 10;
  13908. },
  13909. /**
  13910. * @return (boolean) whether the value of the localize flag on the string property
  13911. */
  13912. /** @expose */
  13913. localize : function() {
  13914. return this._localize;
  13915. },
  13916. /** @expose */
  13917. initType : function(propertyJSON, info) {
  13918. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  13919. if (!(info.validate && info.hasInvalidProperties)) {
  13920. var minObj = propertyJSON["minLength"];
  13921. var maxObj = propertyJSON["maxLength"];
  13922. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxProperties(minObj, maxObj, false, false))) {
  13923. info.processError();
  13924. return;
  13925. }
  13926. if (minObj != null) {
  13927. this._minLen = ~~ (minObj);
  13928. }
  13929. if (maxObj != null) {
  13930. this._maxLen = ~~ (maxObj);
  13931. }
  13932. var obj = propertyJSON["localize"];
  13933. if (obj != null) {
  13934. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 12))) {
  13935. info.processError();
  13936. return;
  13937. }
  13938. this._localize = (obj);
  13939. }
  13940. obj = propertyJSON["regExp"];
  13941. if (obj != null) {
  13942. if (info.validate && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10))) {
  13943. info.processError();
  13944. return;
  13945. }
  13946. this._regExp = ""+(obj);
  13947. }
  13948. obj = propertyJSON["options"];
  13949. if (obj != null) {
  13950. if (com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 20)) {
  13951. var optionsArray = obj;
  13952. if (info.validate) {
  13953. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateStringOptions(optionsArray, this))) {
  13954. info.processError();
  13955. return;
  13956. }
  13957. }
  13958. var len = optionsArray.length;
  13959. this._options = [];
  13960. for (var i = 0; i < len; ++i) {
  13961. var o = optionsArray[i];
  13962. this._options.push(new com_ibm_rave_library_property_StringPropertyOption(""+(o["value"]), ""+(o["id"]), this._messages));
  13963. }
  13964. } else {
  13965. info.processError();
  13966. if (info.validate) {
  13967. return;
  13968. }
  13969. }
  13970. }
  13971. if (this.defaultValue() != null) {
  13972. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  13973. info.processError();
  13974. return;
  13975. }
  13976. }
  13977. }
  13978. },
  13979. /** @expose */
  13980. validateValue : function(obj) {
  13981. var maxNum = (this._maxLen != -1) ? this._maxLen : null;
  13982. var minNum = (this._minLen != -1) ? this._minLen : null;
  13983. if (!(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10)) || !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateMinMaxPropertyValue(minNum, maxNum, false, (""+(obj)).length))) {
  13984. return false;
  13985. }
  13986. if (this._regExp != null && this._regExp.length > 0 && !(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.stringMatchesRexExp((""+(obj)), this._regExp))) {
  13987. com_ibm_rave_library_Library.logError(37, "Property Validator");
  13988. return false;
  13989. }
  13990. if (this._options.length > 0 && !(com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateObjectExistInList(this.optionsIDs(), obj))) {
  13991. return false;
  13992. }
  13993. return true;
  13994. },
  13995. /** @expose */
  13996. copy : function(parent) {
  13997. var pst = new com_ibm_rave_library_property_PropertyStringType(this.simpleId(), this.id(), parent, this._messages);
  13998. this.pTypeCopy(pst);
  13999. pst._minLen = this._minLen;
  14000. pst._maxLen = this._maxLen;
  14001. pst._localize = this._localize;
  14002. pst._regExp = this._regExp;
  14003. return pst;
  14004. }
  14005. });
  14006. // $source: com/ibm/rave/library/property/PropertyJSONObjectType
  14007. /************************************************************************
  14008. ** IBM Confidential
  14009. **
  14010. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14011. **
  14012. ** (C) Copyright IBM Corp. 2017
  14013. **
  14014. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14015. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14016. ************************************************************************/
  14017. // GENERATED
  14018. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  14019. //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isJSONObject
  14020. //@import com/ibm/rave/library/Library (runtime) // logError
  14021. /**
  14022. * <p> PropertyJSONObjectType </p> <p> Handles the JSON Object type for properties. This type is used for passing JSON Objects between the application and the bundle, primarily for GeoJSONs. It is not validated, and cannot have a default, nor does it have any validation fields. </p> <p> The JSONObject property type supports only a single value, not an array of values. </p>
  14023. */
  14024. var com_ibm_rave_library_property_PropertyJSONObjectType = rave_library_externs["PropertyJSONObjectType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  14025. /**
  14026. * Constructor
  14027. */
  14028. /** @expose */
  14029. constructor : function(propertyId, qualifiedId, parent, messages) {
  14030. },
  14031. /**
  14032. * For this type, we do NO validation. It is assumed that the JSON object (usually, a GeoJSON) will have been verified in advance before being submitted.
  14033. */
  14034. /** @expose */
  14035. validateValue : function(obj) {
  14036. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj))) {
  14037. com_ibm_rave_library_Library.logError(31, "PropertyJSONObjectType validateValue");
  14038. return false;
  14039. }
  14040. return true;
  14041. },
  14042. /** @expose */
  14043. type : function() {
  14044. return "jsonobject";
  14045. },
  14046. /** @expose */
  14047. typeId : function() {
  14048. return 22;
  14049. },
  14050. /** @expose */
  14051. initType : function(propertyJSON, info) {
  14052. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  14053. if (this.defaultValue() != null) {
  14054. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  14055. info.processError();
  14056. }
  14057. }
  14058. },
  14059. /** @expose */
  14060. copy : function(parent) {
  14061. var pjt = new com_ibm_rave_library_property_PropertyJSONObjectType(this.simpleId(), this.id(), parent, this._messages);
  14062. this.pTypeCopy(pjt);
  14063. return pjt;
  14064. }
  14065. });
  14066. // $source: com/ibm/rave/library/property/PropertyGeoJsonType
  14067. /************************************************************************
  14068. ** IBM Confidential
  14069. **
  14070. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14071. **
  14072. ** (C) Copyright IBM Corp. 2017
  14073. **
  14074. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14075. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14076. ************************************************************************/
  14077. // GENERATED
  14078. //@import com/ibm/rave/library/property/PropertyJSONObjectType (loadtime) // superclass
  14079. var com_ibm_rave_library_property_PropertyGeoJsonType = rave_library_externs["PropertyGeoJsonType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyJSONObjectType, {
  14080. /** @expose */
  14081. constructor : function(propertyId, qualifiedId, parent, messages) {
  14082. },
  14083. /** @expose */
  14084. type : function() {
  14085. return "geojson";
  14086. },
  14087. /** @expose */
  14088. typeId : function() {
  14089. return 23;
  14090. }
  14091. });
  14092. // $source: com/ibm/rave/library/property/PropertyShadowType
  14093. /************************************************************************
  14094. ** IBM Confidential
  14095. **
  14096. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14097. **
  14098. ** (C) Copyright IBM Corp. 2017
  14099. **
  14100. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14101. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14102. ************************************************************************/
  14103. // GENERATED
  14104. //@import com/ibm/rave/library/property/PropertyType (loadtime) // superclass
  14105. //@import com/ibm/rave/library/property/PropertyUtil (runtime) // PropertyUtil
  14106. var com_ibm_rave_library_property_PropertyShadowType = rave_library_externs["PropertyShadowType"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyType, {
  14107. /** @expose */
  14108. constructor : function(propertyId, qualifiedId, parent, messages) {
  14109. },
  14110. /** @expose */
  14111. type : function() {
  14112. return "shadow";
  14113. },
  14114. /** @expose */
  14115. typeId : function() {
  14116. return 24;
  14117. },
  14118. /** @expose */
  14119. validateValue : function(obj) {
  14120. return com_ibm_rave_library_property_PropertyUtil.INSTANCE.validateBasicType(obj, 10);
  14121. },
  14122. /** @expose */
  14123. copy : function(parent) {
  14124. var pst = new com_ibm_rave_library_property_PropertyShadowType(this.simpleId(), this.id(), parent, this._messages);
  14125. this.pTypeCopy(pst);
  14126. return pst;
  14127. },
  14128. /** @expose */
  14129. initType : function(propertyJSON, info) {
  14130. com_ibm_rave_library_property_PropertyType.prototype.initType.call(this, propertyJSON, info);
  14131. if (!(info.validate && info.hasInvalidProperties)) {
  14132. if (this.defaultValue() != null) {
  14133. if (info.validate && !(this.validateValue(this.defaultValue()))) {
  14134. info.processError();
  14135. return;
  14136. }
  14137. }
  14138. }
  14139. }
  14140. });
  14141. // $source: com/ibm/rave/library/datamodel/internal/BundleDataModels
  14142. /************************************************************************
  14143. ** IBM Confidential
  14144. **
  14145. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14146. **
  14147. ** (C) Copyright IBM Corp. 2017
  14148. **
  14149. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14150. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14151. ************************************************************************/
  14152. // GENERATED
  14153. //@import com/ibm/rave/library/datamodel/internal/DataModelDescriptorImpl (runtime) // create
  14154. //@import com/ibm/rave/library/datamodel/internal/DataModelImpl (runtime) // new
  14155. //@import com/ibm/rave/library/Library (static) // logError
  14156. /**
  14157. * <p> Represents the data models of a bundle, and the current model. </p> <p> Two lists of models are kept, one with all models and one with only the visible (in public/integrator API) models. {@link #this.populate(Object, com_ibm_rave_library_i18n_MessagesRegistry)} adds new models to both lists. {@link #this.configure(Object)} filters the current visible models with a JSON configuration. Both methods can be used incrementally, to first define models from several files and then to repeatedly filter them with configurations. For correct behavior populate should not be called after configure, but this is not checked. </p> <p> There is at any time one current data model. {@link #this.createDataModel(String)} creates a new instance of the requested model with no data, makes it the current data model, and returns it. {@link #this.dataModel()} returns the current data model. </p>
  14158. */
  14159. var com_ibm_rave_library_datamodel_internal_BundleDataModels = rave['internal']['Declare']({
  14160. /**
  14161. * Descriptors of all defined models
  14162. */
  14163. //_allDescriptors : null,
  14164. /**
  14165. * Map from data model ID to descriptor, for all defined models
  14166. */
  14167. //_allIds : null,
  14168. /**
  14169. * IDs of hidden models.
  14170. */
  14171. //_hiddenIds : null,
  14172. /**
  14173. * List of visible model descriptors, null when it must be recreated.
  14174. */
  14175. //_visibleDescriptors : null,
  14176. /**
  14177. * Te default model id; null if not set
  14178. */
  14179. //_defaultModel : null,
  14180. /**
  14181. * The current data model
  14182. */
  14183. //_dataModel : null,
  14184. constructor : function() {
  14185. this._allDescriptors = [];
  14186. this._allIds = {};
  14187. this._hiddenIds = {};
  14188. this._visibleDescriptors = [];
  14189. },
  14190. /**
  14191. * <p> Populate models from the given JSON, which may be a data model schema. If it does not have a "datamodels" property, nothing is done. </p> <p> Otherwise, the "datamodels" property is taken as an array of objects describing data models, as in the schema. If the object "id" is already defined, it is skipped (no overwrite of existing models). Otherwise a new data model descriptor for the object is created and added to the collection. The current model is made null. </p> <p> If the object also has a "defaultModel" property, the default model is not yet defined, and the "defaultModel" id is a visible model, the default model is set to that id. </p>
  14192. * @param (Object) json JSON descriptor
  14193. */
  14194. populate : function(json, messages) {
  14195. var v = json["datamodels"];
  14196. if (v != null) {
  14197. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  14198. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14199. var o = __exp_enFor0[__i_enFor0];
  14200. var model = o;
  14201. var id = (model["id"]);
  14202. if (id != null && !(this._allIds.hasOwnProperty(id))) {
  14203. var desc = com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl.create(model);
  14204. (desc).setMessages(messages);
  14205. this._allDescriptors.push(desc);
  14206. this._allIds[id] = desc;
  14207. }
  14208. }
  14209. this._dataModel = null;
  14210. this._visibleDescriptors = [];
  14211. this.setDefaultModel(json);
  14212. }
  14213. },
  14214. /**
  14215. * <p> Configure visible models from the given JSON. If it does not have a "datamodels" property, nothing is done. </p> <p> Otherwise, the "datamodels" property is an array of objects describing the datamodel configuration, as in the schema. The list of visible descriptors is traversed and filtered by the configurations, to rebuild the visible descriptors. The current model is made null. </p> <p> If the filtering hides the default model, the default model is made undefined. If the object also has a "defaultModel" property, the default model is not yet defined, and the "defaultModel" id is a visible model, the default model is set to that id. </p>
  14216. */
  14217. configure : function(json) {
  14218. var v = json["datamodels"];
  14219. if (v != null) {
  14220. for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length;
  14221. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14222. var o = __exp_enFor0[__i_enFor0];
  14223. var model = o;
  14224. var id = (model["id"]);
  14225. var hidden = (model["hidden"]);
  14226. if (id != null && hidden != null && hidden) {
  14227. this._hiddenIds[id] = 1;
  14228. }
  14229. }
  14230. this._dataModel = null;
  14231. this._visibleDescriptors = [];
  14232. if (this._defaultModel != null && this._hiddenIds.hasOwnProperty(this._defaultModel)) {
  14233. this._defaultModel = null;
  14234. }
  14235. this.setDefaultModel(json);
  14236. }
  14237. v = json["dataSlots"];
  14238. if (v != null) {
  14239. for (var __i_enFor1 = 0, __exp_enFor1 = this._allDescriptors, __len_enFor1 = __exp_enFor1.length;
  14240. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  14241. var model = __exp_enFor1[__i_enFor1];
  14242. (model).configure(v);
  14243. }
  14244. }
  14245. },
  14246. /**
  14247. * If the default model is not set and the JSON has a "defaultModel" property which is the ID of a visible model, set the default model to that ID.
  14248. * @param (Object) json The JSON (from populate or configure)
  14249. */
  14250. setDefaultModel : function(json) {
  14251. if (this._defaultModel == null) {
  14252. var id = (json["defaultModel"]);
  14253. if (id != null && this._allIds.hasOwnProperty(id) && !(this._hiddenIds.hasOwnProperty(id))) {
  14254. this._defaultModel = id;
  14255. }
  14256. }
  14257. },
  14258. /**
  14259. * Get descriptors of the data models supported by this bundle. The array will not be empty. In the current implementations each bundle has exactly one model.
  14260. * @return (Array) Array of the model descriptors.
  14261. */
  14262. getDataModels : function() {
  14263. if (this._visibleDescriptors.length == 0) {
  14264. for (var __i_enFor0 = 0, __exp_enFor0 = this._allDescriptors, __len_enFor0 = __exp_enFor0.length;
  14265. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14266. var dmd = __exp_enFor0[__i_enFor0];
  14267. if (!(this._hiddenIds.hasOwnProperty(dmd.id()))) {
  14268. this._visibleDescriptors.push(dmd);
  14269. }
  14270. }
  14271. }
  14272. return this._visibleDescriptors;
  14273. },
  14274. /**
  14275. * Get the id of the default data model. If the default model has not been set and there are models defined, the default model is set to the first model. This will return null only if no models are defined; this is not reported as an error.
  14276. * @return (String) Default model ID
  14277. */
  14278. getDefaultModelId : function() {
  14279. if (this._defaultModel == null) {
  14280. this.getDataModels();
  14281. if (this._visibleDescriptors.length > 0) {
  14282. this._defaultModel = this._visibleDescriptors[0].id();
  14283. }
  14284. }
  14285. return this._defaultModel;
  14286. },
  14287. /**
  14288. * <p> Get a data model by id. If the id is non-null, it must be that of one of the supported models or null is returned. If the id is null, the default model is returned. If the default model has not been set when this method is called, the default model is set to the first model if any are defined. </p> <p> The returned model becomes the current input model for the bundle and should be used to set data in the slots. The model is returned by {@link #this.dataModel()} . If this method is called again (even with the same argument as the previous call), a new model is created and becomes the current model; no data is used from the previous model. </p> <p> If no models are defined or an unknown id is requested, null is returned and an error is reported. The current model is not changed in this case. </p>
  14289. * @param (String) modelId The model ID; if null, the default model is used
  14290. * @return (com.ibm.rave.library.datamodel.DataModel) A data model for that ID, usable to set data; or null
  14291. */
  14292. createDataModel : function(modelId) {
  14293. if (this._allDescriptors.length == 0) {
  14294. com_ibm_rave_library_datamodel_internal_BundleDataModels.reportError(104, null);
  14295. return null;
  14296. }
  14297. this.getDefaultModelId();
  14298. if (modelId != null) {
  14299. if (this._hiddenIds.hasOwnProperty(modelId)) {
  14300. com_ibm_rave_library_datamodel_internal_BundleDataModels.reportError(105, modelId);
  14301. return null;
  14302. }
  14303. var desc = this._allIds[modelId];
  14304. if (desc) {
  14305. this._dataModel = new com_ibm_rave_library_datamodel_internal_DataModelImpl(desc);
  14306. return this._dataModel;
  14307. }
  14308. com_ibm_rave_library_datamodel_internal_BundleDataModels.reportError(105, modelId);
  14309. return null;
  14310. }
  14311. this._dataModel = new com_ibm_rave_library_datamodel_internal_DataModelImpl(this._allIds[this._defaultModel]);
  14312. return this._dataModel;
  14313. },
  14314. /**
  14315. * <p> Get the current data model for this bundle. If no data model has been requested with {@link #this.createDataModel(String)} , an instance of the default data model will be created and made the current data model. This will also set the default model to the first model defined, if it has not already been set. </p>
  14316. * @return (com.ibm.rave.library.datamodel.DataModel) The current data model
  14317. */
  14318. dataModel : function() {
  14319. if (!this._dataModel) {
  14320. this.createDataModel(null);
  14321. }
  14322. return this._dataModel;
  14323. },
  14324. /**
  14325. * Deep copy of this data models object.
  14326. * @return (com.ibm.rave.library.datamodel.internal.BundleDataModels) copy of all properties.
  14327. */
  14328. copy : function() {
  14329. var models = new com_ibm_rave_library_datamodel_internal_BundleDataModels();
  14330. for (var __i_enFor0 = 0, __exp_enFor0 = this._allDescriptors, __len_enFor0 = __exp_enFor0.length;
  14331. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14332. var model = __exp_enFor0[__i_enFor0];
  14333. models._allDescriptors.push((model).copy());
  14334. }
  14335. for (var __i_enFor1 = 0, __exp_enFor1 = models._allDescriptors, __len_enFor1 = __exp_enFor1.length;
  14336. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  14337. var model = __exp_enFor1[__i_enFor1];
  14338. models._allIds[model.id()] = model;
  14339. }
  14340. for (var __i_enFor2 = 0, __exp_enFor2 = Object.keys(this._hiddenIds), __len_enFor2 = __exp_enFor2.length;
  14341. __i_enFor2 < __len_enFor2; ++__i_enFor2) {
  14342. var key = __exp_enFor2[__i_enFor2];
  14343. models._hiddenIds[(key)] = 1;
  14344. }
  14345. this._visibleDescriptors = [];
  14346. models._defaultModel = this._defaultModel;
  14347. models._dataModel = this._dataModel;
  14348. return models;
  14349. }
  14350. });
  14351. /**
  14352. * Report an error to the Library with code DATAMODEL_ERROR and the given message and location.
  14353. * @param (int) code error code, may be null
  14354. * @param (String) location Location, may be null
  14355. */
  14356. com_ibm_rave_library_datamodel_internal_BundleDataModels.reportError = function(code, location) {
  14357. com_ibm_rave_library_Library.logError(code, location);
  14358. };
  14359. // $source: com/ibm/rave/library/datamodel/internal/DataSetDescriptorImpl
  14360. /************************************************************************
  14361. ** IBM Confidential
  14362. **
  14363. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14364. **
  14365. ** (C) Copyright IBM Corp. 2017
  14366. **
  14367. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14368. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14369. ************************************************************************/
  14370. // GENERATED
  14371. //@import com/ibm/rave/library/datamodel/DataSetDescriptor (loadtime) // superclass
  14372. //@import com/ibm/rave/library/datamodel/internal/DataSlotDescriptorImpl (runtime) // create
  14373. /**
  14374. * Implementation of the {@link DataSetDescriptor} . This is the only implementation of the interface used by VizLibrary.
  14375. */
  14376. var com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl = rave['internal']['Declare'](com_ibm_rave_library_datamodel_DataSetDescriptor, {
  14377. /**
  14378. * The id, set in the constructor
  14379. */
  14380. //_id : null,
  14381. /**
  14382. * The label, set in the constructor
  14383. */
  14384. //_label : null,
  14385. /**
  14386. * The descriptor, set in the constructor
  14387. */
  14388. //_description : null,
  14389. /**
  14390. * The tags, set in the constructor; never null, empty array if no tags defined
  14391. */
  14392. //_tags : null,
  14393. /**
  14394. * The icon, set in the constructor
  14395. */
  14396. //_icon : null,
  14397. /**
  14398. * The cardinality, set in the constructor
  14399. */
  14400. //_cardinality : null,
  14401. /**
  14402. * The type, set in the constructor
  14403. */
  14404. //_type : null,
  14405. /**
  14406. * The data slots, set in the constructor; never null, empty array if no slots defined
  14407. */
  14408. //_dataSlots : null,
  14409. /**
  14410. * Map from slot name to index
  14411. */
  14412. //_slotIndexes : null,
  14413. /**
  14414. * Localization Strings. These can change.
  14415. */
  14416. //_messages : null,
  14417. /**
  14418. * Private constructor used by factory methods. The data slots array is allocated but empty.
  14419. * @param (String) id The id
  14420. * @param (String) label The label
  14421. * @param (String) description The description
  14422. * @param (Array) tags The array of tags
  14423. * @param (Object) icon The icon
  14424. * @param (String) cardinality The cardinality
  14425. * @param (String) type The type
  14426. */
  14427. constructor : function(id, label, description, tags, icon, cardinality, type) {
  14428. this._id = id;
  14429. this._label = label;
  14430. this._description = description;
  14431. this._tags = tags;
  14432. this._icon = icon;
  14433. this._cardinality = cardinality;
  14434. this._type = type;
  14435. this._dataSlots = [];
  14436. this._slotIndexes = {};
  14437. },
  14438. /**
  14439. * Clear any previous configuration settings.
  14440. */
  14441. clearConfiguration : function() {
  14442. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSlots, __len_enFor0 = __exp_enFor0.length;
  14443. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14444. var dataSlot = __exp_enFor0[__i_enFor0];
  14445. (dataSlot).clearConfiguration();
  14446. }
  14447. return this;
  14448. },
  14449. /**
  14450. * @param (Object) slotConfig
  14451. */
  14452. configure : function(slotConfig) {
  14453. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSlots, __len_enFor0 = __exp_enFor0.length;
  14454. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14455. var dataSlot = __exp_enFor0[__i_enFor0];
  14456. if (dataSlot.id() == slotConfig["dataSlotId"]) {
  14457. (dataSlot).configure(slotConfig);
  14458. }
  14459. }
  14460. return this;
  14461. },
  14462. /**
  14463. * Set the message registry for displaying the data in the current locale.
  14464. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry
  14465. */
  14466. setMessages : function(messages) {
  14467. this._messages = messages;
  14468. for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSlots, __len_enFor0 = __exp_enFor0.length;
  14469. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14470. var slot = __exp_enFor0[__i_enFor0];
  14471. (slot)._messages = messages;
  14472. }
  14473. },
  14474. /** @expose */
  14475. id : function() {
  14476. return this._id;
  14477. },
  14478. /** @expose */
  14479. label : function() {
  14480. if (!this._messages) {
  14481. return this._label;
  14482. }
  14483. return this._messages._nls(this._label, this._label);
  14484. },
  14485. /** @expose */
  14486. description : function() {
  14487. if (!this._messages) {
  14488. return this._description;
  14489. }
  14490. return this._messages._nls(this._description, this._description);
  14491. },
  14492. /** @expose */
  14493. tags : function() {
  14494. if (!this._messages) {
  14495. return this._tags;
  14496. }
  14497. var msgTags = [];
  14498. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  14499. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14500. var tag = __exp_enFor0[__i_enFor0];
  14501. msgTags.push(this._messages._nls(tag, tag));
  14502. }
  14503. return msgTags;
  14504. },
  14505. /** @expose */
  14506. icon : function() {
  14507. return this._icon;
  14508. },
  14509. /** @expose */
  14510. cardinality : function() {
  14511. return this._cardinality;
  14512. },
  14513. /** @expose */
  14514. type : function() {
  14515. return this._type;
  14516. },
  14517. /** @expose */
  14518. dataSlots : function() {
  14519. return this._dataSlots;
  14520. },
  14521. /**
  14522. * @param (String) dataSlotId A slot identifier
  14523. * @return (Number) Index of that slot in the descriptor array, or -1 if not defined
  14524. */
  14525. dataSlotIndex : function(dataSlotId) {
  14526. return this._slotIndexes[dataSlotId];
  14527. },
  14528. /** @expose */
  14529. copy : function() {
  14530. var newDescriptor = new com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl(this._id, this._label, this._description, this._tags, this._icon, this._cardinality, this._type);
  14531. for (var i = 0; i < this._dataSlots.length; ++i) {
  14532. var slot = (this._dataSlots[i].copy());
  14533. newDescriptor._dataSlots.push(slot);
  14534. newDescriptor._slotIndexes[slot._id] = i;
  14535. }
  14536. newDescriptor._messages = this._messages;
  14537. return newDescriptor;
  14538. }
  14539. });
  14540. /**
  14541. * Construct the data set description from the JSON, which conforms to the schema for data sets. This code assumes that the JSON has been checked against that schema and is valid (all required fields present, no illegal types or enum values, etc.).
  14542. * @param (Object) json Description of data set
  14543. */
  14544. com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl.create = function(json) {
  14545. var id = (json["id"]);
  14546. var label = (json["label"]);
  14547. var description = (json["description"]);
  14548. var tags = [];
  14549. var a = json["tags"];
  14550. if (a) {
  14551. var l = a.length;
  14552. for (var i = 0; i < l; ++i) {
  14553. tags.push(""+(a[i]));
  14554. }
  14555. }
  14556. var icon = json["icon"];
  14557. var cardinality = ""+(json["cardinality"]);
  14558. if (!("0..1" == cardinality || "1" == cardinality)) {
  14559. cardinality = "0..1";
  14560. }
  14561. var type = ""+(json["type"]);
  14562. if (!("tabular" == type || "hierarchy" == type)) {
  14563. type = "tabular";
  14564. }
  14565. var dsd = new com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl(id, label, description, tags, icon, cardinality, type);
  14566. a = json["dataslots"];
  14567. if (a) {
  14568. var l = a.length;
  14569. for (var i = 0; i < l; ++i) {
  14570. var slot = com_ibm_rave_library_datamodel_internal_DataSlotDescriptorImpl.create(a[i]);
  14571. dsd._dataSlots.push(slot);
  14572. dsd._slotIndexes[slot._id] = i;
  14573. }
  14574. }
  14575. return dsd;
  14576. };
  14577. // $source: com/ibm/rave/library/datamodel/internal/DataSlotDescriptorImpl
  14578. /************************************************************************
  14579. ** IBM Confidential
  14580. **
  14581. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14582. **
  14583. ** (C) Copyright IBM Corp. 2017
  14584. **
  14585. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14586. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14587. ************************************************************************/
  14588. // GENERATED
  14589. //@import com/ibm/rave/library/datamodel/DataSlotDescriptor (loadtime) // superclass
  14590. /**
  14591. * Implementation of the {@link DataSlotDescriptor} . This is the only implementation of the interface used by VizLibrary.
  14592. */
  14593. var com_ibm_rave_library_datamodel_internal_DataSlotDescriptorImpl = rave['internal']['Declare'](com_ibm_rave_library_datamodel_DataSlotDescriptor, {
  14594. /**
  14595. * The id, set in the constructor
  14596. */
  14597. //_id : null,
  14598. /**
  14599. * The label, set in the constructor
  14600. */
  14601. //_label : null,
  14602. //_labelDefault : null,
  14603. /**
  14604. * The descriptor, set in the constructor
  14605. */
  14606. //_description : null,
  14607. /**
  14608. * The tags, set in the constructor; never null, empty array if no tags defined
  14609. */
  14610. //_tags : null,
  14611. /**
  14612. * The image icon path, set in the constructor
  14613. */
  14614. //_imageIcon : null,
  14615. /**
  14616. * The svg icon path, set in the constructor
  14617. */
  14618. //_svgIcon : null,
  14619. //_svgIconDefault : null,
  14620. /**
  14621. * The cardinality, set in the constructor
  14622. */
  14623. //_cardinality : null,
  14624. //_cardinalityDefault : null,
  14625. /**
  14626. * The data types, set in the constructor; never null
  14627. */
  14628. //_dataTypes : null,
  14629. /**
  14630. * The data types, set by configuration, and can be null
  14631. */
  14632. //_configDataTypes : null,
  14633. /**
  14634. * Localization Strings. These can change.
  14635. */
  14636. //_messages : null,
  14637. /**
  14638. * The cardinality, set in the constructor
  14639. */
  14640. _hidden : false,
  14641. /**
  14642. * Private constructor used by factory methods.
  14643. * @param (String) id The id
  14644. * @param (String) label The label
  14645. * @param (String) description The description
  14646. * @param (Array) tags The array of tags
  14647. * @param icon The icon
  14648. * @param (String) cardinality The cardinality
  14649. * @param (Array) dataTypes The array of data types
  14650. */
  14651. constructor : function(id, label, description, tags, imageIcon, svgIcon, cardinality, dataTypes) {
  14652. this._id = id;
  14653. this._label = label;
  14654. this._labelDefault = label;
  14655. this._description = description;
  14656. this._tags = tags;
  14657. this._imageIcon = imageIcon;
  14658. this._svgIcon = svgIcon;
  14659. this._svgIconDefault = svgIcon;
  14660. this._cardinality = cardinality;
  14661. this._cardinalityDefault = cardinality;
  14662. this._dataTypes = dataTypes;
  14663. },
  14664. /**
  14665. * Clear any previous configuration settings.
  14666. */
  14667. clearConfiguration : function() {
  14668. this._hidden = false;
  14669. this._configDataTypes = null;
  14670. this._label = this._labelDefault;
  14671. this._svgIcon = this._svgIconDefault;
  14672. this._cardinality = this._cardinalityDefault;
  14673. return this;
  14674. },
  14675. /**
  14676. * Configures the configuration options for the slot: - determine whether the slot is hidden (and hence has no data) - determine whether its data types are more limited than those in the data model - determine if overriding label/icon for the slot
  14677. */
  14678. configure : function(slotConfig) {
  14679. this._hidden = (slotConfig["hidden"]);
  14680. var configDataTypes = slotConfig["dataTypes"];
  14681. if (configDataTypes) {
  14682. this._configDataTypes = [];
  14683. for (var __i_enFor0 = 0, __exp_enFor0 = configDataTypes, __len_enFor0 = __exp_enFor0.length;
  14684. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14685. var dataTypeObj = __exp_enFor0[__i_enFor0];
  14686. var dataType = dataTypeObj;
  14687. if (this._dataTypes.indexOf(dataType)> -1) {
  14688. this._configDataTypes.push(dataType);
  14689. }
  14690. }
  14691. }
  14692. var cardinality = slotConfig["cardinality"];
  14693. if (cardinality != null) {
  14694. this._cardinality = cardinality;
  14695. }
  14696. var label = slotConfig["label"];
  14697. if (label != null) {
  14698. this._label = label;
  14699. }
  14700. var svgIcon = slotConfig["svgIcon"];
  14701. if (svgIcon != null) {
  14702. this._svgIcon = svgIcon;
  14703. }
  14704. var configTags = slotConfig["tags"];
  14705. for (var i = 0; configTags && i < configTags.length; ++i) {
  14706. var tag = configTags[i];
  14707. if (this._tags.indexOf(tag) == -1) {
  14708. this._tags.push(tag);
  14709. }
  14710. }
  14711. return this;
  14712. },
  14713. /**
  14714. * Set the message registry for displaying the meta data in the current locale.
  14715. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry
  14716. */
  14717. setMessages : function(messages) {
  14718. this._messages = messages;
  14719. },
  14720. /** @expose */
  14721. id : function() {
  14722. return this._id;
  14723. },
  14724. /** @expose */
  14725. label : function() {
  14726. if (!this._messages) {
  14727. return this._label;
  14728. }
  14729. return this._messages._nls(this._label, this._label);
  14730. },
  14731. /** @expose */
  14732. description : function() {
  14733. if (!this._messages) {
  14734. return this._description;
  14735. }
  14736. return this._messages._nls(this._description, this._description);
  14737. },
  14738. /** @expose */
  14739. tags : function() {
  14740. if (!this._messages) {
  14741. return this._tags;
  14742. }
  14743. var msgTags = [];
  14744. for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length;
  14745. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14746. var tag = __exp_enFor0[__i_enFor0];
  14747. msgTags.push(this._messages._nls(tag, tag));
  14748. }
  14749. return msgTags;
  14750. },
  14751. /** @expose */
  14752. icon : function(type) {
  14753. if ("image" == type) {
  14754. return this._imageIcon;
  14755. }
  14756. return this._svgIcon;
  14757. },
  14758. /** @expose */
  14759. cardinality : function() {
  14760. return this._cardinality;
  14761. },
  14762. /** @expose */
  14763. isMultiple : function() {
  14764. return this._cardinality == "0..n" || this._cardinality == "1..n";
  14765. },
  14766. /** @expose */
  14767. isRequired : function() {
  14768. return this._cardinality == "1" || this._cardinality == "1..n";
  14769. },
  14770. /** @expose */
  14771. dataTypes : function() {
  14772. if (this._configDataTypes) {
  14773. return this._configDataTypes;
  14774. }
  14775. return this._dataTypes;
  14776. },
  14777. /** @expose */
  14778. isHidden : function() {
  14779. return this._hidden;
  14780. },
  14781. /**
  14782. * Check if a type-string is one allowed by the slot. If configuration has limited the types available, we use the more limited list.
  14783. * @param (String) type Type string
  14784. * @return (boolean) True if allowed
  14785. */
  14786. isValidType : function(type) {
  14787. for (var __i_enFor0 = 0, __exp_enFor0 = this.dataTypes(), __len_enFor0 = __exp_enFor0.length;
  14788. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14789. var s = __exp_enFor0[__i_enFor0];
  14790. if (s == type) {
  14791. return true;
  14792. }
  14793. }
  14794. return false;
  14795. },
  14796. /**
  14797. * Perform a deep copy of this slot
  14798. * @return (com.ibm.rave.library.datamodel.internal.DataSlotDescriptorImpl) A copy of this DataSlotDescriptorImpl
  14799. */
  14800. /** @expose */
  14801. copy : function() {
  14802. var slot = new com_ibm_rave_library_datamodel_internal_DataSlotDescriptorImpl(this._id, this._labelDefault, this._description, this._tags, this._imageIcon, this._svgIconDefault, this._cardinalityDefault, this._dataTypes);
  14803. slot._messages = this._messages;
  14804. slot._configDataTypes = null;
  14805. slot._hidden = false;
  14806. return slot;
  14807. }
  14808. });
  14809. /**
  14810. * Construct the data slot description from the JSON, which conforms to the schema for data slots. This code assumes that the JSON has been checked against that schema and is valid (all required fields present, no illegal types or enum values, etc.).
  14811. * @param (Object) json Description of data slot
  14812. */
  14813. com_ibm_rave_library_datamodel_internal_DataSlotDescriptorImpl.create = function(json) {
  14814. var id = (json["id"]);
  14815. var label = (json["label"]);
  14816. var description = (json["description"]);
  14817. var tags = [];
  14818. var t = json["tags"];
  14819. if (t) {
  14820. var l = t.length;
  14821. for (var i = 0; i < l; ++i) {
  14822. tags.push(""+(t[i]));
  14823. }
  14824. }
  14825. var imageIcon, svgIcon;
  14826. var icon = json["icon"];
  14827. if (icon) {
  14828. imageIcon = icon["image"];
  14829. svgIcon = icon["svg"];
  14830. }
  14831. var cardinality = ""+(json["cardinality"]);
  14832. if (!("0..1" == cardinality || "1" == cardinality || "0..n" == cardinality || "1..n" == cardinality)) {
  14833. cardinality = "0..1";
  14834. }
  14835. var dataTypes = [];
  14836. t = json["datatypes"];
  14837. if (t) {
  14838. var l = t.length;
  14839. for (var i = 0; i < l; ++i) {
  14840. var s = ""+(t[i]);
  14841. if ("numeric" == s || "string" == s || "date" == s || "object" == s || "array" == s) {
  14842. dataTypes.push(s);
  14843. }
  14844. }
  14845. }
  14846. return new com_ibm_rave_library_datamodel_internal_DataSlotDescriptorImpl(id, label, description, tags, imageIcon, svgIcon, cardinality, dataTypes);
  14847. };
  14848. // $source: com/ibm/rave/library/i18n/MessagesRegistry
  14849. /************************************************************************
  14850. ** IBM Confidential
  14851. **
  14852. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14853. **
  14854. ** (C) Copyright IBM Corp. 2017
  14855. **
  14856. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14857. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14858. ************************************************************************/
  14859. // GENERATED
  14860. //@import com/ibm/rave/library/framework/Bundle (runtime) // Bundle
  14861. //@import com/ibm/rave/library/i18n/Messages (static) // Messages
  14862. /**
  14863. * A registry of Messages files. Each Messages catalog is specific to a certain locale. Right now, this just delegates to a Map but may contain additional utilities in the future.
  14864. */
  14865. var com_ibm_rave_library_i18n_MessagesRegistry = rave_library_externs["MessagesRegistry"] = rave['internal']['Declare']({
  14866. //_locale : null,
  14867. //_currentMessages : null,
  14868. //registry : null,
  14869. constructor : function() {
  14870. this._locale = com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE;
  14871. this._currentMessages = com_ibm_rave_library_i18n_Messages.EMPTY_MESSAGES;
  14872. this.registry = {};
  14873. },
  14874. /**
  14875. * Add a new localized string catalog to the registry.
  14876. * @param (String) locale String id of locale (ie "en-us").
  14877. * @param (com.ibm.rave.library.i18n.Messages) catalog
  14878. */
  14879. /** @expose */
  14880. add : function(locale, catalog) {
  14881. this.registry[locale] = catalog;
  14882. if (this._locale == locale) {
  14883. this._currentMessages = catalog;
  14884. }
  14885. },
  14886. /**
  14887. * Set the current locale, provided there is a messages file for it, and return true. If there are no messages for this locale, nothing changes, and we return false.
  14888. * @param (String) locale String id of locale (ie "en-us").
  14889. * @return (boolean) true if we have messages for this locale loaded
  14890. */
  14891. locale$0 : function(locale) {
  14892. var current = this.get(locale);
  14893. if (current) {
  14894. this._locale = locale;
  14895. this._currentMessages = current;
  14896. return true;
  14897. }
  14898. return false;
  14899. },
  14900. /**
  14901. * @return (String) the current locale
  14902. */
  14903. locale$1 : function() {
  14904. return this._locale;
  14905. },
  14906. /**
  14907. * Get a localized Message catalog from the registry.
  14908. * @param (String) locale String id of locale (ie "en") to retrieve.
  14909. * @return (com.ibm.rave.library.i18n.Messages) Message Catalog for current locale.
  14910. */
  14911. /** @expose */
  14912. get : function(locale) {
  14913. return this.registry[locale];
  14914. },
  14915. /**
  14916. * Get a localized Message catalog from catalog for the current locale.
  14917. * @param (String) key The key to lookup in the catalog
  14918. * @param (String) alt What to return if the key isn't found
  14919. * @return (String) The localized message String
  14920. */
  14921. /** @expose */
  14922. _nls : function(key, alt) {
  14923. return this._currentMessages._nls(key, alt);
  14924. },
  14925. /** @expose */
  14926. locale : function(a0) {
  14927. var args = arguments;
  14928. if (args.length == 0) {
  14929. return this.locale$1();
  14930. }
  14931. return this.locale$0(a0);
  14932. }
  14933. });
  14934. /** @expose */
  14935. com_ibm_rave_library_i18n_MessagesRegistry.EmptyRegistry = function() {
  14936. if (!com_ibm_rave_library_i18n_MessagesRegistry._emptyRegistry) {
  14937. com_ibm_rave_library_i18n_MessagesRegistry._emptyRegistry = new com_ibm_rave_library_i18n_MessagesRegistry();
  14938. com_ibm_rave_library_i18n_MessagesRegistry._emptyRegistry.add("en", com_ibm_rave_library_i18n_Messages.EMPTY_MESSAGES);
  14939. }
  14940. return com_ibm_rave_library_i18n_MessagesRegistry._emptyRegistry;
  14941. };
  14942. //com_ibm_rave_library_i18n_MessagesRegistry._emptyRegistry = null;
  14943. // $source: com/ibm/rave/library/property/ObjectPropertyImpl
  14944. /************************************************************************
  14945. ** IBM Confidential
  14946. **
  14947. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  14948. **
  14949. ** (C) Copyright IBM Corp. 2017
  14950. **
  14951. ** The source code for this program is not published or otherwise divested of its trade secrets,
  14952. ** irrespective of what has been deposited with the U.S. Copyright Office.
  14953. ************************************************************************/
  14954. // GENERATED
  14955. //@import com/ibm/rave/library/property/PropertyImpl (loadtime) // superclass
  14956. //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isJSONObject
  14957. //@import com/ibm/rave/library/Library (runtime) // logError
  14958. /**
  14959. */
  14960. var com_ibm_rave_library_property_ObjectPropertyImpl = rave_library_externs["ObjectPropertyImpl"] = rave['internal']['Declare'](com_ibm_rave_library_property_PropertyImpl, {
  14961. //_childProperties : null,
  14962. constructor : function(propertyType, parent) {
  14963. this._childProperties = {};
  14964. /**
  14965. * @param (com.ibm.rave.library.property.PropertyObjectType) propertyType
  14966. * @param (com.ibm.rave.library.property.PropertyImpl) parent
  14967. */
  14968. {
  14969. this.buildValue();
  14970. }
  14971. },
  14972. buildValue : function() {
  14973. var defaultValue = this.meta().defaultValue();
  14974. var valueInstance = this.value();
  14975. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(defaultValue), __len_enFor0 = __exp_enFor0.length;
  14976. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14977. var propertyId = __exp_enFor0[__i_enFor0];
  14978. var def = defaultValue[propertyId];
  14979. valueInstance[propertyId] = def;
  14980. }
  14981. },
  14982. /** @expose */
  14983. reset : function() {
  14984. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._childProperties), __len_enFor0 = __exp_enFor0.length;
  14985. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14986. var propertyId = __exp_enFor0[__i_enFor0];
  14987. var childProperty = this._childProperties[propertyId];
  14988. childProperty.reset();
  14989. }
  14990. return this.value();
  14991. },
  14992. /** @expose */
  14993. value$1 : function(obj) {
  14994. var result = true;
  14995. var childPropertiesOriginalValues = {};
  14996. if (obj == null) {
  14997. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._childProperties), __len_enFor0 = __exp_enFor0.length;
  14998. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  14999. var propertyId = __exp_enFor0[__i_enFor0];
  15000. var childProperty = this._childProperties[propertyId];
  15001. childPropertiesOriginalValues[propertyId] = childProperty.value();
  15002. if (!(childProperty.value(null))) {
  15003. this.rollBackChildPropertiesValues(childPropertiesOriginalValues);
  15004. result = false;
  15005. }
  15006. }
  15007. return result;
  15008. }
  15009. if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj))) {
  15010. com_ibm_rave_library_Library.logError(31, "Property validate");
  15011. return false;
  15012. }
  15013. var val = obj;
  15014. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(val), __len_enFor1 = __exp_enFor1.length;
  15015. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  15016. var propertyId = __exp_enFor1[__i_enFor1];
  15017. var propVal = val[propertyId];
  15018. var childProperty = this._childProperties[""+(propertyId)];
  15019. if (!childProperty) {
  15020. com_ibm_rave_library_Library.logError(32, "Property validate");
  15021. this.rollBackChildPropertiesValues(childPropertiesOriginalValues);
  15022. result = false;
  15023. } else {
  15024. childPropertiesOriginalValues[""+(propertyId)] = childProperty.value();
  15025. if (!(childProperty.value(propVal))) {
  15026. this.rollBackChildPropertiesValues(childPropertiesOriginalValues);
  15027. result = false;
  15028. }
  15029. }
  15030. }
  15031. return result;
  15032. },
  15033. rollBackChildPropertiesValues : function(childPropertiesOriginalValues) {
  15034. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(childPropertiesOriginalValues), __len_enFor0 = __exp_enFor0.length;
  15035. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  15036. var childId = __exp_enFor0[__i_enFor0];
  15037. var childProperty = this._childProperties[childId];
  15038. childProperty.value(childPropertiesOriginalValues[childId]);
  15039. }
  15040. },
  15041. /**
  15042. * Gets a map of child properties the key of which is the simpleId of each child This map should be treated as read-only map and should not be modified
  15043. * @return (Object) the child properties of this object property
  15044. */
  15045. /** @expose */
  15046. childProperties : function() {
  15047. return this._childProperties;
  15048. }
  15049. });
  15050. // $source: com/ibm/rave/library/action/internal/ActionImpl
  15051. /************************************************************************
  15052. ** IBM Confidential
  15053. **
  15054. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15055. **
  15056. ** (C) Copyright IBM Corp. 2017
  15057. **
  15058. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15059. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15060. ************************************************************************/
  15061. // GENERATED
  15062. //@import com/ibm/rave/library/action/Action (loadtime) // superclass
  15063. //@import com/ibm/rave/library/action/ActionOperation (static)
  15064. var com_ibm_rave_library_action_internal_ActionImpl = rave['internal']['Declare'](com_ibm_rave_library_action_Action, {
  15065. //_meta : null,
  15066. //_actionFunction : null,
  15067. //_binding : null,
  15068. //_unbinding : null,
  15069. _autoBind : true,
  15070. _$functionClassMethod : function() {
  15071. var _$self = function(args) {
  15072. if (args !== null || arguments.length > 1){
  15073. args = Array.prototype.slice.call(arguments);
  15074. }
  15075. {
  15076. _$self._actionFunction.apply(_$self._actionFunction, args);
  15077. }
  15078. };
  15079. return _$self;
  15080. },
  15081. constructor : function(meta) {
  15082. this._actionFunction = com_ibm_rave_library_action_internal_ActionImpl.NO_OP_FUNCTION;
  15083. this._binding = com_ibm_rave_library_action_internal_ActionImpl.NO_OP_BINDING_FUNCTION;
  15084. this._unbinding = com_ibm_rave_library_action_internal_ActionImpl.NO_OP_BINDING_FUNCTION;
  15085. /**
  15086. * Construct instance with the metadata.
  15087. * @param (com.ibm.rave.library.framework.meta.ActionMeta) meta Metadata
  15088. */
  15089. {
  15090. this._meta = meta;
  15091. }
  15092. },
  15093. /**
  15094. * @return (com.ibm.rave.library.framework.meta.ActionMeta) Action metadata as passed to the constructor
  15095. */
  15096. meta : function() {
  15097. return this._meta;
  15098. },
  15099. /**
  15100. * Set a function to execute when this action is invoked. This is where the bundle author will implement their action logic.
  15101. * @param (com.ibm.rave.library.action.ActionOperation) f An action function callback.
  15102. */
  15103. /** @expose */
  15104. setOperation : function(f) {
  15105. this._actionFunction = f ? f : com_ibm_rave_library_action_internal_ActionImpl.NO_OP_FUNCTION;
  15106. return this;
  15107. },
  15108. setBindFn : function(f) {
  15109. this._binding = f ? f : com_ibm_rave_library_action_internal_ActionImpl.NO_OP_BINDING_FUNCTION;
  15110. return this;
  15111. },
  15112. setUnbindFn : function(f) {
  15113. this._unbinding = f ? f : com_ibm_rave_library_action_internal_ActionImpl.NO_OP_BINDING_FUNCTION;
  15114. return this;
  15115. },
  15116. autoBind$0 : function() {
  15117. return this._autoBind;
  15118. },
  15119. autoBind$1 : function(bind) {
  15120. this._autoBind = bind;
  15121. if (!this._autoBind) {
  15122. this._unbinding();
  15123. }
  15124. },
  15125. getBinding : function() {
  15126. return this._binding;
  15127. },
  15128. getUnBind : function() {
  15129. return this._unbinding;
  15130. },
  15131. getOperation : function() {
  15132. return this._actionFunction;
  15133. },
  15134. /**
  15135. * @see ActionOperation#this.get(String) Delegates to the actionOperation's get method.
  15136. */
  15137. /** @expose */
  15138. get : function(id) {
  15139. return this._actionFunction.get(id);
  15140. },
  15141. /** @expose */
  15142. autoBind : function(a0) {
  15143. var args = arguments;
  15144. if (args.length == 0) {
  15145. return this.autoBind$0();
  15146. }
  15147. return this.autoBind$1(a0);
  15148. }
  15149. });
  15150. com_ibm_rave_library_action_internal_ActionImpl.NO_OP_FUNCTION = new (rave['internal']['Declare']([com_ibm_rave_library_action_ActionOperation], {
  15151. _$functionClassMethod : function() {
  15152. var _$self = function(args) {};
  15153. return _$self;
  15154. },
  15155. get : function(id) {
  15156. return null;
  15157. }
  15158. }))();
  15159. com_ibm_rave_library_action_internal_ActionImpl.NO_OP_BINDING_FUNCTION = function() {};
  15160. // $source: com/ibm/rave/library/framework/internal/BundleContext
  15161. /************************************************************************
  15162. ** IBM Confidential
  15163. **
  15164. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15165. **
  15166. ** (C) Copyright IBM Corp. 2017
  15167. **
  15168. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15169. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15170. ************************************************************************/
  15171. // GENERATED
  15172. //@import com/ibm/rave/library/property/PropertySet (runtime) // new
  15173. //@import com/ibm/rave/library/action/internal/ActionsManager (runtime) // new
  15174. //@import com/ibm/rave/library/framework/internal/ContextSize (runtime) // new
  15175. //@import com/ibm/rave/library/framework/internal/CustomFormatInfoImpl (static) // new, makeForEntry
  15176. //@import com/ibm/rave/library/framework/internal/CSSConverter (runtime) // convertCSSSizeToPixel
  15177. //@import com/ibm/rave/library/framework/meta/internal/PropertyPresentationManager (runtime) // new
  15178. /**
  15179. * The BundleContext acts as the "Model" (in the MVC pattern) between the {@link (com.ibm.rave.library.framework.internal.AbstractController) AbstractController} and the {@link (com.ibm.rave.library.framework.internal.AbstractView) AbstractView} .
  15180. */
  15181. var com_ibm_rave_library_framework_internal_BundleContext = rave['internal']['Declare']({
  15182. //_metadata : null,
  15183. //_previewsMeta : null,
  15184. //properties : null,
  15185. //actions : null,
  15186. //datamodels : null,
  15187. //propertyPresentations : null,
  15188. /**
  15189. * Size (width, height) of the bundle context scene node at the time of the last call to {@link this.AbstractController#this.render()} .
  15190. */
  15191. //size : null,
  15192. //node : null,
  15193. //_customFormatters : null,
  15194. //_messages : null,
  15195. /**
  15196. * Component pre-create callback
  15197. */
  15198. //_preExecuteCallback : null,
  15199. /**
  15200. * pre render callback
  15201. */
  15202. //_prerenderCallback : null,
  15203. /**
  15204. * Render callback
  15205. */
  15206. //_renderCallback : null,
  15207. /**
  15208. * post render callback
  15209. */
  15210. //_postrenderCallback : null,
  15211. //_instanceId : null,
  15212. constructor : function(instanceId, messages, dataModels, metaData, previews) {
  15213. this.properties = new com_ibm_rave_library_property_PropertySet();
  15214. this.actions = new com_ibm_rave_library_action_internal_ActionsManager();
  15215. this.size = new com_ibm_rave_library_framework_internal_ContextSize();
  15216. this.node = rave.selection();
  15217. this._customFormatters = {};
  15218. /**
  15219. * Construct the context. The error reporter, which may be null, will be passed to the components that need to report errors.
  15220. * @param (String) instanceId String id of this context
  15221. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Localized messages object associated with this context
  15222. * @param (com.ibm.rave.library.datamodel.internal.BundleDataModels) dataModels Data models object
  15223. * @param (com.ibm.rave.library.framework.meta.GenericMetadata) metaData Meta data object
  15224. */
  15225. {
  15226. this._instanceId = instanceId;
  15227. this._messages = messages;
  15228. this._metadata = metaData;
  15229. this._previewsMeta = previews;
  15230. this.datamodels = dataModels;
  15231. this.propertyPresentations = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationManager(this._messages);
  15232. }
  15233. },
  15234. /**
  15235. * Get a data model by id. This is a utility method which calls datamodels.getInputDataModel(modelId).
  15236. * @param (String) modelId The model ID; if null, the default model is used
  15237. * @return (com.ibm.rave.library.datamodel.DataModel) A data model for that ID, usable to set data
  15238. */
  15239. getInputDataModel : function(modelId) {
  15240. return this.datamodels.createDataModel(modelId);
  15241. },
  15242. /**
  15243. * Get the current data model for this bundle. This is a utility method which calls datamodels.getDataModel.
  15244. * @return (com.ibm.rave.library.datamodel.DataModel) The data model used for rendering
  15245. */
  15246. dataModel : function() {
  15247. return this.datamodels.dataModel();
  15248. },
  15249. /**
  15250. * Get the property value for the property with the given id, or null if the property does not exist. TODO. null may not be viable return value, or we may wish to leave properties undefined so that they do not override CSS values.
  15251. * @return (Object) The value of the property
  15252. */
  15253. getPropertyValue : function(id) {
  15254. var prop = this.properties.property(id);
  15255. if (prop) {
  15256. return prop.value();
  15257. }
  15258. return null;
  15259. },
  15260. /**
  15261. * Get the property default value for the property with the given id, or null if the property does does not exist
  15262. * @param target
  15263. * @param formatter
  15264. */
  15265. getPropertyDefault : function(id) {
  15266. var prop = this.properties.property(id);
  15267. if (prop) {
  15268. return prop.meta().defaultValue();
  15269. }
  15270. return null;
  15271. },
  15272. addCustomFormatter : function(target, formatter) {
  15273. if (!formatter) {
  15274. delete this._customFormatters[target];
  15275. } else {
  15276. this._customFormatters[target] = formatter;
  15277. }
  15278. },
  15279. getCustomFormatters : function() {
  15280. return this._customFormatters;
  15281. },
  15282. removeCustomFormatter : function(target) {
  15283. if ("all" == target) {
  15284. this._customFormatters = {};
  15285. } else {
  15286. delete this._customFormatters[target];
  15287. }
  15288. },
  15289. /**
  15290. * Search the list of targets for the first for which a custom formatter is defined. Return a value function that when called will invoke the custom formatter with the given info and flag. If none of the targets are defined, return the default function. This method can return null, if the default function is null.
  15291. * @param (java.lang.String[]) targets Custom formatter targets (ALL, LEGEND, etc.)
  15292. * @param (com.ibm.rave.library.framework.CustomFormatInfo) info The extra information passed to the custom formatter
  15293. * @param (rave['internal']['ValueFunction']) defaultFunction Value when none of the targets are defined
  15294. * @param (boolean) simplified This flag is passed down to the CustomFormatter and decides what the return value for its function will be. Axes use this method with the flag set to true, if they fail to fit a value on a vertical numeric axis. Integrators can implemented their CustomFormatter to provide different value when this flag is set see {@link this.CustomFormatter#this.getValue(Object, Object, , , com_ibm_rave_library_framework_CustomFormatInfo, )} .
  15295. * @return (rave['internal']['ValueFunction']) Value function, either the first defined target or the default function
  15296. */
  15297. getCustomFormatterWithFlag : function(targets, info, defaultFunction, simplified) {
  15298. for (var __i_enFor0 = 0, __len_enFor0 = targets.length;
  15299. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  15300. var s = targets[__i_enFor0];
  15301. var f = this._customFormatters[s];
  15302. if (f) {
  15303. return function(value, index, groupIndex) {
  15304. return f.call(this, value, index, groupIndex, info, simplified);
  15305. };
  15306. }
  15307. }
  15308. return defaultFunction;
  15309. },
  15310. /**
  15311. * Utility that builds a CustomFormatInfo for element labels with no special format (the common case) then calls {@link #this.getCustomFormatterWithFlag(, com_ibm_rave_library_framework_CustomFormatInfo, rave['internal']['ValueFunction'], )} with a null default function (also the common case).
  15312. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry The data slot entry used for the label
  15313. * @return (rave['internal']['ValueFunction']) Value function, either the first defined target or the default function
  15314. */
  15315. getCustomFormatterForElementLabels$0 : function(entry) {
  15316. return this.getCustomFormatterForElementLabels$1(entry, "ROLE_NONE");
  15317. },
  15318. /**
  15319. * Utility that builds a CustomFormatInfo for element labels with no special format (the common case) then calls {@link #this.getCustomFormatterWithFlag(, com_ibm_rave_library_framework_CustomFormatInfo, rave['internal']['ValueFunction'], )} with a null default function (also the common case).
  15320. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry The data slot entry used for the label
  15321. * @param (String) role Format info role
  15322. * @return (rave['internal']['ValueFunction']) Value function, either the first defined target or the default function
  15323. */
  15324. getCustomFormatterForElementLabels$1 : function(entry, role) {
  15325. return this.getCustomFormatterWithFlag(["label", "all"], com_ibm_rave_library_framework_internal_CustomFormatInfoImpl.makeForEntry("element-label", role, "none", entry), null, false);
  15326. },
  15327. /**
  15328. * Retrieve internationalized text message for the key, if not found use alternative value
  15329. * @param (String) key nls key
  15330. * @param (String) alt alternative value, if the key is not present in the catalog
  15331. * @return (String) internationalized text message
  15332. */
  15333. message : function(key, alt) {
  15334. return this._messages._nls(key, alt);
  15335. },
  15336. instanceId : function() {
  15337. return this._instanceId;
  15338. },
  15339. /**
  15340. * Return the current locale set for this context.
  15341. * @return (String) current locale code.
  15342. */
  15343. locale : function() {
  15344. return this._messages.locale();
  15345. },
  15346. /**
  15347. * Set the component pre-execute callback.
  15348. * @param (com.ibm.rave.library.framework.ComponentCallback) callback The callback, may be null to disable callbacks
  15349. */
  15350. setPreExecute : function(callback) {
  15351. this._preExecuteCallback = callback;
  15352. },
  15353. /**
  15354. * @return (com.ibm.rave.library.framework.ComponentCallback) The bundle post-execute callback, may be null
  15355. */
  15356. getPreExecute : function() {
  15357. return this._preExecuteCallback;
  15358. },
  15359. /**
  15360. * Set the pre render callback.
  15361. * @param (com.ibm.rave.library.framework.Controller.Callback) callback The callback, may be null to disable callbacks
  15362. */
  15363. setPrerenderCallback : function(callback) {
  15364. this._prerenderCallback = callback;
  15365. },
  15366. /**
  15367. * @return (com.ibm.rave.library.framework.Controller.Callback) The post render callback, may be null
  15368. */
  15369. getPrerenderCallback : function() {
  15370. return this._prerenderCallback;
  15371. },
  15372. /**
  15373. * Set the bundle render callback.
  15374. * @param (rave['internal']['RunFunction']) callback The callback, may be null to disable callbacks
  15375. */
  15376. setRenderCallback : function(callback) {
  15377. this._renderCallback = callback;
  15378. },
  15379. /**
  15380. * @return (rave['internal']['RunFunction']) The render callback, may be null
  15381. */
  15382. getRenderCallback : function() {
  15383. return this._renderCallback;
  15384. },
  15385. /**
  15386. * Set the post render callback.
  15387. * @param (com.ibm.rave.library.framework.Controller.Callback) callback The callback, may be null to disable callbacks
  15388. */
  15389. setPostrenderCallback : function(callback) {
  15390. this._postrenderCallback = callback;
  15391. },
  15392. /**
  15393. * @return (com.ibm.rave.library.framework.Controller.Callback) The post render callback, may be null
  15394. */
  15395. getPostrenderCallback : function() {
  15396. return this._postrenderCallback;
  15397. },
  15398. /**
  15399. * Convert a value representing a CSSSize to a string for the size with "px" units. For example, "0.5in" will become "48px". The number part is rounded to two digits. This method is included in the context because it will need to handle "%" size, which will depend on the context height and width. "%" is not handled yet, % values are treated as pixels. "em" depends on the font height, which is not available. It is treated as 10px.
  15400. * @param (Object) value The value, may be null, number, or string
  15401. * @return (String) Size as string ending with "px", or null
  15402. */
  15403. convertCSSSizeToPixels : function(value) {
  15404. return com_ibm_rave_library_framework_internal_CSSConverter.convertCSSSizeToPixel(value, 100.0, 10.0);
  15405. },
  15406. /**
  15407. * Retrieve a label for a given data slot, with a fallback property value. The provided property ID takes priority. If the property contains a non-empty string, the property value will be used as the label; otherwise the data slot entry label will be used. <br /> <br /> Note this method delegates to {@link #this.getDataSlotLabel(String, Array)} , by wrapping the entry parameter in an array.
  15408. * @param (String) propertyId A property containing a string value that should take priority.
  15409. * @param (com.ibm.rave.library.datamodel.DataSlotEntry) entry A data slot entry from which a label will be retrieved if the provided property does not contain a string.
  15410. */
  15411. getDataSlotLabel$0 : function(propertyId, entry) {
  15412. return this.getDataSlotLabel$1(propertyId, [entry]);
  15413. },
  15414. /**
  15415. * Retrieve a label for a given list of data slots, with a fallback property value. The provided property ID takes priority. If the property contains a non-empty string, the property value will be used as the label; otherwise the first data slot entry in the list with a non-null, non-empty label will be used.
  15416. * @param (String) propertyId A property containing a string value that should take priority.
  15417. * @param (Array) entries A list of data slot entries from which a label will be retrieved if the provided property does not contain a string.
  15418. */
  15419. getDataSlotLabel$1 : function(propertyId, entries) {
  15420. var label = (this.getPropertyValue(propertyId));
  15421. if (!((label)) && entries && entries.length > 0) {
  15422. var entryLabel = null;
  15423. var i = 0;
  15424. while (entryLabel == null && i < entries.length) {
  15425. var e = entries[i];
  15426. if (e && (e.label$0())) {
  15427. entryLabel = e.label$0();
  15428. }
  15429. i++;
  15430. }
  15431. label = entryLabel;
  15432. }
  15433. return label;
  15434. },
  15435. getCustomFormatterForElementLabels : function(a0, a1) {
  15436. var args = arguments;
  15437. if (args.length == 1) {
  15438. return this.getCustomFormatterForElementLabels$0(a0);
  15439. }
  15440. return this.getCustomFormatterForElementLabels$1(a0, a1);
  15441. },
  15442. getDataSlotLabel : function(a0, a1) {
  15443. var args = arguments;
  15444. if (args.length == 2 && typeof a1 === "function") {
  15445. return this.getDataSlotLabel$0(a0, a1);
  15446. }
  15447. return this.getDataSlotLabel$1(a0, a1);
  15448. }
  15449. });
  15450. /**
  15451. * Create a CustomFormatInfoImpl for the given arguments. This is included so non-framework code doesn't have to access the internal CustomFormatInfoImpl constructor.
  15452. * @param (String) type Format info type
  15453. * @param (String) role Format info role
  15454. * @param (String) format Format info format
  15455. * @param (Array) entries List of entries
  15456. */
  15457. com_ibm_rave_library_framework_internal_BundleContext.makeCustomFormatInfo = function(type, role, format, entries) {
  15458. return new com_ibm_rave_library_framework_internal_CustomFormatInfoImpl(type, role, format, entries);
  15459. };
  15460. // $source: com/ibm/rave/library/internal/nativeImpl/Module
  15461. /************************************************************************
  15462. ** IBM Confidential
  15463. **
  15464. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15465. **
  15466. ** (C) Copyright IBM Corp. 2015, 2016
  15467. **
  15468. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15469. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15470. ************************************************************************/
  15471. // Must be the first import
  15472. // @import ./ModuleHeader
  15473. // @import com/ibm/rave/library/Library
  15474. // @import com/ibm/rave/library/framework/internal/AbstractView
  15475. // @import com/ibm/rave/library/framework/internal/BundleContext
  15476. // @import com/ibm/rave/library/framework/internal/ScaleManager
  15477. // @import com/ibm/rave/library/action/internal/OperationsUtil
  15478. // @import com/ibm/rave/library/framework/internal/LinearCoordinateScale
  15479. // @import com/ibm/rave/library/framework/internal/OrdinalCoordinateScale
  15480. // @import com/ibm/rave/library/service/BundleService
  15481. // @import com/ibm/rave/library/service/ErrorDispatcher
  15482. // @import com/ibm/rave/library/service/LibraryError
  15483. // @import com/ibm/rave/library/palette/internal/CategoricalPalette
  15484. // @import com/ibm/rave/library/datamodel/internal/BundleDataModels
  15485. // @import com/ibm/rave/library/framework/meta/internal/GenericMetadataImpl
  15486. // @import com/ibm/rave/library/framework/internal/ContextSize
  15487. // @import com/ibm/rave/library/property/PropertyProcessor
  15488. // @import com/ibm/rave/library/datamodel/internal/DataModelDescriptorImpl
  15489. // @import com/ibm/rave/library/datamodel/internal/DataModelImpl
  15490. // @import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils
  15491. // @import com/ibm/rave/library/palette/internal/ContinuousPalette
  15492. // @import com/ibm/rave/library/framework/internal/CSSConverter
  15493. // @import com/ibm/rave/library/framework/internal/HierarchyUtility
  15494. // @import com/ibm/rave/library/framework/internal/TimeCoordinateScale
  15495. // @import com/ibm/rave/library/framework/internal/ClusteredCoordinateScale
  15496. // @import com/ibm/rave/library/framework/internal/ClusteredCoordinateScale
  15497. // @import com/ibm/rave/library/framework/internal/CSSConverter
  15498. // @import com/ibm/rave/library/palette/internal/ConditionalPalette
  15499. // @import com/ibm/rave/library/framework/CustomFormatter
  15500. // @import com/ibm/rave/library/framework/meta/internal/PreviewsMetadataImpl
  15501. // Expose library through rave entry point
  15502. rave["library"] = com_ibm_rave_library_Library;
  15503. rave["library"]["internal"] = rave_library_externs;
  15504. rave["library"]["internal"]["AbstractView"]=com_ibm_rave_library_framework_internal_AbstractView;
  15505. rave["library"]["internal"]["BundleContext"]=com_ibm_rave_library_framework_internal_BundleContext;
  15506. rave["library"]["internal"]["ScaleManager"]=com_ibm_rave_library_framework_internal_ScaleManager;
  15507. rave["library"]["internal"]["OperationsUtil"]=com_ibm_rave_library_action_internal_OperationsUtil;
  15508. rave["library"]["internal"]["LinearCoordinateScale"]=com_ibm_rave_library_framework_internal_LinearCoordinateScale;
  15509. rave["library"]["internal"]["OrdinalCoordinateScale"]=com_ibm_rave_library_framework_internal_OrdinalCoordinateScale;
  15510. rave["library"]["internal"]["OrdinalCoordinateScaleDatum"]=com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum;
  15511. rave["library"]["internal"]["TimeCoordinateScale"]=com_ibm_rave_library_framework_internal_TimeCoordinateScale;
  15512. rave["library"]["internal"]["ClusteredCoordinateScale"]=com_ibm_rave_library_framework_internal_ClusteredCoordinateScale;
  15513. rave["library"]["internal"]["BundleService"]=com_ibm_rave_library_service_BundleService;
  15514. rave["library"]["internal"]["ErrorDispatcher"]=com_ibm_rave_library_service_ErrorDispatcher;
  15515. rave["library"]["internal"]["LibraryError"]=com_ibm_rave_library_service_LibraryError;
  15516. rave["library"]["internal"]["HierarchyUtility"]=com_ibm_rave_library_framework_internal_HierarchyUtility;
  15517. rave["library"]["internal"]["HUFactory"]=com_ibm_rave_library_framework_internal_HierarchyUtility.HUFactory;
  15518. rave["library"]["internal"]["HUResult"]=com_ibm_rave_library_framework_internal_HierarchyUtility.HUResult;
  15519. //For Unit Tests
  15520. rave["library"]["internal"]["CategoricalPalette"]=com_ibm_rave_library_palette_internal_CategoricalPalette;
  15521. rave["library"]["internal"]["BundleDataModels"]=com_ibm_rave_library_datamodel_internal_BundleDataModels;
  15522. rave["library"]["internal"]["GenericMetadataImpl"]=com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl;
  15523. rave["library"]["internal"]["ContextSize"]=com_ibm_rave_library_framework_internal_ContextSize;
  15524. rave["library"]["internal"]["PropertyProcessor"]=com_ibm_rave_library_property_PropertyProcessor;
  15525. rave["library"]["internal"]["DataModelDescriptorImpl"]=com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl;
  15526. rave["library"]["internal"]["DataModelImpl"]=com_ibm_rave_library_datamodel_internal_DataModelImpl;
  15527. rave["library"]["internal"]["PropertyNativeUtils"]=com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils;
  15528. rave["library"]["internal"]["CSSConverter"]=com_ibm_rave_library_framework_internal_CSSConverter;
  15529. rave["library"]["internal"]["ContinuousPalette"]=com_ibm_rave_library_palette_internal_ContinuousPalette;
  15530. rave["library"]["internal"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  15531. rave["library"]["internal"]["PreviewsMetadataImpl"]=com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl;
  15532. rave["library"]["internal"]["ConditionalPalette"]=com_ibm_rave_library_palette_internal_ConditionalPalette;
  15533. rave["library"]["internal"]["CSSConverter"]=com_ibm_rave_library_framework_internal_CSSConverter;
  15534. // $source: com/ibm/rave/library/action/BundleUtils
  15535. /************************************************************************
  15536. ** IBM Confidential
  15537. **
  15538. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15539. **
  15540. ** (C) Copyright IBM Corp. 2017
  15541. **
  15542. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15543. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15544. ************************************************************************/
  15545. // GENERATED
  15546. //@import com/ibm/rave/library/action/internal/OperationsUtil (static) // highlight, unhighlight, select, deselectAll, deselect, panZoom, toggleSelection
  15547. var com_ibm_rave_library_action_BundleUtils = rave_library_externs["BundleUtils"] = rave['internal']['Declare']({
  15548. });
  15549. /** @expose */
  15550. com_ibm_rave_library_action_BundleUtils.setupDefaultActions = function(context, element, originalStyle) {
  15551. var highlightAction = com_ibm_rave_library_action_BundleUtils.setupAction(context, element, "highlight", ["mouseenter.default"]);
  15552. highlightAction.setOperation(com_ibm_rave_library_action_internal_OperationsUtil.highlight());
  15553. var dehighlightAction = com_ibm_rave_library_action_BundleUtils.setupAction(context, element, "unhighlight", ["mouseout.default"]);
  15554. dehighlightAction.setOperation(com_ibm_rave_library_action_internal_OperationsUtil.unhighlight(originalStyle));
  15555. context.actions.action("select").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.select());
  15556. context.actions.action("deselect").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.deselect());
  15557. var deselectAllAction = context.actions.action("deselectAll");
  15558. deselectAllAction.setOperation(com_ibm_rave_library_action_internal_OperationsUtil.deselectAll(originalStyle));
  15559. var deselectAllEventListener = function(data, index, groupIndex, event) {
  15560. deselectAllAction(context.node.selectAll(element));
  15561. };
  15562. deselectAllAction.setBindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, ".background", ["click.default", "touchstart.default"], deselectAllEventListener));
  15563. deselectAllAction.setUnbindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, ".background", ["click.default", "touchstart.default"], null));
  15564. var toggleSelectionAction = context.actions.action("toggleSelect").setOperation(com_ibm_rave_library_action_internal_OperationsUtil.toggleSelection(originalStyle));
  15565. var toggleSelectionListener = function(data, index, groupIndex, event) {
  15566. toggleSelectionAction(rave.select(this), context.node.selectAll(element));
  15567. };
  15568. toggleSelectionAction.setBindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, element, ["click.default", "touchstart.default"], toggleSelectionListener));
  15569. toggleSelectionAction.setUnbindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, element, ["click.default", "touchstart.default"], null));
  15570. com_ibm_rave_library_action_BundleUtils.setupZoomAction(context);
  15571. };
  15572. /**
  15573. * Select the ".chart" shapes from the context (in the bundles this is the container for all chart shapes). Bind the "wheel.zoom", "dblclick.zoom", "mousedown.zoom", "mouseup.zoom", and "mousemove.zoom" actions to an 'OperationsUtil.panZoom(Zoom, ZoomContextFunction)' with a new Zoom (the Zoom will be available from the action's get() method).
  15574. * @param (com.ibm.rave.library.framework.internal.BundleContext) context Bundle context
  15575. */
  15576. /** @expose */
  15577. com_ibm_rave_library_action_BundleUtils.setupZoomAction = function(context) {
  15578. var zoomAction = context.actions.action("zoom");
  15579. if (zoomAction) {
  15580. zoomAction.setBindFn(com_ibm_rave_library_action_BundleUtils.bindPanZoom(context, zoomAction, "zoom"));
  15581. zoomAction.setUnbindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, ".chart", ["wheel.zoom", "dblclick.zoom", "mousedown.zoom", "mouseup.zoom", "mousemove.zoom"], null));
  15582. var fn = function() {
  15583. return context.node.selectAll(".chart");
  15584. };
  15585. zoomAction.setOperation(com_ibm_rave_library_action_internal_OperationsUtil.panZoom(rave.behavior.zoom(), fn));
  15586. }
  15587. };
  15588. com_ibm_rave_library_action_BundleUtils.setupAction = function(context, element, actionName, event) {
  15589. var action = context.actions.action(actionName);
  15590. if (action) {
  15591. action.setBindFn(com_ibm_rave_library_action_BundleUtils.bindAction(context, element, action, event));
  15592. action.setUnbindFn(com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater(context, element, event, null));
  15593. }
  15594. return action;
  15595. };
  15596. com_ibm_rave_library_action_BundleUtils.bindPanZoom = function(context, zoomAction, action) {
  15597. return function() {
  15598. context.node.selectAll(".chart").call(zoomAction.get(action));
  15599. };
  15600. };
  15601. /** @expose */
  15602. com_ibm_rave_library_action_BundleUtils.bindAction = function(context, element, action, events) {
  15603. var listener = function(data, index, groupIndex, event) {
  15604. action(rave.select(this));
  15605. };
  15606. return function() {
  15607. for (var __i_enFor0 = 0, __len_enFor0 = events.length;
  15608. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  15609. var event = events[__i_enFor0];
  15610. context.node.selectAll(element).on(event, listener);
  15611. }
  15612. };
  15613. };
  15614. /**
  15615. * setup a binding or unbinding action on one or more events
  15616. * @param (com.ibm.rave.library.framework.internal.BundleContext) context the context
  15617. * @param (String) element the element to select on the context
  15618. * @param (java.lang.String[]) events the list of events that the actionListener should be invoked on
  15619. * @param (rave['internal']['SelectorEventListener']) actionListener set actionListener to null if you want to setup an unbindfunction
  15620. * @return (com.ibm.rave.library.action.BundleUtils.BindingOperation) returns a binding or unbinding function based on the value passed to the actionListener
  15621. */
  15622. /** @expose */
  15623. com_ibm_rave_library_action_BundleUtils.bindOrUnbindActionFunctionCreater = function(context, element, events, actionListener) {
  15624. return function() {
  15625. for (var __i_enFor0 = 0, __len_enFor0 = events.length;
  15626. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  15627. var event = events[__i_enFor0];
  15628. context.node.selectAll(element).on(event, actionListener);
  15629. }
  15630. };
  15631. };
  15632. /** @expose */
  15633. com_ibm_rave_library_action_BundleUtils.setupBreadcrumbDefaultActions = function(context, element) {
  15634. var breadcrumbSelectAction = context.actions.action("breadcrumbSelect");
  15635. breadcrumbSelectAction.setBindFn(function() {
  15636. context.node.selectAll(element).on("click.default", function(data, index, groupIndex, event) {
  15637. breadcrumbSelectAction(data);
  15638. });
  15639. });
  15640. breadcrumbSelectAction.setUnbindFn(function() {
  15641. context.node.selectAll(element).on("click.default", null);
  15642. });
  15643. };
  15644. /**
  15645. * Queries whether the node is part of the exit group
  15646. */
  15647. /** @expose */
  15648. com_ibm_rave_library_action_BundleUtils.notExit = function(data, index, groupIndex) {
  15649. if (this.rave_hasProperty("isExit")) {
  15650. return false;
  15651. }
  15652. return true;
  15653. };
  15654. // $source: com/ibm/rave/library/property/CommonPropertyConstants
  15655. /************************************************************************
  15656. ** IBM Confidential
  15657. **
  15658. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  15659. **
  15660. ** (C) Copyright IBM Corp. 2017
  15661. **
  15662. ** The source code for this program is not published or otherwise divested of its trade secrets,
  15663. ** irrespective of what has been deposited with the U.S. Copyright Office.
  15664. ************************************************************************/
  15665. // GENERATED
  15666. //@import com/ibm/rave/library/framework/internal/CommonPropertyIDs (loadtime) // superclass
  15667. /**
  15668. * Catalog of common constants used by properties. The location of these constants may be temporary and some may need to be defined in their appropriate domains (e.g. data handling to Data model, palette ids in Palette). Also, the superclass catalog should probably be merged into this class, to keep all property related constants together
  15669. */
  15670. var com_ibm_rave_library_property_CommonPropertyConstants = rave_library_externs["CommonPropertyConstants"] = rave['internal']['Declare'](com_ibm_rave_library_framework_internal_CommonPropertyIDs, {
  15671. });
  15672. /** @expose */
  15673. com_ibm_rave_library_property_CommonPropertyConstants.DATA_MODEL_HIERACHY = "HierarchyData";
  15674. /** @expose */
  15675. com_ibm_rave_library_property_CommonPropertyConstants.DATA_MODEL_SIMPLE = "SimpleData";
  15676. /** @expose */
  15677. com_ibm_rave_library_property_CommonPropertyConstants.DONUT_PLUS_RATIO = 0.6;
  15678. /**
  15679. * Used when setting the stroke color for highlighting and selection events
  15680. */
  15681. /** @expose */
  15682. com_ibm_rave_library_property_CommonPropertyConstants.INITIAL_COLOR = "_rave_initialColor";
  15683. /**
  15684. * The following represent options for data labels. Options are: "None", "Show", "Show as percentage"
  15685. */
  15686. /** @expose */
  15687. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_NONE = "None";
  15688. /** @expose */
  15689. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_SHOW = "Show";
  15690. /** @expose */
  15691. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_SHOW_AS_PERCENTAGE = "ShowAsPercentage";
  15692. /** @expose */
  15693. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_VALUE = "Value";
  15694. /** @expose */
  15695. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_PERCENT_BY_CATEGORY = "PercentOfCategory";
  15696. /** @expose */
  15697. com_ibm_rave_library_property_CommonPropertyConstants.DATA_LABEL_PERCENT_BY_COLOR = "PercentOfColor";
  15698. /** @expose */
  15699. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_NONE = "None";
  15700. /** @expose */
  15701. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_CLUSTERED = "Clustered";
  15702. /** @expose */
  15703. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_SIMPLE = "Simple";
  15704. /** @expose */
  15705. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_STACKED = "Stacked";
  15706. /** @expose */
  15707. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_STACKED100 = "Stacked100";
  15708. /** @expose */
  15709. com_ibm_rave_library_property_CommonPropertyConstants.DATA_HANDLING_STREAM = "Stream";
  15710. /** @expose */
  15711. com_ibm_rave_library_property_CommonPropertyConstants.EFFECT_GROW = "grow";
  15712. /** @expose */
  15713. com_ibm_rave_library_property_CommonPropertyConstants.EFFECT_FROMBASE = "fromBase";
  15714. /** @expose */
  15715. com_ibm_rave_library_property_CommonPropertyConstants.EFFECT_GROW_FROMBASE = "growfromBase";
  15716. /** @expose */
  15717. com_ibm_rave_library_property_CommonPropertyConstants.EFFECT_TRANSITION = "transition";
  15718. /** @expose */
  15719. com_ibm_rave_library_property_CommonPropertyConstants.EFFECT_NONE = "none";
  15720. /** @expose */
  15721. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_CIRCLE = "circle";
  15722. /** @expose */
  15723. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_CROSS = "cross";
  15724. /** @expose */
  15725. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_DIAMOND = "diamond";
  15726. /** @expose */
  15727. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_SQUARE = "square";
  15728. /** @expose */
  15729. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_TRIANGLE_DOWN = "triangle-down";
  15730. /** @expose */
  15731. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_TRIANGLE_UP = "triangle-up";
  15732. /** @expose */
  15733. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_HORIZONTAL_RECTANGLE = "horizontal-rectangle";
  15734. /** @expose */
  15735. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_VERTICAL_RECTANGLE = "vertical-rectangle";
  15736. /** @expose */
  15737. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_TRIANGLE_LEFT = "triangle-left";
  15738. /** @expose */
  15739. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_TRIANGLE_RIGHT = "triangle-right";
  15740. /** @expose */
  15741. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_STAR = "star";
  15742. /** @expose */
  15743. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_DONUT = "donut";
  15744. /** @expose */
  15745. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_DONUT_THIN = "donut-thin";
  15746. /** @expose */
  15747. com_ibm_rave_library_property_CommonPropertyConstants.SYMBOL_DONUT_PLUS = "donutPlus";
  15748. /** @expose */
  15749. com_ibm_rave_library_property_CommonPropertyConstants.DONUT_PLUS = function(size) {
  15750. var r = Math.sqrt(size / Math.PI);
  15751. var circle = "M0," + r + "A" + r + "," + r + " 0 1,1 0," + (-r) + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
  15752. var r1 = Math.sqrt(size * 0.6 / Math.PI);
  15753. var r2 = r1 * 0.7;
  15754. var outer = "M0 0m-" + r1 + ",0a" + r1 + "," + r1 + ",0 1,0 " + (r1 * 2) + ",0a " + r1 + "," + r1 + " 0 1,0 -" + (r1 * 2) + ",0z";
  15755. var inner = "M0 0m-" + r2 + ",0a" + r2 + "," + r2 + ",0 0,1 " + (r2 * 2) + ",0a " + r2 + "," + r2 + " 0 0,1 -" + (r2 * 2) + ",0z";
  15756. return circle + outer + inner;
  15757. };
  15758. /** @expose */
  15759. com_ibm_rave_library_property_CommonPropertyConstants.DONUT_THIN = function(size) {
  15760. var r1 = Math.sqrt(size / Math.PI);
  15761. var r2 = r1 * 0.7;
  15762. var outer = "M0 0m-" + r1 + ",0a" + r1 + "," + r1 + ",0 1,0 " + (r1 * 2) + ",0a " + r1 + "," + r1 + " 0 1,0 -" + (r1 * 2) + ",0z";
  15763. var inner = "M0 0m-" + r2 + ",0a" + r2 + "," + r2 + ",0 0,1 " + (r2 * 2) + ",0a " + r2 + "," + r2 + " 0 0,1 -" + (r2 * 2) + ",0z";
  15764. return outer + inner;
  15765. };
  15766. /** @expose */
  15767. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_SampleContinuous = "SampleContinuousPalette";
  15768. /** @expose */
  15769. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousFlow = "ContinuousFlow";
  15770. /** @expose */
  15771. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousClassic = "ContinuousClassic";
  15772. /** @expose */
  15773. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousContemporary = "ContinuousContemporary";
  15774. /** @expose */
  15775. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousActive = "ContinuousActive";
  15776. /** @expose */
  15777. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousCorporate = "ContinuousCorporate";
  15778. /** @expose */
  15779. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousDynamic = "ContinuousDynamic";
  15780. /** @expose */
  15781. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousExcel = "ContinuousExcel";
  15782. /** @expose */
  15783. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousExcel2007 = "ContinuousExcel2007";
  15784. /** @expose */
  15785. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousJazz = "ContinuousJazz";
  15786. /** @expose */
  15787. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousMetro = "ContinuousMetro";
  15788. /** @expose */
  15789. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousModern = "ContinuousModern";
  15790. /** @expose */
  15791. com_ibm_rave_library_property_CommonPropertyConstants.PALETTE_ID_ContinuousHeatMapFlow = "ContinuousHeatMapFlow";
  15792. /** @expose */
  15793. com_ibm_rave_library_property_CommonPropertyConstants.AXIS_LEFT = "left";
  15794. /** @expose */
  15795. com_ibm_rave_library_property_CommonPropertyConstants.AXIS_RIGHT = "right";
  15796. /** @expose */
  15797. com_ibm_rave_library_property_CommonPropertyConstants.AXIS_TOP = "top";
  15798. /** @expose */
  15799. com_ibm_rave_library_property_CommonPropertyConstants.AXIS_BOTTOM = "bottom";
  15800. /** @expose */
  15801. com_ibm_rave_library_property_CommonPropertyConstants.ORIENTATION_VERTICAL = "vertical";
  15802. /** @expose */
  15803. com_ibm_rave_library_property_CommonPropertyConstants.ORIENTATION_HORIZONTAL = "horizontal";
  15804. /** @expose */
  15805. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_ALL = "all";
  15806. /** @expose */
  15807. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_X = "x";
  15808. /** @expose */
  15809. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_Y = "y";
  15810. /** @expose */
  15811. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_X2 = "x2";
  15812. /** @expose */
  15813. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_Y2 = "y2";
  15814. /** @expose */
  15815. com_ibm_rave_library_property_CommonPropertyConstants.ZOOM_NONE = "none";
  15816. /** @expose */
  15817. com_ibm_rave_library_property_CommonPropertyConstants.SORT_NONE = "none";
  15818. /** @expose */
  15819. com_ibm_rave_library_property_CommonPropertyConstants.SORT_ASCENDING = "ascending";
  15820. /** @expose */
  15821. com_ibm_rave_library_property_CommonPropertyConstants.SORT_DESCENDING = "descending";
  15822. /**
  15823. * line_points - show both line(s) and points line - show line(s) only points - show point(s) only
  15824. */
  15825. /** @expose */
  15826. com_ibm_rave_library_property_CommonPropertyConstants.LINE_AND_POINTS = "line_points";
  15827. /** @expose */
  15828. com_ibm_rave_library_property_CommonPropertyConstants.LINE_ONLY = "line";
  15829. /** @expose */
  15830. com_ibm_rave_library_property_CommonPropertyConstants.POINTS_ONLY = "points";
  15831. /**
  15832. * linear - piecewise linear segments, as in a polyline. linear-closed - close the linear segments to form a polygon. step - alternate between horizontal and vertical segments, as in a step function. step-before - alternate between vertical and horizontal segments, as in a step function. step-after - alternate between horizontal and vertical segments, as in a step function. basis - a B-spline, with control point duplication on the ends. basis-open - an open B-spline; may not intersect the start or end. basis-closed - a closed B-spline, as in a loop. bundle - equivalent to basis, except the tension parameter is used to straighten the spline. cardinal - a Cardinal spline, with control point duplication on the ends. cardinal-open - an open Cardinal spline; may not intersect the start or end, but will intersect other control points. cardinal-closed - a closed Cardinal spline, as in a loop. monotone - cubic interpolation that preserves monotonicity in y.
  15833. */
  15834. /** @expose */
  15835. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_LINEAR = "linear";
  15836. /** @expose */
  15837. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_STEP = "step";
  15838. /** @expose */
  15839. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_STEP_BEFORE = "step-before";
  15840. /** @expose */
  15841. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_STEP_AFTER = "step-after";
  15842. /** @expose */
  15843. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_BASIS = "basis";
  15844. /** @expose */
  15845. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_BASIS_OPEN = "basis-open";
  15846. /** @expose */
  15847. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_BASIS_CLOSED = "basis-closed";
  15848. /** @expose */
  15849. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_BUNDLE = "bundle";
  15850. /** @expose */
  15851. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_CARDINAL = "cardinal";
  15852. /** @expose */
  15853. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_CARDINAL_OPEN = "cardinal-open";
  15854. /** @expose */
  15855. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_CARDINAL_CLOSED = "cardinal-closed";
  15856. /** @expose */
  15857. com_ibm_rave_library_property_CommonPropertyConstants.INTERPOLATE_MONOTONE = "monotone";
  15858. /**
  15859. * The following represent legend positions. Possible positions are "top", "bottom", "right", and "left".
  15860. */
  15861. /** @expose */
  15862. com_ibm_rave_library_property_CommonPropertyConstants.LEGEND_POSITION_TOP = "top";
  15863. /** @expose */
  15864. com_ibm_rave_library_property_CommonPropertyConstants.LEGEND_POSITION_BOTTOM = "bottom";
  15865. /** @expose */
  15866. com_ibm_rave_library_property_CommonPropertyConstants.LEGEND_POSITION_RIGHT = "right";
  15867. /** @expose */
  15868. com_ibm_rave_library_property_CommonPropertyConstants.LEGEND_POSITION_LEFT = "left";
  15869. /**
  15870. * The following represent options for text anchor positions for axis tick labels. Options are: "start", "middle", and "end".
  15871. */
  15872. /** @expose */
  15873. com_ibm_rave_library_property_CommonPropertyConstants.TEXT_ANCHOR_START = "start";
  15874. /** @expose */
  15875. com_ibm_rave_library_property_CommonPropertyConstants.TEXT_ANCHOR_MIDDLE = "middle";
  15876. /** @expose */
  15877. com_ibm_rave_library_property_CommonPropertyConstants.TEXT_ANCHOR_END = "end";
  15878. /**
  15879. * The following represent options for vertical alignments for axis tick labels. Options are: "top", "middle", and "bottom".
  15880. */
  15881. /** @expose */
  15882. com_ibm_rave_library_property_CommonPropertyConstants.VERTICAL_ALIGNMENT_TOP = "top";
  15883. /** @expose */
  15884. com_ibm_rave_library_property_CommonPropertyConstants.VERTICAL_ALIGNMENT_MIDDLE = "middle";
  15885. /** @expose */
  15886. com_ibm_rave_library_property_CommonPropertyConstants.VERTICAL_ALIGNMENT_END = "end";
  15887. /**
  15888. * The following represent options for the pattern of the connecting lines between bars in the Waterfall bundle. Options are: "solid" and "dashed".
  15889. */
  15890. /** @expose */
  15891. com_ibm_rave_library_property_CommonPropertyConstants.LINE_PATTERN_SOLID = "solid";
  15892. /** @expose */
  15893. com_ibm_rave_library_property_CommonPropertyConstants.LINE_PATTERN_DASHED = "dashed";
  15894. })();
  15895. },{"./configuration/configuration.json":1}]},{},[2]);
  15896. return rave.library;
  15897. }));