draw2d.js 309 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427
  1. /**
  2. * This notice must be untouched at all times. This is the COMPRESSED version of
  3. * the Draw2D Library WebSite: http://www.draw2d.org Copyright: 2006 Andreas
  4. * Herz. All rights reserved. Created: 5.11.2006 by Andreas Herz (Web:
  5. * http://www.freegroup.de ) LICENSE: LGPL
  6. */
  7. var draw2d = new Object();
  8. var _errorStack_ = [];
  9. function pushErrorStack(e, _56b2) {
  10. _errorStack_.push(_56b2 + "\n");
  11. throw e;
  12. }
  13. draw2d.AbstractEvent = function() {
  14. this.type = null;
  15. this.target = null;
  16. this.relatedTarget = null;
  17. this.cancelable = false;
  18. this.timeStamp = null;
  19. this.returnValue = true;
  20. };
  21. draw2d.AbstractEvent.prototype.initEvent = function(sType, _56b4) {
  22. this.type = sType;
  23. this.cancelable = _56b4;
  24. this.timeStamp = (new Date()).getTime();
  25. };
  26. draw2d.AbstractEvent.prototype.preventDefault = function() {
  27. if (this.cancelable) {
  28. this.returnValue = false;
  29. }
  30. };
  31. draw2d.AbstractEvent.fireDOMEvent = function(_56b5, _56b6) {
  32. if (document.createEvent) {
  33. var evt = document.createEvent("Events");
  34. evt.initEvent(_56b5, true, true);
  35. _56b6.dispatchEvent(evt);
  36. } else {
  37. if (document.createEventObject) {
  38. var evt = document.createEventObject();
  39. _56b6.fireEvent("on" + _56b5, evt);
  40. }
  41. }
  42. };
  43. draw2d.EventTarget = function() {
  44. this.eventhandlers = {};
  45. };
  46. draw2d.EventTarget.prototype.addEventListener = function(sType, _56b9) {
  47. if (typeof this.eventhandlers[sType] == "undefined") {
  48. this.eventhandlers[sType] = [];
  49. }
  50. this.eventhandlers[sType][this.eventhandlers[sType].length] = _56b9;
  51. };
  52. draw2d.EventTarget.prototype.dispatchEvent = function(_56ba) {
  53. _56ba.target = this;
  54. if (typeof this.eventhandlers[_56ba.type] != "undefined") {
  55. for ( var i = 0; i < this.eventhandlers[_56ba.type].length; i++) {
  56. this.eventhandlers[_56ba.type][i](_56ba);
  57. }
  58. }
  59. return _56ba.returnValue;
  60. };
  61. draw2d.EventTarget.prototype.removeEventListener = function(sType, _56bd) {
  62. if (typeof this.eventhandlers[sType] != "undefined") {
  63. var _56be = [];
  64. for ( var i = 0; i < this.eventhandlers[sType].length; i++) {
  65. if (this.eventhandlers[sType][i] != _56bd) {
  66. _56be[_56be.length] = this.eventhandlers[sType][i];
  67. }
  68. }
  69. this.eventhandlers[sType] = _56be;
  70. }
  71. };
  72. String.prototype.trim = function() {
  73. return (this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), ""));
  74. };
  75. String.prototype.lefttrim = function() {
  76. return (this.replace(new RegExp("^[\\s]+", "gm"), ""));
  77. };
  78. String.prototype.righttrim = function() {
  79. return (this.replace(new RegExp("[\\s]+$", "gm"), ""));
  80. };
  81. String.prototype.between = function(left, right, _558a) {
  82. if (!_558a) {
  83. _558a = 0;
  84. }
  85. var li = this.indexOf(left, _558a);
  86. if (li == -1) {
  87. return null;
  88. }
  89. var ri = this.indexOf(right, li);
  90. if (ri == -1) {
  91. return null;
  92. }
  93. return this.substring(li + left.length, ri);
  94. };
  95. draw2d.UUID = function() {
  96. };
  97. draw2d.UUID.prototype.type = "draw2d.UUID";
  98. draw2d.UUID.create = function() {
  99. var _4a13 = function() {
  100. return (((1 + Math.random()) * 65536) | 0).toString(16).substring(1);
  101. };
  102. return (_4a13() + _4a13() + "-" + _4a13() + "-" + _4a13() + "-" + _4a13()
  103. + "-" + _4a13() + _4a13() + _4a13());
  104. };
  105. draw2d.ArrayList = function() {
  106. this.increment = 10;
  107. this.size = 0;
  108. this.data = new Array(this.increment);
  109. };
  110. draw2d.ArrayList.EMPTY_LIST = new draw2d.ArrayList();
  111. draw2d.ArrayList.prototype.type = "draw2d.ArrayList";
  112. draw2d.ArrayList.prototype.reverse = function() {
  113. var _4b1e = new Array(this.size);
  114. for ( var i = 0; i < this.size; i++) {
  115. _4b1e[i] = this.data[this.size - i - 1];
  116. }
  117. this.data = _4b1e;
  118. };
  119. draw2d.ArrayList.prototype.getCapacity = function() {
  120. return this.data.length;
  121. };
  122. draw2d.ArrayList.prototype.getSize = function() {
  123. return this.size;
  124. };
  125. draw2d.ArrayList.prototype.isEmpty = function() {
  126. return this.getSize() === 0;
  127. };
  128. draw2d.ArrayList.prototype.getLastElement = function() {
  129. if (this.data[this.getSize() - 1] !== null) {
  130. return this.data[this.getSize() - 1];
  131. }
  132. };
  133. draw2d.ArrayList.prototype.getFirstElement = function() {
  134. if (this.data[0] !== null && this.data[0] !== undefined) {
  135. return this.data[0];
  136. }
  137. return null;
  138. };
  139. draw2d.ArrayList.prototype.get = function(i) {
  140. return this.data[i];
  141. };
  142. draw2d.ArrayList.prototype.add = function(obj) {
  143. if (this.getSize() == this.data.length) {
  144. this.resize();
  145. }
  146. this.data[this.size++] = obj;
  147. };
  148. draw2d.ArrayList.prototype.addAll = function(obj) {
  149. for ( var i = 0; i < obj.getSize(); i++) {
  150. this.add(obj.get(i));
  151. }
  152. };
  153. draw2d.ArrayList.prototype.remove = function(obj) {
  154. var index = this.indexOf(obj);
  155. if (index >= 0) {
  156. return this.removeElementAt(index);
  157. }
  158. return null;
  159. };
  160. draw2d.ArrayList.prototype.insertElementAt = function(obj, index) {
  161. if (this.size == this.capacity) {
  162. this.resize();
  163. }
  164. for ( var i = this.getSize(); i > index; i--) {
  165. this.data[i] = this.data[i - 1];
  166. }
  167. this.data[index] = obj;
  168. this.size++;
  169. };
  170. draw2d.ArrayList.prototype.removeElementAt = function(index) {
  171. var _4b2a = this.data[index];
  172. for ( var i = index; i < (this.getSize() - 1); i++) {
  173. this.data[i] = this.data[i + 1];
  174. }
  175. this.data[this.getSize() - 1] = null;
  176. this.size--;
  177. return _4b2a;
  178. };
  179. draw2d.ArrayList.prototype.removeAllElements = function() {
  180. this.size = 0;
  181. for ( var i = 0; i < this.data.length; i++) {
  182. this.data[i] = null;
  183. }
  184. };
  185. draw2d.ArrayList.prototype.indexOf = function(obj) {
  186. for ( var i = 0; i < this.getSize(); i++) {
  187. if (this.data[i] == obj) {
  188. return i;
  189. }
  190. }
  191. return -1;
  192. };
  193. draw2d.ArrayList.prototype.contains = function(obj) {
  194. for ( var i = 0; i < this.getSize(); i++) {
  195. if (this.data[i] == obj) {
  196. return true;
  197. }
  198. }
  199. return false;
  200. };
  201. draw2d.ArrayList.prototype.resize = function() {
  202. newData = new Array(this.data.length + this.increment);
  203. for ( var i = 0; i < this.data.length; i++) {
  204. newData[i] = this.data[i];
  205. }
  206. this.data = newData;
  207. };
  208. draw2d.ArrayList.prototype.trimToSize = function() {
  209. if (this.data.length == this.size) {
  210. return;
  211. }
  212. var temp = new Array(this.getSize());
  213. for ( var i = 0; i < this.getSize(); i++) {
  214. temp[i] = this.data[i];
  215. }
  216. this.size = temp.length;
  217. this.data = temp;
  218. };
  219. draw2d.ArrayList.prototype.sort = function(f) {
  220. var i, j;
  221. var _4b36;
  222. var _4b37;
  223. var _4b38;
  224. var _4b39;
  225. for (i = 1; i < this.getSize(); i++) {
  226. _4b37 = this.data[i];
  227. _4b36 = _4b37[f];
  228. j = i - 1;
  229. _4b38 = this.data[j];
  230. _4b39 = _4b38[f];
  231. while (j >= 0 && _4b39 > _4b36) {
  232. this.data[j + 1] = this.data[j];
  233. j--;
  234. if (j >= 0) {
  235. _4b38 = this.data[j];
  236. _4b39 = _4b38[f];
  237. }
  238. }
  239. this.data[j + 1] = _4b37;
  240. }
  241. };
  242. draw2d.ArrayList.prototype.clone = function() {
  243. var _4b3a = new draw2d.ArrayList(this.size);
  244. for ( var i = 0; i < this.size; i++) {
  245. _4b3a.add(this.data[i]);
  246. }
  247. return _4b3a;
  248. };
  249. draw2d.ArrayList.prototype.overwriteElementAt = function(obj, index) {
  250. this.data[index] = obj;
  251. };
  252. draw2d.ArrayList.prototype.getPersistentAttributes = function() {
  253. return {
  254. data : this.data,
  255. increment : this.increment,
  256. size : this.getSize()
  257. };
  258. };
  259. function trace(_5cb5) {
  260. var _5cb6 = openwindow("about:blank", 700, 400);
  261. _5cb6.document.writeln("<pre>" + _5cb5 + "</pre>");
  262. }
  263. function openwindow(url, width, _5cb9) {
  264. var left = (screen.width - width) / 2;
  265. var top = (screen.height - _5cb9) / 2;
  266. property = "left="
  267. + left
  268. + ", top="
  269. + top
  270. + ", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,alwaysRaised,width="
  271. + width + ",height=" + _5cb9;
  272. return window.open(url, "_blank", property);
  273. }
  274. function dumpObject(obj) {
  275. trace("----------------------------------------------------------------------------");
  276. trace("- Object dump");
  277. trace("----------------------------------------------------------------------------");
  278. for ( var i in obj) {
  279. try {
  280. if (typeof obj[i] != "function") {
  281. trace(i + " --&gt; " + obj[i]);
  282. }
  283. } catch (e) {
  284. }
  285. }
  286. for ( var i in obj) {
  287. try {
  288. if (typeof obj[i] == "function") {
  289. trace(i + " --&gt; " + obj[i]);
  290. }
  291. } catch (e) {
  292. }
  293. }
  294. trace("----------------------------------------------------------------------------");
  295. }
  296. draw2d.Drag = function() {
  297. };
  298. draw2d.Drag.current = null;
  299. draw2d.Drag.currentTarget = null;
  300. draw2d.Drag.currentHover = null;
  301. draw2d.Drag.currentCompartment = null;
  302. draw2d.Drag.dragging = false;
  303. draw2d.Drag.isDragging = function() {
  304. return this.dragging;
  305. };
  306. draw2d.Drag.setCurrent = function(_604e) {
  307. this.current = _604e;
  308. this.dragging = true;
  309. };
  310. draw2d.Drag.getCurrent = function() {
  311. return this.current;
  312. };
  313. draw2d.Drag.clearCurrent = function() {
  314. this.current = null;
  315. this.dragging = false;
  316. this.currentTarget = null;
  317. };
  318. draw2d.Draggable = function(_604f, _6050) {
  319. this.id = draw2d.UUID.create();
  320. this.node = null;
  321. draw2d.EventTarget.call(this);
  322. this.construct(_604f, _6050);
  323. this.diffX = 0;
  324. this.diffY = 0;
  325. this.targets = new draw2d.ArrayList();
  326. };
  327. draw2d.Draggable.prototype = new draw2d.EventTarget();
  328. draw2d.Draggable.prototype.construct = function(_6051) {
  329. if (_6051 === null || _6051 === undefined) {
  330. return;
  331. }
  332. this.element = _6051;
  333. var oThis = this;
  334. var _6053 = function() {
  335. var _6054 = new draw2d.DragDropEvent();
  336. _6054.initDragDropEvent("dblclick", true);
  337. oThis.dispatchEvent(_6054);
  338. var _6055 = arguments[0] || window.event;
  339. _6055.cancelBubble = true;
  340. _6055.returnValue = false;
  341. };
  342. var _6056 = function() {
  343. var _6057 = arguments[0] || window.event;
  344. var _6058 = new draw2d.DragDropEvent();
  345. if (oThis.node !== null) {
  346. var _6059 = oThis.node.getWorkflow().getAbsoluteX();
  347. var _605a = oThis.node.getWorkflow().getAbsoluteY();
  348. var _605b = oThis.node.getWorkflow().getScrollLeft();
  349. var _605c = oThis.node.getWorkflow().getScrollTop();
  350. _6058.x = _6057.clientX - oThis.element.offsetLeft + _605b - _6059;
  351. _6058.y = _6057.clientY - oThis.element.offsetTop + _605c - _605a;
  352. }
  353. if (_6057.button === 2) {
  354. _6058.initDragDropEvent("contextmenu", true);
  355. oThis.dispatchEvent(_6058);
  356. } else {
  357. _6058.initDragDropEvent("dragstart", true);
  358. if (oThis.dispatchEvent(_6058)) {
  359. oThis.diffX = _6057.clientX - oThis.element.offsetLeft;
  360. oThis.diffY = _6057.clientY - oThis.element.offsetTop;
  361. draw2d.Drag.setCurrent(oThis);
  362. if (oThis.isAttached == true) {
  363. oThis.detachEventHandlers();
  364. }
  365. oThis.attachEventHandlers();
  366. }
  367. }
  368. _6057.cancelBubble = true;
  369. _6057.returnValue = false;
  370. };
  371. var _605d = function() {
  372. if (draw2d.Drag.getCurrent() === null) {
  373. var _605e = arguments[0] || window.event;
  374. if (draw2d.Drag.currentHover !== null
  375. && oThis !== draw2d.Drag.currentHover) {
  376. var _605f = new draw2d.DragDropEvent();
  377. _605f.initDragDropEvent("mouseleave", false, oThis);
  378. draw2d.Drag.currentHover.dispatchEvent(_605f);
  379. }
  380. if (oThis !== null && oThis !== draw2d.Drag.currentHover) {
  381. var _605f = new draw2d.DragDropEvent();
  382. _605f.initDragDropEvent("mouseenter", false, oThis);
  383. oThis.dispatchEvent(_605f);
  384. }
  385. draw2d.Drag.currentHover = oThis;
  386. } else {
  387. }
  388. };
  389. if (this.element.addEventListener) {
  390. this.element.addEventListener("mousemove", _605d, false);
  391. this.element.addEventListener("mousedown", _6056, false);
  392. this.element.addEventListener("dblclick", _6053, false);
  393. } else {
  394. if (this.element.attachEvent) {
  395. this.element.attachEvent("onmousemove", _605d);
  396. this.element.attachEvent("onmousedown", _6056);
  397. this.element.attachEvent("ondblclick", _6053);
  398. } else {
  399. throw "Drag not supported in this browser.";
  400. }
  401. }
  402. };
  403. draw2d.Draggable.prototype.onDrop = function(_6060, _6061) {
  404. };
  405. draw2d.Draggable.prototype.attachEventHandlers = function() {
  406. var oThis = this;
  407. oThis.isAttached = true;
  408. this.tempMouseMove = function() {
  409. var _6063 = arguments[0] || window.event;
  410. var _6064 = new draw2d.Point(_6063.clientX - oThis.diffX, _6063.clientY
  411. - oThis.diffY);
  412. if (oThis.node !== null && oThis.node.getCanSnapToHelper()) {
  413. _6064 = oThis.node.getWorkflow().snapToHelper(oThis.node, _6064);
  414. }
  415. oThis.element.style.left = _6064.x + "px";
  416. oThis.element.style.top = _6064.y + "px";
  417. if (oThis.node !== null) {
  418. var _6065 = oThis.node.getWorkflow().getScrollLeft();
  419. var _6066 = oThis.node.getWorkflow().getScrollTop();
  420. var _6067 = oThis.node.getWorkflow().getAbsoluteX();
  421. var _6068 = oThis.node.getWorkflow().getAbsoluteY();
  422. var _6069 = oThis.getDropTarget(_6063.clientX + _6065 - _6067,
  423. _6063.clientY + _6066 - _6068);
  424. var _606a = oThis.getCompartment(_6063.clientX + _6065 - _6067,
  425. _6063.clientY + _6066 - _6068);
  426. if (draw2d.Drag.currentTarget !== null
  427. && _6069 != draw2d.Drag.currentTarget) {
  428. var _606b = new draw2d.DragDropEvent();
  429. _606b.initDragDropEvent("dragleave", false, oThis);
  430. draw2d.Drag.currentTarget.dispatchEvent(_606b);
  431. }
  432. if (_6069 !== null && _6069 !== draw2d.Drag.currentTarget) {
  433. var _606b = new draw2d.DragDropEvent();
  434. _606b.initDragDropEvent("dragenter", false, oThis);
  435. _6069.dispatchEvent(_606b);
  436. }
  437. draw2d.Drag.currentTarget = _6069;
  438. if (draw2d.Drag.currentCompartment !== null
  439. && _606a !== draw2d.Drag.currentCompartment) {
  440. var _606b = new draw2d.DragDropEvent();
  441. _606b.initDragDropEvent("figureleave", false, oThis);
  442. draw2d.Drag.currentCompartment.dispatchEvent(_606b);
  443. }
  444. if (_606a !== null && _606a.node != oThis.node
  445. && _606a !== draw2d.Drag.currentCompartment) {
  446. var _606b = new draw2d.DragDropEvent();
  447. _606b.initDragDropEvent("figureenter", false, oThis);
  448. _606a.dispatchEvent(_606b);
  449. }
  450. draw2d.Drag.currentCompartment = _606a;
  451. }
  452. var _606c = new draw2d.DragDropEvent();
  453. _606c.initDragDropEvent("drag", false);
  454. oThis.dispatchEvent(_606c);
  455. };
  456. oThis.tempMouseUp = function() {
  457. oThis.detachEventHandlers();
  458. var _606d = arguments[0] || window.event;
  459. if (oThis.node !== null) {
  460. var _606e = oThis.node.getWorkflow().getScrollLeft();
  461. var _606f = oThis.node.getWorkflow().getScrollTop();
  462. var _6070 = oThis.node.getWorkflow().getAbsoluteX();
  463. var _6071 = oThis.node.getWorkflow().getAbsoluteY();
  464. var _6072 = oThis.getDropTarget(_606d.clientX + _606e - _6070,
  465. _606d.clientY + _606f - _6071);
  466. var _6073 = oThis.getCompartment(_606d.clientX + _606e - _6070,
  467. _606d.clientY + _606f - _6071);
  468. if (_6072 !== null) {
  469. var _6074 = new draw2d.DragDropEvent();
  470. _6074.initDragDropEvent("drop", false, oThis);
  471. _6072.dispatchEvent(_6074);
  472. }
  473. if (_6073 !== null && _6073.node !== oThis.node) {
  474. var _6074 = new draw2d.DragDropEvent();
  475. _6074.initDragDropEvent("figuredrop", false, oThis);
  476. _6073.dispatchEvent(_6074);
  477. }
  478. if (draw2d.Drag.currentTarget !== null) {
  479. var _6074 = new draw2d.DragDropEvent();
  480. _6074.initDragDropEvent("dragleave", false, oThis);
  481. draw2d.Drag.currentTarget.dispatchEvent(_6074);
  482. draw2d.Drag.currentTarget = null;
  483. }
  484. }
  485. var _6075 = new draw2d.DragDropEvent();
  486. _6075.initDragDropEvent("dragend", false);
  487. oThis.dispatchEvent(_6075);
  488. oThis.onDrop(_606d.clientX, _606d.clientY);
  489. draw2d.Drag.currentCompartment = null;
  490. draw2d.Drag.clearCurrent();
  491. };
  492. if (document.body.addEventListener) {
  493. document.body.addEventListener("mousemove", this.tempMouseMove, false);
  494. document.body.addEventListener("mouseup", this.tempMouseUp, false);
  495. } else {
  496. if (document.body.attachEvent) {
  497. document.body.attachEvent("onmousemove", this.tempMouseMove);
  498. document.body.attachEvent("onmouseup", this.tempMouseUp);
  499. } else {
  500. throw new Error("Drag doesn't support this browser.");
  501. }
  502. }
  503. };
  504. draw2d.Draggable.prototype.detachEventHandlers = function() {
  505. this.isAttached = false;
  506. if (document.body.removeEventListener) {
  507. document.body.removeEventListener("mousemove", this.tempMouseMove,
  508. false);
  509. document.body.removeEventListener("mouseup", this.tempMouseUp, false);
  510. } else {
  511. if (document.body.detachEvent) {
  512. document.body.detachEvent("onmousemove", this.tempMouseMove);
  513. document.body.detachEvent("onmouseup", this.tempMouseUp);
  514. } else {
  515. throw new Error("Drag doesn't support this browser.");
  516. }
  517. }
  518. };
  519. draw2d.Draggable.prototype.getDropTarget = function(x, y) {
  520. for ( var i = 0; i < this.targets.getSize(); i++) {
  521. var _6079 = this.targets.get(i);
  522. if (_6079.node.isOver(x, y) && _6079.node !== this.node) {
  523. return _6079;
  524. }
  525. }
  526. return null;
  527. };
  528. draw2d.Draggable.prototype.getCompartment = function(x, y) {
  529. var _607c = null;
  530. for ( var i = 0; i < this.node.getWorkflow().compartments.getSize(); i++) {
  531. var _607e = this.node.getWorkflow().compartments.get(i);
  532. if (_607e.isOver(x, y) && _607e !== this.node) {
  533. if (_607c === null) {
  534. _607c = _607e;
  535. } else {
  536. if (_607c.getZOrder() < _607e.getZOrder()) {
  537. _607c = _607e;
  538. }
  539. }
  540. }
  541. }
  542. return _607c === null ? null : _607c.dropable;
  543. };
  544. draw2d.Draggable.prototype.getLeft = function() {
  545. return this.element.offsetLeft;
  546. };
  547. draw2d.Draggable.prototype.getTop = function() {
  548. return this.element.offsetTop;
  549. };
  550. draw2d.DragDropEvent = function() {
  551. draw2d.AbstractEvent.call(this);
  552. };
  553. draw2d.DragDropEvent.prototype = new draw2d.AbstractEvent();
  554. draw2d.DragDropEvent.prototype.initDragDropEvent = function(sType, _6080, _6081) {
  555. this.initEvent(sType, _6080);
  556. this.relatedTarget = _6081;
  557. };
  558. draw2d.DropTarget = function(_6082) {
  559. draw2d.EventTarget.call(this);
  560. this.construct(_6082);
  561. };
  562. draw2d.DropTarget.prototype = new draw2d.EventTarget();
  563. draw2d.DropTarget.prototype.construct = function(_6083) {
  564. this.element = _6083;
  565. };
  566. draw2d.DropTarget.prototype.getLeft = function() {
  567. var el = this.element;
  568. var ol = el.offsetLeft;
  569. while ((el = el.offsetParent) !== null) {
  570. ol += el.offsetLeft;
  571. }
  572. return ol;
  573. };
  574. draw2d.DropTarget.prototype.getTop = function() {
  575. var el = this.element;
  576. var ot = el.offsetTop;
  577. while ((el = el.offsetParent) !== null) {
  578. ot += el.offsetTop;
  579. }
  580. return ot;
  581. };
  582. draw2d.DropTarget.prototype.getHeight = function() {
  583. return this.element.offsetHeight;
  584. };
  585. draw2d.DropTarget.prototype.getWidth = function() {
  586. return this.element.offsetWidth;
  587. };
  588. draw2d.PositionConstants = function() {
  589. };
  590. draw2d.PositionConstants.NORTH = 1;
  591. draw2d.PositionConstants.SOUTH = 4;
  592. draw2d.PositionConstants.WEST = 8;
  593. draw2d.PositionConstants.EAST = 16;
  594. draw2d.Color = function(red, green, blue) {
  595. if (typeof green == "undefined") {
  596. var rgb = this.hex2rgb(red);
  597. this.red = rgb[0];
  598. this.green = rgb[1];
  599. this.blue = rgb[2];
  600. } else {
  601. this.red = red;
  602. this.green = green;
  603. this.blue = blue;
  604. }
  605. };
  606. draw2d.Color.prototype.type = "draw2d.Color";
  607. draw2d.Color.prototype.getHTMLStyle = function() {
  608. return "rgb(" + this.red + "," + this.green + "," + this.blue + ")";
  609. };
  610. draw2d.Color.prototype.getRed = function() {
  611. return this.red;
  612. };
  613. draw2d.Color.prototype.getGreen = function() {
  614. return this.green;
  615. };
  616. draw2d.Color.prototype.getBlue = function() {
  617. return this.blue;
  618. };
  619. draw2d.Color.prototype.getIdealTextColor = function() {
  620. var _5062 = 105;
  621. var _5063 = (this.red * 0.299) + (this.green * 0.587) + (this.blue * 0.114);
  622. return (255 - _5063 < _5062) ? new draw2d.Color(0, 0, 0)
  623. : new draw2d.Color(255, 255, 255);
  624. };
  625. draw2d.Color.prototype.hex2rgb = function(_5064) {
  626. _5064 = _5064.replace("#", "");
  627. return ( {
  628. 0 : parseInt(_5064.substr(0, 2), 16),
  629. 1 : parseInt(_5064.substr(2, 2), 16),
  630. 2 : parseInt(_5064.substr(4, 2), 16)
  631. });
  632. };
  633. draw2d.Color.prototype.hex = function() {
  634. return (this.int2hex(this.red) + this.int2hex(this.green) + this
  635. .int2hex(this.blue));
  636. };
  637. draw2d.Color.prototype.int2hex = function(v) {
  638. v = Math.round(Math.min(Math.max(0, v), 255));
  639. return ("0123456789ABCDEF".charAt((v - v % 16) / 16) + "0123456789ABCDEF"
  640. .charAt(v % 16));
  641. };
  642. draw2d.Color.prototype.darker = function(_5066) {
  643. var red = parseInt(Math.round(this.getRed() * (1 - _5066)));
  644. var green = parseInt(Math.round(this.getGreen() * (1 - _5066)));
  645. var blue = parseInt(Math.round(this.getBlue() * (1 - _5066)));
  646. if (red < 0) {
  647. red = 0;
  648. } else {
  649. if (red > 255) {
  650. red = 255;
  651. }
  652. }
  653. if (green < 0) {
  654. green = 0;
  655. } else {
  656. if (green > 255) {
  657. green = 255;
  658. }
  659. }
  660. if (blue < 0) {
  661. blue = 0;
  662. } else {
  663. if (blue > 255) {
  664. blue = 255;
  665. }
  666. }
  667. return new draw2d.Color(red, green, blue);
  668. };
  669. draw2d.Color.prototype.lighter = function(_506a) {
  670. var red = parseInt(Math.round(this.getRed() * (1 + _506a)));
  671. var green = parseInt(Math.round(this.getGreen() * (1 + _506a)));
  672. var blue = parseInt(Math.round(this.getBlue() * (1 + _506a)));
  673. if (red < 0) {
  674. red = 0;
  675. } else {
  676. if (red > 255) {
  677. red = 255;
  678. }
  679. }
  680. if (green < 0) {
  681. green = 0;
  682. } else {
  683. if (green > 255) {
  684. green = 255;
  685. }
  686. }
  687. if (blue < 0) {
  688. blue = 0;
  689. } else {
  690. if (blue > 255) {
  691. blue = 255;
  692. }
  693. }
  694. return new draw2d.Color(red, green, blue);
  695. };
  696. draw2d.Point = function(x, y) {
  697. this.x = x;
  698. this.y = y;
  699. };
  700. draw2d.Point.prototype.type = "draw2d.Point";
  701. draw2d.Point.prototype.getX = function() {
  702. return this.x;
  703. };
  704. draw2d.Point.prototype.getY = function() {
  705. return this.y;
  706. };
  707. draw2d.Point.prototype.getPosition = function(p) {
  708. var dx = p.x - this.x;
  709. var dy = p.y - this.y;
  710. if (Math.abs(dx) > Math.abs(dy)) {
  711. if (dx < 0) {
  712. return draw2d.PositionConstants.WEST;
  713. }
  714. return draw2d.PositionConstants.EAST;
  715. }
  716. if (dy < 0) {
  717. return draw2d.PositionConstants.NORTH;
  718. }
  719. return draw2d.PositionConstants.SOUTH;
  720. };
  721. draw2d.Point.prototype.equals = function(o) {
  722. return this.x == o.x && this.y == o.y;
  723. };
  724. draw2d.Point.prototype.getDistance = function(other) {
  725. return Math.sqrt((this.x - other.x) * (this.x - other.x)
  726. + (this.y - other.y) * (this.y - other.y));
  727. };
  728. draw2d.Point.prototype.getTranslated = function(other) {
  729. return new draw2d.Point(this.x + other.x, this.y + other.y);
  730. };
  731. draw2d.Point.prototype.getPersistentAttributes = function() {
  732. return {
  733. x : this.x,
  734. y : this.y
  735. };
  736. };
  737. draw2d.Dimension = function(x, y, w, h) {
  738. draw2d.Point.call(this, x, y);
  739. this.w = w;
  740. this.h = h;
  741. };
  742. draw2d.Dimension.prototype = new draw2d.Point();
  743. draw2d.Dimension.prototype.type = "draw2d.Dimension";
  744. draw2d.Dimension.prototype.translate = function(dx, dy) {
  745. this.x += dx;
  746. this.y += dy;
  747. return this;
  748. };
  749. draw2d.Dimension.prototype.resize = function(dw, dh) {
  750. this.w += dw;
  751. this.h += dh;
  752. return this;
  753. };
  754. draw2d.Dimension.prototype.setBounds = function(rect) {
  755. this.x = rect.x;
  756. this.y = rect.y;
  757. this.w = rect.w;
  758. this.h = rect.h;
  759. return this;
  760. };
  761. draw2d.Dimension.prototype.isEmpty = function() {
  762. return this.w <= 0 || this.h <= 0;
  763. };
  764. draw2d.Dimension.prototype.getWidth = function() {
  765. return this.w;
  766. };
  767. draw2d.Dimension.prototype.getHeight = function() {
  768. return this.h;
  769. };
  770. draw2d.Dimension.prototype.getRight = function() {
  771. return this.x + this.w;
  772. };
  773. draw2d.Dimension.prototype.getBottom = function() {
  774. return this.y + this.h;
  775. };
  776. draw2d.Dimension.prototype.getTopLeft = function() {
  777. return new draw2d.Point(this.x, this.y);
  778. };
  779. draw2d.Dimension.prototype.getCenter = function() {
  780. return new draw2d.Point(this.x + this.w / 2, this.y + this.h / 2);
  781. };
  782. draw2d.Dimension.prototype.getBottomRight = function() {
  783. return new draw2d.Point(this.x + this.w, this.y + this.h);
  784. };
  785. draw2d.Dimension.prototype.equals = function(o) {
  786. return this.x == o.x && this.y == o.y && this.w == o.w && this.h == o.h;
  787. };
  788. draw2d.SnapToHelper = function(_5932) {
  789. this.workflow = _5932;
  790. };
  791. draw2d.SnapToHelper.NORTH = 1;
  792. draw2d.SnapToHelper.SOUTH = 4;
  793. draw2d.SnapToHelper.WEST = 8;
  794. draw2d.SnapToHelper.EAST = 16;
  795. draw2d.SnapToHelper.CENTER = 32;
  796. draw2d.SnapToHelper.NORTH_EAST = draw2d.SnapToHelper.NORTH
  797. | draw2d.SnapToHelper.EAST;
  798. draw2d.SnapToHelper.NORTH_WEST = draw2d.SnapToHelper.NORTH
  799. | draw2d.SnapToHelper.WEST;
  800. draw2d.SnapToHelper.SOUTH_EAST = draw2d.SnapToHelper.SOUTH
  801. | draw2d.SnapToHelper.EAST;
  802. draw2d.SnapToHelper.SOUTH_WEST = draw2d.SnapToHelper.SOUTH
  803. | draw2d.SnapToHelper.WEST;
  804. draw2d.SnapToHelper.NORTH_SOUTH = draw2d.SnapToHelper.NORTH
  805. | draw2d.SnapToHelper.SOUTH;
  806. draw2d.SnapToHelper.EAST_WEST = draw2d.SnapToHelper.EAST
  807. | draw2d.SnapToHelper.WEST;
  808. draw2d.SnapToHelper.NSEW = draw2d.SnapToHelper.NORTH_SOUTH
  809. | draw2d.SnapToHelper.EAST_WEST;
  810. draw2d.SnapToHelper.prototype.snapPoint = function(_5933, _5934, _5935) {
  811. return _5934;
  812. };
  813. draw2d.SnapToHelper.prototype.snapRectangle = function(_5936, _5937) {
  814. return _5936;
  815. };
  816. draw2d.SnapToHelper.prototype.onSetDocumentDirty = function() {
  817. };
  818. draw2d.SnapToGrid = function(_4a14) {
  819. draw2d.SnapToHelper.call(this, _4a14);
  820. };
  821. draw2d.SnapToGrid.prototype = new draw2d.SnapToHelper();
  822. draw2d.SnapToGrid.prototype.type = "draw2d.SnapToGrid";
  823. draw2d.SnapToGrid.prototype.snapPoint = function(_4a15, _4a16, _4a17) {
  824. _4a17.x = this.workflow.gridWidthX
  825. * Math
  826. .floor(((_4a16.x + this.workflow.gridWidthX / 2) / this.workflow.gridWidthX));
  827. _4a17.y = this.workflow.gridWidthY
  828. * Math
  829. .floor(((_4a16.y + this.workflow.gridWidthY / 2) / this.workflow.gridWidthY));
  830. return 0;
  831. };
  832. draw2d.SnapToGrid.prototype.snapRectangle = function(_4a18, _4a19) {
  833. _4a19.x = _4a18.x;
  834. _4a19.y = _4a18.y;
  835. _4a19.w = _4a18.w;
  836. _4a19.h = _4a18.h;
  837. return 0;
  838. };
  839. draw2d.SnapToGeometryEntry = function(type, _5944) {
  840. this.type = type;
  841. this.location = _5944;
  842. };
  843. draw2d.SnapToGeometryEntry.prototype.getLocation = function() {
  844. return this.location;
  845. };
  846. draw2d.SnapToGeometryEntry.prototype.getType = function() {
  847. return this.type;
  848. };
  849. draw2d.SnapToGeometry = function(_5afe) {
  850. draw2d.SnapToHelper.call(this, _5afe);
  851. this.rows = null;
  852. this.cols = null;
  853. };
  854. draw2d.SnapToGeometry.prototype = new draw2d.SnapToHelper();
  855. draw2d.SnapToGeometry.THRESHOLD = 5;
  856. draw2d.SnapToGeometry.prototype.snapPoint = function(_5aff, _5b00, _5b01) {
  857. if (this.rows === null || this.cols === null) {
  858. this.populateRowsAndCols();
  859. }
  860. if ((_5aff & draw2d.SnapToHelper.EAST) !== 0) {
  861. var _5b02 = this.getCorrectionFor(this.cols, _5b00.getX() - 1, 1);
  862. if (_5b02 !== draw2d.SnapToGeometry.THRESHOLD) {
  863. _5aff &= ~draw2d.SnapToHelper.EAST;
  864. _5b01.x += _5b02;
  865. }
  866. }
  867. if ((_5aff & draw2d.SnapToHelper.WEST) !== 0) {
  868. var _5b03 = this.getCorrectionFor(this.cols, _5b00.getX(), -1);
  869. if (_5b03 !== draw2d.SnapToGeometry.THRESHOLD) {
  870. _5aff &= ~draw2d.SnapToHelper.WEST;
  871. _5b01.x += _5b03;
  872. }
  873. }
  874. if ((_5aff & draw2d.SnapToHelper.SOUTH) !== 0) {
  875. var _5b04 = this.getCorrectionFor(this.rows, _5b00.getY() - 1, 1);
  876. if (_5b04 !== draw2d.SnapToGeometry.THRESHOLD) {
  877. _5aff &= ~draw2d.SnapToHelper.SOUTH;
  878. _5b01.y += _5b04;
  879. }
  880. }
  881. if ((_5aff & draw2d.SnapToHelper.NORTH) !== 0) {
  882. var _5b05 = this.getCorrectionFor(this.rows, _5b00.getY(), -1);
  883. if (_5b05 !== draw2d.SnapToGeometry.THRESHOLD) {
  884. _5aff &= ~draw2d.SnapToHelper.NORTH;
  885. _5b01.y += _5b05;
  886. }
  887. }
  888. return _5aff;
  889. };
  890. draw2d.SnapToGeometry.prototype.snapRectangle = function(_5b06, _5b07) {
  891. var _5b08 = _5b06.getTopLeft();
  892. var _5b09 = _5b06.getBottomRight();
  893. var _5b0a = this.snapPoint(draw2d.SnapToHelper.NORTH_WEST, _5b06
  894. .getTopLeft(), _5b08);
  895. _5b07.x = _5b08.x;
  896. _5b07.y = _5b08.y;
  897. var _5b0b = this.snapPoint(draw2d.SnapToHelper.SOUTH_EAST, _5b06
  898. .getBottomRight(), _5b09);
  899. if (_5b0a & draw2d.SnapToHelper.WEST) {
  900. _5b07.x = _5b09.x - _5b06.getWidth();
  901. }
  902. if (_5b0a & draw2d.SnapToHelper.NORTH) {
  903. _5b07.y = _5b09.y - _5b06.getHeight();
  904. }
  905. return _5b0a | _5b0b;
  906. };
  907. draw2d.SnapToGeometry.prototype.populateRowsAndCols = function() {
  908. this.rows = [];
  909. this.cols = [];
  910. var _5b0c = this.workflow.getDocument().getFigures();
  911. var index = 0;
  912. for ( var i = 0; i < _5b0c.getSize(); i++) {
  913. var _5b0f = _5b0c.get(i);
  914. if (_5b0f != this.workflow.getCurrentSelection()) {
  915. var _5b10 = _5b0f.getBounds();
  916. this.cols[index * 3] = new draw2d.SnapToGeometryEntry(-1, _5b10
  917. .getX());
  918. this.rows[index * 3] = new draw2d.SnapToGeometryEntry(-1, _5b10
  919. .getY());
  920. this.cols[index * 3 + 1] = new draw2d.SnapToGeometryEntry(0,
  921. _5b10.x + (_5b10.getWidth() - 1) / 2);
  922. this.rows[index * 3 + 1] = new draw2d.SnapToGeometryEntry(0,
  923. _5b10.y + (_5b10.getHeight() - 1) / 2);
  924. this.cols[index * 3 + 2] = new draw2d.SnapToGeometryEntry(1, _5b10
  925. .getRight() - 1);
  926. this.rows[index * 3 + 2] = new draw2d.SnapToGeometryEntry(1, _5b10
  927. .getBottom() - 1);
  928. index++;
  929. }
  930. }
  931. };
  932. draw2d.SnapToGeometry.prototype.getCorrectionFor = function(_5b11, value, side) {
  933. var _5b14 = draw2d.SnapToGeometry.THRESHOLD;
  934. var _5b15 = draw2d.SnapToGeometry.THRESHOLD;
  935. for ( var i = 0; i < _5b11.length; i++) {
  936. var entry = _5b11[i];
  937. var _5b18;
  938. if (entry.type === -1 && side !== 0) {
  939. _5b18 = Math.abs(value - entry.location);
  940. if (_5b18 < _5b14) {
  941. _5b14 = _5b18;
  942. _5b15 = entry.location - value;
  943. }
  944. } else {
  945. if (entry.type === 0 && side === 0) {
  946. _5b18 = Math.abs(value - entry.location);
  947. if (_5b18 < _5b14) {
  948. _5b14 = _5b18;
  949. _5b15 = entry.location - value;
  950. }
  951. } else {
  952. if (entry.type === 1 && side !== 0) {
  953. _5b18 = Math.abs(value - entry.location);
  954. if (_5b18 < _5b14) {
  955. _5b14 = _5b18;
  956. _5b15 = entry.location - value;
  957. }
  958. }
  959. }
  960. }
  961. }
  962. return _5b15;
  963. };
  964. draw2d.SnapToGeometry.prototype.onSetDocumentDirty = function() {
  965. this.rows = null;
  966. this.cols = null;
  967. };
  968. draw2d.Border = function() {
  969. this.color = null;
  970. };
  971. draw2d.Border.prototype.type = "draw2d.Border";
  972. draw2d.Border.prototype.dispose = function() {
  973. this.color = null;
  974. };
  975. draw2d.Border.prototype.getHTMLStyle = function() {
  976. return "";
  977. };
  978. draw2d.Border.prototype.setColor = function(c) {
  979. this.color = c;
  980. };
  981. draw2d.Border.prototype.getColor = function() {
  982. return this.color;
  983. };
  984. draw2d.Border.prototype.refresh = function() {
  985. };
  986. draw2d.LineBorder = function(width) {
  987. draw2d.Border.call(this);
  988. this.width = 1;
  989. if (width) {
  990. this.width = width;
  991. }
  992. this.figure = null;
  993. };
  994. draw2d.LineBorder.prototype = new draw2d.Border();
  995. draw2d.LineBorder.prototype.type = "draw2d.LineBorder";
  996. draw2d.LineBorder.prototype.dispose = function() {
  997. draw2d.Border.prototype.dispose.call(this);
  998. this.figure = null;
  999. };
  1000. draw2d.LineBorder.prototype.setLineWidth = function(w) {
  1001. this.width = w;
  1002. if (this.figure !== null) {
  1003. this.figure.html.style.border = this.getHTMLStyle();
  1004. }
  1005. };
  1006. draw2d.LineBorder.prototype.getHTMLStyle = function() {
  1007. if (this.getColor() !== null) {
  1008. return this.width + "px solid " + this.getColor().getHTMLStyle();
  1009. }
  1010. return this.width + "px solid black";
  1011. };
  1012. draw2d.LineBorder.prototype.refresh = function() {
  1013. this.setLineWidth(this.width);
  1014. };
  1015. draw2d.Figure = function() {
  1016. this.construct();
  1017. };
  1018. draw2d.Figure.prototype.type = "draw2d.Figure";
  1019. draw2d.Figure.ZOrderBaseIndex = 100;
  1020. draw2d.Figure.setZOrderBaseIndex = function(index) {
  1021. draw2d.Figure.ZOrderBaseIndex = index;
  1022. };
  1023. draw2d.Figure.prototype.construct = function() {
  1024. this.lastDragStartTime = 0;
  1025. this.x = 0;
  1026. this.y = 0;
  1027. this.width = 10;
  1028. this.height = 10;
  1029. this.border = null;
  1030. this.id = draw2d.UUID.create();
  1031. this.html = this.createHTMLElement();
  1032. this.canvas = null;
  1033. this.workflow = null;
  1034. this.draggable = null;
  1035. this.parent = null;
  1036. this.isMoving = false;
  1037. this.canSnapToHelper = true;
  1038. this.snapToGridAnchor = new draw2d.Point(0, 0);
  1039. this.timer = -1;
  1040. this.model = null;
  1041. this.alpha = 1;
  1042. this.alphaBeforeOnDrag = 1;
  1043. this.properties = {};
  1044. this.moveListener = new draw2d.ArrayList();
  1045. this.setDimension(this.width, this.height);
  1046. this.setDeleteable(true);
  1047. this.setCanDrag(true);
  1048. this.setResizeable(true);
  1049. this.setSelectable(true);
  1050. };
  1051. draw2d.Figure.prototype.dispose = function() {
  1052. this.canvas = null;
  1053. this.workflow = null;
  1054. this.moveListener = null;
  1055. if (this.draggable !== null) {
  1056. this.draggable.removeEventListener("mouseenter", this.tmpMouseEnter);
  1057. this.draggable.removeEventListener("mouseleave", this.tmpMouseLeave);
  1058. this.draggable.removeEventListener("dragend", this.tmpDragend);
  1059. this.draggable.removeEventListener("dragstart", this.tmpDragstart);
  1060. this.draggable.removeEventListener("drag", this.tmpDrag);
  1061. this.draggable.removeEventListener("dblclick", this.tmpDoubleClick);
  1062. this.draggable.node = null;
  1063. this.draggable.target.removeAllElements();
  1064. }
  1065. this.draggable = null;
  1066. if (this.border !== null) {
  1067. this.border.dispose();
  1068. }
  1069. this.border = null;
  1070. if (this.parent !== null) {
  1071. this.parent.removeChild(this);
  1072. }
  1073. };
  1074. draw2d.Figure.prototype.getProperties = function() {
  1075. return this.properties;
  1076. };
  1077. draw2d.Figure.prototype.getProperty = function(key) {
  1078. return this.properties[key];
  1079. };
  1080. draw2d.Figure.prototype.setProperty = function(key, value) {
  1081. this.properties[key] = value;
  1082. this.setDocumentDirty();
  1083. };
  1084. draw2d.Figure.prototype.getId = function() {
  1085. return this.id;
  1086. };
  1087. draw2d.Figure.prototype.setId = function(id) {
  1088. this.id = id;
  1089. if (this.html !== null) {
  1090. this.html.id = id;
  1091. }
  1092. };
  1093. draw2d.Figure.prototype.setCanvas = function(_59c6) {
  1094. this.canvas = _59c6;
  1095. };
  1096. draw2d.Figure.prototype.getWorkflow = function() {
  1097. return this.workflow;
  1098. };
  1099. draw2d.Figure.prototype.setWorkflow = function(_59c7) {
  1100. if (this.draggable === null) {
  1101. this.html.tabIndex = "0";
  1102. var oThis = this;
  1103. this.keyDown = function(event) {
  1104. event.cancelBubble = true;
  1105. event.returnValue = true;
  1106. oThis.onKeyDown(event.keyCode, event.ctrlKey);
  1107. };
  1108. if (this.html.addEventListener) {
  1109. this.html.addEventListener("keydown", this.keyDown, false);
  1110. } else {
  1111. if (this.html.attachEvent) {
  1112. this.html.attachEvent("onkeydown", this.keyDown);
  1113. }
  1114. }
  1115. this.draggable = new draw2d.Draggable(this.html,
  1116. draw2d.Draggable.DRAG_X | draw2d.Draggable.DRAG_Y);
  1117. this.draggable.node = this;
  1118. this.tmpContextMenu = function(_59ca) {
  1119. oThis.onContextMenu(oThis.x + _59ca.x, _59ca.y + oThis.y);
  1120. };
  1121. this.tmpMouseEnter = function(_59cb) {
  1122. oThis.onMouseEnter();
  1123. };
  1124. this.tmpMouseLeave = function(_59cc) {
  1125. oThis.onMouseLeave();
  1126. };
  1127. this.tmpDragend = function(_59cd) {
  1128. oThis.onDragend();
  1129. };
  1130. this.tmpDragstart = function(_59ce) {
  1131. var w = oThis.workflow;
  1132. w.showMenu(null);
  1133. if (w.toolPalette && w.toolPalette.activeTool) {
  1134. _59ce.returnValue = false;
  1135. w.onMouseDown(oThis.x + _59ce.x, _59ce.y + oThis.y);
  1136. w.onMouseUp(oThis.x + _59ce.x, _59ce.y + oThis.y);
  1137. return;
  1138. }
  1139. if (!(oThis instanceof draw2d.ResizeHandle)
  1140. && !(oThis instanceof draw2d.Port)) {
  1141. var line = w.getBestLine(oThis.x + _59ce.x, _59ce.y + oThis.y);
  1142. if (line !== null) {
  1143. _59ce.returnValue = false;
  1144. w.setCurrentSelection(line);
  1145. w.showLineResizeHandles(line);
  1146. w.onMouseDown(oThis.x + _59ce.x, _59ce.y + oThis.y);
  1147. return;
  1148. } else {
  1149. if (oThis.isSelectable()) {
  1150. w.showResizeHandles(oThis);
  1151. w.setCurrentSelection(oThis);
  1152. }
  1153. }
  1154. }
  1155. _59ce.returnValue = oThis.onDragstart(_59ce.x, _59ce.y);
  1156. };
  1157. this.tmpDrag = function(_59d1) {
  1158. oThis.onDrag();
  1159. };
  1160. this.tmpDoubleClick = function(_59d2) {
  1161. oThis.onDoubleClick();
  1162. };
  1163. this.draggable.addEventListener("contextmenu", this.tmpContextMenu);
  1164. this.draggable.addEventListener("mouseenter", this.tmpMouseEnter);
  1165. this.draggable.addEventListener("mouseleave", this.tmpMouseLeave);
  1166. this.draggable.addEventListener("dragend", this.tmpDragend);
  1167. this.draggable.addEventListener("dragstart", this.tmpDragstart);
  1168. this.draggable.addEventListener("drag", this.tmpDrag);
  1169. this.draggable.addEventListener("dblclick", this.tmpDoubleClick);
  1170. }
  1171. this.workflow = _59c7;
  1172. };
  1173. draw2d.Figure.prototype.createHTMLElement = function() {
  1174. var item = document.createElement("div");
  1175. item.id = this.id;
  1176. item.style.position = "absolute";
  1177. item.style.left = this.x + "px";
  1178. item.style.top = this.y + "px";
  1179. item.style.height = this.width + "px";
  1180. item.style.width = this.height + "px";
  1181. item.style.margin = "0px";
  1182. item.style.padding = "0px";
  1183. item.style.outline = "none";
  1184. item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
  1185. return item;
  1186. };
  1187. draw2d.Figure.prototype.setParent = function(_59d4) {
  1188. this.parent = _59d4;
  1189. };
  1190. draw2d.Figure.prototype.getParent = function() {
  1191. return this.parent;
  1192. };
  1193. draw2d.Figure.prototype.getZOrder = function() {
  1194. return this.html.style.zIndex;
  1195. };
  1196. draw2d.Figure.prototype.setZOrder = function(index) {
  1197. this.html.style.zIndex = index;
  1198. };
  1199. draw2d.Figure.prototype.hasFixedPosition = function() {
  1200. return false;
  1201. };
  1202. draw2d.Figure.prototype.getMinWidth = function() {
  1203. return 5;
  1204. };
  1205. draw2d.Figure.prototype.getMinHeight = function() {
  1206. return 5;
  1207. };
  1208. draw2d.Figure.prototype.getHTMLElement = function() {
  1209. if (this.html === null) {
  1210. this.html = this.createHTMLElement();
  1211. }
  1212. return this.html;
  1213. };
  1214. draw2d.Figure.prototype.paint = function() {
  1215. };
  1216. draw2d.Figure.prototype.setBorder = function(_59d6) {
  1217. if (this.border !== null) {
  1218. this.border.figure = null;
  1219. }
  1220. this.border = _59d6;
  1221. this.border.figure = this;
  1222. this.border.refresh();
  1223. this.setDocumentDirty();
  1224. };
  1225. draw2d.Figure.prototype.onRemove = function(_59d7) {
  1226. };
  1227. draw2d.Figure.prototype.onContextMenu = function(x, y) {
  1228. var menu = this.getContextMenu();
  1229. if (menu !== null) {
  1230. this.workflow.showMenu(menu, x, y);
  1231. }
  1232. };
  1233. draw2d.Figure.prototype.getContextMenu = function() {
  1234. return null;
  1235. };
  1236. draw2d.Figure.prototype.onDoubleClick = function() {
  1237. this.figureDoubleClick();
  1238. };
  1239. draw2d.Figure.prototype.figureDoubleClick = function() {
  1240. return null;
  1241. };
  1242. draw2d.Figure.prototype.onMouseEnter = function() {
  1243. };
  1244. draw2d.Figure.prototype.onMouseLeave = function() {
  1245. };
  1246. draw2d.Figure.prototype.onDrag = function() {
  1247. this.x = this.draggable.getLeft();
  1248. this.y = this.draggable.getTop();
  1249. if (this.isMoving == false) {
  1250. this.isMoving = true;
  1251. this.alphaBeforeOnDrag = this.getAlpha();
  1252. this.setAlpha(this.alphaBeforeOnDrag * 0.5);
  1253. }
  1254. this.fireMoveEvent();
  1255. };
  1256. draw2d.Figure.prototype.onDragend = function() {
  1257. if (this.getWorkflow().getEnableSmoothFigureHandling() === true) {
  1258. var oThis = this;
  1259. var _59dc = function() {
  1260. if (oThis.alpha < oThis.alphaBeforeOnDrag) {
  1261. oThis.setAlpha(Math.min(1, oThis.alpha + 0.05));
  1262. } else {
  1263. window.clearInterval(oThis.timer);
  1264. oThis.timer = -1;
  1265. }
  1266. };
  1267. if (oThis.timer > 0) {
  1268. window.clearInterval(oThis.timer);
  1269. }
  1270. oThis.timer = window.setInterval(_59dc, 20);
  1271. } else {
  1272. this.setAlpha(this.alphaBeforeOnDrag);
  1273. }
  1274. this.command.setPosition(this.x, this.y);
  1275. this.workflow.commandStack.execute(this.command);
  1276. this.command = null;
  1277. this.isMoving = false;
  1278. this.workflow.hideSnapToHelperLines();
  1279. this.fireMoveEvent();
  1280. };
  1281. draw2d.Figure.prototype.onDragstart = function(x, y) {
  1282. this.command = this.createCommand(new draw2d.EditPolicy(
  1283. draw2d.EditPolicy.MOVE));
  1284. return this.command !== null;
  1285. };
  1286. draw2d.Figure.prototype.setCanDrag = function(flag) {
  1287. this.canDrag = flag;
  1288. if (flag) {
  1289. this.html.style.cursor = "move";
  1290. } else {
  1291. this.html.style.cursor = "";
  1292. }
  1293. };
  1294. draw2d.Figure.prototype.getCanDrag = function() {
  1295. return this.canDrag;
  1296. };
  1297. draw2d.Figure.prototype.setAlpha = function(_59e0) {
  1298. if (this.alpha === _59e0) {
  1299. return;
  1300. }
  1301. this.alpha = Math.max(0, Math.min(1, _59e0));
  1302. if (this.alpha == 1) {
  1303. this.html.style.filter = "";
  1304. this.html.style.opacity = "";
  1305. } else {
  1306. this.html.style.filter = "alpha(opacity="
  1307. + Math.round(this.alpha * 100) + ")";
  1308. this.html.style.opacity = this.alpha;
  1309. }
  1310. };
  1311. draw2d.Figure.prototype.getAlpha = function() {
  1312. return this.alpha;
  1313. };
  1314. draw2d.Figure.prototype.setDimension = function(w, h) {
  1315. this.width = Math.max(this.getMinWidth(), w);
  1316. this.height = Math.max(this.getMinHeight(), h);
  1317. if (this.html === null) {
  1318. return;
  1319. }
  1320. this.html.style.width = this.width + "px";
  1321. this.html.style.height = this.height + "px";
  1322. this.fireMoveEvent();
  1323. if (this.workflow !== null && this.workflow.getCurrentSelection() == this) {
  1324. this.workflow.showResizeHandles(this);
  1325. }
  1326. };
  1327. draw2d.Figure.prototype.setPosition = function(xPos, yPos) {
  1328. this.x = xPos;
  1329. this.y = yPos;
  1330. if (this.html === null) {
  1331. return;
  1332. }
  1333. this.html.style.left = this.x + "px";
  1334. this.html.style.top = this.y + "px";
  1335. this.fireMoveEvent();
  1336. if (this.workflow !== null && this.workflow.getCurrentSelection() == this) {
  1337. this.workflow.showResizeHandles(this);
  1338. }
  1339. };
  1340. draw2d.Figure.prototype.isResizeable = function() {
  1341. return this.resizeable;
  1342. };
  1343. draw2d.Figure.prototype.setResizeable = function(flag) {
  1344. this.resizeable = flag;
  1345. };
  1346. draw2d.Figure.prototype.isSelectable = function() {
  1347. return this.selectable;
  1348. };
  1349. draw2d.Figure.prototype.setSelectable = function(flag) {
  1350. this.selectable = flag;
  1351. };
  1352. draw2d.Figure.prototype.isStrechable = function() {
  1353. return true;
  1354. };
  1355. draw2d.Figure.prototype.isDeleteable = function() {
  1356. return this.deleteable;
  1357. };
  1358. draw2d.Figure.prototype.setDeleteable = function(flag) {
  1359. this.deleteable = flag;
  1360. };
  1361. draw2d.Figure.prototype.setCanSnapToHelper = function(flag) {
  1362. this.canSnapToHelper = flag;
  1363. };
  1364. draw2d.Figure.prototype.getCanSnapToHelper = function() {
  1365. return this.canSnapToHelper;
  1366. };
  1367. draw2d.Figure.prototype.getSnapToGridAnchor = function() {
  1368. return this.snapToGridAnchor;
  1369. };
  1370. draw2d.Figure.prototype.setSnapToGridAnchor = function(point) {
  1371. this.snapToGridAnchor = point;
  1372. };
  1373. draw2d.Figure.prototype.getBounds = function() {
  1374. return new draw2d.Dimension(this.getX(), this.getY(), this.getWidth(), this
  1375. .getHeight());
  1376. };
  1377. draw2d.Figure.prototype.getWidth = function() {
  1378. return this.width;
  1379. };
  1380. draw2d.Figure.prototype.getHeight = function() {
  1381. return this.height;
  1382. };
  1383. draw2d.Figure.prototype.getY = function() {
  1384. return this.y;
  1385. };
  1386. draw2d.Figure.prototype.getX = function() {
  1387. return this.x;
  1388. };
  1389. draw2d.Figure.prototype.getAbsoluteY = function() {
  1390. return this.y;
  1391. };
  1392. draw2d.Figure.prototype.getAbsoluteX = function() {
  1393. return this.x;
  1394. };
  1395. draw2d.Figure.prototype.onKeyDown = function(_59ea, ctrl) {
  1396. if (_59ea == 46) {
  1397. this.workflow.getCommandStack().execute(
  1398. this.createCommand(new draw2d.EditPolicy(
  1399. draw2d.EditPolicy.DELETE)));
  1400. }
  1401. if (ctrl) {
  1402. this.workflow.onKeyDown(_59ea, ctrl);
  1403. }
  1404. };
  1405. draw2d.Figure.prototype.getPosition = function() {
  1406. return new draw2d.Point(this.x, this.y);
  1407. };
  1408. draw2d.Figure.prototype.isOver = function(iX, iY) {
  1409. var x = this.getAbsoluteX();
  1410. var y = this.getAbsoluteY();
  1411. var iX2 = x + this.width;
  1412. var iY2 = y + this.height;
  1413. return (iX >= x && iX <= iX2 && iY >= y && iY <= iY2);
  1414. };
  1415. draw2d.Figure.prototype.attachMoveListener = function(_59f2) {
  1416. if (_59f2 === null || this.moveListener === null) {
  1417. return;
  1418. }
  1419. this.moveListener.add(_59f2);
  1420. };
  1421. draw2d.Figure.prototype.detachMoveListener = function(_59f3) {
  1422. if (_59f3 === null || this.moveListener === null) {
  1423. return;
  1424. }
  1425. this.moveListener.remove(_59f3);
  1426. };
  1427. draw2d.Figure.prototype.fireMoveEvent = function() {
  1428. this.setDocumentDirty();
  1429. var size = this.moveListener.getSize();
  1430. for ( var i = 0; i < size; i++) {
  1431. this.moveListener.get(i).onOtherFigureMoved(this);
  1432. }
  1433. };
  1434. draw2d.Figure.prototype.setModel = function(model) {
  1435. if (this.model !== null) {
  1436. this.model.removePropertyChangeListener(this);
  1437. }
  1438. this.model = model;
  1439. if (this.model !== null) {
  1440. this.model.addPropertyChangeListener(this);
  1441. }
  1442. };
  1443. draw2d.Figure.prototype.getModel = function() {
  1444. return this.model;
  1445. };
  1446. draw2d.Figure.prototype.onOtherFigureMoved = function(_59f7) {
  1447. };
  1448. draw2d.Figure.prototype.setDocumentDirty = function() {
  1449. if (this.workflow !== null) {
  1450. this.workflow.setDocumentDirty();
  1451. }
  1452. };
  1453. draw2d.Figure.prototype.disableTextSelection = function(_59f8) {
  1454. _59f8.onselectstart = function() {
  1455. return false;
  1456. };
  1457. _59f8.unselectable = "on";
  1458. _59f8.style.MozUserSelect = "none";
  1459. _59f8.onmousedown = function() {
  1460. return false;
  1461. };
  1462. };
  1463. draw2d.Figure.prototype.createCommand = function(_59f9) {
  1464. if (_59f9.getPolicy() == draw2d.EditPolicy.MOVE) {
  1465. if (!this.canDrag) {
  1466. return null;
  1467. }
  1468. return new draw2d.CommandMove(this);
  1469. }
  1470. if (_59f9.getPolicy() == draw2d.EditPolicy.DELETE) {
  1471. if (!this.isDeleteable()) {
  1472. return null;
  1473. }
  1474. return new draw2d.CommandDelete(this);
  1475. }
  1476. if (_59f9.getPolicy() == draw2d.EditPolicy.RESIZE) {
  1477. if (!this.isResizeable()) {
  1478. return null;
  1479. }
  1480. return new draw2d.CommandResize(this);
  1481. }
  1482. return null;
  1483. };
  1484. draw2d.Node = function() {
  1485. this.bgColor = null;
  1486. this.lineColor = new draw2d.Color(128, 128, 255);
  1487. this.lineStroke = 1;
  1488. this.ports = new draw2d.ArrayList();
  1489. draw2d.Figure.call(this);
  1490. };
  1491. draw2d.Node.prototype = new draw2d.Figure();
  1492. draw2d.Node.prototype.type = "draw2d.Node";
  1493. draw2d.Node.prototype.dispose = function() {
  1494. for ( var i = 0; i < this.ports.getSize(); i++) {
  1495. this.ports.get(i).dispose();
  1496. }
  1497. this.ports = null;
  1498. draw2d.Figure.prototype.dispose.call(this);
  1499. };
  1500. draw2d.Node.prototype.createHTMLElement = function() {
  1501. var item = draw2d.Figure.prototype.createHTMLElement.call(this);
  1502. item.style.width = "auto";
  1503. item.style.height = "auto";
  1504. item.style.margin = "0px";
  1505. item.style.padding = "0px";
  1506. if (this.lineColor !== null) {
  1507. item.style.border = this.lineStroke + "px solid "
  1508. + this.lineColor.getHTMLStyle();
  1509. }
  1510. item.style.fontSize = "1px";
  1511. if (this.bgColor !== null) {
  1512. item.style.backgroundColor = this.bgColor.getHTMLStyle();
  1513. }
  1514. return item;
  1515. };
  1516. draw2d.Node.prototype.paint = function() {
  1517. draw2d.Figure.prototype.paint.call(this);
  1518. for ( var i = 0; i < this.ports.getSize(); i++) {
  1519. this.ports.get(i).paint();
  1520. }
  1521. };
  1522. draw2d.Node.prototype.getPorts = function() {
  1523. return this.ports;
  1524. };
  1525. draw2d.Node.prototype.getInputPorts = function() {
  1526. var _4ad8 = new draw2d.ArrayList();
  1527. for ( var i = 0; i < this.ports.getSize(); i++) {
  1528. var port = this.ports.get(i);
  1529. if (port instanceof draw2d.InputPort) {
  1530. _4ad8.add(port);
  1531. }
  1532. }
  1533. return _4ad8;
  1534. };
  1535. draw2d.Node.prototype.getOutputPorts = function() {
  1536. var _4adb = new draw2d.ArrayList();
  1537. for ( var i = 0; i < this.ports.getSize(); i++) {
  1538. var port = this.ports.get(i);
  1539. if (port instanceof draw2d.OutputPort) {
  1540. _4adb.add(port);
  1541. }
  1542. }
  1543. return _4adb;
  1544. };
  1545. draw2d.Node.prototype.getPort = function(_4ade) {
  1546. if (this.ports === null) {
  1547. return null;
  1548. }
  1549. for ( var i = 0; i < this.ports.getSize(); i++) {
  1550. var port = this.ports.get(i);
  1551. if (port.getName() == _4ade) {
  1552. return port;
  1553. }
  1554. }
  1555. };
  1556. draw2d.Node.prototype.getInputPort = function(_4ae1) {
  1557. if (this.ports === null) {
  1558. return null;
  1559. }
  1560. for ( var i = 0; i < this.ports.getSize(); i++) {
  1561. var port = this.ports.get(i);
  1562. if (port.getName() == _4ae1 && port instanceof draw2d.InputPort) {
  1563. return port;
  1564. }
  1565. }
  1566. };
  1567. draw2d.Node.prototype.getOutputPort = function(_4ae4) {
  1568. if (this.ports === null) {
  1569. return null;
  1570. }
  1571. for ( var i = 0; i < this.ports.getSize(); i++) {
  1572. var port = this.ports.get(i);
  1573. if (port.getName() == _4ae4 && port instanceof draw2d.OutputPort) {
  1574. return port;
  1575. }
  1576. }
  1577. };
  1578. draw2d.Node.prototype.addPort = function(port, x, y) {
  1579. this.ports.add(port);
  1580. port.setOrigin(x, y);
  1581. port.setPosition(x, y);
  1582. port.setParent(this);
  1583. port.setDeleteable(false);
  1584. this.html.appendChild(port.getHTMLElement());
  1585. if (this.workflow !== null) {
  1586. this.workflow.registerPort(port);
  1587. }
  1588. };
  1589. draw2d.Node.prototype.removePort = function(port) {
  1590. if (this.ports !== null) {
  1591. this.ports.remove(port);
  1592. }
  1593. try {
  1594. this.html.removeChild(port.getHTMLElement());
  1595. } catch (exc) {
  1596. }
  1597. if (this.workflow !== null) {
  1598. this.workflow.unregisterPort(port);
  1599. }
  1600. var _4aeb = port.getConnections();
  1601. for ( var i = 0; i < _4aeb.getSize(); ++i) {
  1602. this.workflow.removeFigure(_4aeb.get(i));
  1603. }
  1604. };
  1605. draw2d.Node.prototype.setWorkflow = function(_4aed) {
  1606. var _4aee = this.workflow;
  1607. draw2d.Figure.prototype.setWorkflow.call(this, _4aed);
  1608. if (_4aee !== null) {
  1609. for ( var i = 0; i < this.ports.getSize(); i++) {
  1610. _4aee.unregisterPort(this.ports.get(i));
  1611. }
  1612. }
  1613. if (this.workflow !== null) {
  1614. for ( var i = 0; i < this.ports.getSize(); i++) {
  1615. this.workflow.registerPort(this.ports.get(i));
  1616. }
  1617. }
  1618. };
  1619. draw2d.Node.prototype.setBackgroundColor = function(color) {
  1620. this.bgColor = color;
  1621. if (this.bgColor !== null) {
  1622. this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
  1623. } else {
  1624. this.html.style.backgroundColor = "transparent";
  1625. }
  1626. };
  1627. draw2d.Node.prototype.getBackgroundColor = function() {
  1628. return this.bgColor;
  1629. };
  1630. draw2d.Node.prototype.setColor = function(color) {
  1631. this.lineColor = color;
  1632. if (this.lineColor !== null) {
  1633. this.html.style.border = this.lineStroke + "px solid "
  1634. + this.lineColor.getHTMLStyle();
  1635. } else {
  1636. this.html.style.border = "0px";
  1637. }
  1638. };
  1639. draw2d.Node.prototype.setLineWidth = function(w) {
  1640. this.lineStroke = w;
  1641. if (this.lineColor !== null) {
  1642. this.html.style.border = this.lineStroke + "px solid "
  1643. + this.lineColor.getHTMLStyle();
  1644. } else {
  1645. this.html.style.border = "0px";
  1646. }
  1647. };
  1648. draw2d.Node.prototype.getModelSourceConnections = function() {
  1649. throw "You must override the method [Node.prototype.getModelSourceConnections]";
  1650. };
  1651. draw2d.Node.prototype.refreshConnections = function() {
  1652. if (this.workflow !== null) {
  1653. this.workflow.refreshConnections(this);
  1654. }
  1655. };
  1656. draw2d.VectorFigure = function() {
  1657. this.bgColor = null;
  1658. this.lineColor = new draw2d.Color(0, 0, 0);
  1659. this.stroke = 1;
  1660. this.graphics = null;
  1661. draw2d.Node.call(this);
  1662. };
  1663. draw2d.VectorFigure.prototype = new draw2d.Node;
  1664. draw2d.VectorFigure.prototype.type = "draw2d.VectorFigure";
  1665. draw2d.VectorFigure.prototype.dispose = function() {
  1666. draw2d.Node.prototype.dispose.call(this);
  1667. this.bgColor = null;
  1668. this.lineColor = null;
  1669. if (this.graphics !== null) {
  1670. this.graphics.clear();
  1671. }
  1672. this.graphics = null;
  1673. };
  1674. draw2d.VectorFigure.prototype.createHTMLElement = function() {
  1675. var item = draw2d.Node.prototype.createHTMLElement.call(this);
  1676. item.style.border = "0px";
  1677. item.style.backgroundColor = "transparent";
  1678. return item;
  1679. };
  1680. draw2d.VectorFigure.prototype.setWorkflow = function(_4b44) {
  1681. draw2d.Node.prototype.setWorkflow.call(this, _4b44);
  1682. if (this.workflow === null) {
  1683. this.graphics.clear();
  1684. this.graphics = null;
  1685. }
  1686. };
  1687. draw2d.VectorFigure.prototype.paint = function() {
  1688. if (this.html === null) {
  1689. return;
  1690. }
  1691. try {
  1692. if (this.graphics === null) {
  1693. this.graphics = new jsGraphics(this.html);
  1694. } else {
  1695. this.graphics.clear();
  1696. }
  1697. draw2d.Node.prototype.paint.call(this);
  1698. for ( var i = 0; i < this.ports.getSize(); i++) {
  1699. this.getHTMLElement().appendChild(
  1700. this.ports.get(i).getHTMLElement());
  1701. }
  1702. } catch (e) {
  1703. pushErrorStack(e, "draw2d.VectorFigure.prototype.paint=function()["
  1704. + area + "]");
  1705. }
  1706. };
  1707. draw2d.VectorFigure.prototype.setDimension = function(w, h) {
  1708. draw2d.Node.prototype.setDimension.call(this, w, h);
  1709. if (this.graphics !== null) {
  1710. this.paint();
  1711. }
  1712. };
  1713. draw2d.VectorFigure.prototype.setBackgroundColor = function(color) {
  1714. this.bgColor = color;
  1715. if (this.graphics !== null) {
  1716. this.paint();
  1717. }
  1718. };
  1719. draw2d.VectorFigure.prototype.getBackgroundColor = function() {
  1720. return this.bgColor;
  1721. };
  1722. draw2d.VectorFigure.prototype.setLineWidth = function(w) {
  1723. this.stroke = w;
  1724. if (this.graphics !== null) {
  1725. this.paint();
  1726. }
  1727. };
  1728. draw2d.VectorFigure.prototype.setColor = function(color) {
  1729. this.lineColor = color;
  1730. if (this.graphics !== null) {
  1731. this.paint();
  1732. }
  1733. };
  1734. draw2d.VectorFigure.prototype.getColor = function() {
  1735. return this.lineColor;
  1736. };
  1737. draw2d.SVGFigure = function(width, _5070) {
  1738. this.bgColor = null;
  1739. this.lineColor = new draw2d.Color(0, 0, 0);
  1740. this.stroke = 1;
  1741. this.context = null;
  1742. draw2d.Node.call(this);
  1743. if (width && _5070) {
  1744. this.setDimension(width, _5070);
  1745. }
  1746. };
  1747. draw2d.SVGFigure.prototype = new draw2d.Node();
  1748. draw2d.SVGFigure.prototype.type = "draw2d.SVGFigure";
  1749. draw2d.SVGFigure.prototype.createHTMLElement = function() {
  1750. var item = new MooCanvas(this.id, {
  1751. width : 100,
  1752. height : 100
  1753. });
  1754. item.style.position = "absolute";
  1755. item.style.left = this.x + "px";
  1756. item.style.top = this.y + "px";
  1757. item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
  1758. this.context = item.getContext("2d");
  1759. return item;
  1760. };
  1761. draw2d.SVGFigure.prototype.paint = function() {
  1762. this.context.clearRect(0, 0, this.getWidth(), this.getHeight());
  1763. this.context.fillStyle = "rgba(200,0,0,0.3)";
  1764. this.context.fillRect(0, 0, this.getWidth(), this.getHeight());
  1765. };
  1766. draw2d.SVGFigure.prototype.setDimension = function(w, h) {
  1767. draw2d.Node.prototype.setDimension.call(this, w, h);
  1768. this.html.width = w;
  1769. this.html.height = h;
  1770. this.html.style.width = w + "px";
  1771. this.html.style.height = h + "px";
  1772. if (this.context !== null) {
  1773. if (this.context.element) {
  1774. this.context.element.style.width = w + "px";
  1775. this.context.element.style.height = h + "px";
  1776. }
  1777. this.paint();
  1778. }
  1779. };
  1780. draw2d.SVGFigure.prototype.setBackgroundColor = function(color) {
  1781. this.bgColor = color;
  1782. if (this.graphics !== null) {
  1783. this.paint();
  1784. }
  1785. };
  1786. draw2d.SVGFigure.prototype.getBackgroundColor = function() {
  1787. return this.bgColor;
  1788. };
  1789. draw2d.SVGFigure.prototype.setLineWidth = function(w) {
  1790. this.stroke = w;
  1791. if (this.context !== null) {
  1792. this.paint();
  1793. }
  1794. };
  1795. draw2d.SVGFigure.prototype.setColor = function(color) {
  1796. this.lineColor = color;
  1797. if (this.context !== null) {
  1798. this.paint();
  1799. }
  1800. };
  1801. draw2d.SVGFigure.prototype.getColor = function() {
  1802. return this.lineColor;
  1803. };
  1804. draw2d.Label = function(msg) {
  1805. this.msg = msg;
  1806. this.bgColor = null;
  1807. this.color = new draw2d.Color(0, 0, 0);
  1808. this.fontSize = 10;
  1809. this.textNode = null;
  1810. this.align = "center";
  1811. draw2d.Figure.call(this);
  1812. };
  1813. draw2d.Label.prototype = new draw2d.Figure();
  1814. draw2d.Label.prototype.type = "draw2d.Label";
  1815. draw2d.Label.prototype.createHTMLElement = function() {
  1816. var item = draw2d.Figure.prototype.createHTMLElement.call(this);
  1817. this.textNode = document.createTextNode(this.msg);
  1818. item.appendChild(this.textNode);
  1819. item.style.color = this.color.getHTMLStyle();
  1820. item.style.fontSize = this.fontSize + "pt";
  1821. item.style.width = "auto";
  1822. item.style.height = "auto";
  1823. item.style.paddingLeft = "3px";
  1824. item.style.paddingRight = "3px";
  1825. item.style.textAlign = this.align;
  1826. item.style.MozUserSelect = "none";
  1827. this.disableTextSelection(item);
  1828. if (this.bgColor !== null) {
  1829. item.style.backgroundColor = this.bgColor.getHTMLStyle();
  1830. }
  1831. return item;
  1832. };
  1833. draw2d.Label.prototype.isResizeable = function() {
  1834. return false;
  1835. };
  1836. draw2d.Label.prototype.setWordwrap = function(flag) {
  1837. this.html.style.whiteSpace = flag ? "wrap" : "nowrap";
  1838. };
  1839. draw2d.Label.prototype.setAlign = function(align) {
  1840. this.align = align;
  1841. this.html.style.textAlign = align;
  1842. };
  1843. draw2d.Label.prototype.setBackgroundColor = function(color) {
  1844. this.bgColor = color;
  1845. if (this.bgColor !== null) {
  1846. this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
  1847. } else {
  1848. this.html.style.backgroundColor = "transparent";
  1849. }
  1850. };
  1851. draw2d.Label.prototype.setColor = function(color) {
  1852. this.color = color;
  1853. this.html.style.color = this.color.getHTMLStyle();
  1854. };
  1855. draw2d.Label.prototype.setFontSize = function(size) {
  1856. this.fontSize = size;
  1857. this.html.style.fontSize = this.fontSize + "pt";
  1858. };
  1859. draw2d.Label.prototype.setDimension = function(w, h) {
  1860. };
  1861. draw2d.Label.prototype.getWidth = function() {
  1862. if (window.getComputedStyle) {
  1863. return parseInt(getComputedStyle(this.html, "").getPropertyValue(
  1864. "width"));
  1865. }
  1866. return parseInt(this.html.clientWidth);
  1867. };
  1868. draw2d.Label.prototype.getHeight = function() {
  1869. if (window.getComputedStyle) {
  1870. return parseInt(getComputedStyle(this.html, "").getPropertyValue(
  1871. "height"));
  1872. }
  1873. return parseInt(this.html.clientHeight);
  1874. };
  1875. draw2d.Label.prototype.getText = function() {
  1876. return this.msg;
  1877. };
  1878. draw2d.Label.prototype.setText = function(text) {
  1879. this.msg = text;
  1880. this.html.removeChild(this.textNode);
  1881. this.textNode = document.createTextNode(this.msg);
  1882. this.html.appendChild(this.textNode);
  1883. };
  1884. draw2d.Label.prototype.setStyledText = function(text) {
  1885. this.msg = text;
  1886. this.html.removeChild(this.textNode);
  1887. this.textNode = document.createElement("div");
  1888. this.textNode.style.whiteSpace = "nowrap";
  1889. this.textNode.innerHTML = text;
  1890. this.html.appendChild(this.textNode);
  1891. };
  1892. draw2d.Oval = function() {
  1893. draw2d.VectorFigure.call(this);
  1894. };
  1895. draw2d.Oval.prototype = new draw2d.VectorFigure();
  1896. draw2d.Oval.prototype.type = "draw2d.Oval";
  1897. draw2d.Oval.prototype.paint = function() {
  1898. if (this.html === null) {
  1899. return;
  1900. }
  1901. try {
  1902. draw2d.VectorFigure.prototype.paint.call(this);
  1903. this.graphics.setStroke(this.stroke);
  1904. if (this.bgColor !== null) {
  1905. this.graphics.setColor(this.bgColor.getHTMLStyle());
  1906. this.graphics.fillOval(0, 0, this.getWidth() - 1,
  1907. this.getHeight() - 1);
  1908. }
  1909. if (this.lineColor !== null) {
  1910. this.graphics.setColor(this.lineColor.getHTMLStyle());
  1911. this.graphics.drawOval(0, 0, this.getWidth() - 1,
  1912. this.getHeight() - 1);
  1913. }
  1914. this.graphics.paint();
  1915. } catch (e) {
  1916. pushErrorStack(e, "draw2d.Oval.prototype.paint=function()");
  1917. }
  1918. };
  1919. draw2d.Circle = function(_5044) {
  1920. draw2d.Oval.call(this);
  1921. if (_5044) {
  1922. this.setDimension(_5044, _5044);
  1923. }
  1924. };
  1925. draw2d.Circle.prototype = new draw2d.Oval();
  1926. draw2d.Circle.prototype.type = "draw2d.Circle";
  1927. draw2d.Circle.prototype.setDimension = function(w, h) {
  1928. if (w > h) {
  1929. draw2d.Oval.prototype.setDimension.call(this, w, w);
  1930. } else {
  1931. draw2d.Oval.prototype.setDimension.call(this, h, h);
  1932. }
  1933. };
  1934. draw2d.Circle.prototype.isStrechable = function() {
  1935. return false;
  1936. };
  1937. draw2d.Rectangle = function(width, _5698) {
  1938. this.bgColor = null;
  1939. this.lineColor = new draw2d.Color(0, 0, 0);
  1940. this.lineStroke = 1;
  1941. draw2d.Figure.call(this);
  1942. if (width && _5698) {
  1943. this.setDimension(width, _5698);
  1944. }
  1945. };
  1946. draw2d.Rectangle.prototype = new draw2d.Figure();
  1947. draw2d.Rectangle.prototype.type = "draw2d.Rectangle";
  1948. draw2d.Rectangle.prototype.dispose = function() {
  1949. draw2d.Figure.prototype.dispose.call(this);
  1950. this.bgColor = null;
  1951. this.lineColor = null;
  1952. };
  1953. draw2d.Rectangle.prototype.createHTMLElement = function() {
  1954. var item = draw2d.Figure.prototype.createHTMLElement.call(this);
  1955. item.style.width = "auto";
  1956. item.style.height = "auto";
  1957. item.style.margin = "0px";
  1958. item.style.padding = "0px";
  1959. item.style.border = this.lineStroke + "px solid "
  1960. + this.lineColor.getHTMLStyle();
  1961. item.style.fontSize = "1px";
  1962. item.style.lineHeight = "1px";
  1963. item.innerHTML = "&nbsp";
  1964. if (this.bgColor !== null) {
  1965. item.style.backgroundColor = this.bgColor.getHTMLStyle();
  1966. }
  1967. return item;
  1968. };
  1969. draw2d.Rectangle.prototype.setBackgroundColor = function(color) {
  1970. this.bgColor = color;
  1971. if (this.bgColor !== null) {
  1972. this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
  1973. } else {
  1974. this.html.style.backgroundColor = "transparent";
  1975. }
  1976. };
  1977. draw2d.Rectangle.prototype.getBackgroundColor = function() {
  1978. return this.bgColor;
  1979. };
  1980. draw2d.Rectangle.prototype.setColor = function(color) {
  1981. this.lineColor = color;
  1982. if (this.lineColor !== null) {
  1983. this.html.style.border = this.lineStroke + "px solid "
  1984. + this.lineColor.getHTMLStyle();
  1985. } else {
  1986. this.html.style.border = this.lineStroke + "0px";
  1987. }
  1988. };
  1989. draw2d.Rectangle.prototype.getColor = function() {
  1990. return this.lineColor;
  1991. };
  1992. draw2d.Rectangle.prototype.getWidth = function() {
  1993. return draw2d.Figure.prototype.getWidth.call(this) + 2 * this.lineStroke;
  1994. };
  1995. draw2d.Rectangle.prototype.getHeight = function() {
  1996. return draw2d.Figure.prototype.getHeight.call(this) + 2 * this.lineStroke;
  1997. };
  1998. draw2d.Rectangle.prototype.setDimension = function(w, h) {
  1999. draw2d.Figure.prototype.setDimension.call(this, w - 2 * this.lineStroke, h
  2000. - 2 * this.lineStroke);
  2001. };
  2002. draw2d.Rectangle.prototype.setLineWidth = function(w) {
  2003. var diff = w - this.lineStroke;
  2004. this.setDimension(this.getWidth() - 2 * diff, this.getHeight() - 2 * diff);
  2005. this.lineStroke = w;
  2006. var c = "transparent";
  2007. if (this.lineColor !== null) {
  2008. c = this.lineColor.getHTMLStyle();
  2009. }
  2010. this.html.style.border = this.lineStroke + "px solid " + c;
  2011. };
  2012. draw2d.Rectangle.prototype.getLineWidth = function() {
  2013. return this.lineStroke;
  2014. };
  2015. draw2d.ImageFigure = function(url) {
  2016. if (url === undefined) {
  2017. url = null;
  2018. }
  2019. this.url = url;
  2020. draw2d.Node.call(this);
  2021. this.setDimension(40, 40);
  2022. };
  2023. draw2d.ImageFigure.prototype = new draw2d.Node;
  2024. draw2d.ImageFigure.prototype.type = "draw2d.Image";
  2025. draw2d.ImageFigure.prototype.createHTMLElement = function() {
  2026. var item = draw2d.Node.prototype.createHTMLElement.call(this);
  2027. item.style.width = this.width + "px";
  2028. item.style.height = this.height + "px";
  2029. item.style.margin = "0px";
  2030. item.style.padding = "0px";
  2031. item.style.border = "0px";
  2032. if (this.url !== null) {
  2033. item.style.backgroundImage = "url(" + this.url + ")";
  2034. } else {
  2035. item.style.backgroundImage = "";
  2036. }
  2037. return item;
  2038. };
  2039. draw2d.ImageFigure.prototype.setColor = function(color) {
  2040. };
  2041. draw2d.ImageFigure.prototype.isResizeable = function() {
  2042. return false;
  2043. };
  2044. draw2d.ImageFigure.prototype.setImage = function(url) {
  2045. if (url === undefined) {
  2046. url = null;
  2047. }
  2048. this.url = url;
  2049. if (this.url !== null) {
  2050. this.html.style.backgroundImage = "url(" + this.url + ")";
  2051. } else {
  2052. this.html.style.backgroundImage = "";
  2053. }
  2054. };
  2055. draw2d.Port = function(_5730, _5731) {
  2056. Corona = function() {
  2057. };
  2058. Corona.prototype = new draw2d.Circle();
  2059. Corona.prototype.setAlpha = function(_5732) {
  2060. draw2d.Circle.prototype.setAlpha.call(this, Math.min(0.3, _5732));
  2061. this.setDeleteable(false);
  2062. this.setCanDrag(false);
  2063. this.setResizeable(false);
  2064. this.setSelectable(false);
  2065. };
  2066. if (_5730 === null || _5730 === undefined) {
  2067. this.currentUIRepresentation = new draw2d.Circle();
  2068. } else {
  2069. this.currentUIRepresentation = _5730;
  2070. }
  2071. if (_5731 === null || _5731 === undefined) {
  2072. this.connectedUIRepresentation = new draw2d.Circle();
  2073. this.connectedUIRepresentation.setColor(null);
  2074. } else {
  2075. this.connectedUIRepresentation = _5731;
  2076. }
  2077. this.disconnectedUIRepresentation = this.currentUIRepresentation;
  2078. this.hideIfConnected = false;
  2079. this.uiRepresentationAdded = true;
  2080. this.parentNode = null;
  2081. this.originX = 0;
  2082. this.originY = 0;
  2083. this.coronaWidth = 10;
  2084. this.corona = null;
  2085. draw2d.Rectangle.call(this);
  2086. this.setDimension(8, 8);
  2087. this.setBackgroundColor(new draw2d.Color(100, 180, 100));
  2088. this.setColor(new draw2d.Color(90, 150, 90));
  2089. draw2d.Rectangle.prototype.setColor.call(this, null);
  2090. this.dropable = new draw2d.DropTarget(this.html);
  2091. this.dropable.node = this;
  2092. this.dropable.addEventListener("dragenter", function(_5733) {
  2093. _5733.target.node.onDragEnter(_5733.relatedTarget.node);
  2094. });
  2095. this.dropable.addEventListener("dragleave", function(_5734) {
  2096. _5734.target.node.onDragLeave(_5734.relatedTarget.node);
  2097. });
  2098. this.dropable.addEventListener("drop", function(_5735) {
  2099. _5735.relatedTarget.node.onDrop(_5735.target.node);
  2100. });
  2101. };
  2102. draw2d.Port.prototype = new draw2d.Rectangle();
  2103. draw2d.Port.prototype.type = "draw2d.Port";
  2104. draw2d.Port.ZOrderBaseIndex = 5000;
  2105. draw2d.Port.setZOrderBaseIndex = function(index) {
  2106. draw2d.Port.ZOrderBaseIndex = index;
  2107. };
  2108. draw2d.Port.prototype.setHideIfConnected = function(flag) {
  2109. this.hideIfConnected = flag;
  2110. };
  2111. draw2d.Port.prototype.dispose = function() {
  2112. var size = this.moveListener.getSize();
  2113. for ( var i = 0; i < size; i++) {
  2114. var _573a = this.moveListener.get(i);
  2115. this.parentNode.workflow.removeFigure(_573a);
  2116. _573a.dispose();
  2117. }
  2118. draw2d.Rectangle.prototype.dispose.call(this);
  2119. this.parentNode = null;
  2120. this.dropable.node = null;
  2121. this.dropable = null;
  2122. this.disconnectedUIRepresentation.dispose();
  2123. this.connectedUIRepresentation.dispose();
  2124. };
  2125. draw2d.Port.prototype.createHTMLElement = function() {
  2126. var item = draw2d.Rectangle.prototype.createHTMLElement.call(this);
  2127. item.style.zIndex = draw2d.Port.ZOrderBaseIndex;
  2128. this.currentUIRepresentation.html.zIndex = draw2d.Port.ZOrderBaseIndex;
  2129. item.appendChild(this.currentUIRepresentation.html);
  2130. this.uiRepresentationAdded = true;
  2131. return item;
  2132. };
  2133. draw2d.Port.prototype.setUiRepresentation = function(_573c) {
  2134. if (_573c === null) {
  2135. _573c = new draw2d.Figure();
  2136. }
  2137. if (this.uiRepresentationAdded) {
  2138. this.html.removeChild(this.currentUIRepresentation.getHTMLElement());
  2139. }
  2140. this.html.appendChild(_573c.getHTMLElement());
  2141. _573c.paint();
  2142. this.currentUIRepresentation = _573c;
  2143. };
  2144. draw2d.Port.prototype.onMouseEnter = function() {
  2145. this.setLineWidth(2);
  2146. };
  2147. draw2d.Port.prototype.onMouseLeave = function() {
  2148. this.setLineWidth(0);
  2149. };
  2150. draw2d.Port.prototype.setDimension = function(width, _573e) {
  2151. draw2d.Rectangle.prototype.setDimension.call(this, width, _573e);
  2152. this.connectedUIRepresentation.setDimension(width, _573e);
  2153. this.disconnectedUIRepresentation.setDimension(width, _573e);
  2154. this.setPosition(this.x, this.y);
  2155. };
  2156. draw2d.Port.prototype.setBackgroundColor = function(color) {
  2157. this.currentUIRepresentation.setBackgroundColor(color);
  2158. };
  2159. draw2d.Port.prototype.getBackgroundColor = function() {
  2160. return this.currentUIRepresentation.getBackgroundColor();
  2161. };
  2162. draw2d.Port.prototype.getConnections = function() {
  2163. var _5740 = new draw2d.ArrayList();
  2164. var size = this.moveListener.getSize();
  2165. for ( var i = 0; i < size; i++) {
  2166. var _5743 = this.moveListener.get(i);
  2167. if (_5743 instanceof draw2d.Connection) {
  2168. _5740.add(_5743);
  2169. }
  2170. }
  2171. return _5740;
  2172. };
  2173. draw2d.Port.prototype.setColor = function(color) {
  2174. this.currentUIRepresentation.setColor(color);
  2175. };
  2176. draw2d.Port.prototype.getColor = function() {
  2177. return this.currentUIRepresentation.getColor();
  2178. };
  2179. draw2d.Port.prototype.setLineWidth = function(width) {
  2180. this.currentUIRepresentation.setLineWidth(width);
  2181. };
  2182. draw2d.Port.prototype.getLineWidth = function() {
  2183. return this.currentUIRepresentation.getLineWidth();
  2184. };
  2185. draw2d.Port.prototype.paint = function() {
  2186. try {
  2187. this.currentUIRepresentation.paint();
  2188. } catch (e) {
  2189. pushErrorStack(e, "draw2d.Port.prototype.paint=function()");
  2190. }
  2191. };
  2192. draw2d.Port.prototype.setPosition = function(xPos, yPos) {
  2193. this.originX = xPos;
  2194. this.originY = yPos;
  2195. draw2d.Rectangle.prototype.setPosition.call(this, xPos, yPos);
  2196. if (this.html === null) {
  2197. return;
  2198. }
  2199. this.html.style.left = (this.x - this.getWidth() / 2) + "px";
  2200. this.html.style.top = (this.y - this.getHeight() / 2) + "px";
  2201. };
  2202. draw2d.Port.prototype.setParent = function(_5748) {
  2203. if (this.parentNode !== null) {
  2204. this.parentNode.detachMoveListener(this);
  2205. }
  2206. this.parentNode = _5748;
  2207. if (this.parentNode !== null) {
  2208. this.parentNode.attachMoveListener(this);
  2209. }
  2210. };
  2211. draw2d.Port.prototype.attachMoveListener = function(_5749) {
  2212. draw2d.Rectangle.prototype.attachMoveListener.call(this, _5749);
  2213. if (this.hideIfConnected == true) {
  2214. this.setUiRepresentation(this.connectedUIRepresentation);
  2215. }
  2216. };
  2217. draw2d.Port.prototype.detachMoveListener = function(_574a) {
  2218. draw2d.Rectangle.prototype.detachMoveListener.call(this, _574a);
  2219. if (this.getConnections().getSize() == 0) {
  2220. this.setUiRepresentation(this.disconnectedUIRepresentation);
  2221. }
  2222. };
  2223. draw2d.Port.prototype.getParent = function() {
  2224. return this.parentNode;
  2225. };
  2226. draw2d.Port.prototype.onDrag = function() {
  2227. draw2d.Rectangle.prototype.onDrag.call(this);
  2228. this.parentNode.workflow.showConnectionLine(this.parentNode.x + this.x,
  2229. this.parentNode.y + this.y, this.parentNode.x + this.originX,
  2230. this.parentNode.y + this.originY);
  2231. };
  2232. draw2d.Port.prototype.getCoronaWidth = function() {
  2233. return this.coronaWidth;
  2234. };
  2235. draw2d.Port.prototype.setCoronaWidth = function(width) {
  2236. this.coronaWidth = width;
  2237. };
  2238. draw2d.Port.prototype.setOrigin = function(x, y) {
  2239. this.originX = x;
  2240. this.originY = y;
  2241. };
  2242. draw2d.Port.prototype.onDragend = function() {
  2243. this.setAlpha(1);
  2244. this.setPosition(this.originX, this.originY);
  2245. this.parentNode.workflow.hideConnectionLine();
  2246. document.body.focus();
  2247. };
  2248. draw2d.Port.prototype.onDragEnter = function(port) {
  2249. var _574f = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
  2250. _574f.canvas = this.parentNode.workflow;
  2251. _574f.source = port;
  2252. _574f.target = this;
  2253. var _5750 = this.createCommand(_574f);
  2254. if (_5750 === null) {
  2255. return;
  2256. }
  2257. this.parentNode.workflow.connectionLine
  2258. .setColor(new draw2d.Color(0, 150, 0));
  2259. this.parentNode.workflow.connectionLine.setLineWidth(3);
  2260. this.showCorona(true);
  2261. };
  2262. draw2d.Port.prototype.onDragLeave = function(port) {
  2263. this.parentNode.workflow.connectionLine.setColor(new draw2d.Color(0, 0, 0));
  2264. this.parentNode.workflow.connectionLine.setLineWidth(1);
  2265. this.showCorona(false);
  2266. };
  2267. draw2d.Port.prototype.onDrop = function(port) {
  2268. var _5753 = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
  2269. _5753.canvas = this.parentNode.workflow;
  2270. _5753.source = port;
  2271. _5753.target = this;
  2272. var _5754 = this.createCommand(_5753);
  2273. if (_5754 !== null) {
  2274. this.parentNode.workflow.getCommandStack().execute(_5754);
  2275. }
  2276. };
  2277. draw2d.Port.prototype.getAbsolutePosition = function() {
  2278. return new draw2d.Point(this.getAbsoluteX(), this.getAbsoluteY());
  2279. };
  2280. draw2d.Port.prototype.getAbsoluteBounds = function() {
  2281. return new draw2d.Dimension(this.getAbsoluteX(), this.getAbsoluteY(), this
  2282. .getWidth(), this.getHeight());
  2283. };
  2284. draw2d.Port.prototype.getAbsoluteY = function() {
  2285. return this.originY + this.parentNode.getY();
  2286. };
  2287. draw2d.Port.prototype.getAbsoluteX = function() {
  2288. return this.originX + this.parentNode.getX();
  2289. };
  2290. draw2d.Port.prototype.onOtherFigureMoved = function(_5755) {
  2291. this.fireMoveEvent();
  2292. };
  2293. draw2d.Port.prototype.getName = function() {
  2294. return this.name;
  2295. };
  2296. draw2d.Port.prototype.setName = function(name) {
  2297. this.name = name;
  2298. };
  2299. draw2d.Port.prototype.isOver = function(iX, iY) {
  2300. var x = this.getAbsoluteX() - this.coronaWidth - this.getWidth() / 2;
  2301. var y = this.getAbsoluteY() - this.coronaWidth - this.getHeight() / 2;
  2302. var iX2 = x + this.width + (this.coronaWidth * 2) + this.getWidth() / 2;
  2303. var iY2 = y + this.height + (this.coronaWidth * 2) + this.getHeight() / 2;
  2304. return (iX >= x && iX <= iX2 && iY >= y && iY <= iY2);
  2305. };
  2306. draw2d.Port.prototype.showCorona = function(flag, _575e) {
  2307. if (flag === true) {
  2308. this.corona = new Corona();
  2309. this.corona.setAlpha(0.3);
  2310. this.corona.setBackgroundColor(new draw2d.Color(0, 125, 125));
  2311. this.corona.setColor(null);
  2312. this.corona.setDimension(this.getWidth() + (this.getCoronaWidth() * 2),
  2313. this.getWidth() + (this.getCoronaWidth() * 2));
  2314. this.parentNode.getWorkflow().addFigure(
  2315. this.corona,
  2316. this.getAbsoluteX() - this.getCoronaWidth() - this.getWidth()
  2317. / 2,
  2318. this.getAbsoluteY() - this.getCoronaWidth() - this.getHeight()
  2319. / 2);
  2320. } else {
  2321. if (flag === false && this.corona !== null) {
  2322. this.parentNode.getWorkflow().removeFigure(this.corona);
  2323. this.corona = null;
  2324. }
  2325. }
  2326. };
  2327. draw2d.Port.prototype.createCommand = function(_575f) {
  2328. if (_575f.getPolicy() === draw2d.EditPolicy.MOVE) {
  2329. if (!this.canDrag) {
  2330. return null;
  2331. }
  2332. return new draw2d.CommandMovePort(this);
  2333. }
  2334. if (_575f.getPolicy() === draw2d.EditPolicy.CONNECT) {
  2335. if (_575f.source.parentNode.id === _575f.target.parentNode.id) {
  2336. return null;
  2337. } else {
  2338. return new draw2d.CommandConnect(_575f.canvas, _575f.source,
  2339. _575f.target);
  2340. }
  2341. }
  2342. return null;
  2343. };
  2344. draw2d.InputPort = function(_590b) {
  2345. draw2d.Port.call(this, _590b);
  2346. };
  2347. draw2d.InputPort.prototype = new draw2d.Port();
  2348. draw2d.InputPort.prototype.type = "draw2d.InputPort";
  2349. draw2d.InputPort.prototype.onDragstart = function(x, y) {
  2350. if (!this.canDrag) {
  2351. return false;
  2352. }
  2353. return true;
  2354. };
  2355. draw2d.InputPort.prototype.onDragEnter = function(port) {
  2356. if (port instanceof draw2d.OutputPort) {
  2357. draw2d.Port.prototype.onDragEnter.call(this, port);
  2358. } else {
  2359. if (port instanceof draw2d.LineStartResizeHandle) {
  2360. var line = this.workflow.currentSelection;
  2361. if (line instanceof draw2d.Connection
  2362. && line.getSource() instanceof draw2d.InputPort) {
  2363. draw2d.Port.prototype.onDragEnter.call(this, line.getTarget());
  2364. }
  2365. } else {
  2366. if (port instanceof draw2d.LineEndResizeHandle) {
  2367. var line = this.workflow.currentSelection;
  2368. if (line instanceof draw2d.Connection
  2369. && line.getTarget() instanceof draw2d.InputPort) {
  2370. draw2d.Port.prototype.onDragEnter.call(this, line
  2371. .getSource());
  2372. }
  2373. }
  2374. }
  2375. }
  2376. };
  2377. draw2d.InputPort.prototype.onDragLeave = function(port) {
  2378. if (port instanceof draw2d.OutputPort) {
  2379. draw2d.Port.prototype.onDragLeave.call(this, port);
  2380. } else {
  2381. if (port instanceof draw2d.LineStartResizeHandle) {
  2382. var line = this.workflow.currentSelection;
  2383. if (line instanceof draw2d.Connection
  2384. && line.getSource() instanceof draw2d.InputPort) {
  2385. draw2d.Port.prototype.onDragLeave.call(this, line.getTarget());
  2386. }
  2387. } else {
  2388. if (port instanceof draw2d.LineEndResizeHandle) {
  2389. var line = this.workflow.currentSelection;
  2390. if (line instanceof draw2d.Connection
  2391. && line.getTarget() instanceof draw2d.InputPort) {
  2392. draw2d.Port.prototype.onDragLeave.call(this, line
  2393. .getSource());
  2394. }
  2395. }
  2396. }
  2397. }
  2398. };
  2399. draw2d.InputPort.prototype.createCommand = function(_5912) {
  2400. if (_5912.getPolicy() == draw2d.EditPolicy.CONNECT) {
  2401. if (_5912.source.parentNode.id == _5912.target.parentNode.id) {
  2402. return null;
  2403. }
  2404. if (_5912.source instanceof draw2d.OutputPort) {
  2405. return new draw2d.CommandConnect(_5912.canvas, _5912.source,
  2406. _5912.target);
  2407. }
  2408. return null;
  2409. }
  2410. return draw2d.Port.prototype.createCommand.call(this, _5912);
  2411. };
  2412. draw2d.OutputPort = function(_5ca2) {
  2413. draw2d.Port.call(this, _5ca2);
  2414. this.maxFanOut = 100;
  2415. };
  2416. draw2d.OutputPort.prototype = new draw2d.Port();
  2417. draw2d.OutputPort.prototype.type = "draw2d.OutputPort";
  2418. draw2d.OutputPort.prototype.onDragEnter = function(port) {
  2419. if (this.getMaxFanOut() <= this.getFanOut()) {
  2420. return;
  2421. }
  2422. if (port instanceof draw2d.InputPort) {
  2423. draw2d.Port.prototype.onDragEnter.call(this, port);
  2424. } else {
  2425. if (port instanceof draw2d.LineStartResizeHandle) {
  2426. var line = this.workflow.currentSelection;
  2427. if (line instanceof draw2d.Connection
  2428. && line.getSource() instanceof draw2d.OutputPort) {
  2429. draw2d.Port.prototype.onDragEnter.call(this, line.getTarget());
  2430. }
  2431. } else {
  2432. if (port instanceof draw2d.LineEndResizeHandle) {
  2433. var line = this.workflow.currentSelection;
  2434. if (line instanceof draw2d.Connection
  2435. && line.getTarget() instanceof draw2d.OutputPort) {
  2436. draw2d.Port.prototype.onDragEnter.call(this, line
  2437. .getSource());
  2438. }
  2439. }
  2440. }
  2441. }
  2442. };
  2443. draw2d.OutputPort.prototype.onDragLeave = function(port) {
  2444. if (port instanceof draw2d.InputPort) {
  2445. draw2d.Port.prototype.onDragLeave.call(this, port);
  2446. } else {
  2447. if (port instanceof draw2d.LineStartResizeHandle) {
  2448. var line = this.workflow.currentSelection;
  2449. if (line instanceof draw2d.Connection
  2450. && line.getSource() instanceof draw2d.OutputPort) {
  2451. draw2d.Port.prototype.onDragLeave.call(this, line.getTarget());
  2452. }
  2453. } else {
  2454. if (port instanceof draw2d.LineEndResizeHandle) {
  2455. var line = this.workflow.currentSelection;
  2456. if (line instanceof draw2d.Connection
  2457. && line.getTarget() instanceof draw2d.OutputPort) {
  2458. draw2d.Port.prototype.onDragLeave.call(this, line
  2459. .getSource());
  2460. }
  2461. }
  2462. }
  2463. }
  2464. };
  2465. draw2d.OutputPort.prototype.onDragstart = function(x, y) {
  2466. if (!this.canDrag) {
  2467. return false;
  2468. }
  2469. if (this.maxFanOut === -1) {
  2470. return true;
  2471. }
  2472. if (this.getMaxFanOut() <= this.getFanOut()) {
  2473. return false;
  2474. }
  2475. return true;
  2476. };
  2477. draw2d.OutputPort.prototype.setMaxFanOut = function(count) {
  2478. this.maxFanOut = count;
  2479. };
  2480. draw2d.OutputPort.prototype.getMaxFanOut = function() {
  2481. return this.maxFanOut;
  2482. };
  2483. draw2d.OutputPort.prototype.getFanOut = function() {
  2484. if (this.getParent().workflow === null) {
  2485. return 0;
  2486. }
  2487. var count = 0;
  2488. var lines = this.getParent().workflow.getLines();
  2489. var size = lines.getSize();
  2490. for ( var i = 0; i < size; i++) {
  2491. var line = lines.get(i);
  2492. if (line instanceof draw2d.Connection) {
  2493. if (line.getSource() == this) {
  2494. count++;
  2495. } else {
  2496. if (line.getTarget() == this) {
  2497. count++;
  2498. }
  2499. }
  2500. }
  2501. }
  2502. return count;
  2503. };
  2504. draw2d.OutputPort.prototype.createCommand = function(_5caf) {
  2505. if (_5caf.getPolicy() === draw2d.EditPolicy.CONNECT) {
  2506. if (_5caf.source.parentNode.id === _5caf.target.parentNode.id) {
  2507. return null;
  2508. }
  2509. if (_5caf.source instanceof draw2d.InputPort) {
  2510. return new draw2d.CommandConnect(_5caf.canvas, _5caf.target,
  2511. _5caf.source);
  2512. }
  2513. return null;
  2514. }
  2515. return draw2d.Port.prototype.createCommand.call(this, _5caf);
  2516. };
  2517. draw2d.Line = function() {
  2518. this.lineColor = new draw2d.Color(0, 0, 0);
  2519. this.stroke = 1;
  2520. this.canvas = null;
  2521. this.parent = null;
  2522. this.workflow = null;
  2523. this.html = null;
  2524. this.graphics = null;
  2525. this.id = draw2d.UUID.create();
  2526. this.startX = 30;
  2527. this.startY = 30;
  2528. this.endX = 100;
  2529. this.endY = 100;
  2530. this.alpha = 1;
  2531. this.isMoving = false;
  2532. this.model = null;
  2533. this.zOrder = draw2d.Line.ZOrderBaseIndex;
  2534. this.corona = draw2d.Line.CoronaWidth;
  2535. this.properties = {};
  2536. this.moveListener = new draw2d.ArrayList();
  2537. this.setSelectable(true);
  2538. this.setDeleteable(true);
  2539. };
  2540. draw2d.Line.prototype.type = "draw2d.Line";
  2541. draw2d.Line.ZOrderBaseIndex = 200;
  2542. draw2d.Line.ZOrderBaseIndex = 200;
  2543. draw2d.Line.CoronaWidth = 5;
  2544. draw2d.Line.setZOrderBaseIndex = function(index) {
  2545. draw2d.Line.ZOrderBaseIndex = index;
  2546. };
  2547. draw2d.Line.setDefaultCoronaWidth = function(width) {
  2548. draw2d.Line.CoronaWidth = width;
  2549. };
  2550. draw2d.Line.prototype.dispose = function() {
  2551. this.canvas = null;
  2552. this.workflow = null;
  2553. if (this.graphics !== null) {
  2554. this.graphics.clear();
  2555. }
  2556. this.graphics = null;
  2557. };
  2558. draw2d.Line.prototype.getZOrder = function() {
  2559. return this.zOrder;
  2560. };
  2561. draw2d.Line.prototype.setZOrder = function(index) {
  2562. if (this.html !== null) {
  2563. this.html.style.zIndex = index;
  2564. }
  2565. this.zOrder = index;
  2566. };
  2567. draw2d.Line.prototype.setCoronaWidth = function(width) {
  2568. this.corona = width;
  2569. };
  2570. draw2d.Line.prototype.createHTMLElement = function() {
  2571. var item = document.createElement("div");
  2572. item.id = this.id;
  2573. item.style.position = "absolute";
  2574. item.style.left = "0px";
  2575. item.style.top = "0px";
  2576. item.style.height = "0px";
  2577. item.style.width = "0px";
  2578. item.style.zIndex = this.zOrder;
  2579. return item;
  2580. };
  2581. draw2d.Line.prototype.setId = function(id) {
  2582. this.id = id;
  2583. if (this.html !== null) {
  2584. this.html.id = id;
  2585. }
  2586. };
  2587. draw2d.Line.prototype.getId = function() {
  2588. return this.id;
  2589. };
  2590. draw2d.Line.prototype.getProperties = function() {
  2591. return this.properties;
  2592. };
  2593. draw2d.Line.prototype.getProperty = function(key) {
  2594. return this.properties[key];
  2595. };
  2596. draw2d.Line.prototype.setProperty = function(key, value) {
  2597. this.properties[key] = value;
  2598. this.setDocumentDirty();
  2599. };
  2600. draw2d.Line.prototype.getHTMLElement = function() {
  2601. if (this.html === null) {
  2602. this.html = this.createHTMLElement();
  2603. }
  2604. return this.html;
  2605. };
  2606. draw2d.Line.prototype.getWorkflow = function() {
  2607. return this.workflow;
  2608. };
  2609. draw2d.Line.prototype.isResizeable = function() {
  2610. return true;
  2611. };
  2612. draw2d.Line.prototype.setCanvas = function(_56ed) {
  2613. this.canvas = _56ed;
  2614. if (this.graphics !== null) {
  2615. this.graphics.clear();
  2616. }
  2617. this.graphics = null;
  2618. };
  2619. draw2d.Line.prototype.setWorkflow = function(_56ee) {
  2620. this.workflow = _56ee;
  2621. if (this.graphics !== null) {
  2622. this.graphics.clear();
  2623. }
  2624. this.graphics = null;
  2625. };
  2626. draw2d.Line.prototype.paint = function() {
  2627. if (this.html === null) {
  2628. return;
  2629. }
  2630. try {
  2631. if (this.graphics === null) {
  2632. this.graphics = new jsGraphics(this.html);
  2633. } else {
  2634. this.graphics.clear();
  2635. }
  2636. this.graphics.setStroke(this.stroke);
  2637. this.graphics.setColor(this.lineColor.getHTMLStyle());
  2638. this.graphics.drawLine(this.startX, this.startY, this.endX, this.endY);
  2639. this.graphics.paint();
  2640. } catch (e) {
  2641. pushErrorStack(e, "draw2d.Line.prototype.paint=function()");
  2642. }
  2643. };
  2644. draw2d.Line.prototype.attachMoveListener = function(_56ef) {
  2645. this.moveListener.add(_56ef);
  2646. };
  2647. draw2d.Line.prototype.detachMoveListener = function(_56f0) {
  2648. this.moveListener.remove(_56f0);
  2649. };
  2650. draw2d.Line.prototype.fireMoveEvent = function() {
  2651. var size = this.moveListener.getSize();
  2652. for ( var i = 0; i < size; i++) {
  2653. this.moveListener.get(i).onOtherFigureMoved(this);
  2654. }
  2655. };
  2656. draw2d.Line.prototype.onOtherFigureMoved = function(_56f3) {
  2657. };
  2658. draw2d.Line.prototype.setLineWidth = function(w) {
  2659. this.stroke = w;
  2660. if (this.graphics !== null) {
  2661. this.paint();
  2662. }
  2663. this.setDocumentDirty();
  2664. };
  2665. draw2d.Line.prototype.setColor = function(color) {
  2666. this.lineColor = color;
  2667. if (this.graphics !== null) {
  2668. this.paint();
  2669. }
  2670. this.setDocumentDirty();
  2671. };
  2672. draw2d.Line.prototype.getColor = function() {
  2673. return this.lineColor;
  2674. };
  2675. draw2d.Line.prototype.setAlpha = function(_56f6) {
  2676. if (_56f6 == this.alpha) {
  2677. return;
  2678. }
  2679. try {
  2680. this.html.style.MozOpacity = _56f6;
  2681. } catch (exc1) {
  2682. }
  2683. try {
  2684. this.html.style.opacity = _56f6;
  2685. } catch (exc2) {
  2686. }
  2687. try {
  2688. var _56f7 = Math.round(_56f6 * 100);
  2689. if (_56f7 >= 99) {
  2690. this.html.style.filter = "";
  2691. } else {
  2692. this.html.style.filter = "alpha(opacity=" + _56f7 + ")";
  2693. }
  2694. } catch (exc3) {
  2695. }
  2696. this.alpha = _56f6;
  2697. };
  2698. draw2d.Line.prototype.setStartPoint = function(x, y) {
  2699. this.startX = x;
  2700. this.startY = y;
  2701. if (this.graphics !== null) {
  2702. this.paint();
  2703. }
  2704. this.setDocumentDirty();
  2705. };
  2706. draw2d.Line.prototype.setEndPoint = function(x, y) {
  2707. this.endX = x;
  2708. this.endY = y;
  2709. if (this.graphics !== null) {
  2710. this.paint();
  2711. }
  2712. this.setDocumentDirty();
  2713. };
  2714. draw2d.Line.prototype.getStartX = function() {
  2715. return this.startX;
  2716. };
  2717. draw2d.Line.prototype.getStartY = function() {
  2718. return this.startY;
  2719. };
  2720. draw2d.Line.prototype.getStartPoint = function() {
  2721. return new draw2d.Point(this.startX, this.startY);
  2722. };
  2723. draw2d.Line.prototype.getEndX = function() {
  2724. return this.endX;
  2725. };
  2726. draw2d.Line.prototype.getEndY = function() {
  2727. return this.endY;
  2728. };
  2729. draw2d.Line.prototype.getEndPoint = function() {
  2730. return new draw2d.Point(this.endX, this.endY);
  2731. };
  2732. draw2d.Line.prototype.isSelectable = function() {
  2733. return this.selectable;
  2734. };
  2735. draw2d.Line.prototype.setSelectable = function(flag) {
  2736. this.selectable = flag;
  2737. };
  2738. draw2d.Line.prototype.isDeleteable = function() {
  2739. return this.deleteable;
  2740. };
  2741. draw2d.Line.prototype.setDeleteable = function(flag) {
  2742. this.deleteable = flag;
  2743. };
  2744. draw2d.Line.prototype.getLength = function() {
  2745. return Math.sqrt((this.startX - this.endX) * (this.startX - this.endX)
  2746. + (this.startY - this.endY) * (this.startY - this.endY));
  2747. };
  2748. draw2d.Line.prototype.getAngle = function() {
  2749. var _56fe = this.getLength();
  2750. var angle = -(180 / Math.PI) * Math.asin((this.startY - this.endY) / _56fe);
  2751. if (angle < 0) {
  2752. if (this.endX < this.startX) {
  2753. angle = Math.abs(angle) + 180;
  2754. } else {
  2755. angle = 360 - Math.abs(angle);
  2756. }
  2757. } else {
  2758. if (this.endX < this.startX) {
  2759. angle = 180 - angle;
  2760. }
  2761. }
  2762. return angle;
  2763. };
  2764. draw2d.Line.prototype.createCommand = function(_5700) {
  2765. if (_5700.getPolicy() == draw2d.EditPolicy.MOVE) {
  2766. var x1 = this.getStartX();
  2767. var y1 = this.getStartY();
  2768. var x2 = this.getEndX();
  2769. var y2 = this.getEndY();
  2770. return new draw2d.CommandMoveLine(this, x1, y1, x2, y2);
  2771. }
  2772. if (_5700.getPolicy() == draw2d.EditPolicy.DELETE) {
  2773. if (this.isDeleteable() == false) {
  2774. return null;
  2775. }
  2776. return new draw2d.CommandDelete(this);
  2777. }
  2778. return null;
  2779. };
  2780. draw2d.Line.prototype.setModel = function(model) {
  2781. if (this.model !== null) {
  2782. this.model.removePropertyChangeListener(this);
  2783. }
  2784. this.model = model;
  2785. if (this.model !== null) {
  2786. this.model.addPropertyChangeListener(this);
  2787. }
  2788. };
  2789. draw2d.Line.prototype.getModel = function() {
  2790. return this.model;
  2791. };
  2792. draw2d.Line.prototype.onRemove = function(_5706) {
  2793. };
  2794. draw2d.Line.prototype.onContextMenu = function(x, y) {
  2795. var menu = this.getContextMenu();
  2796. if (menu !== null) {
  2797. this.workflow.showMenu(menu, x, y);
  2798. }
  2799. };
  2800. draw2d.Line.prototype.getContextMenu = function() {
  2801. return null;
  2802. };
  2803. draw2d.Line.prototype.onDoubleClick = function() {
  2804. };
  2805. draw2d.Line.prototype.setDocumentDirty = function() {
  2806. if (this.workflow !== null) {
  2807. this.workflow.setDocumentDirty();
  2808. }
  2809. };
  2810. draw2d.Line.prototype.containsPoint = function(px, py) {
  2811. return draw2d.Line.hit(this.corona, this.startX, this.startY, this.endX,
  2812. this.endY, px, py);
  2813. };
  2814. draw2d.Line.hit = function(_570c, X1, Y1, X2, Y2, px, py) {
  2815. X2 -= X1;
  2816. Y2 -= Y1;
  2817. px -= X1;
  2818. py -= Y1;
  2819. var _5713 = px * X2 + py * Y2;
  2820. var _5714;
  2821. if (_5713 <= 0) {
  2822. _5714 = 0;
  2823. } else {
  2824. px = X2 - px;
  2825. py = Y2 - py;
  2826. _5713 = px * X2 + py * Y2;
  2827. if (_5713 <= 0) {
  2828. _5714 = 0;
  2829. } else {
  2830. _5714 = _5713 * _5713 / (X2 * X2 + Y2 * Y2);
  2831. }
  2832. }
  2833. var lenSq = px * px + py * py - _5714;
  2834. if (lenSq < 0) {
  2835. lenSq = 0;
  2836. }
  2837. return Math.sqrt(lenSq) < _570c;
  2838. };
  2839. draw2d.ConnectionRouter = function() {
  2840. };
  2841. draw2d.ConnectionRouter.prototype.type = "draw2d.ConnectionRouter";
  2842. draw2d.ConnectionRouter.prototype.getDirection = function(r, p) {
  2843. var _5b2e = Math.abs(r.x - p.x);
  2844. var _5b2f = 3;
  2845. var i = Math.abs(r.y - p.y);
  2846. if (i <= _5b2e) {
  2847. _5b2e = i;
  2848. _5b2f = 0;
  2849. }
  2850. i = Math.abs(r.getBottom() - p.y);
  2851. if (i <= _5b2e) {
  2852. _5b2e = i;
  2853. _5b2f = 2;
  2854. }
  2855. i = Math.abs(r.getRight() - p.x);
  2856. if (i < _5b2e) {
  2857. _5b2e = i;
  2858. _5b2f = 1;
  2859. }
  2860. return _5b2f;
  2861. };
  2862. draw2d.ConnectionRouter.prototype.getEndDirection = function(conn) {
  2863. var p = conn.getEndPoint();
  2864. var rect = conn.getTarget().getParent().getBounds();
  2865. return this.getDirection(rect, p);
  2866. };
  2867. draw2d.ConnectionRouter.prototype.getStartDirection = function(conn) {
  2868. var p = conn.getStartPoint();
  2869. var rect = conn.getSource().getParent().getBounds();
  2870. return this.getDirection(rect, p);
  2871. };
  2872. draw2d.ConnectionRouter.prototype.route = function(_5b37) {
  2873. };
  2874. draw2d.NullConnectionRouter = function() {
  2875. };
  2876. draw2d.NullConnectionRouter.prototype = new draw2d.ConnectionRouter();
  2877. draw2d.NullConnectionRouter.prototype.type = "draw2d.NullConnectionRouter";
  2878. draw2d.NullConnectionRouter.prototype.invalidate = function() {
  2879. };
  2880. draw2d.NullConnectionRouter.prototype.route = function(_4a11) {
  2881. _4a11.addPoint(_4a11.getStartPoint());
  2882. _4a11.addPoint(_4a11.getEndPoint());
  2883. };
  2884. draw2d.ManhattanConnectionRouter = function() {
  2885. this.MINDIST = 20;
  2886. };
  2887. draw2d.ManhattanConnectionRouter.prototype = new draw2d.ConnectionRouter();
  2888. draw2d.ManhattanConnectionRouter.prototype.type = "draw2d.ManhattanConnectionRouter";
  2889. draw2d.ManhattanConnectionRouter.prototype.route = function(conn) {
  2890. var _5525 = conn.getStartPoint();
  2891. var _5526 = this.getStartDirection(conn);
  2892. var toPt = conn.getEndPoint();
  2893. var toDir = this.getEndDirection(conn);
  2894. this._route(conn, toPt, toDir, _5525, _5526);
  2895. };
  2896. draw2d.ManhattanConnectionRouter.prototype._route = function(conn, _552a,
  2897. _552b, toPt, toDir) {
  2898. var TOL = 0.1;
  2899. var _552f = 0.01;
  2900. var UP = 0;
  2901. var RIGHT = 1;
  2902. var DOWN = 2;
  2903. var LEFT = 3;
  2904. var xDiff = _552a.x - toPt.x;
  2905. var yDiff = _552a.y - toPt.y;
  2906. var point;
  2907. var dir;
  2908. if (((xDiff * xDiff) < (_552f)) && ((yDiff * yDiff) < (_552f))) {
  2909. conn.addPoint(new draw2d.Point(toPt.x, toPt.y));
  2910. return;
  2911. }
  2912. if (_552b == LEFT) {
  2913. if ((xDiff > 0) && ((yDiff * yDiff) < TOL) && (toDir === RIGHT)) {
  2914. point = toPt;
  2915. dir = toDir;
  2916. } else {
  2917. if (xDiff < 0) {
  2918. point = new draw2d.Point(_552a.x - this.MINDIST, _552a.y);
  2919. } else {
  2920. if (((yDiff > 0) && (toDir === DOWN))
  2921. || ((yDiff < 0) && (toDir == UP))) {
  2922. point = new draw2d.Point(toPt.x, _552a.y);
  2923. } else {
  2924. if (_552b == toDir) {
  2925. var pos = Math.min(_552a.x, toPt.x) - this.MINDIST;
  2926. point = new draw2d.Point(pos, _552a.y);
  2927. } else {
  2928. point = new draw2d.Point(_552a.x - (xDiff / 2), _552a.y);
  2929. }
  2930. }
  2931. }
  2932. if (yDiff > 0) {
  2933. dir = UP;
  2934. } else {
  2935. dir = DOWN;
  2936. }
  2937. }
  2938. } else {
  2939. if (_552b == RIGHT) {
  2940. if ((xDiff < 0) && ((yDiff * yDiff) < TOL) && (toDir === LEFT)) {
  2941. point = toPt;
  2942. dir = toDir;
  2943. } else {
  2944. if (xDiff > 0) {
  2945. point = new draw2d.Point(_552a.x + this.MINDIST, _552a.y);
  2946. } else {
  2947. if (((yDiff > 0) && (toDir === DOWN))
  2948. || ((yDiff < 0) && (toDir === UP))) {
  2949. point = new draw2d.Point(toPt.x, _552a.y);
  2950. } else {
  2951. if (_552b == toDir) {
  2952. var pos = Math.max(_552a.x, toPt.x) + this.MINDIST;
  2953. point = new draw2d.Point(pos, _552a.y);
  2954. } else {
  2955. point = new draw2d.Point(_552a.x - (xDiff / 2),
  2956. _552a.y);
  2957. }
  2958. }
  2959. }
  2960. if (yDiff > 0) {
  2961. dir = UP;
  2962. } else {
  2963. dir = DOWN;
  2964. }
  2965. }
  2966. } else {
  2967. if (_552b == DOWN) {
  2968. if (((xDiff * xDiff) < TOL) && (yDiff < 0) && (toDir == UP)) {
  2969. point = toPt;
  2970. dir = toDir;
  2971. } else {
  2972. if (yDiff > 0) {
  2973. point = new draw2d.Point(_552a.x, _552a.y
  2974. + this.MINDIST);
  2975. } else {
  2976. if (((xDiff > 0) && (toDir === RIGHT))
  2977. || ((xDiff < 0) && (toDir === LEFT))) {
  2978. point = new draw2d.Point(_552a.x, toPt.y);
  2979. } else {
  2980. if (_552b === toDir) {
  2981. var pos = Math.max(_552a.y, toPt.y)
  2982. + this.MINDIST;
  2983. point = new draw2d.Point(_552a.x, pos);
  2984. } else {
  2985. point = new draw2d.Point(_552a.x, _552a.y
  2986. - (yDiff / 2));
  2987. }
  2988. }
  2989. }
  2990. if (xDiff > 0) {
  2991. dir = LEFT;
  2992. } else {
  2993. dir = RIGHT;
  2994. }
  2995. }
  2996. } else {
  2997. if (_552b == UP) {
  2998. if (((xDiff * xDiff) < TOL) && (yDiff > 0)
  2999. && (toDir === DOWN)) {
  3000. point = toPt;
  3001. dir = toDir;
  3002. } else {
  3003. if (yDiff < 0) {
  3004. point = new draw2d.Point(_552a.x, _552a.y
  3005. - this.MINDIST);
  3006. } else {
  3007. if (((xDiff > 0) && (toDir === RIGHT))
  3008. || ((xDiff < 0) && (toDir === LEFT))) {
  3009. point = new draw2d.Point(_552a.x, toPt.y);
  3010. } else {
  3011. if (_552b === toDir) {
  3012. var pos = Math.min(_552a.y, toPt.y)
  3013. - this.MINDIST;
  3014. point = new draw2d.Point(_552a.x, pos);
  3015. } else {
  3016. point = new draw2d.Point(_552a.x, _552a.y
  3017. - (yDiff / 2));
  3018. }
  3019. }
  3020. }
  3021. if (xDiff > 0) {
  3022. dir = LEFT;
  3023. } else {
  3024. dir = RIGHT;
  3025. }
  3026. }
  3027. }
  3028. }
  3029. }
  3030. }
  3031. this._route(conn, point, dir, toPt, toDir);
  3032. conn.addPoint(_552a);
  3033. };
  3034. draw2d.BezierConnectionRouter = function(_5fa4) {
  3035. if (!_5fa4) {
  3036. this.cheapRouter = new draw2d.ManhattanConnectionRouter();
  3037. } else {
  3038. this.cheapRouter = null;
  3039. }
  3040. this.iteration = 5;
  3041. };
  3042. draw2d.BezierConnectionRouter.prototype = new draw2d.ConnectionRouter();
  3043. draw2d.BezierConnectionRouter.prototype.type = "draw2d.BezierConnectionRouter";
  3044. draw2d.BezierConnectionRouter.prototype.drawBezier = function(_5fa5, _5fa6, t,
  3045. iter) {
  3046. var n = _5fa5.length - 1;
  3047. var q = [];
  3048. var _5fab = n + 1;
  3049. for ( var i = 0; i < _5fab; i++) {
  3050. q[i] = [];
  3051. q[i][0] = _5fa5[i];
  3052. }
  3053. for ( var j = 1; j <= n; j++) {
  3054. for ( var i = 0; i <= (n - j); i++) {
  3055. q[i][j] = new draw2d.Point((1 - t) * q[i][j - 1].x + t
  3056. * q[i + 1][j - 1].x, (1 - t) * q[i][j - 1].y + t
  3057. * q[i + 1][j - 1].y);
  3058. }
  3059. }
  3060. var c1 = [];
  3061. var c2 = [];
  3062. for ( var i = 0; i < n + 1; i++) {
  3063. c1[i] = q[0][i];
  3064. c2[i] = q[i][n - i];
  3065. }
  3066. if (iter >= 0) {
  3067. this.drawBezier(c1, _5fa6, t, --iter);
  3068. this.drawBezier(c2, _5fa6, t, --iter);
  3069. } else {
  3070. for ( var i = 0; i < n; i++) {
  3071. _5fa6.push(q[i][n - i]);
  3072. }
  3073. }
  3074. };
  3075. draw2d.BezierConnectionRouter.prototype.route = function(conn) {
  3076. if (this.cheapRouter !== null
  3077. && (conn.getSource().getParent().isMoving === true || conn
  3078. .getTarget().getParent().isMoving === true)) {
  3079. this.cheapRouter.route(conn);
  3080. return;
  3081. }
  3082. var _5fb1 = [];
  3083. var _5fb2 = conn.getStartPoint();
  3084. var toPt = conn.getEndPoint();
  3085. this._route(_5fb1, conn, toPt, this.getEndDirection(conn), _5fb2, this
  3086. .getStartDirection(conn));
  3087. var _5fb4 = [];
  3088. this.drawBezier(_5fb1, _5fb4, 0.5, this.iteration);
  3089. for ( var i = 0; i < _5fb4.length; i++) {
  3090. conn.addPoint(_5fb4[i]);
  3091. }
  3092. conn.addPoint(toPt);
  3093. };
  3094. draw2d.BezierConnectionRouter.prototype._route = function(_5fb6, conn, _5fb8,
  3095. _5fb9, toPt, toDir) {
  3096. var TOL = 0.1;
  3097. var _5fbd = 0.01;
  3098. var _5fbe = 90;
  3099. var UP = 0;
  3100. var RIGHT = 1;
  3101. var DOWN = 2;
  3102. var LEFT = 3;
  3103. var xDiff = _5fb8.x - toPt.x;
  3104. var yDiff = _5fb8.y - toPt.y;
  3105. var point;
  3106. var dir;
  3107. if (((xDiff * xDiff) < (_5fbd)) && ((yDiff * yDiff) < (_5fbd))) {
  3108. _5fb6.push(new draw2d.Point(toPt.x, toPt.y));
  3109. return;
  3110. }
  3111. if (_5fb9 === LEFT) {
  3112. if ((xDiff > 0) && ((yDiff * yDiff) < TOL) && (toDir === RIGHT)) {
  3113. point = toPt;
  3114. dir = toDir;
  3115. } else {
  3116. if (xDiff < 0) {
  3117. point = new draw2d.Point(_5fb8.x - _5fbe, _5fb8.y);
  3118. } else {
  3119. if (((yDiff > 0) && (toDir === DOWN))
  3120. || ((yDiff < 0) && (toDir === UP))) {
  3121. point = new draw2d.Point(toPt.x, _5fb8.y);
  3122. } else {
  3123. if (_5fb9 === toDir) {
  3124. var pos = Math.min(_5fb8.x, toPt.x) - _5fbe;
  3125. point = new draw2d.Point(pos, _5fb8.y);
  3126. } else {
  3127. point = new draw2d.Point(_5fb8.x - (xDiff / 2), _5fb8.y);
  3128. }
  3129. }
  3130. }
  3131. if (yDiff > 0) {
  3132. dir = UP;
  3133. } else {
  3134. dir = DOWN;
  3135. }
  3136. }
  3137. } else {
  3138. if (_5fb9 === RIGHT) {
  3139. if ((xDiff < 0) && ((yDiff * yDiff) < TOL) && (toDir == LEFT)) {
  3140. point = toPt;
  3141. dir = toDir;
  3142. } else {
  3143. if (xDiff > 0) {
  3144. point = new draw2d.Point(_5fb8.x + _5fbe, _5fb8.y);
  3145. } else {
  3146. if (((yDiff > 0) && (toDir === DOWN))
  3147. || ((yDiff < 0) && (toDir === UP))) {
  3148. point = new draw2d.Point(toPt.x, _5fb8.y);
  3149. } else {
  3150. if (_5fb9 === toDir) {
  3151. var pos = Math.max(_5fb8.x, toPt.x) + _5fbe;
  3152. point = new draw2d.Point(pos, _5fb8.y);
  3153. } else {
  3154. point = new draw2d.Point(_5fb8.x - (xDiff / 2),
  3155. _5fb8.y);
  3156. }
  3157. }
  3158. }
  3159. if (yDiff > 0) {
  3160. dir = UP;
  3161. } else {
  3162. dir = DOWN;
  3163. }
  3164. }
  3165. } else {
  3166. if (_5fb9 === DOWN) {
  3167. if (((xDiff * xDiff) < TOL) && (yDiff < 0) && (toDir === UP)) {
  3168. point = toPt;
  3169. dir = toDir;
  3170. } else {
  3171. if (yDiff > 0) {
  3172. point = new draw2d.Point(_5fb8.x, _5fb8.y + _5fbe);
  3173. } else {
  3174. if (((xDiff > 0) && (toDir === RIGHT))
  3175. || ((xDiff < 0) && (toDir === LEFT))) {
  3176. point = new draw2d.Point(_5fb8.x, toPt.y);
  3177. } else {
  3178. if (_5fb9 === toDir) {
  3179. var pos = Math.max(_5fb8.y, toPt.y) + _5fbe;
  3180. point = new draw2d.Point(_5fb8.x, pos);
  3181. } else {
  3182. point = new draw2d.Point(_5fb8.x, _5fb8.y
  3183. - (yDiff / 2));
  3184. }
  3185. }
  3186. }
  3187. if (xDiff > 0) {
  3188. dir = LEFT;
  3189. } else {
  3190. dir = RIGHT;
  3191. }
  3192. }
  3193. } else {
  3194. if (_5fb9 === UP) {
  3195. if (((xDiff * xDiff) < TOL) && (yDiff > 0)
  3196. && (toDir === DOWN)) {
  3197. point = toPt;
  3198. dir = toDir;
  3199. } else {
  3200. if (yDiff < 0) {
  3201. point = new draw2d.Point(_5fb8.x, _5fb8.y - _5fbe);
  3202. } else {
  3203. if (((xDiff > 0) && (toDir === RIGHT))
  3204. || ((xDiff < 0) && (toDir === LEFT))) {
  3205. point = new draw2d.Point(_5fb8.x, toPt.y);
  3206. } else {
  3207. if (_5fb9 === toDir) {
  3208. var pos = Math.min(_5fb8.y, toPt.y) - _5fbe;
  3209. point = new draw2d.Point(_5fb8.x, pos);
  3210. } else {
  3211. point = new draw2d.Point(_5fb8.x, _5fb8.y
  3212. - (yDiff / 2));
  3213. }
  3214. }
  3215. }
  3216. if (xDiff > 0) {
  3217. dir = LEFT;
  3218. } else {
  3219. dir = RIGHT;
  3220. }
  3221. }
  3222. }
  3223. }
  3224. }
  3225. }
  3226. this._route(_5fb6, conn, point, dir, toPt, toDir);
  3227. _5fb6.push(_5fb8);
  3228. };
  3229. draw2d.FanConnectionRouter = function() {
  3230. };
  3231. draw2d.FanConnectionRouter.prototype = new draw2d.NullConnectionRouter();
  3232. draw2d.FanConnectionRouter.prototype.type = "draw2d.FanConnectionRouter";
  3233. draw2d.FanConnectionRouter.prototype.route = function(conn) {
  3234. var _5680 = conn.getStartPoint();
  3235. var toPt = conn.getEndPoint();
  3236. var lines = conn.getSource().getConnections();
  3237. var _5683 = new draw2d.ArrayList();
  3238. var index = 0;
  3239. for ( var i = 0; i < lines.getSize(); i++) {
  3240. var _5686 = lines.get(i);
  3241. if (_5686.getTarget() == conn.getTarget()
  3242. || _5686.getSource() == conn.getTarget()) {
  3243. _5683.add(_5686);
  3244. if (conn == _5686) {
  3245. index = _5683.getSize();
  3246. }
  3247. }
  3248. }
  3249. if (_5683.getSize() > 1) {
  3250. this.routeCollision(conn, index);
  3251. } else {
  3252. draw2d.NullConnectionRouter.prototype.route.call(this, conn);
  3253. }
  3254. };
  3255. draw2d.FanConnectionRouter.prototype.routeNormal = function(conn) {
  3256. conn.addPoint(conn.getStartPoint());
  3257. conn.addPoint(conn.getEndPoint());
  3258. };
  3259. draw2d.FanConnectionRouter.prototype.routeCollision = function(conn, index) {
  3260. var start = conn.getStartPoint();
  3261. var end = conn.getEndPoint();
  3262. conn.addPoint(start);
  3263. var _568c = 10;
  3264. var _568d = new draw2d.Point((end.x + start.x) / 2, (end.y + start.y) / 2);
  3265. var _568e = end.getPosition(start);
  3266. var ray;
  3267. if (_568e == draw2d.PositionConstants.SOUTH
  3268. || _568e == draw2d.PositionConstants.EAST) {
  3269. ray = new draw2d.Point(end.x - start.x, end.y - start.y);
  3270. } else {
  3271. ray = new draw2d.Point(start.x - end.x, start.y - end.y);
  3272. }
  3273. var _5690 = Math.sqrt(ray.x * ray.x + ray.y * ray.y);
  3274. var _5691 = _568c * ray.x / _5690;
  3275. var _5692 = _568c * ray.y / _5690;
  3276. var _5693;
  3277. if (index % 2 === 0) {
  3278. _5693 = new draw2d.Point(_568d.x + (index / 2) * (-1 * _5692), _568d.y
  3279. + (index / 2) * _5691);
  3280. } else {
  3281. _5693 = new draw2d.Point(_568d.x + (index / 2) * _5692, _568d.y
  3282. + (index / 2) * (-1 * _5691));
  3283. }
  3284. conn.addPoint(_5693);
  3285. conn.addPoint(end);
  3286. };
  3287. draw2d.Graphics = function(_6019, _601a, _601b) {
  3288. this.jsGraphics = _6019;
  3289. this.xt = _601b.x;
  3290. this.yt = _601b.y;
  3291. this.radian = _601a * Math.PI / 180;
  3292. this.sinRadian = Math.sin(this.radian);
  3293. this.cosRadian = Math.cos(this.radian);
  3294. };
  3295. draw2d.Graphics.prototype.setStroke = function(x) {
  3296. this.jsGraphics.setStroke(x);
  3297. };
  3298. draw2d.Graphics.prototype.drawLine = function(x1, y1, x2, y2) {
  3299. var _x1 = this.xt + x1 * this.cosRadian - y1 * this.sinRadian;
  3300. var _y1 = this.yt + x1 * this.sinRadian + y1 * this.cosRadian;
  3301. var _x2 = this.xt + x2 * this.cosRadian - y2 * this.sinRadian;
  3302. var _y2 = this.yt + x2 * this.sinRadian + y2 * this.cosRadian;
  3303. this.jsGraphics.drawLine(_x1, _y1, _x2, _y2);
  3304. };
  3305. draw2d.Graphics.prototype.fillRect = function(x, y, w, h) {
  3306. var x1 = this.xt + x * this.cosRadian - y * this.sinRadian;
  3307. var y1 = this.yt + x * this.sinRadian + y * this.cosRadian;
  3308. var x2 = this.xt + (x + w) * this.cosRadian - y * this.sinRadian;
  3309. var y2 = this.yt + (x + w) * this.sinRadian + y * this.cosRadian;
  3310. var x3 = this.xt + (x + w) * this.cosRadian - (y + h) * this.sinRadian;
  3311. var y3 = this.yt + (x + w) * this.sinRadian + (y + h) * this.cosRadian;
  3312. var x4 = this.xt + x * this.cosRadian - (y + h) * this.sinRadian;
  3313. var y4 = this.yt + x * this.sinRadian + (y + h) * this.cosRadian;
  3314. this.jsGraphics.fillPolygon( [ x1, x2, x3, x4 ], [ y1, y2, y3, y4 ]);
  3315. };
  3316. draw2d.Graphics.prototype.fillPolygon = function(_6031, _6032) {
  3317. var rotX = [];
  3318. var rotY = [];
  3319. for ( var i = 0; i < _6031.length; i++) {
  3320. rotX[i] = this.xt + _6031[i] * this.cosRadian - _6032[i]
  3321. * this.sinRadian;
  3322. rotY[i] = this.yt + _6031[i] * this.sinRadian + _6032[i]
  3323. * this.cosRadian;
  3324. }
  3325. this.jsGraphics.fillPolygon(rotX, rotY);
  3326. };
  3327. draw2d.Graphics.prototype.setColor = function(color) {
  3328. this.jsGraphics.setColor(color.getHTMLStyle());
  3329. };
  3330. draw2d.Graphics.prototype.drawPolygon = function(_6037, _6038) {
  3331. var rotX = [];
  3332. var rotY = [];
  3333. for ( var i = 0; i < _6037.length; i++) {
  3334. rotX[i] = this.xt + _6037[i] * this.cosRadian - _6038[i]
  3335. * this.sinRadian;
  3336. rotY[i] = this.yt + _6037[i] * this.sinRadian + _6038[i]
  3337. * this.cosRadian;
  3338. }
  3339. this.jsGraphics.drawPolygon(rotX, rotY);
  3340. };
  3341. draw2d.Connection = function() {
  3342. draw2d.Line.call(this);
  3343. this.sourcePort = null;
  3344. this.targetPort = null;
  3345. this.canDrag = true;
  3346. this.sourceDecorator = null;
  3347. this.targetDecorator = null;
  3348. this.sourceAnchor = new draw2d.ConnectionAnchor();
  3349. this.targetAnchor = new draw2d.ConnectionAnchor();
  3350. this.router = draw2d.Connection.defaultRouter;
  3351. this.lineSegments = new draw2d.ArrayList();
  3352. this.children = new draw2d.ArrayList();
  3353. this.setColor(new draw2d.Color(0, 0, 115));
  3354. this.setLineWidth(1);
  3355. };
  3356. draw2d.Connection.prototype = new draw2d.Line();
  3357. draw2d.Connection.prototype.type = "draw2d.Connection";
  3358. draw2d.Connection.defaultRouter = new draw2d.ManhattanConnectionRouter();
  3359. draw2d.Connection.setDefaultRouter = function(_58bd) {
  3360. draw2d.Connection.defaultRouter = _58bd;
  3361. };
  3362. draw2d.Connection.prototype.disconnect = function() {
  3363. if (this.sourcePort !== null) {
  3364. this.sourcePort.detachMoveListener(this);
  3365. this.fireSourcePortRouteEvent();
  3366. }
  3367. if (this.targetPort !== null) {
  3368. this.targetPort.detachMoveListener(this);
  3369. this.fireTargetPortRouteEvent();
  3370. }
  3371. };
  3372. draw2d.Connection.prototype.reconnect = function() {
  3373. if (this.sourcePort !== null) {
  3374. this.sourcePort.attachMoveListener(this);
  3375. this.fireSourcePortRouteEvent();
  3376. }
  3377. if (this.targetPort !== null) {
  3378. this.targetPort.attachMoveListener(this);
  3379. this.fireTargetPortRouteEvent();
  3380. }
  3381. };
  3382. draw2d.Connection.prototype.isResizeable = function() {
  3383. return this.getCanDrag();
  3384. };
  3385. draw2d.Connection.prototype.setCanDrag = function(flag) {
  3386. this.canDrag = flag;
  3387. };
  3388. draw2d.Connection.prototype.getCanDrag = function() {
  3389. return this.canDrag;
  3390. };
  3391. draw2d.Connection.prototype.addFigure = function(_58bf, _58c0) {
  3392. var entry = {};
  3393. entry.figure = _58bf;
  3394. entry.locator = _58c0;
  3395. this.children.add(entry);
  3396. if (this.graphics !== null) {
  3397. this.paint();
  3398. }
  3399. var oThis = this;
  3400. var _58c3 = function() {
  3401. var _58c4 = arguments[0] || window.event;
  3402. _58c4.returnValue = false;
  3403. oThis.getWorkflow().setCurrentSelection(oThis);
  3404. oThis.getWorkflow().showLineResizeHandles(oThis);
  3405. };
  3406. if (_58bf.getHTMLElement().addEventListener) {
  3407. _58bf.getHTMLElement().addEventListener("mousedown", _58c3, false);
  3408. } else {
  3409. if (_58bf.getHTMLElement().attachEvent) {
  3410. _58bf.getHTMLElement().attachEvent("onmousedown", _58c3);
  3411. }
  3412. }
  3413. };
  3414. draw2d.Connection.prototype.setSourceDecorator = function(_58c5) {
  3415. this.sourceDecorator = _58c5;
  3416. if (this.graphics !== null) {
  3417. this.paint();
  3418. }
  3419. };
  3420. draw2d.Connection.prototype.getSourceDecorator = function() {
  3421. return this.sourceDecorator;
  3422. };
  3423. draw2d.Connection.prototype.setTargetDecorator = function(_58c6) {
  3424. this.targetDecorator = _58c6;
  3425. if (this.graphics !== null) {
  3426. this.paint();
  3427. }
  3428. };
  3429. draw2d.Connection.prototype.getTargetDecorator = function() {
  3430. return this.targetDecorator;
  3431. };
  3432. draw2d.Connection.prototype.setSourceAnchor = function(_58c7) {
  3433. this.sourceAnchor = _58c7;
  3434. this.sourceAnchor.setOwner(this.sourcePort);
  3435. if (this.graphics !== null) {
  3436. this.paint();
  3437. }
  3438. };
  3439. draw2d.Connection.prototype.setTargetAnchor = function(_58c8) {
  3440. this.targetAnchor = _58c8;
  3441. this.targetAnchor.setOwner(this.targetPort);
  3442. if (this.graphics !== null) {
  3443. this.paint();
  3444. }
  3445. };
  3446. draw2d.Connection.prototype.setRouter = function(_58c9) {
  3447. if (_58c9 !== null) {
  3448. this.router = _58c9;
  3449. } else {
  3450. this.router = new draw2d.NullConnectionRouter();
  3451. }
  3452. if (this.graphics !== null) {
  3453. this.paint();
  3454. }
  3455. };
  3456. draw2d.Connection.prototype.getRouter = function() {
  3457. return this.router;
  3458. };
  3459. draw2d.Connection.prototype.setWorkflow = function(_58ca) {
  3460. draw2d.Line.prototype.setWorkflow.call(this, _58ca);
  3461. for ( var i = 0; i < this.children.getSize(); i++) {
  3462. this.children.get(i).isAppended = false;
  3463. }
  3464. };
  3465. draw2d.Connection.prototype.paint = function() {
  3466. if (this.html === null) {
  3467. return;
  3468. }
  3469. try {
  3470. for ( var i = 0; i < this.children.getSize(); i++) {
  3471. var entry = this.children.get(i);
  3472. if (entry.isAppended == true) {
  3473. this.html.removeChild(entry.figure.getHTMLElement());
  3474. }
  3475. entry.isAppended = false;
  3476. }
  3477. if (this.graphics === null) {
  3478. this.graphics = new jsGraphics(this.html);
  3479. } else {
  3480. this.graphics.clear();
  3481. }
  3482. this.graphics.setStroke(this.stroke);
  3483. this.graphics.setColor(this.lineColor.getHTMLStyle());
  3484. this.startStroke();
  3485. this.router.route(this);
  3486. if (this.getSource().getParent().isMoving == false
  3487. && this.getTarget().getParent().isMoving == false) {
  3488. if (this.targetDecorator !== null) {
  3489. this.targetDecorator.paint(new draw2d.Graphics(this.graphics,
  3490. this.getEndAngle(), this.getEndPoint()));
  3491. }
  3492. if (this.sourceDecorator !== null) {
  3493. this.sourceDecorator.paint(new draw2d.Graphics(this.graphics,
  3494. this.getStartAngle(), this.getStartPoint()));
  3495. }
  3496. }
  3497. this.finishStroke();
  3498. for ( var i = 0; i < this.children.getSize(); i++) {
  3499. var entry = this.children.get(i);
  3500. this.html.appendChild(entry.figure.getHTMLElement());
  3501. entry.isAppended = true;
  3502. entry.locator.relocate(entry.figure);
  3503. }
  3504. } catch (e) {
  3505. pushErrorStack(e, "draw2d.Connection.prototype.paint=function()");
  3506. }
  3507. };
  3508. draw2d.Connection.prototype.getStartPoint = function() {
  3509. if (this.isMoving == false) {
  3510. return this.sourceAnchor.getLocation(this.targetAnchor
  3511. .getReferencePoint());
  3512. } else {
  3513. return draw2d.Line.prototype.getStartPoint.call(this);
  3514. }
  3515. };
  3516. draw2d.Connection.prototype.getEndPoint = function() {
  3517. if (this.isMoving == false) {
  3518. return this.targetAnchor.getLocation(this.sourceAnchor
  3519. .getReferencePoint());
  3520. } else {
  3521. return draw2d.Line.prototype.getEndPoint.call(this);
  3522. }
  3523. };
  3524. draw2d.Connection.prototype.startStroke = function() {
  3525. this.oldPoint = null;
  3526. this.lineSegments = new draw2d.ArrayList();
  3527. };
  3528. draw2d.Connection.prototype.finishStroke = function() {
  3529. this.graphics.paint();
  3530. this.oldPoint = null;
  3531. };
  3532. draw2d.Connection.prototype.getPoints = function() {
  3533. var _58ce = new draw2d.ArrayList();
  3534. var line = null;
  3535. for ( var i = 0; i < this.lineSegments.getSize(); i++) {
  3536. line = this.lineSegments.get(i);
  3537. _58ce.add(line.start);
  3538. }
  3539. if (line !== null) {
  3540. _58ce.add(line.end);
  3541. }
  3542. return _58ce;
  3543. };
  3544. draw2d.Connection.prototype.addPoint = function(p) {
  3545. p = new draw2d.Point(parseInt(p.x), parseInt(p.y));
  3546. if (this.oldPoint !== null) {
  3547. this.graphics.drawLine(this.oldPoint.x, this.oldPoint.y, p.x, p.y);
  3548. var line = {};
  3549. line.start = this.oldPoint;
  3550. line.end = p;
  3551. this.lineSegments.add(line);
  3552. }
  3553. this.oldPoint = {};
  3554. this.oldPoint.x = p.x;
  3555. this.oldPoint.y = p.y;
  3556. };
  3557. draw2d.Connection.prototype.refreshSourcePort = function() {
  3558. var model = this.getModel().getSourceModel();
  3559. var _58d4 = this.getModel().getSourcePortName();
  3560. var _58d5 = this.getWorkflow().getDocument().getFigures();
  3561. var count = _58d5.getSize();
  3562. for ( var i = 0; i < count; i++) {
  3563. var _58d8 = _58d5.get(i);
  3564. if (_58d8.getModel() == model) {
  3565. var port = _58d8.getOutputPort(_58d4);
  3566. this.setSource(port);
  3567. }
  3568. }
  3569. this.setRouter(this.getRouter());
  3570. };
  3571. draw2d.Connection.prototype.refreshTargetPort = function() {
  3572. var model = this.getModel().getTargetModel();
  3573. var _58db = this.getModel().getTargetPortName();
  3574. var _58dc = this.getWorkflow().getDocument().getFigures();
  3575. var count = _58dc.getSize();
  3576. for ( var i = 0; i < count; i++) {
  3577. var _58df = _58dc.get(i);
  3578. if (_58df.getModel() == model) {
  3579. var port = _58df.getInputPort(_58db);
  3580. this.setTarget(port);
  3581. }
  3582. }
  3583. this.setRouter(this.getRouter());
  3584. };
  3585. draw2d.Connection.prototype.setSource = function(port) {
  3586. if (this.sourcePort !== null) {
  3587. this.sourcePort.detachMoveListener(this);
  3588. }
  3589. this.sourcePort = port;
  3590. if (this.sourcePort === null) {
  3591. return;
  3592. }
  3593. this.sourceAnchor.setOwner(this.sourcePort);
  3594. this.fireSourcePortRouteEvent();
  3595. this.sourcePort.attachMoveListener(this);
  3596. this.setStartPoint(port.getAbsoluteX(), port.getAbsoluteY());
  3597. };
  3598. draw2d.Connection.prototype.getSource = function() {
  3599. return this.sourcePort;
  3600. };
  3601. draw2d.Connection.prototype.setTarget = function(port) {
  3602. if (this.targetPort !== null) {
  3603. this.targetPort.detachMoveListener(this);
  3604. }
  3605. this.targetPort = port;
  3606. if (this.targetPort === null) {
  3607. return;
  3608. }
  3609. this.targetAnchor.setOwner(this.targetPort);
  3610. this.fireTargetPortRouteEvent();
  3611. this.targetPort.attachMoveListener(this);
  3612. this.setEndPoint(port.getAbsoluteX(), port.getAbsoluteY());
  3613. };
  3614. draw2d.Connection.prototype.getTarget = function() {
  3615. return this.targetPort;
  3616. };
  3617. draw2d.Connection.prototype.onOtherFigureMoved = function(_58e3) {
  3618. if (_58e3 == this.sourcePort) {
  3619. this.setStartPoint(this.sourcePort.getAbsoluteX(), this.sourcePort
  3620. .getAbsoluteY());
  3621. } else {
  3622. this.setEndPoint(this.targetPort.getAbsoluteX(), this.targetPort
  3623. .getAbsoluteY());
  3624. }
  3625. };
  3626. draw2d.Connection.prototype.containsPoint = function(px, py) {
  3627. for ( var i = 0; i < this.lineSegments.getSize(); i++) {
  3628. var line = this.lineSegments.get(i);
  3629. if (draw2d.Line.hit(this.corona, line.start.x, line.start.y,
  3630. line.end.x, line.end.y, px, py)) {
  3631. return true;
  3632. }
  3633. }
  3634. return false;
  3635. };
  3636. draw2d.Connection.prototype.getStartAngle = function() {
  3637. var p1 = this.lineSegments.get(0).start;
  3638. var p2 = this.lineSegments.get(0).end;
  3639. if (this.router instanceof draw2d.BezierConnectionRouter) {
  3640. p2 = this.lineSegments.get(5).end;
  3641. }
  3642. var _58ea = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y)
  3643. * (p1.y - p2.y));
  3644. var angle = -(180 / Math.PI) * Math.asin((p1.y - p2.y) / _58ea);
  3645. if (angle < 0) {
  3646. if (p2.x < p1.x) {
  3647. angle = Math.abs(angle) + 180;
  3648. } else {
  3649. angle = 360 - Math.abs(angle);
  3650. }
  3651. } else {
  3652. if (p2.x < p1.x) {
  3653. angle = 180 - angle;
  3654. }
  3655. }
  3656. return angle;
  3657. };
  3658. draw2d.Connection.prototype.getEndAngle = function() {
  3659. if (this.lineSegments.getSize() === 0) {
  3660. return 90;
  3661. }
  3662. var p1 = this.lineSegments.get(this.lineSegments.getSize() - 1).end;
  3663. var p2 = this.lineSegments.get(this.lineSegments.getSize() - 1).start;
  3664. if (this.router instanceof draw2d.BezierConnectionRouter) {
  3665. p2 = this.lineSegments.get(this.lineSegments.getSize() - 5).end;
  3666. }
  3667. var _58ee = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y)
  3668. * (p1.y - p2.y));
  3669. var angle = -(180 / Math.PI) * Math.asin((p1.y - p2.y) / _58ee);
  3670. if (angle < 0) {
  3671. if (p2.x < p1.x) {
  3672. angle = Math.abs(angle) + 180;
  3673. } else {
  3674. angle = 360 - Math.abs(angle);
  3675. }
  3676. } else {
  3677. if (p2.x < p1.x) {
  3678. angle = 180 - angle;
  3679. }
  3680. }
  3681. return angle;
  3682. };
  3683. draw2d.Connection.prototype.fireSourcePortRouteEvent = function() {
  3684. var _58f0 = this.sourcePort.getConnections();
  3685. for ( var i = 0; i < _58f0.getSize(); i++) {
  3686. _58f0.get(i).paint();
  3687. }
  3688. };
  3689. draw2d.Connection.prototype.fireTargetPortRouteEvent = function() {
  3690. var _58f2 = this.targetPort.getConnections();
  3691. for ( var i = 0; i < _58f2.getSize(); i++) {
  3692. _58f2.get(i).paint();
  3693. }
  3694. };
  3695. draw2d.Connection.prototype.createCommand = function(_58f4) {
  3696. if (_58f4.getPolicy() == draw2d.EditPolicy.MOVE) {
  3697. return new draw2d.CommandReconnect(this);
  3698. }
  3699. if (_58f4.getPolicy() == draw2d.EditPolicy.DELETE) {
  3700. if (this.isDeleteable() == true) {
  3701. return new draw2d.CommandDelete(this);
  3702. }
  3703. return null;
  3704. }
  3705. return null;
  3706. };
  3707. draw2d.ConnectionAnchor = function(owner) {
  3708. this.owner = owner;
  3709. };
  3710. draw2d.ConnectionAnchor.prototype.type = "draw2d.ConnectionAnchor";
  3711. draw2d.ConnectionAnchor.prototype.getLocation = function(_5901) {
  3712. return this.getReferencePoint();
  3713. };
  3714. draw2d.ConnectionAnchor.prototype.getOwner = function() {
  3715. return this.owner;
  3716. };
  3717. draw2d.ConnectionAnchor.prototype.setOwner = function(owner) {
  3718. this.owner = owner;
  3719. };
  3720. draw2d.ConnectionAnchor.prototype.getBox = function() {
  3721. return this.getOwner().getAbsoluteBounds();
  3722. };
  3723. draw2d.ConnectionAnchor.prototype.getReferencePoint = function() {
  3724. if (this.getOwner() === null) {
  3725. return null;
  3726. } else {
  3727. return this.getOwner().getAbsolutePosition();
  3728. }
  3729. };
  3730. draw2d.ChopboxConnectionAnchor = function(owner) {
  3731. draw2d.ConnectionAnchor.call(this, owner);
  3732. };
  3733. draw2d.ChopboxConnectionAnchor.prototype = new draw2d.ConnectionAnchor();
  3734. draw2d.ChopboxConnectionAnchor.prototype.type = "draw2d.ChopboxConnectionAnchor";
  3735. draw2d.ChopboxConnectionAnchor.prototype.getLocation = function(_5009) {
  3736. var r = new draw2d.Dimension();
  3737. r.setBounds(this.getBox());
  3738. r.translate(-1, -1);
  3739. r.resize(1, 1);
  3740. var _500b = r.x + r.w / 2;
  3741. var _500c = r.y + r.h / 2;
  3742. if (r.isEmpty() || (_5009.x == _500b && _5009.y == _500c)) {
  3743. return new Point(_500b, _500c);
  3744. }
  3745. var dx = _5009.x - _500b;
  3746. var dy = _5009.y - _500c;
  3747. var scale = 0.5 / Math.max(Math.abs(dx) / r.w, Math.abs(dy) / r.h);
  3748. dx *= scale;
  3749. dy *= scale;
  3750. _500b += dx;
  3751. _500c += dy;
  3752. return new draw2d.Point(Math.round(_500b), Math.round(_500c));
  3753. };
  3754. draw2d.ChopboxConnectionAnchor.prototype.getBox = function() {
  3755. return this.getOwner().getParent().getBounds();
  3756. };
  3757. draw2d.ChopboxConnectionAnchor.prototype.getReferencePoint = function() {
  3758. return this.getBox().getCenter();
  3759. };
  3760. draw2d.ConnectionDecorator = function() {
  3761. this.color = new draw2d.Color(0, 0, 0);
  3762. this.backgroundColor = new draw2d.Color(250, 250, 250);
  3763. };
  3764. draw2d.ConnectionDecorator.prototype.type = "draw2d.ConnectionDecorator";
  3765. draw2d.ConnectionDecorator.prototype.paint = function(g) {
  3766. };
  3767. draw2d.ConnectionDecorator.prototype.setColor = function(c) {
  3768. this.color = c;
  3769. };
  3770. draw2d.ConnectionDecorator.prototype.setBackgroundColor = function(c) {
  3771. this.backgroundColor = c;
  3772. };
  3773. draw2d.ArrowConnectionDecorator = function(_4b3e, width) {
  3774. draw2d.ConnectionDecorator.call(this);
  3775. if (_4b3e === undefined || _4b3e < 1) {
  3776. this.lenght = 15;
  3777. }
  3778. if (width === undefined || width < 1) {
  3779. this.width = 10;
  3780. }
  3781. };
  3782. draw2d.ArrowConnectionDecorator.prototype = new draw2d.ConnectionDecorator();
  3783. draw2d.ArrowConnectionDecorator.prototype.type = "draw2d.ArrowConnectionDecorator";
  3784. draw2d.ArrowConnectionDecorator.prototype.paint = function(g) {
  3785. if (this.backgroundColor !== null) {
  3786. g.setColor(this.backgroundColor);
  3787. g.fillPolygon( [ 3, this.lenght, this.lenght, 3 ], [ 0,
  3788. (this.width / 2), -(this.width / 2), 0 ]);
  3789. }
  3790. g.setColor(this.color);
  3791. g.setStroke(1);
  3792. g.drawPolygon( [ 3, this.lenght, this.lenght, 3 ], [ 0, (this.width / 2),
  3793. -(this.width / 2), 0 ]);
  3794. };
  3795. draw2d.ArrowConnectionDecorator.prototype.setDimension = function(l, width) {
  3796. this.width = w;
  3797. this.lenght = l;
  3798. };
  3799. draw2d.CompartmentFigure = function() {
  3800. draw2d.Node.call(this);
  3801. this.children = new draw2d.ArrayList();
  3802. this.setBorder(new draw2d.LineBorder(1));
  3803. this.dropable = new draw2d.DropTarget(this.html);
  3804. this.dropable.node = this;
  3805. this.dropable.addEventListener("figureenter", function(_4b0a) {
  3806. _4b0a.target.node.onFigureEnter(_4b0a.relatedTarget.node);
  3807. });
  3808. this.dropable.addEventListener("figureleave", function(_4b0b) {
  3809. _4b0b.target.node.onFigureLeave(_4b0b.relatedTarget.node);
  3810. });
  3811. this.dropable.addEventListener("figuredrop", function(_4b0c) {
  3812. _4b0c.target.node.onFigureDrop(_4b0c.relatedTarget.node);
  3813. });
  3814. };
  3815. draw2d.CompartmentFigure.prototype = new draw2d.Node();
  3816. draw2d.CompartmentFigure.prototype.type = "draw2d.CompartmentFigure";
  3817. draw2d.CompartmentFigure.prototype.onFigureEnter = function(_4b0d) {
  3818. };
  3819. draw2d.CompartmentFigure.prototype.onFigureLeave = function(_4b0e) {
  3820. };
  3821. draw2d.CompartmentFigure.prototype.onFigureDrop = function(_4b0f) {
  3822. };
  3823. draw2d.CompartmentFigure.prototype.getChildren = function() {
  3824. return this.children;
  3825. };
  3826. draw2d.CompartmentFigure.prototype.addChild = function(_4b10) {
  3827. _4b10.setZOrder(this.getZOrder() + 1);
  3828. _4b10.setParent(this);
  3829. this.children.add(_4b10);
  3830. };
  3831. draw2d.CompartmentFigure.prototype.removeChild = function(_4b11) {
  3832. _4b11.setParent(null);
  3833. this.children.remove(_4b11);
  3834. };
  3835. draw2d.CompartmentFigure.prototype.setZOrder = function(index) {
  3836. draw2d.Node.prototype.setZOrder.call(this, index);
  3837. for ( var i = 0; i < this.children.getSize(); i++) {
  3838. this.children.get(i).setZOrder(index + 1);
  3839. }
  3840. };
  3841. draw2d.CompartmentFigure.prototype.setPosition = function(xPos, yPos) {
  3842. var oldX = this.getX();
  3843. var oldY = this.getY();
  3844. draw2d.Node.prototype.setPosition.call(this, xPos, yPos);
  3845. for ( var i = 0; i < this.children.getSize(); i++) {
  3846. var child = this.children.get(i);
  3847. child.setPosition(child.getX() + this.getX() - oldX, child.getY()
  3848. + this.getY() - oldY);
  3849. }
  3850. };
  3851. draw2d.CompartmentFigure.prototype.onDrag = function() {
  3852. var oldX = this.getX();
  3853. var oldY = this.getY();
  3854. draw2d.Node.prototype.onDrag.call(this);
  3855. for ( var i = 0; i < this.children.getSize(); i++) {
  3856. var child = this.children.get(i);
  3857. child.setPosition(child.getX() + this.getX() - oldX, child.getY()
  3858. + this.getY() - oldY);
  3859. }
  3860. };
  3861. draw2d.CanvasDocument = function(_56a8) {
  3862. this.canvas = _56a8;
  3863. };
  3864. draw2d.CanvasDocument.prototype.type = "draw2d.CanvasDocument";
  3865. draw2d.CanvasDocument.prototype.getFigures = function() {
  3866. var _56a9 = new draw2d.ArrayList();
  3867. var _56aa = this.canvas.figures;
  3868. var _56ab = this.canvas.dialogs;
  3869. for ( var i = 0; i < _56aa.getSize(); i++) {
  3870. var _56ad = _56aa.get(i);
  3871. if (_56ab.indexOf(_56ad) == -1 && _56ad.getParent() === null
  3872. && !(_56ad instanceof draw2d.WindowFigure)) {
  3873. _56a9.add(_56ad);
  3874. }
  3875. }
  3876. return _56a9;
  3877. };
  3878. draw2d.CanvasDocument.prototype.getFigure = function(id) {
  3879. return this.canvas.getFigure(id);
  3880. };
  3881. draw2d.CanvasDocument.prototype.getLines = function() {
  3882. return this.canvas.getLines();
  3883. };
  3884. draw2d.CanvasDocument.prototype.getLine = function(id) {
  3885. return this.canvas.getLine(id);
  3886. };
  3887. draw2d.Annotation = function(msg) {
  3888. this.msg = msg;
  3889. this.alpha = 1;
  3890. this.color = new draw2d.Color(0, 0, 0);
  3891. this.bgColor = new draw2d.Color(241, 241, 121);
  3892. this.fontSize = 10;
  3893. this.textNode = null;
  3894. draw2d.Figure.call(this);
  3895. };
  3896. draw2d.Annotation.prototype = new draw2d.Figure();
  3897. draw2d.Annotation.prototype.type = "draw2d.Annotation";
  3898. draw2d.Annotation.prototype.createHTMLElement = function() {
  3899. var item = draw2d.Figure.prototype.createHTMLElement.call(this);
  3900. item.style.color = this.color.getHTMLStyle();
  3901. item.style.backgroundColor = this.bgColor.getHTMLStyle();
  3902. item.style.fontSize = this.fontSize + "pt";
  3903. item.style.width = "auto";
  3904. item.style.height = "auto";
  3905. item.style.margin = "0px";
  3906. item.style.padding = "0px";
  3907. item.onselectstart = function() {
  3908. return false;
  3909. };
  3910. item.unselectable = "on";
  3911. item.style.cursor = "default";
  3912. this.textNode = document.createTextNode(this.msg);
  3913. item.appendChild(this.textNode);
  3914. this.disableTextSelection(item);
  3915. return item;
  3916. };
  3917. draw2d.Annotation.prototype.onDoubleClick = function() {
  3918. var _57d0 = new draw2d.AnnotationDialog(this);
  3919. this.workflow.showDialog(_57d0);
  3920. };
  3921. draw2d.Annotation.prototype.setBackgroundColor = function(color) {
  3922. this.bgColor = color;
  3923. if (this.bgColor !== null) {
  3924. this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
  3925. } else {
  3926. this.html.style.backgroundColor = "transparent";
  3927. }
  3928. };
  3929. draw2d.Annotation.prototype.getBackgroundColor = function() {
  3930. return this.bgColor;
  3931. };
  3932. draw2d.Annotation.prototype.setFontSize = function(size) {
  3933. this.fontSize = size;
  3934. this.html.style.fontSize = this.fontSize + "pt";
  3935. };
  3936. draw2d.Annotation.prototype.getText = function() {
  3937. return this.msg;
  3938. };
  3939. draw2d.Annotation.prototype.setText = function(text) {
  3940. this.msg = text;
  3941. this.html.removeChild(this.textNode);
  3942. this.textNode = document.createTextNode(this.msg);
  3943. this.html.appendChild(this.textNode);
  3944. };
  3945. draw2d.Annotation.prototype.setStyledText = function(text) {
  3946. this.msg = text;
  3947. this.html.removeChild(this.textNode);
  3948. this.textNode = document.createElement("div");
  3949. this.textNode.innerHTML = text;
  3950. this.html.appendChild(this.textNode);
  3951. };
  3952. draw2d.ResizeHandle = function(_57e4, type) {
  3953. draw2d.Rectangle.call(this, 5, 5);
  3954. this.type = type;
  3955. var _57e6 = this.getWidth();
  3956. var _57e7 = _57e6 / 2;
  3957. switch (this.type) {
  3958. case 1:
  3959. this.setSnapToGridAnchor(new draw2d.Point(_57e6, _57e6));
  3960. break;
  3961. case 2:
  3962. this.setSnapToGridAnchor(new draw2d.Point(_57e7, _57e6));
  3963. break;
  3964. case 3:
  3965. this.setSnapToGridAnchor(new draw2d.Point(0, _57e6));
  3966. break;
  3967. case 4:
  3968. this.setSnapToGridAnchor(new draw2d.Point(0, _57e7));
  3969. break;
  3970. case 5:
  3971. this.setSnapToGridAnchor(new draw2d.Point(0, 0));
  3972. break;
  3973. case 6:
  3974. this.setSnapToGridAnchor(new draw2d.Point(_57e7, 0));
  3975. break;
  3976. case 7:
  3977. this.setSnapToGridAnchor(new draw2d.Point(_57e6, 0));
  3978. break;
  3979. case 8:
  3980. this.setSnapToGridAnchor(new draw2d.Point(_57e6, _57e7));
  3981. case 9:
  3982. this.setSnapToGridAnchor(new draw2d.Point(_57e7, _57e7));
  3983. break;
  3984. }
  3985. this.setBackgroundColor(new draw2d.Color(0, 255, 0));
  3986. this.setWorkflow(_57e4);
  3987. this.setZOrder(10000);
  3988. };
  3989. draw2d.ResizeHandle.prototype = new draw2d.Rectangle();
  3990. draw2d.ResizeHandle.prototype.type = "draw2d.ResizeHandle";
  3991. draw2d.ResizeHandle.prototype.getSnapToDirection = function() {
  3992. switch (this.type) {
  3993. case 1:
  3994. return draw2d.SnapToHelper.NORTH_WEST;
  3995. case 2:
  3996. return draw2d.SnapToHelper.NORTH;
  3997. case 3:
  3998. return draw2d.SnapToHelper.NORTH_EAST;
  3999. case 4:
  4000. return draw2d.SnapToHelper.EAST;
  4001. case 5:
  4002. return draw2d.SnapToHelper.SOUTH_EAST;
  4003. case 6:
  4004. return draw2d.SnapToHelper.SOUTH;
  4005. case 7:
  4006. return draw2d.SnapToHelper.SOUTH_WEST;
  4007. case 8:
  4008. return draw2d.SnapToHelper.WEST;
  4009. case 9:
  4010. return draw2d.SnapToHelper.CENTER;
  4011. }
  4012. };
  4013. draw2d.ResizeHandle.prototype.onDragend = function() {
  4014. var _57e8 = this.workflow.currentSelection;
  4015. if (this.commandMove !== null) {
  4016. this.commandMove.setPosition(_57e8.getX(), _57e8.getY());
  4017. this.workflow.getCommandStack().execute(this.commandMove);
  4018. this.commandMove = null;
  4019. }
  4020. if (this.commandResize !== null) {
  4021. this.commandResize.setDimension(_57e8.getWidth(), _57e8.getHeight());
  4022. this.workflow.getCommandStack().execute(this.commandResize);
  4023. this.commandResize = null;
  4024. }
  4025. this.workflow.hideSnapToHelperLines();
  4026. };
  4027. draw2d.ResizeHandle.prototype.setPosition = function(xPos, yPos) {
  4028. this.x = xPos;
  4029. this.y = yPos;
  4030. if (this.html === null) {
  4031. return;
  4032. }
  4033. this.html.style.left = this.x + "px";
  4034. this.html.style.top = this.y + "px";
  4035. };
  4036. draw2d.ResizeHandle.prototype.onDragstart = function(x, y) {
  4037. if (!this.canDrag) {
  4038. return false;
  4039. }
  4040. var _57ed = this.workflow.currentSelection;
  4041. this.commandMove = _57ed.createCommand(new draw2d.EditPolicy(
  4042. draw2d.EditPolicy.MOVE));
  4043. this.commandResize = _57ed.createCommand(new draw2d.EditPolicy(
  4044. draw2d.EditPolicy.RESIZE));
  4045. return true;
  4046. };
  4047. draw2d.ResizeHandle.prototype.onDrag = function() {
  4048. var oldX = this.getX();
  4049. var oldY = this.getY();
  4050. draw2d.Rectangle.prototype.onDrag.call(this);
  4051. var diffX = oldX - this.getX();
  4052. var diffY = oldY - this.getY();
  4053. var _57f2 = this.workflow.currentSelection.getX();
  4054. var _57f3 = this.workflow.currentSelection.getY();
  4055. var _57f4 = this.workflow.currentSelection.getWidth();
  4056. var _57f5 = this.workflow.currentSelection.getHeight();
  4057. switch (this.type) {
  4058. case 1:
  4059. this.workflow.currentSelection
  4060. .setPosition(_57f2 - diffX, _57f3 - diffY);
  4061. this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5
  4062. + diffY);
  4063. break;
  4064. case 2:
  4065. this.workflow.currentSelection.setPosition(_57f2, _57f3 - diffY);
  4066. this.workflow.currentSelection.setDimension(_57f4, _57f5 + diffY);
  4067. break;
  4068. case 3:
  4069. this.workflow.currentSelection.setPosition(_57f2, _57f3 - diffY);
  4070. this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5
  4071. + diffY);
  4072. break;
  4073. case 4:
  4074. this.workflow.currentSelection.setPosition(_57f2, _57f3);
  4075. this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5);
  4076. break;
  4077. case 5:
  4078. this.workflow.currentSelection.setPosition(_57f2, _57f3);
  4079. this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5
  4080. - diffY);
  4081. break;
  4082. case 6:
  4083. this.workflow.currentSelection.setPosition(_57f2, _57f3);
  4084. this.workflow.currentSelection.setDimension(_57f4, _57f5 - diffY);
  4085. break;
  4086. case 7:
  4087. this.workflow.currentSelection.setPosition(_57f2 - diffX, _57f3);
  4088. this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5
  4089. - diffY);
  4090. break;
  4091. case 8:
  4092. this.workflow.currentSelection.setPosition(_57f2 - diffX, _57f3);
  4093. this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5);
  4094. break;
  4095. }
  4096. this.workflow.moveResizeHandles(this.workflow.getCurrentSelection());
  4097. };
  4098. draw2d.ResizeHandle.prototype.setCanDrag = function(flag) {
  4099. draw2d.Rectangle.prototype.setCanDrag.call(this, flag);
  4100. if (this.html === null) {
  4101. return;
  4102. }
  4103. if (!flag) {
  4104. this.html.style.cursor = "";
  4105. return;
  4106. }
  4107. switch (this.type) {
  4108. case 1:
  4109. this.html.style.cursor = "nw-resize";
  4110. break;
  4111. case 2:
  4112. this.html.style.cursor = "s-resize";
  4113. break;
  4114. case 3:
  4115. this.html.style.cursor = "ne-resize";
  4116. break;
  4117. case 4:
  4118. this.html.style.cursor = "w-resize";
  4119. break;
  4120. case 5:
  4121. this.html.style.cursor = "se-resize";
  4122. break;
  4123. case 6:
  4124. this.html.style.cursor = "n-resize";
  4125. break;
  4126. case 7:
  4127. this.html.style.cursor = "sw-resize";
  4128. break;
  4129. case 8:
  4130. this.html.style.cursor = "e-resize";
  4131. break;
  4132. case 9:
  4133. this.html.style.cursor = "resize";
  4134. break;
  4135. }
  4136. };
  4137. draw2d.ResizeHandle.prototype.onKeyDown = function(_57f7, ctrl) {
  4138. this.workflow.onKeyDown(_57f7, ctrl);
  4139. };
  4140. draw2d.ResizeHandle.prototype.fireMoveEvent = function() {
  4141. };
  4142. draw2d.LineStartResizeHandle = function(_5b1e) {
  4143. draw2d.ResizeHandle.call(this, _5b1e, 9);
  4144. this.setDimension(10, 10);
  4145. this.setBackgroundColor(new draw2d.Color(100, 255, 0));
  4146. this.setZOrder(10000);
  4147. };
  4148. draw2d.LineStartResizeHandle.prototype = new draw2d.ResizeHandle();
  4149. draw2d.LineStartResizeHandle.prototype.type = "draw2d.LineStartResizeHandle";
  4150. draw2d.LineStartResizeHandle.prototype.onDragend = function() {
  4151. if (this.workflow.currentSelection instanceof draw2d.Connection) {
  4152. if (this.command !== null) {
  4153. this.command.cancel();
  4154. }
  4155. } else {
  4156. if (this.command !== null) {
  4157. this.getWorkflow().getCommandStack().execute(this.command);
  4158. }
  4159. }
  4160. this.command = null;
  4161. };
  4162. draw2d.LineStartResizeHandle.prototype.onDragstart = function(x, y) {
  4163. if (!this.canDrag) {
  4164. return false;
  4165. }
  4166. this.command = this.workflow.currentSelection
  4167. .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
  4168. return this.command !== null;
  4169. };
  4170. draw2d.LineStartResizeHandle.prototype.onDrag = function() {
  4171. var oldX = this.getX();
  4172. var oldY = this.getY();
  4173. draw2d.Rectangle.prototype.onDrag.call(this);
  4174. var diffX = oldX - this.getX();
  4175. var diffY = oldY - this.getY();
  4176. var _5b25 = this.workflow.currentSelection.getStartPoint();
  4177. var line = this.workflow.currentSelection;
  4178. line.setStartPoint(_5b25.x - diffX, _5b25.y - diffY);
  4179. line.isMoving = true;
  4180. };
  4181. draw2d.LineStartResizeHandle.prototype.onDrop = function(_5b27) {
  4182. var line = this.workflow.currentSelection;
  4183. line.isMoving = false;
  4184. if (line instanceof draw2d.Connection) {
  4185. this.command.setNewPorts(_5b27, line.getTarget());
  4186. this.getWorkflow().getCommandStack().execute(this.command);
  4187. }
  4188. this.command = null;
  4189. };
  4190. draw2d.LineEndResizeHandle = function(_58f5) {
  4191. draw2d.ResizeHandle.call(this, _58f5, 9);
  4192. this.setDimension(10, 10);
  4193. this.setBackgroundColor(new draw2d.Color(0, 255, 0));
  4194. this.setZOrder(10000);
  4195. };
  4196. draw2d.LineEndResizeHandle.prototype = new draw2d.ResizeHandle();
  4197. draw2d.LineEndResizeHandle.prototype.type = "draw2d.LineEndResizeHandle";
  4198. draw2d.LineEndResizeHandle.prototype.onDragend = function() {
  4199. if (this.workflow.currentSelection instanceof draw2d.Connection) {
  4200. if (this.command !== null) {
  4201. this.command.cancel();
  4202. }
  4203. } else {
  4204. if (this.command !== null) {
  4205. this.workflow.getCommandStack().execute(this.command);
  4206. }
  4207. }
  4208. this.command = null;
  4209. };
  4210. draw2d.LineEndResizeHandle.prototype.onDragstart = function(x, y) {
  4211. if (!this.canDrag) {
  4212. return false;
  4213. }
  4214. this.command = this.workflow.currentSelection
  4215. .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
  4216. return this.command !== null;
  4217. };
  4218. draw2d.LineEndResizeHandle.prototype.onDrag = function() {
  4219. var oldX = this.getX();
  4220. var oldY = this.getY();
  4221. draw2d.Rectangle.prototype.onDrag.call(this);
  4222. var diffX = oldX - this.getX();
  4223. var diffY = oldY - this.getY();
  4224. var _58fc = this.workflow.currentSelection.getEndPoint();
  4225. var line = this.workflow.currentSelection;
  4226. line.setEndPoint(_58fc.x - diffX, _58fc.y - diffY);
  4227. line.isMoving = true;
  4228. };
  4229. draw2d.LineEndResizeHandle.prototype.onDrop = function(_58fe) {
  4230. var line = this.workflow.currentSelection;
  4231. line.isMoving = false;
  4232. if (line instanceof draw2d.Connection) {
  4233. this.command.setNewPorts(line.getSource(), _58fe);
  4234. this.getWorkflow().getCommandStack().execute(this.command);
  4235. }
  4236. this.command = null;
  4237. };
  4238. draw2d.Canvas = function(_5020) {
  4239. try {
  4240. if (_5020) {
  4241. this.construct(_5020);
  4242. }
  4243. this.enableSmoothFigureHandling = false;
  4244. this.canvasLines = new draw2d.ArrayList();
  4245. } catch (e) {
  4246. pushErrorStack(e, "draw2d.Canvas=function(/*:String*/id)");
  4247. }
  4248. };
  4249. draw2d.Canvas.IMAGE_BASE_URL = "";
  4250. draw2d.Canvas.prototype.type = "draw2d.Canvas";
  4251. draw2d.Canvas.prototype.construct = function(_5021) {
  4252. this.canvasId = _5021;
  4253. this.html = document.getElementById(this.canvasId);
  4254. this.scrollArea = document.body.parentNode;
  4255. };
  4256. draw2d.Canvas.prototype.setViewPort = function(divId) {
  4257. this.scrollArea = document.getElementById(divId);
  4258. };
  4259. draw2d.Canvas.prototype.addFigure = function(_5023, xPos, yPos, _5026) {
  4260. try {
  4261. if (this.enableSmoothFigureHandling === true) {
  4262. if (_5023.timer <= 0) {
  4263. _5023.setAlpha(0.001);
  4264. }
  4265. var _5027 = _5023;
  4266. var _5028 = function() {
  4267. if (_5027.alpha < 1) {
  4268. _5027.setAlpha(Math.min(1, _5027.alpha + 0.05));
  4269. } else {
  4270. window.clearInterval(_5027.timer);
  4271. _5027.timer = -1;
  4272. }
  4273. };
  4274. if (_5027.timer > 0) {
  4275. window.clearInterval(_5027.timer);
  4276. }
  4277. _5027.timer = window.setInterval(_5028, 30);
  4278. }
  4279. _5023.setCanvas(this);
  4280. if (xPos && yPos) {
  4281. _5023.setPosition(xPos, yPos);
  4282. }
  4283. if (_5023 instanceof draw2d.Line) {
  4284. this.canvasLines.add(_5023);
  4285. this.html.appendChild(_5023.getHTMLElement());
  4286. } else {
  4287. var obj = this.canvasLines.getFirstElement();
  4288. if (obj === null) {
  4289. this.html.appendChild(_5023.getHTMLElement());
  4290. } else {
  4291. this.html.insertBefore(_5023.getHTMLElement(), obj
  4292. .getHTMLElement());
  4293. }
  4294. }
  4295. if (!_5026) {
  4296. _5023.paint();
  4297. }
  4298. } catch (e) {
  4299. pushErrorStack(
  4300. e,
  4301. "draw2d.Canvas.prototype.addFigure= function( /*:draw2d.Figure*/figure,/*:int*/ xPos,/*:int*/ yPos, /*:boolean*/ avoidPaint)");
  4302. }
  4303. };
  4304. draw2d.Canvas.prototype.removeFigure = function(_502a) {
  4305. if (this.enableSmoothFigureHandling === true) {
  4306. var oThis = this;
  4307. var _502c = _502a;
  4308. var _502d = function() {
  4309. if (_502c.alpha > 0) {
  4310. _502c.setAlpha(Math.max(0, _502c.alpha - 0.05));
  4311. } else {
  4312. window.clearInterval(_502c.timer);
  4313. _502c.timer = -1;
  4314. oThis.html.removeChild(_502c.html);
  4315. _502c.setCanvas(null);
  4316. }
  4317. };
  4318. if (_502c.timer > 0) {
  4319. window.clearInterval(_502c.timer);
  4320. }
  4321. _502c.timer = window.setInterval(_502d, 20);
  4322. } else {
  4323. this.html.removeChild(_502a.html);
  4324. _502a.setCanvas(null);
  4325. }
  4326. if (_502a instanceof draw2d.Line) {
  4327. this.canvasLines.remove(_502a);
  4328. }
  4329. };
  4330. draw2d.Canvas.prototype.getEnableSmoothFigureHandling = function() {
  4331. return this.enableSmoothFigureHandling;
  4332. };
  4333. draw2d.Canvas.prototype.setEnableSmoothFigureHandling = function(flag) {
  4334. this.enableSmoothFigureHandling = flag;
  4335. };
  4336. draw2d.Canvas.prototype.getWidth = function() {
  4337. return parseInt(this.html.style.width);
  4338. };
  4339. draw2d.Canvas.prototype.setWidth = function(width) {
  4340. if (this.scrollArea !== null) {
  4341. this.scrollArea.style.width = width + "px";
  4342. } else {
  4343. this.html.style.width = width + "px";
  4344. }
  4345. };
  4346. draw2d.Canvas.prototype.getHeight = function() {
  4347. return parseInt(this.html.style.height);
  4348. };
  4349. draw2d.Canvas.prototype.setHeight = function(_5030) {
  4350. if (this.scrollArea !== null) {
  4351. this.scrollArea.style.height = _5030 + "px";
  4352. } else {
  4353. this.html.style.height = _5030 + "px";
  4354. }
  4355. };
  4356. draw2d.Canvas.prototype.setBackgroundImage = function(_5031, _5032) {
  4357. if (_5031 !== null) {
  4358. if (_5032) {
  4359. this.html.style.background = "transparent url(" + _5031 + ") ";
  4360. } else {
  4361. this.html.style.background = "transparent url(" + _5031
  4362. + ") no-repeat";
  4363. }
  4364. } else {
  4365. this.html.style.background = "transparent";
  4366. }
  4367. };
  4368. draw2d.Canvas.prototype.getY = function() {
  4369. return this.y;
  4370. };
  4371. draw2d.Canvas.prototype.getX = function() {
  4372. return this.x;
  4373. };
  4374. draw2d.Canvas.prototype.getAbsoluteY = function() {
  4375. var el = this.html;
  4376. var ot = el.offsetTop;
  4377. while ((el = el.offsetParent) !== null) {
  4378. ot += el.offsetTop;
  4379. }
  4380. return ot;
  4381. };
  4382. draw2d.Canvas.prototype.getAbsoluteX = function() {
  4383. var el = this.html;
  4384. var ol = el.offsetLeft;
  4385. while ((el = el.offsetParent) !== null) {
  4386. ol += el.offsetLeft;
  4387. }
  4388. return ol;
  4389. };
  4390. draw2d.Canvas.prototype.getScrollLeft = function() {
  4391. return this.scrollArea.scrollLeft;
  4392. };
  4393. draw2d.Canvas.prototype.getScrollTop = function() {
  4394. return this.scrollArea.scrollTop;
  4395. };
  4396. draw2d.Workflow = function(id) {
  4397. try {
  4398. if (!id) {
  4399. return;
  4400. }
  4401. this.menu = null;
  4402. this.gridWidthX = 10;
  4403. this.gridWidthY = 10;
  4404. this.snapToGridHelper = null;
  4405. this.verticalSnapToHelperLine = null;
  4406. this.horizontalSnapToHelperLine = null;
  4407. this.snapToGeometryHelper = null;
  4408. this.figures = new draw2d.ArrayList();
  4409. this.lines = new draw2d.ArrayList();
  4410. this.commonPorts = new draw2d.ArrayList();
  4411. this.dropTargets = new draw2d.ArrayList();
  4412. this.compartments = new draw2d.ArrayList();
  4413. this.selectionListeners = new draw2d.ArrayList();
  4414. this.dialogs = new draw2d.ArrayList();
  4415. this.toolPalette = null;
  4416. this.dragging = false;
  4417. this.tooltip = null;
  4418. this.draggingLine = null;
  4419. this.draggingLineCommand = null;
  4420. this.commandStack = new draw2d.CommandStack();
  4421. this.oldScrollPosLeft = 0;
  4422. this.oldScrollPosTop = 0;
  4423. this.currentSelection = null;
  4424. this.currentMenu = null;
  4425. this.connectionLine = new draw2d.Line();
  4426. this.resizeHandleStart = new draw2d.LineStartResizeHandle(this);
  4427. this.resizeHandleEnd = new draw2d.LineEndResizeHandle(this);
  4428. this.resizeHandle1 = new draw2d.ResizeHandle(this, 1);
  4429. this.resizeHandle2 = new draw2d.ResizeHandle(this, 2);
  4430. this.resizeHandle3 = new draw2d.ResizeHandle(this, 3);
  4431. this.resizeHandle4 = new draw2d.ResizeHandle(this, 4);
  4432. this.resizeHandle5 = new draw2d.ResizeHandle(this, 5);
  4433. this.resizeHandle6 = new draw2d.ResizeHandle(this, 6);
  4434. this.resizeHandle7 = new draw2d.ResizeHandle(this, 7);
  4435. this.resizeHandle8 = new draw2d.ResizeHandle(this, 8);
  4436. this.resizeHandleHalfWidth = parseInt(this.resizeHandle2.getWidth() / 2);
  4437. draw2d.Canvas.call(this, id);
  4438. this.setPanning(false);
  4439. if (this.html !== null) {
  4440. this.html.style.backgroundImage = "url(grid_10.png)";
  4441. this.html.className = "Workflow";
  4442. oThis = this;
  4443. this.html.tabIndex = "0";
  4444. var _4a24 = function() {
  4445. var _4a25 = arguments[0] || window.event;
  4446. _4a25.cancelBubble = true;
  4447. _4a25.returnValue = false;
  4448. _4a25.stopped = true;
  4449. var diffX = _4a25.clientX;
  4450. var diffY = _4a25.clientY;
  4451. var _4a28 = oThis.getScrollLeft();
  4452. var _4a29 = oThis.getScrollTop();
  4453. var _4a2a = oThis.getAbsoluteX();
  4454. var _4a2b = oThis.getAbsoluteY();
  4455. var line = oThis.getBestLine(diffX + _4a28 - _4a2a, diffY
  4456. + _4a29 - _4a2b, null);
  4457. if (line !== null) {
  4458. line.onContextMenu(diffX + _4a28 - _4a2a, diffY + _4a29
  4459. - _4a2b);
  4460. } else {
  4461. oThis.onContextMenu(diffX + _4a28 - _4a2a, diffY + _4a29
  4462. - _4a2b);
  4463. }
  4464. };
  4465. this.html.oncontextmenu = function() {
  4466. return false;
  4467. };
  4468. var oThis = this;
  4469. var _4a2e = function(event) {
  4470. var ctrl = event.ctrlKey;
  4471. oThis.onKeyDown(event.keyCode, ctrl);
  4472. };
  4473. var _4a31 = function() {
  4474. var _4a32 = arguments[0] || window.event;
  4475. if (_4a32.returnValue == false) {
  4476. return;
  4477. }
  4478. var diffX = _4a32.clientX;
  4479. var diffY = _4a32.clientY;
  4480. var _4a35 = oThis.getScrollLeft();
  4481. var _4a36 = oThis.getScrollTop();
  4482. var _4a37 = oThis.getAbsoluteX();
  4483. var _4a38 = oThis.getAbsoluteY();
  4484. oThis.onMouseDown(diffX + _4a35 - _4a37, diffY + _4a36 - _4a38);
  4485. };
  4486. var _4a39 = function() {
  4487. var _4a3a = arguments[0] || window.event;
  4488. if (oThis.currentMenu !== null) {
  4489. oThis.removeFigure(oThis.currentMenu);
  4490. oThis.currentMenu = null;
  4491. }
  4492. if (_4a3a.button == 2) {
  4493. return;
  4494. }
  4495. var diffX = _4a3a.clientX;
  4496. var diffY = _4a3a.clientY;
  4497. var _4a3d = oThis.getScrollLeft();
  4498. var _4a3e = oThis.getScrollTop();
  4499. var _4a3f = oThis.getAbsoluteX();
  4500. var _4a40 = oThis.getAbsoluteY();
  4501. oThis.onMouseUp(diffX + _4a3d - _4a3f, diffY + _4a3e - _4a40);
  4502. };
  4503. var _4a41 = function() {
  4504. var _4a42 = arguments[0] || window.event;
  4505. var diffX = _4a42.clientX;
  4506. var diffY = _4a42.clientY;
  4507. var _4a45 = oThis.getScrollLeft();
  4508. var _4a46 = oThis.getScrollTop();
  4509. var _4a47 = oThis.getAbsoluteX();
  4510. var _4a48 = oThis.getAbsoluteY();
  4511. oThis.currentMouseX = diffX + _4a45 - _4a47;
  4512. oThis.currentMouseY = diffY + _4a46 - _4a48;
  4513. var obj = oThis.getBestFigure(oThis.currentMouseX,
  4514. oThis.currentMouseY);
  4515. if (draw2d.Drag.currentHover !== null && obj === null) {
  4516. var _4a4a = new draw2d.DragDropEvent();
  4517. _4a4a.initDragDropEvent("mouseleave", false, oThis);
  4518. draw2d.Drag.currentHover.dispatchEvent(_4a4a);
  4519. } else {
  4520. var diffX = _4a42.clientX;
  4521. var diffY = _4a42.clientY;
  4522. var _4a45 = oThis.getScrollLeft();
  4523. var _4a46 = oThis.getScrollTop();
  4524. var _4a47 = oThis.getAbsoluteX();
  4525. var _4a48 = oThis.getAbsoluteY();
  4526. oThis.onMouseMove(diffX + _4a45 - _4a47, diffY + _4a46
  4527. - _4a48);
  4528. }
  4529. if (obj === null) {
  4530. draw2d.Drag.currentHover = null;
  4531. }
  4532. if (oThis.tooltip !== null) {
  4533. if (Math.abs(oThis.currentTooltipX - oThis.currentMouseX) > 10
  4534. || Math.abs(oThis.currentTooltipY
  4535. - oThis.currentMouseY) > 10) {
  4536. oThis.showTooltip(null);
  4537. }
  4538. }
  4539. };
  4540. var _4a4b = function(_4a4c) {
  4541. var _4a4c = arguments[0] || window.event;
  4542. var diffX = _4a4c.clientX;
  4543. var diffY = _4a4c.clientY;
  4544. var _4a4f = oThis.getScrollLeft();
  4545. var _4a50 = oThis.getScrollTop();
  4546. var _4a51 = oThis.getAbsoluteX();
  4547. var _4a52 = oThis.getAbsoluteY();
  4548. var line = oThis.getBestLine(diffX + _4a4f - _4a51, diffY
  4549. + _4a50 - _4a52, null);
  4550. if (line !== null) {
  4551. line.onDoubleClick();
  4552. }
  4553. };
  4554. if (this.html.addEventListener) {
  4555. this.html.addEventListener("contextmenu", _4a24, false);
  4556. this.html.addEventListener("mousemove", _4a41, false);
  4557. this.html.addEventListener("mouseup", _4a39, false);
  4558. this.html.addEventListener("mousedown", _4a31, false);
  4559. this.html.addEventListener("keydown", _4a2e, false);
  4560. this.html.addEventListener("dblclick", _4a4b, false);
  4561. } else {
  4562. if (this.html.attachEvent) {
  4563. this.html.attachEvent("oncontextmenu", _4a24);
  4564. this.html.attachEvent("onmousemove", _4a41);
  4565. this.html.attachEvent("onmousedown", _4a31);
  4566. this.html.attachEvent("onmouseup", _4a39);
  4567. this.html.attachEvent("onkeydown", _4a2e);
  4568. this.html.attachEvent("ondblclick", _4a4b);
  4569. } else {
  4570. throw "Open-jACOB Draw2D not supported in this browser.";
  4571. }
  4572. }
  4573. }
  4574. } catch (e) {
  4575. pushErrorStack(e, "draw2d.Workflow=function(/*:String*/id)");
  4576. }
  4577. };
  4578. draw2d.Workflow.prototype = new draw2d.Canvas();
  4579. draw2d.Workflow.prototype.type = "draw2d.Workflow";
  4580. draw2d.Workflow.COLOR_GREEN = new draw2d.Color(0, 255, 0);
  4581. draw2d.Workflow.prototype.clear = function() {
  4582. this.scrollTo(0, 0, true);
  4583. this.gridWidthX = 10;
  4584. this.gridWidthY = 10;
  4585. this.snapToGridHelper = null;
  4586. this.verticalSnapToHelperLine = null;
  4587. this.horizontalSnapToHelperLine = null;
  4588. var _4a54 = this.getDocument();
  4589. var _4a55 = _4a54.getLines().clone();
  4590. for ( var i = 0; i < _4a55.getSize(); i++) {
  4591. (new draw2d.CommandDelete(_4a55.get(i))).execute();
  4592. }
  4593. var _4a57 = _4a54.getFigures().clone();
  4594. for ( var i = 0; i < _4a57.getSize(); i++) {
  4595. (new draw2d.CommandDelete(_4a57.get(i))).execute();
  4596. }
  4597. this.commonPorts.removeAllElements();
  4598. this.dropTargets.removeAllElements();
  4599. this.compartments.removeAllElements();
  4600. this.selectionListeners.removeAllElements();
  4601. this.dialogs.removeAllElements();
  4602. this.commandStack = new draw2d.CommandStack();
  4603. this.currentSelection = null;
  4604. this.currentMenu = null;
  4605. draw2d.Drag.clearCurrent();
  4606. };
  4607. draw2d.Workflow.prototype.onScroll = function() {
  4608. var _4a58 = this.getScrollLeft();
  4609. var _4a59 = this.getScrollTop();
  4610. var _4a5a = _4a58 - this.oldScrollPosLeft;
  4611. var _4a5b = _4a59 - this.oldScrollPosTop;
  4612. for ( var i = 0; i < this.figures.getSize(); i++) {
  4613. var _4a5d = this.figures.get(i);
  4614. if (_4a5d.hasFixedPosition && _4a5d.hasFixedPosition() == true) {
  4615. _4a5d.setPosition(_4a5d.getX() + _4a5a, _4a5d.getY() + _4a5b);
  4616. }
  4617. }
  4618. this.oldScrollPosLeft = _4a58;
  4619. this.oldScrollPosTop = _4a59;
  4620. };
  4621. draw2d.Workflow.prototype.setPanning = function(flag) {
  4622. this.panning = flag;
  4623. if (flag) {
  4624. this.html.style.cursor = "move";
  4625. } else {
  4626. this.html.style.cursor = "default";
  4627. }
  4628. };
  4629. draw2d.Workflow.prototype.scrollTo = function(x, y, fast) {
  4630. if (fast) {
  4631. this.scrollArea.scrollLeft = x;
  4632. this.scrollArea.scrollTop = y;
  4633. } else {
  4634. var steps = 40;
  4635. var xStep = (x - this.getScrollLeft()) / steps;
  4636. var yStep = (y - this.getScrollTop()) / steps;
  4637. var oldX = this.getScrollLeft();
  4638. var oldY = this.getScrollTop();
  4639. for ( var i = 0; i < steps; i++) {
  4640. this.scrollArea.scrollLeft = oldX + (xStep * i);
  4641. this.scrollArea.scrollTop = oldY + (yStep * i);
  4642. }
  4643. }
  4644. };
  4645. draw2d.Workflow.prototype.showTooltip = function(_4a68, _4a69) {
  4646. if (this.tooltip !== null) {
  4647. this.removeFigure(this.tooltip);
  4648. this.tooltip = null;
  4649. if (this.tooltipTimer >= 0) {
  4650. window.clearTimeout(this.tooltipTimer);
  4651. this.tooltipTimer = -1;
  4652. }
  4653. }
  4654. this.tooltip = _4a68;
  4655. if (this.tooltip !== null) {
  4656. this.currentTooltipX = this.currentMouseX;
  4657. this.currentTooltipY = this.currentMouseY;
  4658. this.addFigure(this.tooltip, this.currentTooltipX + 10,
  4659. this.currentTooltipY + 10);
  4660. var oThis = this;
  4661. var _4a6b = function() {
  4662. oThis.tooltipTimer = -1;
  4663. oThis.showTooltip(null);
  4664. };
  4665. if (_4a69 == true) {
  4666. this.tooltipTimer = window.setTimeout(_4a6b, 5000);
  4667. }
  4668. }
  4669. };
  4670. draw2d.Workflow.prototype.showDialog = function(_4a6c, xPos, yPos) {
  4671. if (xPos) {
  4672. this.addFigure(_4a6c, xPos, yPos);
  4673. } else {
  4674. this.addFigure(_4a6c, 200, 100);
  4675. }
  4676. this.dialogs.add(_4a6c);
  4677. };
  4678. draw2d.Workflow.prototype.showMenu = function(menu, xPos, yPos) {
  4679. if (this.menu !== null) {
  4680. this.html.removeChild(this.menu.getHTMLElement());
  4681. this.menu.setWorkflow();
  4682. }
  4683. this.menu = menu;
  4684. if (this.menu !== null) {
  4685. this.menu.setWorkflow(this);
  4686. this.menu.setPosition(xPos, yPos);
  4687. this.html.appendChild(this.menu.getHTMLElement());
  4688. this.menu.paint();
  4689. }
  4690. };
  4691. draw2d.Workflow.prototype.onContextMenu = function(x, y) {
  4692. var menu = this.getContextMenu();
  4693. if (menu !== null) {
  4694. this.showMenu(menu, x, y);
  4695. }
  4696. };
  4697. draw2d.Workflow.prototype.getContextMenu = function() {
  4698. return null;
  4699. };
  4700. draw2d.Workflow.prototype.setToolWindow = function(_4a75, x, y) {
  4701. this.toolPalette = _4a75;
  4702. if (y) {
  4703. this.addFigure(_4a75, x, y);
  4704. } else {
  4705. this.addFigure(_4a75, 20, 20);
  4706. }
  4707. this.dialogs.add(_4a75);
  4708. };
  4709. draw2d.Workflow.prototype.setSnapToGrid = function(flag) {
  4710. if (flag) {
  4711. this.snapToGridHelper = new draw2d.SnapToGrid(this);
  4712. } else {
  4713. this.snapToGridHelper = null;
  4714. }
  4715. };
  4716. draw2d.Workflow.prototype.setSnapToGeometry = function(flag) {
  4717. if (flag) {
  4718. this.snapToGeometryHelper = new draw2d.SnapToGeometry(this);
  4719. } else {
  4720. this.snapToGeometryHelper = null;
  4721. }
  4722. };
  4723. draw2d.Workflow.prototype.setGridWidth = function(dx, dy) {
  4724. this.gridWidthX = dx;
  4725. this.gridWidthY = dy;
  4726. };
  4727. draw2d.Workflow.prototype.addFigure = function(_4a7c, xPos, yPos) {
  4728. try {
  4729. draw2d.Canvas.prototype.addFigure.call(this, _4a7c, xPos, yPos, true);
  4730. _4a7c.setWorkflow(this);
  4731. var _4a7f = this;
  4732. if (_4a7c instanceof draw2d.CompartmentFigure) {
  4733. this.compartments.add(_4a7c);
  4734. }
  4735. if (_4a7c instanceof draw2d.Line) {
  4736. this.lines.add(_4a7c);
  4737. } else {
  4738. this.figures.add(_4a7c);
  4739. _4a7c.draggable.addEventListener("drag", function(_4a80) {
  4740. var _4a81 = _4a7f.getFigure(_4a80.target.element.id);
  4741. if (_4a81 === null) {
  4742. return;
  4743. }
  4744. if (_4a81.isSelectable() == false) {
  4745. return;
  4746. }
  4747. _4a7f.moveResizeHandles(_4a81);
  4748. });
  4749. }
  4750. _4a7c.paint();
  4751. this.setDocumentDirty();
  4752. } catch (e) {
  4753. pushErrorStack(
  4754. e,
  4755. "draw2d.Workflow.prototype.addFigure=function(/*:draw2d.Figure*/ figure ,/*:int*/ xPos, /*:int*/ yPos)");
  4756. }
  4757. };
  4758. draw2d.Workflow.prototype.removeFigure = function(_4a82) {
  4759. draw2d.Canvas.prototype.removeFigure.call(this, _4a82);
  4760. this.figures.remove(_4a82);
  4761. this.lines.remove(_4a82);
  4762. this.dialogs.remove(_4a82);
  4763. _4a82.setWorkflow(null);
  4764. if (_4a82 instanceof draw2d.CompartmentFigure) {
  4765. this.compartments.remove(_4a82);
  4766. }
  4767. if (_4a82 instanceof draw2d.Connection) {
  4768. _4a82.disconnect();
  4769. }
  4770. if (this.currentSelection == _4a82) {
  4771. this.setCurrentSelection(null);
  4772. }
  4773. this.setDocumentDirty();
  4774. _4a82.onRemove(this);
  4775. };
  4776. draw2d.Workflow.prototype.moveFront = function(_4a83) {
  4777. this.html.removeChild(_4a83.getHTMLElement());
  4778. this.html.appendChild(_4a83.getHTMLElement());
  4779. };
  4780. draw2d.Workflow.prototype.moveBack = function(_4a84) {
  4781. this.html.removeChild(_4a84.getHTMLElement());
  4782. this.html.insertBefore(_4a84.getHTMLElement(), this.html.firstChild);
  4783. };
  4784. draw2d.Workflow.prototype.getBestCompartmentFigure = function(x, y, _4a87) {
  4785. var _4a88 = null;
  4786. for ( var i = 0; i < this.figures.getSize(); i++) {
  4787. var _4a8a = this.figures.get(i);
  4788. if ((_4a8a instanceof draw2d.CompartmentFigure)
  4789. && _4a8a.isOver(x, y) == true && _4a8a != _4a87) {
  4790. if (_4a88 === null) {
  4791. _4a88 = _4a8a;
  4792. } else {
  4793. if (_4a88.getZOrder() < _4a8a.getZOrder()) {
  4794. _4a88 = _4a8a;
  4795. }
  4796. }
  4797. }
  4798. }
  4799. return _4a88;
  4800. };
  4801. draw2d.Workflow.prototype.getBestFigure = function(x, y, _4a8d) {
  4802. var _4a8e = null;
  4803. for ( var i = 0; i < this.figures.getSize(); i++) {
  4804. var _4a90 = this.figures.get(i);
  4805. if (_4a90.isOver(x, y) == true && _4a90 != _4a8d) {
  4806. if (_4a8e === null) {
  4807. _4a8e = _4a90;
  4808. } else {
  4809. if (_4a8e.getZOrder() < _4a90.getZOrder()) {
  4810. _4a8e = _4a90;
  4811. }
  4812. }
  4813. }
  4814. }
  4815. return _4a8e;
  4816. };
  4817. draw2d.Workflow.prototype.getBestLine = function(x, y, _4a93) {
  4818. var _4a94 = null;
  4819. var count = this.lines.getSize();
  4820. for ( var i = 0; i < count; i++) {
  4821. var line = this.lines.get(i);
  4822. if (line.containsPoint(x, y) == true && line != _4a93) {
  4823. if (_4a94 === null) {
  4824. _4a94 = line;
  4825. } else {
  4826. if (_4a94.getZOrder() < line.getZOrder()) {
  4827. _4a94 = line;
  4828. }
  4829. }
  4830. }
  4831. }
  4832. return _4a94;
  4833. };
  4834. draw2d.Workflow.prototype.getFigure = function(id) {
  4835. for ( var i = 0; i < this.figures.getSize(); i++) {
  4836. var _4a9a = this.figures.get(i);
  4837. if (_4a9a.id == id) {
  4838. return _4a9a;
  4839. }
  4840. }
  4841. return null;
  4842. };
  4843. draw2d.Workflow.prototype.getFigures = function() {
  4844. return this.figures;
  4845. };
  4846. draw2d.Workflow.prototype.getDocument = function() {
  4847. return new draw2d.CanvasDocument(this);
  4848. };
  4849. draw2d.Workflow.prototype.addSelectionListener = function(w) {
  4850. if (w !== null) {
  4851. if (w.onSelectionChanged) {
  4852. this.selectionListeners.add(w);
  4853. } else {
  4854. throw "Object doesn't implement required callback method [onSelectionChanged]";
  4855. }
  4856. }
  4857. };
  4858. draw2d.Workflow.prototype.removeSelectionListener = function(w) {
  4859. this.selectionListeners.remove(w);
  4860. };
  4861. draw2d.Workflow.prototype.setCurrentSelection = function(_4a9d) {
  4862. if (_4a9d === null || this.currentSelection != _4a9d) {
  4863. this.hideResizeHandles();
  4864. this.hideLineResizeHandles();
  4865. }
  4866. this.currentSelection = _4a9d;
  4867. for ( var i = 0; i < this.selectionListeners.getSize(); i++) {
  4868. var w = this.selectionListeners.get(i);
  4869. if (w.onSelectionChanged) {
  4870. w.onSelectionChanged(this.currentSelection,
  4871. this.currentSelection ? this.currentSelection.getModel()
  4872. : null);
  4873. }
  4874. }
  4875. if (_4a9d instanceof draw2d.Line) {
  4876. this.showLineResizeHandles(_4a9d);
  4877. if (!(_4a9d instanceof draw2d.Connection)) {
  4878. this.draggingLineCommand = line
  4879. .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
  4880. if (this.draggingLineCommand !== null) {
  4881. this.draggingLine = _4a9d;
  4882. }
  4883. }
  4884. }
  4885. };
  4886. draw2d.Workflow.prototype.getCurrentSelection = function() {
  4887. return this.currentSelection;
  4888. };
  4889. draw2d.Workflow.prototype.getLine = function(id) {
  4890. var count = this.lines.getSize();
  4891. for ( var i = 0; i < count; i++) {
  4892. var line = this.lines.get(i);
  4893. if (line.getId() == id) {
  4894. return line;
  4895. }
  4896. }
  4897. return null;
  4898. };
  4899. draw2d.Workflow.prototype.getLines = function() {
  4900. return this.lines;
  4901. };
  4902. draw2d.Workflow.prototype.registerPort = function(port) {
  4903. port.draggable.targets = this.dropTargets;
  4904. this.commonPorts.add(port);
  4905. this.dropTargets.add(port.dropable);
  4906. };
  4907. draw2d.Workflow.prototype.unregisterPort = function(port) {
  4908. port.draggable.targets = null;
  4909. this.commonPorts.remove(port);
  4910. this.dropTargets.remove(port.dropable);
  4911. };
  4912. draw2d.Workflow.prototype.getCommandStack = function() {
  4913. return this.commandStack;
  4914. };
  4915. draw2d.Workflow.prototype.showConnectionLine = function(x1, y1, x2, y2) {
  4916. this.connectionLine.setStartPoint(x1, y1);
  4917. this.connectionLine.setEndPoint(x2, y2);
  4918. if (this.connectionLine.canvas === null) {
  4919. draw2d.Canvas.prototype.addFigure.call(this, this.connectionLine);
  4920. }
  4921. };
  4922. draw2d.Workflow.prototype.hideConnectionLine = function() {
  4923. if (this.connectionLine.canvas !== null) {
  4924. draw2d.Canvas.prototype.removeFigure.call(this, this.connectionLine);
  4925. }
  4926. };
  4927. draw2d.Workflow.prototype.showLineResizeHandles = function(_4aaa) {
  4928. var _4aab = this.resizeHandleStart.getWidth() / 2;
  4929. var _4aac = this.resizeHandleStart.getHeight() / 2;
  4930. var _4aad = _4aaa.getStartPoint();
  4931. var _4aae = _4aaa.getEndPoint();
  4932. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandleStart,
  4933. _4aad.x - _4aab, _4aad.y - _4aab);
  4934. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandleEnd, _4aae.x
  4935. - _4aab, _4aae.y - _4aab);
  4936. this.resizeHandleStart.setCanDrag(_4aaa.isResizeable());
  4937. this.resizeHandleEnd.setCanDrag(_4aaa.isResizeable());
  4938. if (_4aaa.isResizeable()) {
  4939. this.resizeHandleStart.setBackgroundColor(draw2d.Workflow.COLOR_GREEN);
  4940. this.resizeHandleEnd.setBackgroundColor(draw2d.Workflow.COLOR_GREEN);
  4941. this.resizeHandleStart.draggable.targets = this.dropTargets;
  4942. this.resizeHandleEnd.draggable.targets = this.dropTargets;
  4943. } else {
  4944. this.resizeHandleStart.setBackgroundColor(null);
  4945. this.resizeHandleEnd.setBackgroundColor(null);
  4946. }
  4947. };
  4948. draw2d.Workflow.prototype.hideLineResizeHandles = function() {
  4949. if (this.resizeHandleStart.canvas !== null) {
  4950. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandleStart);
  4951. }
  4952. if (this.resizeHandleEnd.canvas !== null) {
  4953. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandleEnd);
  4954. }
  4955. };
  4956. draw2d.Workflow.prototype.showResizeHandles = function(_4aaf) {
  4957. this.hideLineResizeHandles();
  4958. this.hideResizeHandles();
  4959. if (this.getEnableSmoothFigureHandling() == true
  4960. && this.getCurrentSelection() != _4aaf) {
  4961. this.resizeHandle1.setAlpha(0.01);
  4962. this.resizeHandle2.setAlpha(0.01);
  4963. this.resizeHandle3.setAlpha(0.01);
  4964. this.resizeHandle4.setAlpha(0.01);
  4965. this.resizeHandle5.setAlpha(0.01);
  4966. this.resizeHandle6.setAlpha(0.01);
  4967. this.resizeHandle7.setAlpha(0.01);
  4968. this.resizeHandle8.setAlpha(0.01);
  4969. }
  4970. var _4ab0 = this.resizeHandle1.getWidth();
  4971. var _4ab1 = this.resizeHandle1.getHeight();
  4972. var _4ab2 = _4aaf.getHeight();
  4973. var _4ab3 = _4aaf.getWidth();
  4974. var xPos = _4aaf.getX();
  4975. var yPos = _4aaf.getY();
  4976. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle1, xPos
  4977. - _4ab0, yPos - _4ab1);
  4978. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle3, xPos
  4979. + _4ab3, yPos - _4ab1);
  4980. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle5, xPos
  4981. + _4ab3, yPos + _4ab2);
  4982. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle7, xPos
  4983. - _4ab0, yPos + _4ab2);
  4984. this.moveFront(this.resizeHandle1);
  4985. this.moveFront(this.resizeHandle3);
  4986. this.moveFront(this.resizeHandle5);
  4987. this.moveFront(this.resizeHandle7);
  4988. this.resizeHandle1.setCanDrag(_4aaf.isResizeable());
  4989. this.resizeHandle3.setCanDrag(_4aaf.isResizeable());
  4990. this.resizeHandle5.setCanDrag(_4aaf.isResizeable());
  4991. this.resizeHandle7.setCanDrag(_4aaf.isResizeable());
  4992. if (_4aaf.isResizeable()) {
  4993. var green = new draw2d.Color(0, 255, 0);
  4994. this.resizeHandle1.setBackgroundColor(green);
  4995. this.resizeHandle3.setBackgroundColor(green);
  4996. this.resizeHandle5.setBackgroundColor(green);
  4997. this.resizeHandle7.setBackgroundColor(green);
  4998. } else {
  4999. this.resizeHandle1.setBackgroundColor(null);
  5000. this.resizeHandle3.setBackgroundColor(null);
  5001. this.resizeHandle5.setBackgroundColor(null);
  5002. this.resizeHandle7.setBackgroundColor(null);
  5003. }
  5004. if (_4aaf.isStrechable() && _4aaf.isResizeable()) {
  5005. this.resizeHandle2.setCanDrag(_4aaf.isResizeable());
  5006. this.resizeHandle4.setCanDrag(_4aaf.isResizeable());
  5007. this.resizeHandle6.setCanDrag(_4aaf.isResizeable());
  5008. this.resizeHandle8.setCanDrag(_4aaf.isResizeable());
  5009. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle2, xPos
  5010. + (_4ab3 / 2) - this.resizeHandleHalfWidth, yPos - _4ab1);
  5011. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle4, xPos
  5012. + _4ab3, yPos + (_4ab2 / 2) - (_4ab1 / 2));
  5013. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle6, xPos
  5014. + (_4ab3 / 2) - this.resizeHandleHalfWidth, yPos + _4ab2);
  5015. draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle8, xPos
  5016. - _4ab0, yPos + (_4ab2 / 2) - (_4ab1 / 2));
  5017. this.moveFront(this.resizeHandle2);
  5018. this.moveFront(this.resizeHandle4);
  5019. this.moveFront(this.resizeHandle6);
  5020. this.moveFront(this.resizeHandle8);
  5021. }
  5022. };
  5023. draw2d.Workflow.prototype.hideResizeHandles = function() {
  5024. if (this.resizeHandle1.canvas !== null) {
  5025. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle1);
  5026. }
  5027. if (this.resizeHandle2.canvas !== null) {
  5028. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle2);
  5029. }
  5030. if (this.resizeHandle3.canvas !== null) {
  5031. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle3);
  5032. }
  5033. if (this.resizeHandle4.canvas !== null) {
  5034. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle4);
  5035. }
  5036. if (this.resizeHandle5.canvas !== null) {
  5037. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle5);
  5038. }
  5039. if (this.resizeHandle6.canvas !== null) {
  5040. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle6);
  5041. }
  5042. if (this.resizeHandle7.canvas !== null) {
  5043. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle7);
  5044. }
  5045. if (this.resizeHandle8.canvas !== null) {
  5046. draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle8);
  5047. }
  5048. };
  5049. draw2d.Workflow.prototype.moveResizeHandles = function(_4ab7) {
  5050. var _4ab8 = this.resizeHandle1.getWidth();
  5051. var _4ab9 = this.resizeHandle1.getHeight();
  5052. var _4aba = _4ab7.getHeight();
  5053. var _4abb = _4ab7.getWidth();
  5054. var xPos = _4ab7.getX();
  5055. var yPos = _4ab7.getY();
  5056. this.resizeHandle1.setPosition(xPos - _4ab8, yPos - _4ab9);
  5057. this.resizeHandle3.setPosition(xPos + _4abb, yPos - _4ab9);
  5058. this.resizeHandle5.setPosition(xPos + _4abb, yPos + _4aba);
  5059. this.resizeHandle7.setPosition(xPos - _4ab8, yPos + _4aba);
  5060. if (_4ab7.isStrechable()) {
  5061. this.resizeHandle2.setPosition(xPos + (_4abb / 2)
  5062. - this.resizeHandleHalfWidth, yPos - _4ab9);
  5063. this.resizeHandle4.setPosition(xPos + _4abb, yPos + (_4aba / 2)
  5064. - (_4ab9 / 2));
  5065. this.resizeHandle6.setPosition(xPos + (_4abb / 2)
  5066. - this.resizeHandleHalfWidth, yPos + _4aba);
  5067. this.resizeHandle8.setPosition(xPos - _4ab8, yPos + (_4aba / 2)
  5068. - (_4ab9 / 2));
  5069. }
  5070. };
  5071. draw2d.Workflow.prototype.onMouseDown = function(x, y) {
  5072. this.dragging = true;
  5073. this.mouseDownPosX = x;
  5074. this.mouseDownPosY = y;
  5075. if (this.toolPalette !== null && this.toolPalette.getActiveTool() !== null) {
  5076. this.toolPalette.getActiveTool().execute(x, y);
  5077. }
  5078. this.showMenu(null);
  5079. var line = this.getBestLine(x, y);
  5080. if (line !== null && line.isSelectable()) {
  5081. this.setCurrentSelection(line);
  5082. } else {
  5083. this.setCurrentSelection(null);
  5084. }
  5085. };
  5086. draw2d.Workflow.prototype.onMouseUp = function(x, y) {
  5087. this.dragging = false;
  5088. if (this.draggingLineCommand !== null) {
  5089. this.getCommandStack().execute(this.draggingLineCommand);
  5090. this.draggingLine = null;
  5091. this.draggingLineCommand = null;
  5092. }
  5093. };
  5094. draw2d.Workflow.prototype.onMouseMove = function(x, y) {
  5095. if (this.dragging === true && this.draggingLine !== null) {
  5096. var diffX = x - this.mouseDownPosX;
  5097. var diffY = y - this.mouseDownPosY;
  5098. this.draggingLine.startX = this.draggingLine.getStartX() + diffX;
  5099. this.draggingLine.startY = this.draggingLine.getStartY() + diffY;
  5100. this.draggingLine.setEndPoint(this.draggingLine.getEndX() + diffX,
  5101. this.draggingLine.getEndY() + diffY);
  5102. this.mouseDownPosX = x;
  5103. this.mouseDownPosY = y;
  5104. this.showLineResizeHandles(this.currentSelection);
  5105. } else {
  5106. if (this.dragging === true && this.panning === true) {
  5107. var diffX = x - this.mouseDownPosX;
  5108. var diffY = y - this.mouseDownPosY;
  5109. this.scrollTo(this.getScrollLeft() - diffX, this.getScrollTop()
  5110. - diffY, true);
  5111. this.onScroll();
  5112. }
  5113. }
  5114. };
  5115. draw2d.Workflow.prototype.onKeyDown = function(_4ac7, ctrl) {
  5116. if (_4ac7 == 46 && this.currentSelection !== null) {
  5117. this.commandStack
  5118. .execute(this.currentSelection
  5119. .createCommand(new draw2d.EditPolicy(
  5120. draw2d.EditPolicy.DELETE)));
  5121. } else {
  5122. if (_4ac7 == 90 && ctrl) {
  5123. this.commandStack.undo();
  5124. } else {
  5125. if (_4ac7 == 89 && ctrl) {
  5126. this.commandStack.redo();
  5127. }
  5128. }
  5129. }
  5130. };
  5131. draw2d.Workflow.prototype.setDocumentDirty = function() {
  5132. try {
  5133. for ( var i = 0; i < this.dialogs.getSize(); i++) {
  5134. var d = this.dialogs.get(i);
  5135. if (d !== null && d.onSetDocumentDirty) {
  5136. d.onSetDocumentDirty();
  5137. }
  5138. }
  5139. if (this.snapToGeometryHelper !== null) {
  5140. this.snapToGeometryHelper.onSetDocumentDirty();
  5141. }
  5142. if (this.snapToGridHelper !== null) {
  5143. this.snapToGridHelper.onSetDocumentDirty();
  5144. }
  5145. } catch (e) {
  5146. pushErrorStack(e,
  5147. "draw2d.Workflow.prototype.setDocumentDirty=function()");
  5148. }
  5149. };
  5150. draw2d.Workflow.prototype.snapToHelper = function(_4acb, pos) {
  5151. if (this.snapToGeometryHelper !== null) {
  5152. if (_4acb instanceof draw2d.ResizeHandle) {
  5153. var _4acd = _4acb.getSnapToGridAnchor();
  5154. pos.x += _4acd.x;
  5155. pos.y += _4acd.y;
  5156. var _4ace = new draw2d.Point(pos.x, pos.y);
  5157. var _4acf = _4acb.getSnapToDirection();
  5158. var _4ad0 = this.snapToGeometryHelper.snapPoint(_4acf, pos, _4ace);
  5159. if ((_4acf & draw2d.SnapToHelper.EAST_WEST)
  5160. && !(_4ad0 & draw2d.SnapToHelper.EAST_WEST)) {
  5161. this.showSnapToHelperLineVertical(_4ace.x);
  5162. } else {
  5163. this.hideSnapToHelperLineVertical();
  5164. }
  5165. if ((_4acf & draw2d.SnapToHelper.NORTH_SOUTH)
  5166. && !(_4ad0 & draw2d.SnapToHelper.NORTH_SOUTH)) {
  5167. this.showSnapToHelperLineHorizontal(_4ace.y);
  5168. } else {
  5169. this.hideSnapToHelperLineHorizontal();
  5170. }
  5171. _4ace.x -= _4acd.x;
  5172. _4ace.y -= _4acd.y;
  5173. return _4ace;
  5174. } else {
  5175. var _4ad1 = new draw2d.Dimension(pos.x, pos.y, _4acb.getWidth(),
  5176. _4acb.getHeight());
  5177. var _4ace = new draw2d.Dimension(pos.x, pos.y, _4acb.getWidth(),
  5178. _4acb.getHeight());
  5179. var _4acf = draw2d.SnapToHelper.NSEW;
  5180. var _4ad0 = this.snapToGeometryHelper.snapRectangle(_4ad1, _4ace);
  5181. if ((_4acf & draw2d.SnapToHelper.WEST)
  5182. && !(_4ad0 & draw2d.SnapToHelper.WEST)) {
  5183. this.showSnapToHelperLineVertical(_4ace.x);
  5184. } else {
  5185. if ((_4acf & draw2d.SnapToHelper.EAST)
  5186. && !(_4ad0 & draw2d.SnapToHelper.EAST)) {
  5187. this.showSnapToHelperLineVertical(_4ace.getX()
  5188. + _4ace.getWidth());
  5189. } else {
  5190. this.hideSnapToHelperLineVertical();
  5191. }
  5192. }
  5193. if ((_4acf & draw2d.SnapToHelper.NORTH)
  5194. && !(_4ad0 & draw2d.SnapToHelper.NORTH)) {
  5195. this.showSnapToHelperLineHorizontal(_4ace.y);
  5196. } else {
  5197. if ((_4acf & draw2d.SnapToHelper.SOUTH)
  5198. && !(_4ad0 & draw2d.SnapToHelper.SOUTH)) {
  5199. this.showSnapToHelperLineHorizontal(_4ace.getY()
  5200. + _4ace.getHeight());
  5201. } else {
  5202. this.hideSnapToHelperLineHorizontal();
  5203. }
  5204. }
  5205. return _4ace.getTopLeft();
  5206. }
  5207. } else {
  5208. if (this.snapToGridHelper !== null) {
  5209. var _4acd = _4acb.getSnapToGridAnchor();
  5210. pos.x = pos.x + _4acd.x;
  5211. pos.y = pos.y + _4acd.y;
  5212. var _4ace = new draw2d.Point(pos.x, pos.y);
  5213. this.snapToGridHelper.snapPoint(0, pos, _4ace);
  5214. _4ace.x = _4ace.x - _4acd.x;
  5215. _4ace.y = _4ace.y - _4acd.y;
  5216. return _4ace;
  5217. }
  5218. }
  5219. return pos;
  5220. };
  5221. draw2d.Workflow.prototype.showSnapToHelperLineHorizontal = function(_4ad2) {
  5222. if (this.horizontalSnapToHelperLine === null) {
  5223. this.horizontalSnapToHelperLine = new draw2d.Line();
  5224. this.horizontalSnapToHelperLine
  5225. .setColor(new draw2d.Color(175, 175, 255));
  5226. this.addFigure(this.horizontalSnapToHelperLine);
  5227. }
  5228. this.horizontalSnapToHelperLine.setStartPoint(0, _4ad2);
  5229. this.horizontalSnapToHelperLine.setEndPoint(this.getWidth(), _4ad2);
  5230. };
  5231. draw2d.Workflow.prototype.showSnapToHelperLineVertical = function(_4ad3) {
  5232. if (this.verticalSnapToHelperLine === null) {
  5233. this.verticalSnapToHelperLine = new draw2d.Line();
  5234. this.verticalSnapToHelperLine.setColor(new draw2d.Color(175, 175, 255));
  5235. this.addFigure(this.verticalSnapToHelperLine);
  5236. }
  5237. this.verticalSnapToHelperLine.setStartPoint(_4ad3, 0);
  5238. this.verticalSnapToHelperLine.setEndPoint(_4ad3, this.getHeight());
  5239. };
  5240. draw2d.Workflow.prototype.hideSnapToHelperLines = function() {
  5241. this.hideSnapToHelperLineHorizontal();
  5242. this.hideSnapToHelperLineVertical();
  5243. };
  5244. draw2d.Workflow.prototype.hideSnapToHelperLineHorizontal = function() {
  5245. if (this.horizontalSnapToHelperLine !== null) {
  5246. this.removeFigure(this.horizontalSnapToHelperLine);
  5247. this.horizontalSnapToHelperLine = null;
  5248. }
  5249. };
  5250. draw2d.Workflow.prototype.hideSnapToHelperLineVertical = function() {
  5251. if (this.verticalSnapToHelperLine !== null) {
  5252. this.removeFigure(this.verticalSnapToHelperLine);
  5253. this.verticalSnapToHelperLine = null;
  5254. }
  5255. };
  5256. draw2d.WindowFigure = function(title) {
  5257. this.title = title;
  5258. this.titlebar = null;
  5259. draw2d.Figure.call(this);
  5260. this.setDeleteable(false);
  5261. this.setCanSnapToHelper(false);
  5262. this.setZOrder(draw2d.WindowFigure.ZOrderIndex);
  5263. };
  5264. draw2d.WindowFigure.prototype = new draw2d.Figure();
  5265. draw2d.WindowFigure.prototype.type = ":draw2d.WindowFigure";
  5266. draw2d.WindowFigure.ZOrderIndex = 50000;
  5267. draw2d.WindowFigure.setZOrderBaseIndex = function(index) {
  5268. draw2d.WindowFigure.ZOrderBaseIndex = index;
  5269. };
  5270. draw2d.WindowFigure.prototype.hasFixedPosition = function() {
  5271. return true;
  5272. };
  5273. draw2d.WindowFigure.prototype.hasTitleBar = function() {
  5274. return true;
  5275. };
  5276. draw2d.WindowFigure.prototype.createHTMLElement = function() {
  5277. var item = draw2d.Figure.prototype.createHTMLElement.call(this);
  5278. item.style.margin = "0px";
  5279. item.style.padding = "0px";
  5280. item.style.border = "1px solid black";
  5281. item.style.backgroundImage = "url(window_bg.png)";
  5282. item.style.zIndex = draw2d.WindowFigure.ZOrderIndex;
  5283. item.style.cursor = null;
  5284. item.className = "WindowFigure";
  5285. if (this.hasTitleBar()) {
  5286. this.titlebar = document.createElement("div");
  5287. this.titlebar.style.position = "absolute";
  5288. this.titlebar.style.left = "0px";
  5289. this.titlebar.style.top = "0px";
  5290. this.titlebar.style.width = this.getWidth() + "px";
  5291. this.titlebar.style.height = "15px";
  5292. this.titlebar.style.margin = "0px";
  5293. this.titlebar.style.padding = "0px";
  5294. this.titlebar.style.font = "normal 10px verdana";
  5295. this.titlebar.style.backgroundColor = "blue";
  5296. this.titlebar.style.borderBottom = "2px solid gray";
  5297. this.titlebar.style.whiteSpace = "nowrap";
  5298. this.titlebar.style.textAlign = "center";
  5299. this.titlebar.style.backgroundImage = "url(window_toolbar.png)";
  5300. this.titlebar.className = "WindowFigure_titlebar";
  5301. this.textNode = document.createTextNode(this.title);
  5302. this.titlebar.appendChild(this.textNode);
  5303. this.disableTextSelection(this.titlebar);
  5304. item.appendChild(this.titlebar);
  5305. }
  5306. return item;
  5307. };
  5308. draw2d.WindowFigure.prototype.setDocumentDirty = function(_566d) {
  5309. };
  5310. draw2d.WindowFigure.prototype.onDragend = function() {
  5311. };
  5312. draw2d.WindowFigure.prototype.onDragstart = function(x, y) {
  5313. if (this.titlebar === null) {
  5314. return false;
  5315. }
  5316. if (this.canDrag === true && x < parseInt(this.titlebar.style.width)
  5317. && y < parseInt(this.titlebar.style.height)) {
  5318. return true;
  5319. }
  5320. return false;
  5321. };
  5322. draw2d.WindowFigure.prototype.isSelectable = function() {
  5323. return false;
  5324. };
  5325. draw2d.WindowFigure.prototype.setCanDrag = function(flag) {
  5326. draw2d.Figure.prototype.setCanDrag.call(this, flag);
  5327. this.html.style.cursor = "";
  5328. if (this.titlebar === null) {
  5329. return;
  5330. }
  5331. if (flag) {
  5332. this.titlebar.style.cursor = "move";
  5333. } else {
  5334. this.titlebar.style.cursor = "";
  5335. }
  5336. };
  5337. draw2d.WindowFigure.prototype.setWorkflow = function(_5671) {
  5338. var _5672 = this.workflow;
  5339. draw2d.Figure.prototype.setWorkflow.call(this, _5671);
  5340. if (_5672 !== null) {
  5341. _5672.removeSelectionListener(this);
  5342. }
  5343. if (this.workflow !== null) {
  5344. this.workflow.addSelectionListener(this);
  5345. }
  5346. };
  5347. draw2d.WindowFigure.prototype.setDimension = function(w, h) {
  5348. draw2d.Figure.prototype.setDimension.call(this, w, h);
  5349. if (this.titlebar !== null) {
  5350. this.titlebar.style.width = this.getWidth() + "px";
  5351. }
  5352. };
  5353. draw2d.WindowFigure.prototype.setTitle = function(title) {
  5354. this.title = title;
  5355. };
  5356. draw2d.WindowFigure.prototype.getMinWidth = function() {
  5357. return 50;
  5358. };
  5359. draw2d.WindowFigure.prototype.getMinHeight = function() {
  5360. return 50;
  5361. };
  5362. draw2d.WindowFigure.prototype.isResizeable = function() {
  5363. return false;
  5364. };
  5365. draw2d.WindowFigure.prototype.setAlpha = function(_5676) {
  5366. };
  5367. draw2d.WindowFigure.prototype.setBackgroundColor = function(color) {
  5368. this.bgColor = color;
  5369. if (this.bgColor !== null) {
  5370. this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
  5371. } else {
  5372. this.html.style.backgroundColor = "transparent";
  5373. this.html.style.backgroundImage = "";
  5374. }
  5375. };
  5376. draw2d.WindowFigure.prototype.setColor = function(color) {
  5377. this.lineColor = color;
  5378. if (this.lineColor !== null) {
  5379. this.html.style.border = this.lineStroke + "px solid "
  5380. + this.lineColor.getHTMLStyle();
  5381. } else {
  5382. this.html.style.border = "0px";
  5383. }
  5384. };
  5385. draw2d.WindowFigure.prototype.setLineWidth = function(w) {
  5386. this.lineStroke = w;
  5387. this.html.style.border = this.lineStroke + "px solid black";
  5388. };
  5389. draw2d.WindowFigure.prototype.onSelectionChanged = function(_567a, model) {
  5390. };
  5391. draw2d.Button = function(_5544, width, _5546) {
  5392. this.x = 0;
  5393. this.y = 0;
  5394. this.width = 24;
  5395. this.height = 24;
  5396. this.id = draw2d.UUID.create();
  5397. this.enabled = true;
  5398. this.active = false;
  5399. this.palette = _5544;
  5400. this.html = this.createHTMLElement();
  5401. if (width !== undefined && _5546 !== undefined) {
  5402. this.setDimension(width, _5546);
  5403. } else {
  5404. this.setDimension(24, 24);
  5405. }
  5406. };
  5407. draw2d.Button.prototype.type = "draw2d.Button";
  5408. draw2d.Button.prototype.dispose = function() {
  5409. };
  5410. draw2d.Button.prototype.getImageUrl = function() {
  5411. return this.type + ".png";
  5412. };
  5413. draw2d.Button.prototype.createHTMLElement = function() {
  5414. var item = document.createElement("div");
  5415. item.id = this.id;
  5416. item.style.position = "absolute";
  5417. item.style.left = this.x + "px";
  5418. item.style.top = this.y + "px";
  5419. item.style.height = this.width + "px";
  5420. item.style.width = this.height + "px";
  5421. item.style.margin = "0px";
  5422. item.style.padding = "0px";
  5423. item.style.outline = "none";
  5424. if (this.getImageUrl() !== null) {
  5425. item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
  5426. } else {
  5427. item.style.backgroundImage = "";
  5428. }
  5429. var oThis = this;
  5430. this.omousedown = function(event) {
  5431. if (oThis.enabled) {
  5432. oThis.setActive(true);
  5433. }
  5434. event.cancelBubble = true;
  5435. event.returnValue = false;
  5436. };
  5437. this.omouseup = function(event) {
  5438. if (oThis.enabled) {
  5439. oThis.setActive(false);
  5440. oThis.execute();
  5441. oThis.palette.setActiveTool(null);
  5442. }
  5443. event.cancelBubble = true;
  5444. event.returnValue = false;
  5445. };
  5446. if (item.addEventListener) {
  5447. item.addEventListener("mousedown", this.omousedown, false);
  5448. item.addEventListener("mouseup", this.omouseup, false);
  5449. } else {
  5450. if (item.attachEvent) {
  5451. item.attachEvent("onmousedown", this.omousedown);
  5452. item.attachEvent("onmouseup", this.omouseup);
  5453. }
  5454. }
  5455. return item;
  5456. };
  5457. draw2d.Button.prototype.getHTMLElement = function() {
  5458. if (this.html === null) {
  5459. this.html = this.createHTMLElement();
  5460. }
  5461. return this.html;
  5462. };
  5463. draw2d.Button.prototype.execute = function() {
  5464. };
  5465. draw2d.Button.prototype.setTooltip = function(_554b) {
  5466. this.tooltip = _554b;
  5467. if (this.tooltip !== null) {
  5468. this.html.title = this.tooltip;
  5469. } else {
  5470. this.html.title = "";
  5471. }
  5472. };
  5473. draw2d.Button.prototype.getWorkflow = function() {
  5474. return this.getToolPalette().getWorkflow();
  5475. };
  5476. draw2d.Button.prototype.getToolPalette = function() {
  5477. return this.palette;
  5478. };
  5479. draw2d.Button.prototype.setActive = function(flag) {
  5480. if (!this.enabled) {
  5481. return;
  5482. }
  5483. this.active = flag;
  5484. if (flag === true) {
  5485. this.html.style.border = "1px inset";
  5486. } else {
  5487. this.html.style.border = "0px";
  5488. }
  5489. };
  5490. draw2d.Button.prototype.isActive = function() {
  5491. return this.active;
  5492. };
  5493. draw2d.Button.prototype.setEnabled = function(flag) {
  5494. this.enabled = flag;
  5495. if (flag) {
  5496. this.html.style.filter = "alpha(opacity=100)";
  5497. this.html.style.opacity = "1.0";
  5498. } else {
  5499. this.html.style.filter = "alpha(opacity=30)";
  5500. this.html.style.opacity = "0.3";
  5501. }
  5502. };
  5503. draw2d.Button.prototype.setDimension = function(w, h) {
  5504. this.width = w;
  5505. this.height = h;
  5506. if (this.html === null) {
  5507. return;
  5508. }
  5509. this.html.style.width = this.width + "px";
  5510. this.html.style.height = this.height + "px";
  5511. };
  5512. draw2d.Button.prototype.setPosition = function(xPos, yPos) {
  5513. this.x = Math.max(0, xPos);
  5514. this.y = Math.max(0, yPos);
  5515. if (this.html === null) {
  5516. return;
  5517. }
  5518. this.html.style.left = this.x + "px";
  5519. this.html.style.top = this.y + "px";
  5520. };
  5521. draw2d.Button.prototype.getWidth = function() {
  5522. return this.width;
  5523. };
  5524. draw2d.Button.prototype.getHeight = function() {
  5525. return this.height;
  5526. };
  5527. draw2d.Button.prototype.getY = function() {
  5528. return this.y;
  5529. };
  5530. draw2d.Button.prototype.getX = function() {
  5531. return this.x;
  5532. };
  5533. draw2d.Button.prototype.getPosition = function() {
  5534. return new draw2d.Point(this.x, this.y);
  5535. };
  5536. draw2d.ToggleButton = function(_58b2) {
  5537. draw2d.Button.call(this, _58b2);
  5538. this.isDownFlag = false;
  5539. };
  5540. draw2d.ToggleButton.prototype = new draw2d.Button();
  5541. draw2d.ToggleButton.prototype.type = "draw2d.ToggleButton";
  5542. draw2d.ToggleButton.prototype.createHTMLElement = function() {
  5543. var item = document.createElement("div");
  5544. item.id = this.id;
  5545. item.style.position = "absolute";
  5546. item.style.left = this.x + "px";
  5547. item.style.top = this.y + "px";
  5548. item.style.height = "24px";
  5549. item.style.width = "24px";
  5550. item.style.margin = "0px";
  5551. item.style.padding = "0px";
  5552. if (this.getImageUrl() !== null) {
  5553. item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
  5554. } else {
  5555. item.style.backgroundImage = "";
  5556. }
  5557. var oThis = this;
  5558. this.omousedown = function(event) {
  5559. if (oThis.enabled) {
  5560. if (!oThis.isDown()) {
  5561. draw2d.Button.prototype.setActive.call(oThis, true);
  5562. }
  5563. }
  5564. event.cancelBubble = true;
  5565. event.returnValue = false;
  5566. };
  5567. this.omouseup = function(event) {
  5568. if (oThis.enabled) {
  5569. if (oThis.isDown()) {
  5570. draw2d.Button.prototype.setActive.call(oThis, false);
  5571. }
  5572. oThis.isDownFlag = !oThis.isDownFlag;
  5573. oThis.execute();
  5574. }
  5575. event.cancelBubble = true;
  5576. event.returnValue = false;
  5577. };
  5578. if (item.addEventListener) {
  5579. item.addEventListener("mousedown", this.omousedown, false);
  5580. item.addEventListener("mouseup", this.omouseup, false);
  5581. } else {
  5582. if (item.attachEvent) {
  5583. item.attachEvent("onmousedown", this.omousedown);
  5584. item.attachEvent("onmouseup", this.omouseup);
  5585. }
  5586. }
  5587. return item;
  5588. };
  5589. draw2d.ToggleButton.prototype.isDown = function() {
  5590. return this.isDownFlag;
  5591. };
  5592. draw2d.ToggleButton.prototype.setActive = function(flag) {
  5593. draw2d.Button.prototype.setActive.call(this, flag);
  5594. this.isDownFlag = flag;
  5595. };
  5596. draw2d.ToggleButton.prototype.execute = function() {
  5597. };
  5598. draw2d.ToolGeneric = function(_58a4) {
  5599. this.x = 0;
  5600. this.y = 0;
  5601. this.enabled = true;
  5602. this.tooltip = null;
  5603. this.palette = _58a4;
  5604. this.html = this.createHTMLElement();
  5605. this.setDimension(10, 10);
  5606. };
  5607. draw2d.ToolGeneric.prototype.type = "draw2d.ToolGeneric";
  5608. draw2d.ToolGeneric.prototype.dispose = function() {
  5609. };
  5610. draw2d.ToolGeneric.prototype.getImageUrl = function() {
  5611. return this.type + ".png";
  5612. };
  5613. draw2d.ToolGeneric.prototype.getWorkflow = function() {
  5614. return this.getToolPalette().getWorkflow();
  5615. };
  5616. draw2d.ToolGeneric.prototype.getToolPalette = function() {
  5617. return this.palette;
  5618. };
  5619. draw2d.ToolGeneric.prototype.createHTMLElement = function() {
  5620. var item = document.createElement("div");
  5621. item.id = this.id;
  5622. item.style.position = "absolute";
  5623. item.style.left = this.x + "px";
  5624. item.style.top = this.y + "px";
  5625. item.style.height = "24px";
  5626. item.style.width = "24px";
  5627. item.style.margin = "0px";
  5628. item.style.padding = "0px";
  5629. if (this.getImageUrl() !== null) {
  5630. item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
  5631. } else {
  5632. item.style.backgroundImage = "";
  5633. }
  5634. var oThis = this;
  5635. this.click = function(event) {
  5636. if (oThis.enabled) {
  5637. oThis.palette.setActiveTool(oThis);
  5638. }
  5639. event.cancelBubble = true;
  5640. event.returnValue = false;
  5641. };
  5642. if (item.addEventListener) {
  5643. item.addEventListener("click", this.click, false);
  5644. } else {
  5645. if (item.attachEvent) {
  5646. item.attachEvent("onclick", this.click);
  5647. }
  5648. }
  5649. if (this.tooltip !== null) {
  5650. item.title = this.tooltip;
  5651. } else {
  5652. item.title = "";
  5653. }
  5654. return item;
  5655. };
  5656. draw2d.ToolGeneric.prototype.getHTMLElement = function() {
  5657. if (this.html === null) {
  5658. this.html = this.createHTMLElement();
  5659. }
  5660. return this.html;
  5661. };
  5662. draw2d.ToolGeneric.prototype.execute = function(x, y) {
  5663. if (this.enabled) {
  5664. this.palette.setActiveTool(null);
  5665. }
  5666. };
  5667. draw2d.ToolGeneric.prototype.setTooltip = function(_58aa) {
  5668. this.tooltip = _58aa;
  5669. if (this.tooltip !== null) {
  5670. this.html.title = this.tooltip;
  5671. } else {
  5672. this.html.title = "";
  5673. }
  5674. };
  5675. draw2d.ToolGeneric.prototype.setActive = function(flag) {
  5676. if (!this.enabled) {
  5677. return;
  5678. }
  5679. if (flag === true) {
  5680. this.html.style.border = "1px inset";
  5681. } else {
  5682. this.html.style.border = "0px";
  5683. }
  5684. };
  5685. draw2d.ToolGeneric.prototype.setEnabled = function(flag) {
  5686. this.enabled = flag;
  5687. if (flag) {
  5688. this.html.style.filter = "alpha(opacity=100)";
  5689. this.html.style.opacity = "1.0";
  5690. } else {
  5691. this.html.style.filter = "alpha(opacity=30)";
  5692. this.html.style.opacity = "0.3";
  5693. }
  5694. };
  5695. draw2d.ToolGeneric.prototype.setDimension = function(w, h) {
  5696. this.width = w;
  5697. this.height = h;
  5698. if (this.html === null) {
  5699. return;
  5700. }
  5701. this.html.style.width = this.width + "px";
  5702. this.html.style.height = this.height + "px";
  5703. };
  5704. draw2d.ToolGeneric.prototype.setPosition = function(xPos, yPos) {
  5705. this.x = Math.max(0, xPos);
  5706. this.y = Math.max(0, yPos);
  5707. if (this.html === null) {
  5708. return;
  5709. }
  5710. this.html.style.left = this.x + "px";
  5711. this.html.style.top = this.y + "px";
  5712. };
  5713. draw2d.ToolGeneric.prototype.getWidth = function() {
  5714. return this.width;
  5715. };
  5716. draw2d.ToolGeneric.prototype.getHeight = function() {
  5717. return this.height;
  5718. };
  5719. draw2d.ToolGeneric.prototype.getY = function() {
  5720. return this.y;
  5721. };
  5722. draw2d.ToolGeneric.prototype.getX = function() {
  5723. return this.x;
  5724. };
  5725. draw2d.ToolGeneric.prototype.getPosition = function() {
  5726. return new draw2d.Point(this.x, this.y);
  5727. };
  5728. draw2d.ToolPalette = function(title) {
  5729. draw2d.WindowFigure.call(this, title);
  5730. this.setDimension(75, 400);
  5731. this.activeTool = null;
  5732. this.children = {};
  5733. };
  5734. draw2d.ToolPalette.prototype = new draw2d.WindowFigure();
  5735. draw2d.ToolPalette.prototype.type = "draw2d.ToolPalette";
  5736. draw2d.ToolPalette.prototype.dispose = function() {
  5737. draw2d.WindowFigure.prototype.dispose.call(this);
  5738. };
  5739. draw2d.ToolPalette.prototype.createHTMLElement = function() {
  5740. var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
  5741. this.scrollarea = document.createElement("div");
  5742. this.scrollarea.style.position = "absolute";
  5743. this.scrollarea.style.left = "0px";
  5744. if (this.hasTitleBar()) {
  5745. this.scrollarea.style.top = "15px";
  5746. } else {
  5747. this.scrollarea.style.top = "0px";
  5748. }
  5749. this.scrollarea.style.width = this.getWidth() + "px";
  5750. this.scrollarea.style.height = "15px";
  5751. this.scrollarea.style.margin = "0px";
  5752. this.scrollarea.style.padding = "0px";
  5753. this.scrollarea.style.font = "normal 10px verdana";
  5754. this.scrollarea.style.borderBottom = "2px solid gray";
  5755. this.scrollarea.style.whiteSpace = "nowrap";
  5756. this.scrollarea.style.textAlign = "center";
  5757. this.scrollarea.style.overflowX = "auto";
  5758. this.scrollarea.style.overflowY = "auto";
  5759. this.scrollarea.style.overflow = "auto";
  5760. item.appendChild(this.scrollarea);
  5761. return item;
  5762. };
  5763. draw2d.ToolPalette.prototype.setDimension = function(w, h) {
  5764. draw2d.WindowFigure.prototype.setDimension.call(this, w, h);
  5765. if (this.scrollarea !== null) {
  5766. this.scrollarea.style.width = this.getWidth() + "px";
  5767. if (this.hasTitleBar()) {
  5768. this.scrollarea.style.height = (this.getHeight() - 15) + "px";
  5769. } else {
  5770. this.scrollarea.style.height = this.getHeight() + "px";
  5771. }
  5772. }
  5773. };
  5774. draw2d.ToolPalette.prototype.addChild = function(item) {
  5775. this.children[item.id] = item;
  5776. this.scrollarea.appendChild(item.getHTMLElement());
  5777. };
  5778. draw2d.ToolPalette.prototype.getChild = function(id) {
  5779. return this.children[id];
  5780. };
  5781. draw2d.ToolPalette.prototype.getActiveTool = function() {
  5782. return this.activeTool;
  5783. };
  5784. draw2d.ToolPalette.prototype.setActiveTool = function(tool) {
  5785. if (this.activeTool != tool && this.activeTool !== null) {
  5786. this.activeTool.setActive(false);
  5787. }
  5788. if (tool !== null) {
  5789. tool.setActive(true);
  5790. }
  5791. this.activeTool = tool;
  5792. };
  5793. draw2d.Dialog = function(title) {
  5794. this.buttonbar = null;
  5795. if (title) {
  5796. draw2d.WindowFigure.call(this, title);
  5797. } else {
  5798. draw2d.WindowFigure.call(this, "Dialog");
  5799. }
  5800. this.setDimension(400, 300);
  5801. };
  5802. draw2d.Dialog.prototype = new draw2d.WindowFigure();
  5803. draw2d.Dialog.prototype.type = "draw2d.Dialog";
  5804. draw2d.Dialog.prototype.createHTMLElement = function() {
  5805. var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
  5806. var oThis = this;
  5807. this.buttonbar = document.createElement("div");
  5808. this.buttonbar.style.position = "absolute";
  5809. this.buttonbar.style.left = "0px";
  5810. this.buttonbar.style.bottom = "0px";
  5811. this.buttonbar.style.width = this.getWidth() + "px";
  5812. this.buttonbar.style.height = "30px";
  5813. this.buttonbar.style.margin = "0px";
  5814. this.buttonbar.style.padding = "0px";
  5815. this.buttonbar.style.font = "normal 10px verdana";
  5816. this.buttonbar.style.backgroundColor = "#c0c0c0";
  5817. this.buttonbar.style.borderBottom = "2px solid gray";
  5818. this.buttonbar.style.whiteSpace = "nowrap";
  5819. this.buttonbar.style.textAlign = "center";
  5820. this.buttonbar.className = "Dialog_buttonbar";
  5821. this.okbutton = document.createElement("button");
  5822. this.okbutton.style.border = "1px solid gray";
  5823. this.okbutton.style.font = "normal 10px verdana";
  5824. this.okbutton.style.width = "80px";
  5825. this.okbutton.style.margin = "5px";
  5826. this.okbutton.className = "Dialog_okbutton";
  5827. this.okbutton.innerHTML = "Ok";
  5828. this.okbutton.onclick = function() {
  5829. var error = null;
  5830. try {
  5831. oThis.onOk();
  5832. } catch (e) {
  5833. error = e;
  5834. }
  5835. oThis.workflow.removeFigure(oThis);
  5836. if (error !== null) {
  5837. throw error;
  5838. }
  5839. };
  5840. this.buttonbar.appendChild(this.okbutton);
  5841. this.cancelbutton = document.createElement("button");
  5842. this.cancelbutton.innerHTML = "Cancel";
  5843. this.cancelbutton.style.font = "normal 10px verdana";
  5844. this.cancelbutton.style.border = "1px solid gray";
  5845. this.cancelbutton.style.width = "80px";
  5846. this.cancelbutton.style.margin = "5px";
  5847. this.cancelbutton.className = "Dialog_cancelbutton";
  5848. this.cancelbutton.onclick = function() {
  5849. var error = null;
  5850. try {
  5851. oThis.onCancel();
  5852. } catch (e) {
  5853. error = e;
  5854. }
  5855. oThis.workflow.removeFigure(oThis);
  5856. if (error !== null) {
  5857. throw error;
  5858. }
  5859. };
  5860. this.buttonbar.appendChild(this.cancelbutton);
  5861. item.appendChild(this.buttonbar);
  5862. return item;
  5863. };
  5864. draw2d.Dialog.prototype.onOk = function() {
  5865. };
  5866. draw2d.Dialog.prototype.onCancel = function() {
  5867. };
  5868. draw2d.Dialog.prototype.setDimension = function(w, h) {
  5869. draw2d.WindowFigure.prototype.setDimension.call(this, w, h);
  5870. if (this.buttonbar !== null) {
  5871. this.buttonbar.style.width = this.getWidth() + "px";
  5872. }
  5873. };
  5874. draw2d.Dialog.prototype.setWorkflow = function(_5af6) {
  5875. draw2d.WindowFigure.prototype.setWorkflow.call(this, _5af6);
  5876. this.setFocus();
  5877. };
  5878. draw2d.Dialog.prototype.setFocus = function() {
  5879. };
  5880. draw2d.Dialog.prototype.onSetDocumentDirty = function() {
  5881. };
  5882. draw2d.InputDialog = function() {
  5883. draw2d.Dialog.call(this);
  5884. this.setDimension(400, 100);
  5885. };
  5886. draw2d.InputDialog.prototype = new draw2d.Dialog();
  5887. draw2d.InputDialog.prototype.type = "draw2d.InputDialog";
  5888. draw2d.InputDialog.prototype.createHTMLElement = function() {
  5889. var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
  5890. return item;
  5891. };
  5892. draw2d.InputDialog.prototype.onOk = function() {
  5893. this.workflow.removeFigure(this);
  5894. };
  5895. draw2d.InputDialog.prototype.onCancel = function() {
  5896. this.workflow.removeFigure(this);
  5897. };
  5898. draw2d.PropertyDialog = function(_4b4f, _4b50, label) {
  5899. this.figure = _4b4f;
  5900. this.propertyName = _4b50;
  5901. this.label = label;
  5902. draw2d.Dialog.call(this);
  5903. this.setDimension(400, 120);
  5904. };
  5905. draw2d.PropertyDialog.prototype = new draw2d.Dialog();
  5906. draw2d.PropertyDialog.prototype.type = "draw2d.PropertyDialog";
  5907. draw2d.PropertyDialog.prototype.createHTMLElement = function() {
  5908. var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
  5909. var _4b53 = document.createElement("form");
  5910. _4b53.style.position = "absolute";
  5911. _4b53.style.left = "10px";
  5912. _4b53.style.top = "30px";
  5913. _4b53.style.width = "375px";
  5914. _4b53.style.font = "normal 10px verdana";
  5915. item.appendChild(_4b53);
  5916. this.labelDiv = document.createElement("div");
  5917. this.labelDiv.innerHTML = this.label;
  5918. this.disableTextSelection(this.labelDiv);
  5919. _4b53.appendChild(this.labelDiv);
  5920. this.input = document.createElement("input");
  5921. this.input.style.border = "1px solid gray";
  5922. this.input.style.font = "normal 10px verdana";
  5923. this.input.type = "text";
  5924. var value = this.figure.getProperty(this.propertyName);
  5925. if (value) {
  5926. this.input.value = value;
  5927. } else {
  5928. this.input.value = "";
  5929. }
  5930. this.input.style.width = "100%";
  5931. _4b53.appendChild(this.input);
  5932. this.input.focus();
  5933. return item;
  5934. };
  5935. draw2d.PropertyDialog.prototype.onOk = function() {
  5936. draw2d.Dialog.prototype.onOk.call(this);
  5937. this.figure.setProperty(this.propertyName, this.input.value);
  5938. };
  5939. draw2d.AnnotationDialog = function(_57df) {
  5940. this.figure = _57df;
  5941. draw2d.Dialog.call(this);
  5942. this.setDimension(400, 100);
  5943. };
  5944. draw2d.AnnotationDialog.prototype = new draw2d.Dialog();
  5945. draw2d.AnnotationDialog.prototype.type = "draw2d.AnnotationDialog";
  5946. draw2d.AnnotationDialog.prototype.createHTMLElement = function() {
  5947. var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
  5948. var _57e1 = document.createElement("form");
  5949. _57e1.style.position = "absolute";
  5950. _57e1.style.left = "10px";
  5951. _57e1.style.top = "30px";
  5952. _57e1.style.width = "375px";
  5953. _57e1.style.font = "normal 10px verdana";
  5954. item.appendChild(_57e1);
  5955. this.label = document.createTextNode("Text");
  5956. _57e1.appendChild(this.label);
  5957. this.input = document.createElement("input");
  5958. this.input.style.border = "1px solid gray";
  5959. this.input.style.font = "normal 10px verdana";
  5960. this.input.type = "text";
  5961. var value = this.figure.getText();
  5962. if (value) {
  5963. this.input.value = value;
  5964. } else {
  5965. this.input.value = "";
  5966. }
  5967. this.input.style.width = "100%";
  5968. _57e1.appendChild(this.input);
  5969. this.input.focus();
  5970. return item;
  5971. };
  5972. draw2d.AnnotationDialog.prototype.onOk = function() {
  5973. this.workflow.getCommandStack().execute(
  5974. new draw2d.CommandSetText(this.figure, this.input.value));
  5975. this.workflow.removeFigure(this);
  5976. };
  5977. draw2d.PropertyWindow = function() {
  5978. this.currentSelection = null;
  5979. draw2d.WindowFigure.call(this, "Property Window");
  5980. this.setDimension(200, 100);
  5981. };
  5982. draw2d.PropertyWindow.prototype = new draw2d.WindowFigure();
  5983. draw2d.PropertyWindow.prototype.type = "draw2d.PropertyWindow";
  5984. draw2d.PropertyWindow.prototype.dispose = function() {
  5985. draw2d.WindowFigure.prototype.dispose.call(this);
  5986. };
  5987. draw2d.PropertyWindow.prototype.createHTMLElement = function() {
  5988. var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
  5989. item.appendChild(this.createLabel("Type:", 15, 25));
  5990. item.appendChild(this.createLabel("X :", 15, 50));
  5991. item.appendChild(this.createLabel("Y :", 15, 70));
  5992. item.appendChild(this.createLabel("Width :", 85, 50));
  5993. item.appendChild(this.createLabel("Height :", 85, 70));
  5994. this.labelType = this.createLabel("", 50, 25);
  5995. this.labelX = this.createLabel("", 40, 50);
  5996. this.labelY = this.createLabel("", 40, 70);
  5997. this.labelWidth = this.createLabel("", 135, 50);
  5998. this.labelHeight = this.createLabel("", 135, 70);
  5999. this.labelType.style.fontWeight = "normal";
  6000. this.labelX.style.fontWeight = "normal";
  6001. this.labelY.style.fontWeight = "normal";
  6002. this.labelWidth.style.fontWeight = "normal";
  6003. this.labelHeight.style.fontWeight = "normal";
  6004. item.appendChild(this.labelType);
  6005. item.appendChild(this.labelX);
  6006. item.appendChild(this.labelY);
  6007. item.appendChild(this.labelWidth);
  6008. item.appendChild(this.labelHeight);
  6009. return item;
  6010. };
  6011. draw2d.PropertyWindow.prototype.onSelectionChanged = function(_4b56) {
  6012. draw2d.WindowFigure.prototype.onSelectionChanged.call(this, _4b56);
  6013. if (this.currentSelection !== null) {
  6014. this.currentSelection.detachMoveListener(this);
  6015. }
  6016. this.currentSelection = _4b56;
  6017. if (_4b56 !== null && _4b56 != this) {
  6018. this.labelType.innerHTML = _4b56.type;
  6019. if (_4b56.getX) {
  6020. this.labelX.innerHTML = _4b56.getX();
  6021. this.labelY.innerHTML = _4b56.getY();
  6022. this.labelWidth.innerHTML = _4b56.getWidth();
  6023. this.labelHeight.innerHTML = _4b56.getHeight();
  6024. this.currentSelection = _4b56;
  6025. this.currentSelection.attachMoveListener(this);
  6026. } else {
  6027. this.labelX.innerHTML = "";
  6028. this.labelY.innerHTML = "";
  6029. this.labelWidth.innerHTML = "";
  6030. this.labelHeight.innerHTML = "";
  6031. }
  6032. } else {
  6033. this.labelType.innerHTML = "&lt;none&gt;";
  6034. this.labelX.innerHTML = "";
  6035. this.labelY.innerHTML = "";
  6036. this.labelWidth.innerHTML = "";
  6037. this.labelHeight.innerHTML = "";
  6038. }
  6039. };
  6040. draw2d.PropertyWindow.prototype.getCurrentSelection = function() {
  6041. return this.currentSelection;
  6042. };
  6043. draw2d.PropertyWindow.prototype.onOtherFigureMoved = function(_4b57) {
  6044. if (_4b57 == this.currentSelection) {
  6045. this.onSelectionChanged(_4b57);
  6046. }
  6047. };
  6048. draw2d.PropertyWindow.prototype.createLabel = function(text, x, y) {
  6049. var l = document.createElement("div");
  6050. l.style.position = "absolute";
  6051. l.style.left = x + "px";
  6052. l.style.top = y + "px";
  6053. l.style.font = "normal 10px verdana";
  6054. l.style.whiteSpace = "nowrap";
  6055. l.style.fontWeight = "bold";
  6056. l.innerHTML = text;
  6057. return l;
  6058. };
  6059. draw2d.ColorDialog = function() {
  6060. this.maxValue = {
  6061. "h" : "359",
  6062. "s" : "100",
  6063. "v" : "100"
  6064. };
  6065. this.HSV = {
  6066. 0 : 359,
  6067. 1 : 100,
  6068. 2 : 100
  6069. };
  6070. this.slideHSV = {
  6071. 0 : 359,
  6072. 1 : 100,
  6073. 2 : 100
  6074. };
  6075. this.SVHeight = 165;
  6076. this.wSV = 162;
  6077. this.wH = 162;
  6078. draw2d.Dialog.call(this, "Color Chooser");
  6079. this.loadSV();
  6080. this.setColor(new draw2d.Color(255, 0, 0));
  6081. this.setDimension(219, 244);
  6082. };
  6083. draw2d.ColorDialog.prototype = new draw2d.Dialog();
  6084. draw2d.ColorDialog.prototype.type = "draw2d.ColorDialog";
  6085. draw2d.ColorDialog.prototype.createHTMLElement = function() {
  6086. var oThis = this;
  6087. var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
  6088. this.outerDiv = document.createElement("div");
  6089. this.outerDiv.id = "plugin";
  6090. this.outerDiv.style.top = "15px";
  6091. this.outerDiv.style.left = "0px";
  6092. this.outerDiv.style.width = "201px";
  6093. this.outerDiv.style.position = "absolute";
  6094. this.outerDiv.style.padding = "9px";
  6095. this.outerDiv.display = "block";
  6096. this.outerDiv.style.background = "#0d0d0d";
  6097. this.plugHEX = document.createElement("div");
  6098. this.plugHEX.id = "plugHEX";
  6099. this.plugHEX.innerHTML = "F1FFCC";
  6100. this.plugHEX.style.color = "white";
  6101. this.plugHEX.style.font = "normal 10px verdana";
  6102. this.outerDiv.appendChild(this.plugHEX);
  6103. this.SV = document.createElement("div");
  6104. this.SV.onmousedown = function(event) {
  6105. oThis.mouseDownSV(oThis.SVslide, event);
  6106. };
  6107. this.SV.id = "SV";
  6108. this.SV.style.cursor = "crosshair";
  6109. this.SV.style.background = "#FF0000 url(SatVal.png)";
  6110. this.SV.style.position = "absolute";
  6111. this.SV.style.height = "166px";
  6112. this.SV.style.width = "167px";
  6113. this.SV.style.marginRight = "10px";
  6114. this.SV.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='SatVal.png', sizingMethod='scale')";
  6115. this.SV.style["float"] = "left";
  6116. this.outerDiv.appendChild(this.SV);
  6117. this.SVslide = document.createElement("div");
  6118. this.SVslide.onmousedown = function(event) {
  6119. oThis.mouseDownSV(event);
  6120. };
  6121. this.SVslide.style.top = "40px";
  6122. this.SVslide.style.left = "40px";
  6123. this.SVslide.style.position = "absolute";
  6124. this.SVslide.style.cursor = "crosshair";
  6125. this.SVslide.style.background = "url(slide.gif)";
  6126. this.SVslide.style.height = "9px";
  6127. this.SVslide.style.width = "9px";
  6128. this.SVslide.style.lineHeight = "1px";
  6129. this.outerDiv.appendChild(this.SVslide);
  6130. this.H = document.createElement("form");
  6131. this.H.id = "H";
  6132. this.H.onmousedown = function(event) {
  6133. oThis.mouseDownH(event);
  6134. };
  6135. this.H.style.border = "1px solid #000000";
  6136. this.H.style.cursor = "crosshair";
  6137. this.H.style.position = "absolute";
  6138. this.H.style.width = "19px";
  6139. this.H.style.top = "28px";
  6140. this.H.style.left = "191px";
  6141. this.outerDiv.appendChild(this.H);
  6142. this.Hslide = document.createElement("div");
  6143. this.Hslide.style.top = "-7px";
  6144. this.Hslide.style.left = "-8px";
  6145. this.Hslide.style.background = "url(slideHue.gif)";
  6146. this.Hslide.style.height = "5px";
  6147. this.Hslide.style.width = "33px";
  6148. this.Hslide.style.position = "absolute";
  6149. this.Hslide.style.lineHeight = "1px";
  6150. this.H.appendChild(this.Hslide);
  6151. this.Hmodel = document.createElement("div");
  6152. this.Hmodel.style.height = "1px";
  6153. this.Hmodel.style.width = "19px";
  6154. this.Hmodel.style.lineHeight = "1px";
  6155. this.Hmodel.style.margin = "0px";
  6156. this.Hmodel.style.padding = "0px";
  6157. this.Hmodel.style.fontSize = "1px";
  6158. this.H.appendChild(this.Hmodel);
  6159. item.appendChild(this.outerDiv);
  6160. return item;
  6161. };
  6162. draw2d.ColorDialog.prototype.onOk = function() {
  6163. draw2d.Dialog.prototype.onOk.call(this);
  6164. };
  6165. draw2d.browser = function(v) {
  6166. return (Math.max(navigator.userAgent.toLowerCase().indexOf(v), 0));
  6167. };
  6168. draw2d.ColorDialog.prototype.showColor = function(c) {
  6169. this.plugHEX.style.background = "#" + c;
  6170. this.plugHEX.innerHTML = c;
  6171. };
  6172. draw2d.ColorDialog.prototype.getSelectedColor = function() {
  6173. var rgb = this.hex2rgb(this.plugHEX.innerHTML);
  6174. return new draw2d.Color(rgb[0], rgb[1], rgb[2]);
  6175. };
  6176. draw2d.ColorDialog.prototype.setColor = function(color) {
  6177. if (color === null) {
  6178. color = new draw2d.Color(100, 100, 100);
  6179. }
  6180. var hex = this.rgb2hex(Array(color.getRed(), color.getGreen(), color
  6181. .getBlue()));
  6182. this.updateH(hex);
  6183. };
  6184. draw2d.ColorDialog.prototype.XY = function(e, v) {
  6185. var z = draw2d.browser("msie") ? Array(event.clientX
  6186. + document.body.scrollLeft, event.clientY + document.body.scrollTop)
  6187. : Array(e.pageX, e.pageY);
  6188. return z[v];
  6189. };
  6190. draw2d.ColorDialog.prototype.mkHSV = function(a, b, c) {
  6191. return (Math.min(a, Math.max(0, Math.ceil((parseInt(c) / b) * a))));
  6192. };
  6193. draw2d.ColorDialog.prototype.ckHSV = function(a, b) {
  6194. if (a >= 0 && a <= b) {
  6195. return (a);
  6196. } else {
  6197. if (a > b) {
  6198. return (b);
  6199. } else {
  6200. if (a < 0) {
  6201. return ("-" + oo);
  6202. }
  6203. }
  6204. }
  6205. };
  6206. draw2d.ColorDialog.prototype.mouseDownH = function(e) {
  6207. this.slideHSV[0] = this.HSV[0];
  6208. var oThis = this;
  6209. this.H.onmousemove = function(e) {
  6210. oThis.dragH(e);
  6211. };
  6212. this.H.onmouseup = function(e) {
  6213. oThis.H.onmousemove = "";
  6214. oThis.H.onmouseup = "";
  6215. };
  6216. this.dragH(e);
  6217. };
  6218. draw2d.ColorDialog.prototype.dragH = function(e) {
  6219. var y = this.XY(e, 1) - this.getY() - 40;
  6220. this.Hslide.style.top = (this.ckHSV(y, this.wH) - 5) + "px";
  6221. this.slideHSV[0] = this.mkHSV(359, this.wH, this.Hslide.style.top);
  6222. this.updateSV();
  6223. this.showColor(this.commit());
  6224. this.SV.style.backgroundColor = "#"
  6225. + this.hsv2hex(Array(this.HSV[0], 100, 100));
  6226. };
  6227. draw2d.ColorDialog.prototype.mouseDownSV = function(o, e) {
  6228. this.slideHSV[0] = this.HSV[0];
  6229. var oThis = this;
  6230. function reset() {
  6231. oThis.SV.onmousemove = "";
  6232. oThis.SV.onmouseup = "";
  6233. oThis.SVslide.onmousemove = "";
  6234. oThis.SVslide.onmouseup = "";
  6235. }
  6236. this.SV.onmousemove = function(e) {
  6237. oThis.dragSV(e);
  6238. };
  6239. this.SV.onmouseup = reset;
  6240. this.SVslide.onmousemove = function(e) {
  6241. oThis.dragSV(e);
  6242. };
  6243. this.SVslide.onmouseup = reset;
  6244. this.dragSV(e);
  6245. };
  6246. draw2d.ColorDialog.prototype.dragSV = function(e) {
  6247. var x = this.XY(e, 0) - this.getX() - 1;
  6248. var y = this.XY(e, 1) - this.getY() - 20;
  6249. this.SVslide.style.left = this.ckHSV(x, this.wSV) + "px";
  6250. this.SVslide.style.top = this.ckHSV(y, this.wSV) + "px";
  6251. this.slideHSV[1] = this.mkHSV(100, this.wSV, this.SVslide.style.left);
  6252. this.slideHSV[2] = 100 - this.mkHSV(100, this.wSV, this.SVslide.style.top);
  6253. this.updateSV();
  6254. };
  6255. draw2d.ColorDialog.prototype.commit = function() {
  6256. var r = "hsv";
  6257. var z = {};
  6258. var j = "";
  6259. for ( var i = 0; i <= r.length - 1; i++) {
  6260. j = r.substr(i, 1);
  6261. z[i] = (j == "h") ? this.maxValue[j]
  6262. - this.mkHSV(this.maxValue[j], this.wH, this.Hslide.style.top)
  6263. : this.HSV[i];
  6264. }
  6265. return (this.updateSV(this.hsv2hex(z)));
  6266. };
  6267. draw2d.ColorDialog.prototype.updateSV = function(v) {
  6268. this.HSV = v ? this.hex2hsv(v) : Array(this.slideHSV[0], this.slideHSV[1],
  6269. this.slideHSV[2]);
  6270. if (!v) {
  6271. v = this.hsv2hex(Array(this.slideHSV[0], this.slideHSV[1],
  6272. this.slideHSV[2]));
  6273. }
  6274. this.showColor(v);
  6275. return v;
  6276. };
  6277. draw2d.ColorDialog.prototype.loadSV = function() {
  6278. var z = "";
  6279. for ( var i = this.SVHeight; i >= 0; i--) {
  6280. z += "<div style=\"background:#"
  6281. + this.hsv2hex(Array(Math.round((359 / this.SVHeight) * i),
  6282. 100, 100)) + ";\"><br/></div>";
  6283. }
  6284. this.Hmodel.innerHTML = z;
  6285. };
  6286. draw2d.ColorDialog.prototype.updateH = function(v) {
  6287. this.plugHEX.innerHTML = v;
  6288. this.HSV = this.hex2hsv(v);
  6289. this.SV.style.backgroundColor = "#"
  6290. + this.hsv2hex(Array(this.HSV[0], 100, 100));
  6291. this.SVslide.style.top = (parseInt(this.wSV - this.wSV
  6292. * (this.HSV[1] / 100)) + 20)
  6293. + "px";
  6294. this.SVslide.style.left = (parseInt(this.wSV * (this.HSV[1] / 100)) + 5)
  6295. + "px";
  6296. this.Hslide.style.top = (parseInt(this.wH
  6297. * ((this.maxValue["h"] - this.HSV[0]) / this.maxValue["h"])) - 7)
  6298. + "px";
  6299. };
  6300. draw2d.ColorDialog.prototype.toHex = function(v) {
  6301. v = Math.round(Math.min(Math.max(0, v), 255));
  6302. return ("0123456789ABCDEF".charAt((v - v % 16) / 16) + "0123456789ABCDEF"
  6303. .charAt(v % 16));
  6304. };
  6305. draw2d.ColorDialog.prototype.hex2rgb = function(r) {
  6306. return ( {
  6307. 0 : parseInt(r.substr(0, 2), 16),
  6308. 1 : parseInt(r.substr(2, 2), 16),
  6309. 2 : parseInt(r.substr(4, 2), 16)
  6310. });
  6311. };
  6312. draw2d.ColorDialog.prototype.rgb2hex = function(r) {
  6313. return (this.toHex(r[0]) + this.toHex(r[1]) + this.toHex(r[2]));
  6314. };
  6315. draw2d.ColorDialog.prototype.hsv2hex = function(h) {
  6316. return (this.rgb2hex(this.hsv2rgb(h)));
  6317. };
  6318. draw2d.ColorDialog.prototype.hex2hsv = function(v) {
  6319. return (this.rgb2hsv(this.hex2rgb(v)));
  6320. };
  6321. draw2d.ColorDialog.prototype.rgb2hsv = function(r) {
  6322. var max = Math.max(r[0], r[1], r[2]);
  6323. var delta = max - Math.min(r[0], r[1], r[2]);
  6324. var H;
  6325. var S;
  6326. var V;
  6327. if (max != 0) {
  6328. S = Math.round(delta / max * 100);
  6329. if (r[0] == max) {
  6330. H = (r[1] - r[2]) / delta;
  6331. } else {
  6332. if (r[1] == max) {
  6333. H = 2 + (r[2] - r[0]) / delta;
  6334. } else {
  6335. if (r[2] == max) {
  6336. H = 4 + (r[0] - r[1]) / delta;
  6337. }
  6338. }
  6339. }
  6340. var H = Math.min(Math.round(H * 60), 360);
  6341. if (H < 0) {
  6342. H += 360;
  6343. }
  6344. }
  6345. return ( {
  6346. 0 : H ? H : 0,
  6347. 1 : S ? S : 0,
  6348. 2 : Math.round((max / 255) * 100)
  6349. });
  6350. };
  6351. draw2d.ColorDialog.prototype.hsv2rgb = function(r) {
  6352. var R;
  6353. var B;
  6354. var G;
  6355. var S = r[1] / 100;
  6356. var V = r[2] / 100;
  6357. var H = r[0] / 360;
  6358. if (S > 0) {
  6359. if (H >= 1) {
  6360. H = 0;
  6361. }
  6362. H = 6 * H;
  6363. F = H - Math.floor(H);
  6364. A = Math.round(255 * V * (1 - S));
  6365. B = Math.round(255 * V * (1 - (S * F)));
  6366. C = Math.round(255 * V * (1 - (S * (1 - F))));
  6367. V = Math.round(255 * V);
  6368. switch (Math.floor(H)) {
  6369. case 0:
  6370. R = V;
  6371. G = C;
  6372. B = A;
  6373. break;
  6374. case 1:
  6375. R = B;
  6376. G = V;
  6377. B = A;
  6378. break;
  6379. case 2:
  6380. R = A;
  6381. G = V;
  6382. B = C;
  6383. break;
  6384. case 3:
  6385. R = A;
  6386. G = B;
  6387. B = V;
  6388. break;
  6389. case 4:
  6390. R = C;
  6391. G = A;
  6392. B = V;
  6393. break;
  6394. case 5:
  6395. R = V;
  6396. G = A;
  6397. B = B;
  6398. break;
  6399. }
  6400. return ( {
  6401. 0 : R ? R : 0,
  6402. 1 : G ? G : 0,
  6403. 2 : B ? B : 0
  6404. });
  6405. } else {
  6406. return ( {
  6407. 0 : (V = Math.round(V * 255)),
  6408. 1 : V,
  6409. 2 : V
  6410. });
  6411. }
  6412. };
  6413. draw2d.LineColorDialog = function(_5a31) {
  6414. draw2d.ColorDialog.call(this);
  6415. this.figure = _5a31;
  6416. var color = _5a31.getColor();
  6417. this.updateH(this
  6418. .rgb2hex(color.getRed(), color.getGreen(), color.getBlue()));
  6419. };
  6420. draw2d.LineColorDialog.prototype = new draw2d.ColorDialog();
  6421. draw2d.LineColorDialog.prototype.type = "draw2d.LineColorDialog";
  6422. draw2d.LineColorDialog.prototype.onOk = function() {
  6423. var _5a33 = this.workflow;
  6424. draw2d.ColorDialog.prototype.onOk.call(this);
  6425. if (typeof this.figure.setColor == "function") {
  6426. _5a33.getCommandStack()
  6427. .execute(
  6428. new draw2d.CommandSetColor(this.figure, this
  6429. .getSelectedColor()));
  6430. if (_5a33.getCurrentSelection() == this.figure) {
  6431. _5a33.setCurrentSelection(this.figure);
  6432. }
  6433. }
  6434. };
  6435. draw2d.BackgroundColorDialog = function(_5b1b) {
  6436. draw2d.ColorDialog.call(this);
  6437. this.figure = _5b1b;
  6438. var color = _5b1b.getBackgroundColor();
  6439. if (color !== null) {
  6440. this.updateH(this.rgb2hex(color.getRed(), color.getGreen(), color
  6441. .getBlue()));
  6442. }
  6443. };
  6444. draw2d.BackgroundColorDialog.prototype = new draw2d.ColorDialog();
  6445. draw2d.BackgroundColorDialog.prototype.type = "draw2d.BackgroundColorDialog";
  6446. draw2d.BackgroundColorDialog.prototype.onOk = function() {
  6447. var _5b1d = this.workflow;
  6448. draw2d.ColorDialog.prototype.onOk.call(this);
  6449. if (typeof this.figure.setBackgroundColor == "function") {
  6450. _5b1d.getCommandStack().execute(
  6451. new draw2d.CommandSetBackgroundColor(this.figure, this
  6452. .getSelectedColor()));
  6453. if (_5b1d.getCurrentSelection() == this.figure) {
  6454. _5b1d.setCurrentSelection(this.figure);
  6455. }
  6456. }
  6457. };
  6458. draw2d.AnnotationDialog = function(_57df) {
  6459. this.figure = _57df;
  6460. draw2d.Dialog.call(this);
  6461. this.setDimension(400, 100);
  6462. };
  6463. draw2d.AnnotationDialog.prototype = new draw2d.Dialog();
  6464. draw2d.AnnotationDialog.prototype.type = "draw2d.AnnotationDialog";
  6465. draw2d.AnnotationDialog.prototype.createHTMLElement = function() {
  6466. var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
  6467. var _57e1 = document.createElement("form");
  6468. _57e1.style.position = "absolute";
  6469. _57e1.style.left = "10px";
  6470. _57e1.style.top = "30px";
  6471. _57e1.style.width = "375px";
  6472. _57e1.style.font = "normal 10px verdana";
  6473. item.appendChild(_57e1);
  6474. this.label = document.createTextNode("Text");
  6475. _57e1.appendChild(this.label);
  6476. this.input = document.createElement("input");
  6477. this.input.style.border = "1px solid gray";
  6478. this.input.style.font = "normal 10px verdana";
  6479. this.input.type = "text";
  6480. var value = this.figure.getText();
  6481. if (value) {
  6482. this.input.value = value;
  6483. } else {
  6484. this.input.value = "";
  6485. }
  6486. this.input.style.width = "100%";
  6487. _57e1.appendChild(this.input);
  6488. this.input.focus();
  6489. return item;
  6490. };
  6491. draw2d.AnnotationDialog.prototype.onOk = function() {
  6492. this.workflow.getCommandStack().execute(
  6493. new draw2d.CommandSetText(this.figure, this.input.value));
  6494. this.workflow.removeFigure(this);
  6495. };
  6496. draw2d.Command = function(label) {
  6497. this.label = label;
  6498. };
  6499. draw2d.Command.prototype.type = "draw2d.Command";
  6500. draw2d.Command.prototype.getLabel = function() {
  6501. return this.label;
  6502. };
  6503. draw2d.Command.prototype.canExecute = function() {
  6504. return true;
  6505. };
  6506. draw2d.Command.prototype.execute = function() {
  6507. };
  6508. draw2d.Command.prototype.cancel = function() {
  6509. };
  6510. draw2d.Command.prototype.undo = function() {
  6511. };
  6512. draw2d.Command.prototype.redo = function() {
  6513. };
  6514. draw2d.CommandStack = function() {
  6515. this.undostack = [];
  6516. this.redostack = [];
  6517. this.maxundo = 50;
  6518. this.eventListeners = new draw2d.ArrayList();
  6519. };
  6520. draw2d.CommandStack.PRE_EXECUTE = 1;
  6521. draw2d.CommandStack.PRE_REDO = 2;
  6522. draw2d.CommandStack.PRE_UNDO = 4;
  6523. draw2d.CommandStack.POST_EXECUTE = 8;
  6524. draw2d.CommandStack.POST_REDO = 16;
  6525. draw2d.CommandStack.POST_UNDO = 32;
  6526. draw2d.CommandStack.POST_MASK = draw2d.CommandStack.POST_EXECUTE
  6527. | draw2d.CommandStack.POST_UNDO | draw2d.CommandStack.POST_REDO;
  6528. draw2d.CommandStack.PRE_MASK = draw2d.CommandStack.PRE_EXECUTE
  6529. | draw2d.CommandStack.PRE_UNDO | draw2d.CommandStack.PRE_REDO;
  6530. draw2d.CommandStack.prototype.type = "draw2d.CommandStack";
  6531. draw2d.CommandStack.prototype.setUndoLimit = function(count) {
  6532. this.maxundo = count;
  6533. };
  6534. draw2d.CommandStack.prototype.markSaveLocation = function() {
  6535. this.undostack = [];
  6536. this.redostack = [];
  6537. };
  6538. draw2d.CommandStack.prototype.execute = function(_5577) {
  6539. if (_5577 === null) {
  6540. return;
  6541. }
  6542. if (_5577.canExecute() == false) {
  6543. return;
  6544. }
  6545. this.notifyListeners(_5577, draw2d.CommandStack.PRE_EXECUTE);
  6546. this.undostack.push(_5577);
  6547. _5577.execute();
  6548. this.redostack = [];
  6549. if (this.undostack.length > this.maxundo) {
  6550. this.undostack = this.undostack.slice(this.undostack.length
  6551. - this.maxundo);
  6552. }
  6553. this.notifyListeners(_5577, draw2d.CommandStack.POST_EXECUTE);
  6554. };
  6555. draw2d.CommandStack.prototype.undo = function() {
  6556. var _5578 = this.undostack.pop();
  6557. if (_5578) {
  6558. this.notifyListeners(_5578, draw2d.CommandStack.PRE_UNDO);
  6559. this.redostack.push(_5578);
  6560. _5578.undo();
  6561. this.notifyListeners(_5578, draw2d.CommandStack.POST_UNDO);
  6562. }
  6563. };
  6564. draw2d.CommandStack.prototype.redo = function() {
  6565. var _5579 = this.redostack.pop();
  6566. if (_5579) {
  6567. this.notifyListeners(_5579, draw2d.CommandStack.PRE_REDO);
  6568. this.undostack.push(_5579);
  6569. _5579.redo();
  6570. this.notifyListeners(_5579, draw2d.CommandStack.POST_REDO);
  6571. }
  6572. };
  6573. draw2d.CommandStack.prototype.canRedo = function() {
  6574. return this.redostack.length > 0;
  6575. };
  6576. draw2d.CommandStack.prototype.canUndo = function() {
  6577. return this.undostack.length > 0;
  6578. };
  6579. draw2d.CommandStack.prototype.addCommandStackEventListener = function(_557a) {
  6580. this.eventListeners.add(_557a);
  6581. };
  6582. draw2d.CommandStack.prototype.removeCommandStackEventListener = function(_557b) {
  6583. this.eventListeners.remove(_557b);
  6584. };
  6585. draw2d.CommandStack.prototype.notifyListeners = function(_557c, state) {
  6586. var event = new draw2d.CommandStackEvent(_557c, state);
  6587. var size = this.eventListeners.getSize();
  6588. for ( var i = 0; i < size; i++) {
  6589. this.eventListeners.get(i).stackChanged(event);
  6590. }
  6591. };
  6592. draw2d.CommandStackEvent = function(_507a, _507b) {
  6593. this.command = _507a;
  6594. this.details = _507b;
  6595. };
  6596. draw2d.CommandStackEvent.prototype.type = "draw2d.CommandStackEvent";
  6597. draw2d.CommandStackEvent.prototype.getCommand = function() {
  6598. return this.command;
  6599. };
  6600. draw2d.CommandStackEvent.prototype.getDetails = function() {
  6601. return this.details;
  6602. };
  6603. draw2d.CommandStackEvent.prototype.isPostChangeEvent = function() {
  6604. return 0 != (this.getDetails() & draw2d.CommandStack.POST_MASK);
  6605. };
  6606. draw2d.CommandStackEvent.prototype.isPreChangeEvent = function() {
  6607. return 0 != (this.getDetails() & draw2d.CommandStack.PRE_MASK);
  6608. };
  6609. draw2d.CommandStackEventListener = function() {
  6610. };
  6611. draw2d.CommandStackEventListener.prototype.type = "draw2d.CommandStackEventListener";
  6612. draw2d.CommandStackEventListener.prototype.stackChanged = function(event) {
  6613. };
  6614. draw2d.CommandAdd = function(_58b8, _58b9, x, y, _58bc) {
  6615. draw2d.Command.call(this, "add figure");
  6616. if (_58bc === undefined) {
  6617. _58bc = null;
  6618. }
  6619. this.parent = _58bc;
  6620. this.figure = _58b9;
  6621. this.x = x;
  6622. this.y = y;
  6623. this.workflow = _58b8;
  6624. };
  6625. draw2d.CommandAdd.prototype = new draw2d.Command();
  6626. draw2d.CommandAdd.prototype.type = "draw2d.CommandAdd";
  6627. draw2d.CommandAdd.prototype.execute = function() {
  6628. this.redo();
  6629. };
  6630. draw2d.CommandAdd.prototype.redo = function() {
  6631. if (this.x && this.y) {
  6632. this.workflow.addFigure(this.figure, this.x, this.y);
  6633. } else {
  6634. this.workflow.addFigure(this.figure);
  6635. }
  6636. this.workflow.setCurrentSelection(this.figure);
  6637. if (this.parent !== null) {
  6638. this.parent.addChild(this.figure);
  6639. }
  6640. };
  6641. draw2d.CommandAdd.prototype.undo = function() {
  6642. this.workflow.removeFigure(this.figure);
  6643. this.workflow.setCurrentSelection(null);
  6644. if (this.parent !== null) {
  6645. this.parent.removeChild(this.figure);
  6646. }
  6647. };
  6648. draw2d.CommandDelete = function(_553a) {
  6649. draw2d.Command.call(this, "delete figure");
  6650. this.parent = _553a.parent;
  6651. this.figure = _553a;
  6652. this.workflow = _553a.workflow;
  6653. this.connections = null;
  6654. this.compartmentDeleteCommands = null;
  6655. };
  6656. draw2d.CommandDelete.prototype = new draw2d.Command();
  6657. draw2d.CommandDelete.prototype.type = "draw2d.CommandDelete";
  6658. draw2d.CommandDelete.prototype.execute = function() {
  6659. this.redo();
  6660. };
  6661. draw2d.CommandDelete.prototype.undo = function() {
  6662. if (this.figure instanceof draw2d.CompartmentFigure) {
  6663. for ( var i = 0; i < this.compartmentDeleteCommands.getSize(); i++) {
  6664. var _553c = this.compartmentDeleteCommands.get(i);
  6665. this.figure.addChild(_553c.figure);
  6666. this.workflow.getCommandStack().undo();
  6667. }
  6668. }
  6669. this.workflow.addFigure(this.figure);
  6670. if (this.figure instanceof draw2d.Connection) {
  6671. this.figure.reconnect();
  6672. }
  6673. this.workflow.setCurrentSelection(this.figure);
  6674. if (this.parent !== null) {
  6675. this.parent.addChild(this.figure);
  6676. }
  6677. for ( var i = 0; i < this.connections.getSize(); ++i) {
  6678. this.workflow.addFigure(this.connections.get(i));
  6679. this.connections.get(i).reconnect();
  6680. }
  6681. };
  6682. draw2d.CommandDelete.prototype.redo = function() {
  6683. if (this.figure instanceof draw2d.CompartmentFigure) {
  6684. if (this.compartmentDeleteCommands === null) {
  6685. this.compartmentDeleteCommands = new draw2d.ArrayList();
  6686. var _553d = this.figure.getChildren().clone();
  6687. for ( var i = 0; i < _553d.getSize(); i++) {
  6688. var child = _553d.get(i);
  6689. this.figure.removeChild(child);
  6690. var _5540 = new draw2d.CommandDelete(child);
  6691. this.compartmentDeleteCommands.add(_5540);
  6692. this.workflow.getCommandStack().execute(_5540);
  6693. }
  6694. } else {
  6695. for ( var i = 0; i < this.compartmentDeleteCommands.getSize(); i++) {
  6696. this.workflow.redo();
  6697. }
  6698. }
  6699. }
  6700. this.workflow.removeFigure(this.figure);
  6701. this.workflow.setCurrentSelection(null);
  6702. if (this.figure instanceof draw2d.Node && this.connections === null) {
  6703. this.connections = new draw2d.ArrayList();
  6704. var ports = this.figure.getPorts();
  6705. for ( var i = 0; i < ports.getSize(); i++) {
  6706. var port = ports.get(i);
  6707. for ( var c = 0, c_size = port.getConnections().getSize(); c < c_size; c++) {
  6708. if (!this.connections.contains(port.getConnections().get(c))) {
  6709. this.connections.add(port.getConnections().get(c));
  6710. }
  6711. }
  6712. }
  6713. }
  6714. if (this.connections === null) {
  6715. this.connections = new draw2d.ArrayList();
  6716. }
  6717. if (this.parent !== null) {
  6718. this.parent.removeChild(this.figure);
  6719. }
  6720. for ( var i = 0; i < this.connections.getSize(); ++i) {
  6721. this.workflow.removeFigure(this.connections.get(i));
  6722. }
  6723. };
  6724. draw2d.CommandMove = function(_4fff, x, y) {
  6725. draw2d.Command.call(this, "move figure");
  6726. this.figure = _4fff;
  6727. if (x == undefined) {
  6728. this.oldX = _4fff.getX();
  6729. this.oldY = _4fff.getY();
  6730. } else {
  6731. this.oldX = x;
  6732. this.oldY = y;
  6733. }
  6734. this.oldCompartment = _4fff.getParent();
  6735. };
  6736. draw2d.CommandMove.prototype = new draw2d.Command();
  6737. draw2d.CommandMove.prototype.type = "draw2d.CommandMove";
  6738. draw2d.CommandMove.prototype.setStartPosition = function(x, y) {
  6739. this.oldX = x;
  6740. this.oldY = y;
  6741. };
  6742. draw2d.CommandMove.prototype.setPosition = function(x, y) {
  6743. this.newX = x;
  6744. this.newY = y;
  6745. this.newCompartment = this.figure.workflow.getBestCompartmentFigure(x, y,
  6746. this.figure);
  6747. };
  6748. draw2d.CommandMove.prototype.canExecute = function() {
  6749. return this.newX != this.oldX || this.newY != this.oldY;
  6750. };
  6751. draw2d.CommandMove.prototype.execute = function() {
  6752. this.redo();
  6753. };
  6754. draw2d.CommandMove.prototype.undo = function() {
  6755. this.figure.setPosition(this.oldX, this.oldY);
  6756. if (this.newCompartment !== null) {
  6757. this.newCompartment.removeChild(this.figure);
  6758. }
  6759. if (this.oldCompartment !== null) {
  6760. this.oldCompartment.addChild(this.figure);
  6761. }
  6762. this.figure.workflow.moveResizeHandles(this.figure);
  6763. };
  6764. draw2d.CommandMove.prototype.redo = function() {
  6765. this.figure.setPosition(this.newX, this.newY);
  6766. if (this.oldCompartment !== null) {
  6767. this.oldCompartment.removeChild(this.figure);
  6768. }
  6769. if (this.newCompartment !== null) {
  6770. this.newCompartment.addChild(this.figure);
  6771. }
  6772. this.figure.workflow.moveResizeHandles(this.figure);
  6773. };
  6774. draw2d.CommandResize = function(_5570, width, _5572) {
  6775. draw2d.Command.call(this, "resize figure");
  6776. this.figure = _5570;
  6777. if (width === undefined) {
  6778. this.oldWidth = _5570.getWidth();
  6779. this.oldHeight = _5570.getHeight();
  6780. } else {
  6781. this.oldWidth = width;
  6782. this.oldHeight = _5572;
  6783. }
  6784. };
  6785. draw2d.CommandResize.prototype = new draw2d.Command();
  6786. draw2d.CommandResize.prototype.type = "draw2d.CommandResize";
  6787. draw2d.CommandResize.prototype.setDimension = function(width, _5574) {
  6788. this.newWidth = width;
  6789. this.newHeight = _5574;
  6790. };
  6791. draw2d.CommandResize.prototype.canExecute = function() {
  6792. return this.newWidth != this.oldWidth || this.newHeight != this.oldHeight;
  6793. };
  6794. draw2d.CommandResize.prototype.execute = function() {
  6795. this.redo();
  6796. };
  6797. draw2d.CommandResize.prototype.undo = function() {
  6798. this.figure.setDimension(this.oldWidth, this.oldHeight);
  6799. this.figure.workflow.moveResizeHandles(this.figure);
  6800. };
  6801. draw2d.CommandResize.prototype.redo = function() {
  6802. this.figure.setDimension(this.newWidth, this.newHeight);
  6803. this.figure.workflow.moveResizeHandles(this.figure);
  6804. };
  6805. draw2d.CommandSetText = function(_5771, text) {
  6806. draw2d.Command.call(this, "set text");
  6807. this.figure = _5771;
  6808. this.newText = text;
  6809. this.oldText = _5771.getText();
  6810. };
  6811. draw2d.CommandSetText.prototype = new draw2d.Command();
  6812. draw2d.CommandSetText.prototype.type = "draw2d.CommandSetText";
  6813. draw2d.CommandSetText.prototype.execute = function() {
  6814. this.redo();
  6815. };
  6816. draw2d.CommandSetText.prototype.redo = function() {
  6817. this.figure.setText(this.newText);
  6818. };
  6819. draw2d.CommandSetText.prototype.undo = function() {
  6820. this.figure.setText(this.oldText);
  6821. };
  6822. draw2d.CommandSetColor = function(_5581, color) {
  6823. draw2d.Command.call(this, "set color");
  6824. this.figure = _5581;
  6825. this.newColor = color;
  6826. this.oldColor = _5581.getColor();
  6827. };
  6828. draw2d.CommandSetColor.prototype = new draw2d.Command();
  6829. draw2d.CommandSetColor.prototype.type = "draw2d.CommandSetColor";
  6830. draw2d.CommandSetColor.prototype.execute = function() {
  6831. this.redo();
  6832. };
  6833. draw2d.CommandSetColor.prototype.undo = function() {
  6834. this.figure.setColor(this.oldColor);
  6835. };
  6836. draw2d.CommandSetColor.prototype.redo = function() {
  6837. this.figure.setColor(this.newColor);
  6838. };
  6839. draw2d.CommandSetBackgroundColor = function(_572e, color) {
  6840. draw2d.Command.call(this, "set background color");
  6841. this.figure = _572e;
  6842. this.newColor = color;
  6843. this.oldColor = _572e.getBackgroundColor();
  6844. };
  6845. draw2d.CommandSetBackgroundColor.prototype = new draw2d.Command();
  6846. draw2d.CommandSetBackgroundColor.prototype.type = "draw2d.CommandSetBackgroundColor";
  6847. draw2d.CommandSetBackgroundColor.prototype.execute = function() {
  6848. this.redo();
  6849. };
  6850. draw2d.CommandSetBackgroundColor.prototype.undo = function() {
  6851. this.figure.setBackgroundColor(this.oldColor);
  6852. };
  6853. draw2d.CommandSetBackgroundColor.prototype.redo = function() {
  6854. this.figure.setBackgroundColor(this.newColor);
  6855. };
  6856. draw2d.CommandConnect = function(_5951, _5952, _5953) {
  6857. draw2d.Command.call(this, "create connection");
  6858. this.workflow = _5951;
  6859. this.source = _5952;
  6860. this.target = _5953;
  6861. this.connection = null;
  6862. };
  6863. draw2d.CommandConnect.prototype = new draw2d.Command();
  6864. draw2d.CommandConnect.prototype.type = "draw2d.CommandConnect";
  6865. draw2d.CommandConnect.prototype.setConnection = function(_5954) {
  6866. this.connection = _5954;
  6867. };
  6868. draw2d.CommandConnect.prototype.execute = function() {
  6869. if (this.connection === null) {
  6870. this.connection = new draw2d.Connection();
  6871. }
  6872. this.connection.setSource(this.source);
  6873. this.connection.setTarget(this.target);
  6874. this.workflow.addFigure(this.connection);
  6875. };
  6876. draw2d.CommandConnect.prototype.redo = function() {
  6877. this.workflow.addFigure(this.connection);
  6878. this.connection.reconnect();
  6879. };
  6880. draw2d.CommandConnect.prototype.undo = function() {
  6881. this.workflow.removeFigure(this.connection);
  6882. };
  6883. draw2d.CommandReconnect = function(con) {
  6884. draw2d.Command.call(this, "reconnect connection");
  6885. this.con = con;
  6886. this.oldSourcePort = con.getSource();
  6887. this.oldTargetPort = con.getTarget();
  6888. this.oldRouter = con.getRouter();
  6889. this.con.setRouter(new draw2d.NullConnectionRouter());
  6890. };
  6891. draw2d.CommandReconnect.prototype = new draw2d.Command();
  6892. draw2d.CommandReconnect.prototype.type = "draw2d.CommandReconnect";
  6893. draw2d.CommandReconnect.prototype.canExecute = function() {
  6894. return true;
  6895. };
  6896. draw2d.CommandReconnect.prototype.setNewPorts = function(_5584, _5585) {
  6897. this.newSourcePort = _5584;
  6898. this.newTargetPort = _5585;
  6899. };
  6900. draw2d.CommandReconnect.prototype.execute = function() {
  6901. this.redo();
  6902. };
  6903. draw2d.CommandReconnect.prototype.cancel = function() {
  6904. var start = this.con.sourceAnchor.getLocation(this.con.targetAnchor
  6905. .getReferencePoint());
  6906. var end = this.con.targetAnchor.getLocation(this.con.sourceAnchor
  6907. .getReferencePoint());
  6908. this.con.setStartPoint(start.x, start.y);
  6909. this.con.setEndPoint(end.x, end.y);
  6910. this.con.getWorkflow().showLineResizeHandles(this.con);
  6911. this.con.setRouter(this.oldRouter);
  6912. };
  6913. draw2d.CommandReconnect.prototype.undo = function() {
  6914. this.con.setSource(this.oldSourcePort);
  6915. this.con.setTarget(this.oldTargetPort);
  6916. this.con.setRouter(this.oldRouter);
  6917. if (this.con.getWorkflow().getCurrentSelection() == this.con) {
  6918. this.con.getWorkflow().showLineResizeHandles(this.con);
  6919. }
  6920. };
  6921. draw2d.CommandReconnect.prototype.redo = function() {
  6922. this.con.setSource(this.newSourcePort);
  6923. this.con.setTarget(this.newTargetPort);
  6924. this.con.setRouter(this.oldRouter);
  6925. if (this.con.getWorkflow().getCurrentSelection() == this.con) {
  6926. this.con.getWorkflow().showLineResizeHandles(this.con);
  6927. }
  6928. };
  6929. draw2d.CommandMoveLine = function(line, _57a3, _57a4, endX, endY) {
  6930. draw2d.Command.call(this, "move line");
  6931. this.line = line;
  6932. this.startX1 = _57a3;
  6933. this.startY1 = _57a4;
  6934. this.endX1 = endX;
  6935. this.endY1 = endY;
  6936. };
  6937. draw2d.CommandMoveLine.prototype = new draw2d.Command();
  6938. draw2d.CommandMoveLine.prototype.type = "draw2d.CommandMoveLine";
  6939. draw2d.CommandMoveLine.prototype.canExecute = function() {
  6940. return this.startX1 != this.startX2 || this.startY1 != this.startY2
  6941. || this.endX1 != this.endX2 || this.endY1 != this.endY2;
  6942. };
  6943. draw2d.CommandMoveLine.prototype.execute = function() {
  6944. this.startX2 = this.line.getStartX();
  6945. this.startY2 = this.line.getStartY();
  6946. this.endX2 = this.line.getEndX();
  6947. this.endY2 = this.line.getEndY();
  6948. this.redo();
  6949. };
  6950. draw2d.CommandMoveLine.prototype.undo = function() {
  6951. this.line.setStartPoint(this.startX1, this.startY1);
  6952. this.line.setEndPoint(this.endX1, this.endY1);
  6953. if (this.line.workflow.getCurrentSelection() == this.line) {
  6954. this.line.workflow.showLineResizeHandles(this.line);
  6955. }
  6956. };
  6957. draw2d.CommandMoveLine.prototype.redo = function() {
  6958. this.line.setStartPoint(this.startX2, this.startY2);
  6959. this.line.setEndPoint(this.endX2, this.endY2);
  6960. if (this.line.workflow.getCurrentSelection() == this.line) {
  6961. this.line.workflow.showLineResizeHandles(this.line);
  6962. }
  6963. };
  6964. draw2d.CommandMovePort = function(port) {
  6965. draw2d.Command.call(this, "move port");
  6966. this.port = port;
  6967. };
  6968. draw2d.CommandMovePort.prototype = new draw2d.Command();
  6969. draw2d.CommandMovePort.prototype.type = "draw2d.CommandMovePort";
  6970. draw2d.CommandMovePort.prototype.execute = function() {
  6971. this.port.setAlpha(1);
  6972. this.port.setPosition(this.port.originX, this.port.originY);
  6973. this.port.parentNode.workflow.hideConnectionLine();
  6974. };
  6975. draw2d.CommandMovePort.prototype.undo = function() {
  6976. };
  6977. draw2d.CommandMovePort.prototype.redo = function() {
  6978. };
  6979. draw2d.CommandMovePort.prototype.setPosition = function(x, y) {
  6980. };
  6981. draw2d.Menu = function() {
  6982. this.menuItems = new draw2d.ArrayList();
  6983. draw2d.Figure.call(this);
  6984. this.setSelectable(false);
  6985. this.setDeleteable(false);
  6986. this.setCanDrag(false);
  6987. this.setResizeable(false);
  6988. this.setSelectable(false);
  6989. this.setZOrder(10000);
  6990. this.dirty = false;
  6991. };
  6992. draw2d.Menu.prototype = new draw2d.Figure();
  6993. draw2d.Menu.prototype.type = "draw2d.Menu";
  6994. draw2d.Menu.prototype.createHTMLElement = function() {
  6995. var item = document.createElement("div");
  6996. item.style.position = "absolute";
  6997. item.style.left = this.x + "px";
  6998. item.style.top = this.y + "px";
  6999. item.style.margin = "0px";
  7000. item.style.padding = "0px";
  7001. item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
  7002. item.style.border = "1px solid gray";
  7003. item.style.background = "lavender";
  7004. item.style.cursor = "pointer";
  7005. item.style.width = "auto";
  7006. item.style.height = "auto";
  7007. item.className = "Menu";
  7008. return item;
  7009. };
  7010. draw2d.Menu.prototype.setWorkflow = function(_5085) {
  7011. this.workflow = _5085;
  7012. };
  7013. draw2d.Menu.prototype.setDimension = function(w, h) {
  7014. };
  7015. draw2d.Menu.prototype.appendMenuItem = function(item) {
  7016. this.menuItems.add(item);
  7017. item.parentMenu = this;
  7018. this.dirty = true;
  7019. };
  7020. draw2d.Menu.prototype.getHTMLElement = function() {
  7021. var html = draw2d.Figure.prototype.getHTMLElement.call(this);
  7022. if (this.dirty) {
  7023. this.createList();
  7024. }
  7025. return html;
  7026. };
  7027. draw2d.Menu.prototype.createList = function() {
  7028. this.dirty = false;
  7029. this.html.innerHTML = "";
  7030. var oThis = this;
  7031. for ( var i = 0; i < this.menuItems.getSize(); i++) {
  7032. var item = this.menuItems.get(i);
  7033. var li = document.createElement("a");
  7034. li.innerHTML = item.getLabel();
  7035. li.style.display = "block";
  7036. li.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif";
  7037. li.style.fontSize = "9pt";
  7038. li.style.color = "dimgray";
  7039. li.style.borderBottom = "1px solid silver";
  7040. li.style.paddingLeft = "5px";
  7041. li.style.paddingRight = "5px";
  7042. li.style.whiteSpace = "nowrap";
  7043. li.style.cursor = "pointer";
  7044. li.className = "MenuItem";
  7045. this.html.appendChild(li);
  7046. li.menuItem = item;
  7047. if (li.addEventListener) {
  7048. li.addEventListener("click", function(event) {
  7049. var _508f = arguments[0] || window.event;
  7050. _508f.cancelBubble = true;
  7051. _508f.returnValue = false;
  7052. var diffX = _508f.clientX;
  7053. var diffY = _508f.clientY;
  7054. var _5092 = document.body.parentNode.scrollLeft;
  7055. var _5093 = document.body.parentNode.scrollTop;
  7056. this.menuItem.execute(diffX + _5092, diffY + _5093);
  7057. }, false);
  7058. li.addEventListener("mouseup", function(event) {
  7059. event.cancelBubble = true;
  7060. event.returnValue = false;
  7061. }, false);
  7062. li.addEventListener("mousedown", function(event) {
  7063. event.cancelBubble = true;
  7064. event.returnValue = false;
  7065. }, false);
  7066. li.addEventListener("mouseover", function(event) {
  7067. this.style.backgroundColor = "silver";
  7068. }, false);
  7069. li.addEventListener("mouseout", function(event) {
  7070. this.style.backgroundColor = "transparent";
  7071. }, false);
  7072. } else {
  7073. if (li.attachEvent) {
  7074. li.attachEvent("onclick", function(event) {
  7075. var _5099 = arguments[0] || window.event;
  7076. _5099.cancelBubble = true;
  7077. _5099.returnValue = false;
  7078. var diffX = _5099.clientX;
  7079. var diffY = _5099.clientY;
  7080. var _509c = document.body.parentNode.scrollLeft;
  7081. var _509d = document.body.parentNode.scrollTop;
  7082. event.srcElement.menuItem.execute(diffX + _509c, diffY
  7083. + _509d);
  7084. });
  7085. li.attachEvent("onmousedown", function(event) {
  7086. event.cancelBubble = true;
  7087. event.returnValue = false;
  7088. });
  7089. li.attachEvent("onmouseup", function(event) {
  7090. event.cancelBubble = true;
  7091. event.returnValue = false;
  7092. });
  7093. li.attachEvent("onmouseover", function(event) {
  7094. event.srcElement.style.backgroundColor = "silver";
  7095. });
  7096. li.attachEvent("onmouseout", function(event) {
  7097. event.srcElement.style.backgroundColor = "transparent";
  7098. });
  7099. }
  7100. }
  7101. }
  7102. };
  7103. draw2d.MenuItem = function(label, _4f03, _4f04) {
  7104. this.label = label;
  7105. this.iconUrl = _4f03;
  7106. this.parentMenu = null;
  7107. this.action = _4f04;
  7108. };
  7109. draw2d.MenuItem.prototype.type = "draw2d.MenuItem";
  7110. draw2d.MenuItem.prototype.isEnabled = function() {
  7111. return true;
  7112. };
  7113. draw2d.MenuItem.prototype.getLabel = function() {
  7114. return this.label;
  7115. };
  7116. draw2d.MenuItem.prototype.execute = function(x, y) {
  7117. this.parentMenu.workflow.showMenu(null);
  7118. this.action(x, y);
  7119. };
  7120. draw2d.Locator = function() {
  7121. };
  7122. draw2d.Locator.prototype.type = "draw2d.Locator";
  7123. draw2d.Locator.prototype.relocate = function(_5077) {
  7124. };
  7125. draw2d.ConnectionLocator = function(_57d5) {
  7126. draw2d.Locator.call(this);
  7127. this.connection = _57d5;
  7128. };
  7129. draw2d.ConnectionLocator.prototype = new draw2d.Locator;
  7130. draw2d.ConnectionLocator.prototype.type = "draw2d.ConnectionLocator";
  7131. draw2d.ConnectionLocator.prototype.getConnection = function() {
  7132. return this.connection;
  7133. };
  7134. draw2d.ManhattanMidpointLocator = function(_603c) {
  7135. draw2d.ConnectionLocator.call(this, _603c);
  7136. };
  7137. draw2d.ManhattanMidpointLocator.prototype = new draw2d.ConnectionLocator;
  7138. draw2d.ManhattanMidpointLocator.prototype.type = "draw2d.ManhattanMidpointLocator";
  7139. draw2d.ManhattanMidpointLocator.prototype.relocate = function(_603d) {
  7140. var conn = this.getConnection();
  7141. var p = new draw2d.Point();
  7142. var _6040 = conn.getPoints();
  7143. var index = Math.floor((_6040.getSize() - 2) / 2);
  7144. if (_6040.getSize() <= index + 1) {
  7145. return;
  7146. }
  7147. var p1 = _6040.get(index);
  7148. var p2 = _6040.get(index + 1);
  7149. p.x = (p2.x - p1.x) / 2 + p1.x + 5;
  7150. p.y = (p2.y - p1.y) / 2 + p1.y + 5;
  7151. _603d.setPosition(p.x, p.y);
  7152. };
  7153. draw2d.EditPartFactory = function() {
  7154. };
  7155. draw2d.EditPartFactory.prototype.type = "draw2d.EditPartFactory";
  7156. draw2d.EditPartFactory.prototype.createEditPart = function(model) {
  7157. };
  7158. draw2d.AbstractObjectModel = function() {
  7159. this.listeners = new draw2d.ArrayList();
  7160. this.id = draw2d.UUID.create();
  7161. };
  7162. draw2d.AbstractObjectModel.EVENT_ELEMENT_ADDED = "element added";
  7163. draw2d.AbstractObjectModel.EVENT_ELEMENT_REMOVED = "element removed";
  7164. draw2d.AbstractObjectModel.EVENT_CONNECTION_ADDED = "connection addedx";
  7165. draw2d.AbstractObjectModel.EVENT_CONNECTION_REMOVED = "connection removed";
  7166. draw2d.AbstractObjectModel.prototype.type = "draw2d.AbstractObjectModel";
  7167. draw2d.AbstractObjectModel.prototype.getModelChildren = function() {
  7168. return new draw2d.ArrayList();
  7169. };
  7170. draw2d.AbstractObjectModel.prototype.getModelParent = function() {
  7171. return this.modelParent;
  7172. };
  7173. draw2d.AbstractObjectModel.prototype.setModelParent = function(_555f) {
  7174. this.modelParent = _555f;
  7175. };
  7176. draw2d.AbstractObjectModel.prototype.getId = function() {
  7177. return this.id;
  7178. };
  7179. draw2d.AbstractObjectModel.prototype.firePropertyChange = function(_5560,
  7180. _5561, _5562) {
  7181. var count = this.listeners.getSize();
  7182. if (count === 0) {
  7183. return;
  7184. }
  7185. var event = new draw2d.PropertyChangeEvent(this, _5560, _5561, _5562);
  7186. for ( var i = 0; i < count; i++) {
  7187. try {
  7188. this.listeners.get(i).propertyChange(event);
  7189. } catch (e) {
  7190. alert("Method: draw2d.AbstractObjectModel.prototype.firePropertyChange\n"
  7191. + e
  7192. + "\nProperty: "
  7193. + _5560
  7194. + "\nListener Class:"
  7195. + this.listeners.get(i).type);
  7196. }
  7197. }
  7198. };
  7199. draw2d.AbstractObjectModel.prototype.addPropertyChangeListener = function(_5566) {
  7200. if (_5566 !== null) {
  7201. this.listeners.add(_5566);
  7202. }
  7203. };
  7204. draw2d.AbstractObjectModel.prototype.removePropertyChangeListener = function(
  7205. _5567) {
  7206. if (_5567 !== null) {
  7207. this.listeners.remove(_5567);
  7208. }
  7209. };
  7210. draw2d.AbstractObjectModel.prototype.getPersistentAttributes = function() {
  7211. return {
  7212. id : this.id
  7213. };
  7214. };
  7215. draw2d.AbstractConnectionModel = function() {
  7216. draw2d.AbstractObjectModel.call(this);
  7217. };
  7218. draw2d.AbstractConnectionModel.prototype = new draw2d.AbstractObjectModel();
  7219. draw2d.AbstractConnectionModel.prototype.type = "draw2d.AbstractConnectionModel";
  7220. draw2d.AbstractConnectionModel.prototype.getSourceModel = function() {
  7221. throw "you must override the method [AbstractConnectionModel.prototype.getSourceModel]";
  7222. };
  7223. draw2d.AbstractConnectionModel.prototype.getTargetModel = function() {
  7224. throw "you must override the method [AbstractConnectionModel.prototype.getTargetModel]";
  7225. };
  7226. draw2d.AbstractConnectionModel.prototype.getSourcePortName = function() {
  7227. throw "you must override the method [AbstractConnectionModel.prototype.getSourcePortName]";
  7228. };
  7229. draw2d.AbstractConnectionModel.prototype.getTargetPortName = function() {
  7230. throw "you must override the method [AbstractConnectionModel.prototype.getTargetPortName]";
  7231. };
  7232. draw2d.AbstractConnectionModel.prototype.getSourcePortModel = function() {
  7233. throw "you must override the method [AbstractConnectionModel.prototype.getSourcePortModel]";
  7234. };
  7235. draw2d.AbstractConnectionModel.prototype.getTargetPortModel = function() {
  7236. throw "you must override the method [AbstractConnectionModel.prototype.getTargetPortModel]";
  7237. };
  7238. draw2d.PropertyChangeEvent = function(model, _5919, _591a, _591b) {
  7239. this.model = model;
  7240. this.property = _5919;
  7241. this.oldValue = _591a;
  7242. this.newValue = _591b;
  7243. };
  7244. draw2d.PropertyChangeEvent.prototype.type = "draw2d.PropertyChangeEvent";
  7245. draw2d.GraphicalViewer = function(id) {
  7246. try {
  7247. draw2d.Workflow.call(this, id);
  7248. this.factory = null;
  7249. this.model = null;
  7250. this.initDone = false;
  7251. } catch (e) {
  7252. pushErrorStack(e, "draw2d.GraphicalViewer=function(/*:String*/ id)");
  7253. }
  7254. };
  7255. draw2d.GraphicalViewer.prototype = new draw2d.Workflow();
  7256. draw2d.GraphicalViewer.prototype.type = "draw2d.GraphicalViewer";
  7257. draw2d.GraphicalViewer.prototype.setEditPartFactory = function(_56c3) {
  7258. this.factory = _56c3;
  7259. this.checkInit();
  7260. };
  7261. draw2d.GraphicalViewer.prototype.setModel = function(model) {
  7262. try {
  7263. if (model instanceof draw2d.AbstractObjectModel) {
  7264. this.model = model;
  7265. this.checkInit();
  7266. this.model.addPropertyChangeListener(this);
  7267. } else {
  7268. alert("Invalid model class type:" + model.type);
  7269. }
  7270. } catch (e) {
  7271. pushErrorStack(
  7272. e,
  7273. "draw2d.GraphicalViewer.prototype.setModel=function(/*:draw2d.AbstractObjectModel*/ model )");
  7274. }
  7275. };
  7276. draw2d.GraphicalViewer.prototype.propertyChange = function(event) {
  7277. switch (event.property) {
  7278. case draw2d.AbstractObjectModel.EVENT_ELEMENT_REMOVED:
  7279. var _56c6 = this.getFigure(event.oldValue.getId());
  7280. this.removeFigure(_56c6);
  7281. break;
  7282. case draw2d.AbstractObjectModel.EVENT_ELEMENT_ADDED:
  7283. var _56c6 = this.factory.createEditPart(event.newValue);
  7284. _56c6.setId(event.newValue.getId());
  7285. this.addFigure(_56c6);
  7286. this.setCurrentSelection(_56c6);
  7287. break;
  7288. }
  7289. };
  7290. draw2d.GraphicalViewer.prototype.checkInit = function() {
  7291. if (this.factory !== null && this.model !== null && this.initDone == false) {
  7292. try {
  7293. var _56c7 = this.model.getModelChildren();
  7294. var count = _56c7.getSize();
  7295. for ( var i = 0; i < count; i++) {
  7296. var child = _56c7.get(i);
  7297. var _56cb = this.factory.createEditPart(child);
  7298. _56cb.setId(child.getId());
  7299. this.addFigure(_56cb);
  7300. }
  7301. } catch (e) {
  7302. pushErrorStack(e,
  7303. "draw2d.GraphicalViewer.prototype.checkInit=function()[addFigures]");
  7304. }
  7305. try {
  7306. var _56cc = this.getDocument().getFigures();
  7307. var count = _56cc.getSize();
  7308. for ( var i = 0; i < count; i++) {
  7309. var _56cb = _56cc.get(i);
  7310. if (_56cb instanceof draw2d.Node) {
  7311. this.refreshConnections(_56cb);
  7312. }
  7313. }
  7314. } catch (e) {
  7315. pushErrorStack(e,
  7316. "draw2d.GraphicalViewer.prototype.checkInit=function()[refreshConnections]");
  7317. }
  7318. }
  7319. };
  7320. draw2d.GraphicalViewer.prototype.refreshConnections = function(node) {
  7321. try {
  7322. var _56ce = new draw2d.ArrayList();
  7323. var _56cf = node.getModelSourceConnections();
  7324. var count = _56cf.getSize();
  7325. for ( var i = 0; i < count; i++) {
  7326. var _56d2 = _56cf.get(i);
  7327. _56ce.add(_56d2.getId());
  7328. var _56d3 = this.getLine(_56d2.getId());
  7329. if (_56d3 === null) {
  7330. _56d3 = this.factory.createEditPart(_56d2);
  7331. var _56d4 = _56d2.getSourceModel();
  7332. var _56d5 = _56d2.getTargetModel();
  7333. var _56d6 = this.getFigure(_56d4.getId());
  7334. var _56d7 = this.getFigure(_56d5.getId());
  7335. var _56d8 = _56d6.getOutputPort(_56d2.getSourcePortName());
  7336. var _56d9 = _56d7.getInputPort(_56d2.getTargetPortName());
  7337. _56d3.setTarget(_56d9);
  7338. _56d3.setSource(_56d8);
  7339. _56d3.setId(_56d2.getId());
  7340. this.addFigure(_56d3);
  7341. this.setCurrentSelection(_56d3);
  7342. }
  7343. }
  7344. var ports = node.getOutputPorts();
  7345. count = ports.getSize();
  7346. for ( var i = 0; i < count; i++) {
  7347. var _56db = ports.get(i).getConnections();
  7348. var _56dc = _56db.getSize();
  7349. for ( var ii = 0; ii < _56dc; ii++) {
  7350. var _56de = _56db.get(ii);
  7351. if (!_56ce.contains(_56de.getId())) {
  7352. this.removeFigure(_56de);
  7353. _56ce.add(_56de.getId());
  7354. }
  7355. }
  7356. }
  7357. } catch (e) {
  7358. pushErrorStack(
  7359. e,
  7360. "draw2d.GraphicalViewer.prototype.refreshConnections=function(/*:draw2d.Node*/ node )");
  7361. }
  7362. };
  7363. draw2d.GraphicalEditor = function(id) {
  7364. try {
  7365. this.view = new draw2d.GraphicalViewer(id);
  7366. this.initializeGraphicalViewer();
  7367. } catch (e) {
  7368. pushErrorStack(e, "draw2d.GraphicalEditor=function(/*:String*/ id)");
  7369. }
  7370. };
  7371. draw2d.GraphicalEditor.prototype.type = "draw2d.GraphicalEditor";
  7372. draw2d.GraphicalEditor.prototype.initializeGraphicalViewer = function() {
  7373. };
  7374. draw2d.GraphicalEditor.prototype.getGraphicalViewer = function() {
  7375. return this.view;
  7376. };
  7377. var whitespace = "\n\r\t ";
  7378. XMLP = function(_595d) {
  7379. _595d = SAXStrings.replace(_595d, null, null, "\r\n", "\n");
  7380. _595d = SAXStrings.replace(_595d, null, null, "\r", "\n");
  7381. this.m_xml = _595d;
  7382. this.m_iP = 0;
  7383. this.m_iState = XMLP._STATE_PROLOG;
  7384. this.m_stack = new Stack();
  7385. this._clearAttributes();
  7386. };
  7387. XMLP._NONE = 0;
  7388. XMLP._ELM_B = 1;
  7389. XMLP._ELM_E = 2;
  7390. XMLP._ELM_EMP = 3;
  7391. XMLP._ATT = 4;
  7392. XMLP._TEXT = 5;
  7393. XMLP._ENTITY = 6;
  7394. XMLP._PI = 7;
  7395. XMLP._CDATA = 8;
  7396. XMLP._COMMENT = 9;
  7397. XMLP._DTD = 10;
  7398. XMLP._ERROR = 11;
  7399. XMLP._CONT_XML = 0;
  7400. XMLP._CONT_ALT = 1;
  7401. XMLP._ATT_NAME = 0;
  7402. XMLP._ATT_VAL = 1;
  7403. XMLP._STATE_PROLOG = 1;
  7404. XMLP._STATE_DOCUMENT = 2;
  7405. XMLP._STATE_MISC = 3;
  7406. XMLP._errs = [];
  7407. XMLP._errs[XMLP.ERR_CLOSE_PI = 0] = "PI: missing closing sequence";
  7408. XMLP._errs[XMLP.ERR_CLOSE_DTD = 1] = "DTD: missing closing sequence";
  7409. XMLP._errs[XMLP.ERR_CLOSE_COMMENT = 2] = "Comment: missing closing sequence";
  7410. XMLP._errs[XMLP.ERR_CLOSE_CDATA = 3] = "CDATA: missing closing sequence";
  7411. XMLP._errs[XMLP.ERR_CLOSE_ELM = 4] = "Element: missing closing sequence";
  7412. XMLP._errs[XMLP.ERR_CLOSE_ENTITY = 5] = "Entity: missing closing sequence";
  7413. XMLP._errs[XMLP.ERR_PI_TARGET = 6] = "PI: target is required";
  7414. XMLP._errs[XMLP.ERR_ELM_EMPTY = 7] = "Element: cannot be both empty and closing";
  7415. XMLP._errs[XMLP.ERR_ELM_NAME = 8] = "Element: name must immediatly follow \"<\"";
  7416. XMLP._errs[XMLP.ERR_ELM_LT_NAME = 9] = "Element: \"<\" not allowed in element names";
  7417. XMLP._errs[XMLP.ERR_ATT_VALUES = 10] = "Attribute: values are required and must be in quotes";
  7418. XMLP._errs[XMLP.ERR_ATT_LT_NAME = 11] = "Element: \"<\" not allowed in attribute names";
  7419. XMLP._errs[XMLP.ERR_ATT_LT_VALUE = 12] = "Attribute: \"<\" not allowed in attribute values";
  7420. XMLP._errs[XMLP.ERR_ATT_DUP = 13] = "Attribute: duplicate attributes not allowed";
  7421. XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN = 14] = "Entity: unknown entity";
  7422. XMLP._errs[XMLP.ERR_INFINITELOOP = 15] = "Infininte loop";
  7423. XMLP._errs[XMLP.ERR_DOC_STRUCTURE = 16] = "Document: only comments, processing instructions, or whitespace allowed outside of document element";
  7424. XMLP._errs[XMLP.ERR_ELM_NESTING = 17] = "Element: must be nested correctly";
  7425. XMLP.prototype._addAttribute = function(name, value) {
  7426. this.m_atts[this.m_atts.length] = new Array(name, value);
  7427. };
  7428. XMLP.prototype._checkStructure = function(_5960) {
  7429. if (XMLP._STATE_PROLOG == this.m_iState) {
  7430. if ((XMLP._TEXT == _5960) || (XMLP._ENTITY == _5960)) {
  7431. if (SAXStrings.indexOfNonWhitespace(this.getContent(), this
  7432. .getContentBegin(), this.getContentEnd()) != -1) {
  7433. return this._setErr(XMLP.ERR_DOC_STRUCTURE);
  7434. }
  7435. }
  7436. if ((XMLP._ELM_B == _5960) || (XMLP._ELM_EMP == _5960)) {
  7437. this.m_iState = XMLP._STATE_DOCUMENT;
  7438. }
  7439. }
  7440. if (XMLP._STATE_DOCUMENT == this.m_iState) {
  7441. if ((XMLP._ELM_B == _5960) || (XMLP._ELM_EMP == _5960)) {
  7442. this.m_stack.push(this.getName());
  7443. }
  7444. if ((XMLP._ELM_E == _5960) || (XMLP._ELM_EMP == _5960)) {
  7445. var _5961 = this.m_stack.pop();
  7446. if ((_5961 === null) || (_5961 != this.getName())) {
  7447. return this._setErr(XMLP.ERR_ELM_NESTING);
  7448. }
  7449. }
  7450. if (this.m_stack.count() === 0) {
  7451. this.m_iState = XMLP._STATE_MISC;
  7452. return _5960;
  7453. }
  7454. }
  7455. if (XMLP._STATE_MISC == this.m_iState) {
  7456. if ((XMLP._ELM_B == _5960) || (XMLP._ELM_E == _5960)
  7457. || (XMLP._ELM_EMP == _5960) || (XMLP.EVT_DTD == _5960)) {
  7458. return this._setErr(XMLP.ERR_DOC_STRUCTURE);
  7459. }
  7460. if ((XMLP._TEXT == _5960) || (XMLP._ENTITY == _5960)) {
  7461. if (SAXStrings.indexOfNonWhitespace(this.getContent(), this
  7462. .getContentBegin(), this.getContentEnd()) != -1) {
  7463. return this._setErr(XMLP.ERR_DOC_STRUCTURE);
  7464. }
  7465. }
  7466. }
  7467. return _5960;
  7468. };
  7469. XMLP.prototype._clearAttributes = function() {
  7470. this.m_atts = [];
  7471. };
  7472. XMLP.prototype._findAttributeIndex = function(name) {
  7473. for ( var i = 0; i < this.m_atts.length; i++) {
  7474. if (this.m_atts[i][XMLP._ATT_NAME] == name) {
  7475. return i;
  7476. }
  7477. }
  7478. return -1;
  7479. };
  7480. XMLP.prototype.getAttributeCount = function() {
  7481. return this.m_atts ? this.m_atts.length : 0;
  7482. };
  7483. XMLP.prototype.getAttributeName = function(index) {
  7484. return ((index < 0) || (index >= this.m_atts.length)) ? null
  7485. : this.m_atts[index][XMLP._ATT_NAME];
  7486. };
  7487. XMLP.prototype.getAttributeValue = function(index) {
  7488. return ((index < 0) || (index >= this.m_atts.length)) ? null
  7489. : __unescapeString(this.m_atts[index][XMLP._ATT_VAL]);
  7490. };
  7491. XMLP.prototype.getAttributeValueByName = function(name) {
  7492. return this.getAttributeValue(this._findAttributeIndex(name));
  7493. };
  7494. XMLP.prototype.getColumnNumber = function() {
  7495. return SAXStrings.getColumnNumber(this.m_xml, this.m_iP);
  7496. };
  7497. XMLP.prototype.getContent = function() {
  7498. return (this.m_cSrc == XMLP._CONT_XML) ? this.m_xml : this.m_cAlt;
  7499. };
  7500. XMLP.prototype.getContentBegin = function() {
  7501. return this.m_cB;
  7502. };
  7503. XMLP.prototype.getContentEnd = function() {
  7504. return this.m_cE;
  7505. };
  7506. XMLP.prototype.getLineNumber = function() {
  7507. return SAXStrings.getLineNumber(this.m_xml, this.m_iP);
  7508. };
  7509. XMLP.prototype.getName = function() {
  7510. return this.m_name;
  7511. };
  7512. XMLP.prototype.next = function() {
  7513. return this._checkStructure(this._parse());
  7514. };
  7515. XMLP.prototype._parse = function() {
  7516. if (this.m_iP == this.m_xml.length) {
  7517. return XMLP._NONE;
  7518. }
  7519. if (this.m_iP == this.m_xml.indexOf("<?", this.m_iP)) {
  7520. return this._parsePI(this.m_iP + 2);
  7521. } else {
  7522. if (this.m_iP == this.m_xml.indexOf("<!DOCTYPE", this.m_iP)) {
  7523. return this._parseDTD(this.m_iP + 9);
  7524. } else {
  7525. if (this.m_iP == this.m_xml.indexOf("<!--", this.m_iP)) {
  7526. return this._parseComment(this.m_iP + 4);
  7527. } else {
  7528. if (this.m_iP == this.m_xml.indexOf("<![CDATA[", this.m_iP)) {
  7529. return this._parseCDATA(this.m_iP + 9);
  7530. } else {
  7531. if (this.m_iP == this.m_xml.indexOf("<", this.m_iP)) {
  7532. return this._parseElement(this.m_iP + 1);
  7533. } else {
  7534. if (this.m_iP == this.m_xml.indexOf("&", this.m_iP)) {
  7535. return this._parseEntity(this.m_iP + 1);
  7536. } else {
  7537. return this._parseText(this.m_iP);
  7538. }
  7539. }
  7540. }
  7541. }
  7542. }
  7543. }
  7544. };
  7545. XMLP.prototype._parseAttribute = function(iB, iE) {
  7546. var iNB, iNE, iEq, iVB, iVE;
  7547. var _596a, strN, strV;
  7548. this.m_cAlt = "";
  7549. iNB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
  7550. if ((iNB == -1) || (iNB >= iE)) {
  7551. return iNB;
  7552. }
  7553. iEq = this.m_xml.indexOf("=", iNB);
  7554. if ((iEq == -1) || (iEq > iE)) {
  7555. return this._setErr(XMLP.ERR_ATT_VALUES);
  7556. }
  7557. iNE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iNB, iEq);
  7558. iVB = SAXStrings.indexOfNonWhitespace(this.m_xml, iEq + 1, iE);
  7559. if ((iVB == -1) || (iVB > iE)) {
  7560. return this._setErr(XMLP.ERR_ATT_VALUES);
  7561. }
  7562. _596a = this.m_xml.charAt(iVB);
  7563. if (SAXStrings.QUOTES.indexOf(_596a) == -1) {
  7564. return this._setErr(XMLP.ERR_ATT_VALUES);
  7565. }
  7566. iVE = this.m_xml.indexOf(_596a, iVB + 1);
  7567. if ((iVE == -1) || (iVE > iE)) {
  7568. return this._setErr(XMLP.ERR_ATT_VALUES);
  7569. }
  7570. strN = this.m_xml.substring(iNB, iNE + 1);
  7571. strV = this.m_xml.substring(iVB + 1, iVE);
  7572. if (strN.indexOf("<") != -1) {
  7573. return this._setErr(XMLP.ERR_ATT_LT_NAME);
  7574. }
  7575. if (strV.indexOf("<") != -1) {
  7576. return this._setErr(XMLP.ERR_ATT_LT_VALUE);
  7577. }
  7578. strV = SAXStrings.replace(strV, null, null, "\n", " ");
  7579. strV = SAXStrings.replace(strV, null, null, "\t", " ");
  7580. iRet = this._replaceEntities(strV);
  7581. if (iRet == XMLP._ERROR) {
  7582. return iRet;
  7583. }
  7584. strV = this.m_cAlt;
  7585. if (this._findAttributeIndex(strN) == -1) {
  7586. this._addAttribute(strN, strV);
  7587. } else {
  7588. return this._setErr(XMLP.ERR_ATT_DUP);
  7589. }
  7590. this.m_iP = iVE + 2;
  7591. return XMLP._ATT;
  7592. };
  7593. XMLP.prototype._parseCDATA = function(iB) {
  7594. var iE = this.m_xml.indexOf("]]>", iB);
  7595. if (iE == -1) {
  7596. return this._setErr(XMLP.ERR_CLOSE_CDATA);
  7597. }
  7598. this._setContent(XMLP._CONT_XML, iB, iE);
  7599. this.m_iP = iE + 3;
  7600. return XMLP._CDATA;
  7601. };
  7602. XMLP.prototype._parseComment = function(iB) {
  7603. var iE = this.m_xml.indexOf("-" + "->", iB);
  7604. if (iE == -1) {
  7605. return this._setErr(XMLP.ERR_CLOSE_COMMENT);
  7606. }
  7607. this._setContent(XMLP._CONT_XML, iB, iE);
  7608. this.m_iP = iE + 3;
  7609. return XMLP._COMMENT;
  7610. };
  7611. XMLP.prototype._parseDTD = function(iB) {
  7612. var iE, strClose, iInt, iLast;
  7613. iE = this.m_xml.indexOf(">", iB);
  7614. if (iE == -1) {
  7615. return this._setErr(XMLP.ERR_CLOSE_DTD);
  7616. }
  7617. iInt = this.m_xml.indexOf("[", iB);
  7618. strClose = ((iInt != -1) && (iInt < iE)) ? "]>" : ">";
  7619. while (true) {
  7620. if (iE == iLast) {
  7621. return this._setErr(XMLP.ERR_INFINITELOOP);
  7622. }
  7623. iLast = iE;
  7624. iE = this.m_xml.indexOf(strClose, iB);
  7625. if (iE == -1) {
  7626. return this._setErr(XMLP.ERR_CLOSE_DTD);
  7627. }
  7628. if (this.m_xml.substring(iE - 1, iE + 2) != "]]>") {
  7629. break;
  7630. }
  7631. }
  7632. this.m_iP = iE + strClose.length;
  7633. return XMLP._DTD;
  7634. };
  7635. XMLP.prototype._parseElement = function(iB) {
  7636. var iE, iDE, iNE, iRet;
  7637. var iType, strN, iLast;
  7638. iDE = iE = this.m_xml.indexOf(">", iB);
  7639. if (iE == -1) {
  7640. return this._setErr(XMLP.ERR_CLOSE_ELM);
  7641. }
  7642. if (this.m_xml.charAt(iB) == "/") {
  7643. iType = XMLP._ELM_E;
  7644. iB++;
  7645. } else {
  7646. iType = XMLP._ELM_B;
  7647. }
  7648. if (this.m_xml.charAt(iE - 1) == "/") {
  7649. if (iType == XMLP._ELM_E) {
  7650. return this._setErr(XMLP.ERR_ELM_EMPTY);
  7651. }
  7652. iType = XMLP._ELM_EMP;
  7653. iDE--;
  7654. }
  7655. iDE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iB, iDE);
  7656. if (iE - iB != 1) {
  7657. if (SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB) {
  7658. return this._setErr(XMLP.ERR_ELM_NAME);
  7659. }
  7660. }
  7661. this._clearAttributes();
  7662. iNE = SAXStrings.indexOfWhitespace(this.m_xml, iB, iDE);
  7663. if (iNE == -1) {
  7664. iNE = iDE + 1;
  7665. } else {
  7666. this.m_iP = iNE;
  7667. while (this.m_iP < iDE) {
  7668. if (this.m_iP == iLast) {
  7669. return this._setErr(XMLP.ERR_INFINITELOOP);
  7670. }
  7671. iLast = this.m_iP;
  7672. iRet = this._parseAttribute(this.m_iP, iDE);
  7673. if (iRet == XMLP._ERROR) {
  7674. return iRet;
  7675. }
  7676. }
  7677. }
  7678. strN = this.m_xml.substring(iB, iNE);
  7679. if (strN.indexOf("<") != -1) {
  7680. return this._setErr(XMLP.ERR_ELM_LT_NAME);
  7681. }
  7682. this.m_name = strN;
  7683. this.m_iP = iE + 1;
  7684. return iType;
  7685. };
  7686. XMLP.prototype._parseEntity = function(iB) {
  7687. var iE = this.m_xml.indexOf(";", iB);
  7688. if (iE == -1) {
  7689. return this._setErr(XMLP.ERR_CLOSE_ENTITY);
  7690. }
  7691. this.m_iP = iE + 1;
  7692. return this._replaceEntity(this.m_xml, iB, iE);
  7693. };
  7694. XMLP.prototype._parsePI = function(iB) {
  7695. var iE, iTB, iTE, iCB, iCE;
  7696. iE = this.m_xml.indexOf("?>", iB);
  7697. if (iE == -1) {
  7698. return this._setErr(XMLP.ERR_CLOSE_PI);
  7699. }
  7700. iTB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
  7701. if (iTB == -1) {
  7702. return this._setErr(XMLP.ERR_PI_TARGET);
  7703. }
  7704. iTE = SAXStrings.indexOfWhitespace(this.m_xml, iTB, iE);
  7705. if (iTE == -1) {
  7706. iTE = iE;
  7707. }
  7708. iCB = SAXStrings.indexOfNonWhitespace(this.m_xml, iTE, iE);
  7709. if (iCB == -1) {
  7710. iCB = iE;
  7711. }
  7712. iCE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iCB, iE);
  7713. if (iCE == -1) {
  7714. iCE = iE - 1;
  7715. }
  7716. this.m_name = this.m_xml.substring(iTB, iTE);
  7717. this._setContent(XMLP._CONT_XML, iCB, iCE + 1);
  7718. this.m_iP = iE + 2;
  7719. return XMLP._PI;
  7720. };
  7721. XMLP.prototype._parseText = function(iB) {
  7722. var iE, iEE;
  7723. iE = this.m_xml.indexOf("<", iB);
  7724. if (iE == -1) {
  7725. iE = this.m_xml.length;
  7726. }
  7727. iEE = this.m_xml.indexOf("&", iB);
  7728. if ((iEE != -1) && (iEE <= iE)) {
  7729. iE = iEE;
  7730. }
  7731. this._setContent(XMLP._CONT_XML, iB, iE);
  7732. this.m_iP = iE;
  7733. return XMLP._TEXT;
  7734. };
  7735. XMLP.prototype._replaceEntities = function(strD, iB, iE) {
  7736. if (SAXStrings.isEmpty(strD)) {
  7737. return "";
  7738. }
  7739. iB = iB || 0;
  7740. iE = iE || strD.length;
  7741. var iEB, iEE, strRet = "";
  7742. iEB = strD.indexOf("&", iB);
  7743. iEE = iB;
  7744. while ((iEB > 0) && (iEB < iE)) {
  7745. strRet += strD.substring(iEE, iEB);
  7746. iEE = strD.indexOf(";", iEB) + 1;
  7747. if ((iEE === 0) || (iEE > iE)) {
  7748. return this._setErr(XMLP.ERR_CLOSE_ENTITY);
  7749. }
  7750. iRet = this._replaceEntity(strD, iEB + 1, iEE - 1);
  7751. if (iRet == XMLP._ERROR) {
  7752. return iRet;
  7753. }
  7754. strRet += this.m_cAlt;
  7755. iEB = strD.indexOf("&", iEE);
  7756. }
  7757. if (iEE != iE) {
  7758. strRet += strD.substring(iEE, iE);
  7759. }
  7760. this._setContent(XMLP._CONT_ALT, strRet);
  7761. return XMLP._ENTITY;
  7762. };
  7763. XMLP.prototype._replaceEntity = function(strD, iB, iE) {
  7764. if (SAXStrings.isEmpty(strD)) {
  7765. return -1;
  7766. }
  7767. iB = iB || 0;
  7768. iE = iE || strD.length;
  7769. switch (strD.substring(iB, iE)) {
  7770. case "amp":
  7771. strEnt = "&";
  7772. break;
  7773. case "lt":
  7774. strEnt = "<";
  7775. break;
  7776. case "gt":
  7777. strEnt = ">";
  7778. break;
  7779. case "apos":
  7780. strEnt = "'";
  7781. break;
  7782. case "quot":
  7783. strEnt = "\"";
  7784. break;
  7785. default:
  7786. if (strD.charAt(iB) == "#") {
  7787. strEnt = String.fromCharCode(parseInt(strD.substring(iB + 1, iE)));
  7788. } else {
  7789. return this._setErr(XMLP.ERR_ENTITY_UNKNOWN);
  7790. }
  7791. break;
  7792. }
  7793. this._setContent(XMLP._CONT_ALT, strEnt);
  7794. return XMLP._ENTITY;
  7795. };
  7796. XMLP.prototype._setContent = function(iSrc) {
  7797. var args = arguments;
  7798. if (XMLP._CONT_XML == iSrc) {
  7799. this.m_cAlt = null;
  7800. this.m_cB = args[1];
  7801. this.m_cE = args[2];
  7802. } else {
  7803. this.m_cAlt = args[1];
  7804. this.m_cB = 0;
  7805. this.m_cE = args[1].length;
  7806. }
  7807. this.m_cSrc = iSrc;
  7808. };
  7809. XMLP.prototype._setErr = function(iErr) {
  7810. var _5984 = XMLP._errs[iErr];
  7811. this.m_cAlt = _5984;
  7812. this.m_cB = 0;
  7813. this.m_cE = _5984.length;
  7814. this.m_cSrc = XMLP._CONT_ALT;
  7815. return XMLP._ERROR;
  7816. };
  7817. SAXDriver = function() {
  7818. this.m_hndDoc = null;
  7819. this.m_hndErr = null;
  7820. this.m_hndLex = null;
  7821. };
  7822. SAXDriver.DOC_B = 1;
  7823. SAXDriver.DOC_E = 2;
  7824. SAXDriver.ELM_B = 3;
  7825. SAXDriver.ELM_E = 4;
  7826. SAXDriver.CHARS = 5;
  7827. SAXDriver.PI = 6;
  7828. SAXDriver.CD_B = 7;
  7829. SAXDriver.CD_E = 8;
  7830. SAXDriver.CMNT = 9;
  7831. SAXDriver.DTD_B = 10;
  7832. SAXDriver.DTD_E = 11;
  7833. SAXDriver.prototype.parse = function(strD) {
  7834. var _5986 = new XMLP(strD);
  7835. if (this.m_hndDoc && this.m_hndDoc.setDocumentLocator) {
  7836. this.m_hndDoc.setDocumentLocator(this);
  7837. }
  7838. this.m_parser = _5986;
  7839. this.m_bErr = false;
  7840. if (!this.m_bErr) {
  7841. this._fireEvent(SAXDriver.DOC_B);
  7842. }
  7843. this._parseLoop();
  7844. if (!this.m_bErr) {
  7845. this._fireEvent(SAXDriver.DOC_E);
  7846. }
  7847. this.m_xml = null;
  7848. this.m_iP = 0;
  7849. };
  7850. SAXDriver.prototype.setDocumentHandler = function(hnd) {
  7851. this.m_hndDoc = hnd;
  7852. };
  7853. SAXDriver.prototype.setErrorHandler = function(hnd) {
  7854. this.m_hndErr = hnd;
  7855. };
  7856. SAXDriver.prototype.setLexicalHandler = function(hnd) {
  7857. this.m_hndLex = hnd;
  7858. };
  7859. SAXDriver.prototype.getColumnNumber = function() {
  7860. return this.m_parser.getColumnNumber();
  7861. };
  7862. SAXDriver.prototype.getLineNumber = function() {
  7863. return this.m_parser.getLineNumber();
  7864. };
  7865. SAXDriver.prototype.getMessage = function() {
  7866. return this.m_strErrMsg;
  7867. };
  7868. SAXDriver.prototype.getPublicId = function() {
  7869. return null;
  7870. };
  7871. SAXDriver.prototype.getSystemId = function() {
  7872. return null;
  7873. };
  7874. SAXDriver.prototype.getLength = function() {
  7875. return this.m_parser.getAttributeCount();
  7876. };
  7877. SAXDriver.prototype.getName = function(index) {
  7878. return this.m_parser.getAttributeName(index);
  7879. };
  7880. SAXDriver.prototype.getValue = function(index) {
  7881. return this.m_parser.getAttributeValue(index);
  7882. };
  7883. SAXDriver.prototype.getValueByName = function(name) {
  7884. return this.m_parser.getAttributeValueByName(name);
  7885. };
  7886. SAXDriver.prototype._fireError = function(_598d) {
  7887. this.m_strErrMsg = _598d;
  7888. this.m_bErr = true;
  7889. if (this.m_hndErr && this.m_hndErr.fatalError) {
  7890. this.m_hndErr.fatalError(this);
  7891. }
  7892. };
  7893. SAXDriver.prototype._fireEvent = function(iEvt) {
  7894. var hnd, func, args = arguments, iLen = args.length - 1;
  7895. if (this.m_bErr) {
  7896. return;
  7897. }
  7898. if (SAXDriver.DOC_B == iEvt) {
  7899. func = "startDocument";
  7900. hnd = this.m_hndDoc;
  7901. } else {
  7902. if (SAXDriver.DOC_E == iEvt) {
  7903. func = "endDocument";
  7904. hnd = this.m_hndDoc;
  7905. } else {
  7906. if (SAXDriver.ELM_B == iEvt) {
  7907. func = "startElement";
  7908. hnd = this.m_hndDoc;
  7909. } else {
  7910. if (SAXDriver.ELM_E == iEvt) {
  7911. func = "endElement";
  7912. hnd = this.m_hndDoc;
  7913. } else {
  7914. if (SAXDriver.CHARS == iEvt) {
  7915. func = "characters";
  7916. hnd = this.m_hndDoc;
  7917. } else {
  7918. if (SAXDriver.PI == iEvt) {
  7919. func = "processingInstruction";
  7920. hnd = this.m_hndDoc;
  7921. } else {
  7922. if (SAXDriver.CD_B == iEvt) {
  7923. func = "startCDATA";
  7924. hnd = this.m_hndLex;
  7925. } else {
  7926. if (SAXDriver.CD_E == iEvt) {
  7927. func = "endCDATA";
  7928. hnd = this.m_hndLex;
  7929. } else {
  7930. if (SAXDriver.CMNT == iEvt) {
  7931. func = "comment";
  7932. hnd = this.m_hndLex;
  7933. }
  7934. }
  7935. }
  7936. }
  7937. }
  7938. }
  7939. }
  7940. }
  7941. }
  7942. if (hnd && hnd[func]) {
  7943. if (0 == iLen) {
  7944. hnd[func]();
  7945. } else {
  7946. if (1 == iLen) {
  7947. hnd[func](args[1]);
  7948. } else {
  7949. if (2 == iLen) {
  7950. hnd[func](args[1], args[2]);
  7951. } else {
  7952. if (3 == iLen) {
  7953. hnd[func](args[1], args[2], args[3]);
  7954. }
  7955. }
  7956. }
  7957. }
  7958. }
  7959. };
  7960. SAXDriver.prototype._parseLoop = function(_5990) {
  7961. var _5991, _5990;
  7962. _5990 = this.m_parser;
  7963. while (!this.m_bErr) {
  7964. _5991 = _5990.next();
  7965. if (_5991 == XMLP._ELM_B) {
  7966. this._fireEvent(SAXDriver.ELM_B, _5990.getName(), this);
  7967. } else {
  7968. if (_5991 == XMLP._ELM_E) {
  7969. this._fireEvent(SAXDriver.ELM_E, _5990.getName());
  7970. } else {
  7971. if (_5991 == XMLP._ELM_EMP) {
  7972. this._fireEvent(SAXDriver.ELM_B, _5990.getName(), this);
  7973. this._fireEvent(SAXDriver.ELM_E, _5990.getName());
  7974. } else {
  7975. if (_5991 == XMLP._TEXT) {
  7976. this._fireEvent(SAXDriver.CHARS, _5990.getContent(),
  7977. _5990.getContentBegin(), _5990.getContentEnd()
  7978. - _5990.getContentBegin());
  7979. } else {
  7980. if (_5991 == XMLP._ENTITY) {
  7981. this._fireEvent(SAXDriver.CHARS,
  7982. _5990.getContent(),
  7983. _5990.getContentBegin(), _5990
  7984. .getContentEnd()
  7985. - _5990.getContentBegin());
  7986. } else {
  7987. if (_5991 == XMLP._PI) {
  7988. this._fireEvent(SAXDriver.PI, _5990.getName(),
  7989. _5990.getContent().substring(
  7990. _5990.getContentBegin(),
  7991. _5990.getContentEnd()));
  7992. } else {
  7993. if (_5991 == XMLP._CDATA) {
  7994. this._fireEvent(SAXDriver.CD_B);
  7995. this._fireEvent(SAXDriver.CHARS, _5990
  7996. .getContent(), _5990
  7997. .getContentBegin(), _5990
  7998. .getContentEnd()
  7999. - _5990.getContentBegin());
  8000. this._fireEvent(SAXDriver.CD_E);
  8001. } else {
  8002. if (_5991 == XMLP._COMMENT) {
  8003. this._fireEvent(SAXDriver.CMNT, _5990
  8004. .getContent(), _5990
  8005. .getContentBegin(), _5990
  8006. .getContentEnd()
  8007. - _5990.getContentBegin());
  8008. } else {
  8009. if (_5991 == XMLP._DTD) {
  8010. } else {
  8011. if (_5991 == XMLP._ERROR) {
  8012. this._fireError(_5990
  8013. .getContent());
  8014. } else {
  8015. if (_5991 == XMLP._NONE) {
  8016. return;
  8017. }
  8018. }
  8019. }
  8020. }
  8021. }
  8022. }
  8023. }
  8024. }
  8025. }
  8026. }
  8027. }
  8028. }
  8029. };
  8030. SAXStrings = function() {
  8031. };
  8032. SAXStrings.WHITESPACE = " \t\n\r";
  8033. SAXStrings.QUOTES = "\"'";
  8034. SAXStrings.getColumnNumber = function(strD, iP) {
  8035. if (SAXStrings.isEmpty(strD)) {
  8036. return -1;
  8037. }
  8038. iP = iP || strD.length;
  8039. var arrD = strD.substring(0, iP).split("\n");
  8040. var _5995 = arrD[arrD.length - 1];
  8041. arrD.length--;
  8042. var _5996 = arrD.join("\n").length;
  8043. return iP - _5996;
  8044. };
  8045. SAXStrings.getLineNumber = function(strD, iP) {
  8046. if (SAXStrings.isEmpty(strD)) {
  8047. return -1;
  8048. }
  8049. iP = iP || strD.length;
  8050. return strD.substring(0, iP).split("\n").length;
  8051. };
  8052. SAXStrings.indexOfNonWhitespace = function(strD, iB, iE) {
  8053. if (SAXStrings.isEmpty(strD)) {
  8054. return -1;
  8055. }
  8056. iB = iB || 0;
  8057. iE = iE || strD.length;
  8058. for ( var i = iB; i < iE; i++) {
  8059. if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
  8060. return i;
  8061. }
  8062. }
  8063. return -1;
  8064. };
  8065. SAXStrings.indexOfWhitespace = function(strD, iB, iE) {
  8066. if (SAXStrings.isEmpty(strD)) {
  8067. return -1;
  8068. }
  8069. iB = iB || 0;
  8070. iE = iE || strD.length;
  8071. for ( var i = iB; i < iE; i++) {
  8072. if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
  8073. return i;
  8074. }
  8075. }
  8076. return -1;
  8077. };
  8078. SAXStrings.isEmpty = function(strD) {
  8079. return (strD === null) || (strD.length === 0);
  8080. };
  8081. SAXStrings.lastIndexOfNonWhitespace = function(strD, iB, iE) {
  8082. if (SAXStrings.isEmpty(strD)) {
  8083. return -1;
  8084. }
  8085. iB = iB || 0;
  8086. iE = iE || strD.length;
  8087. for ( var i = iE - 1; i >= iB; i--) {
  8088. if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
  8089. return i;
  8090. }
  8091. }
  8092. return -1;
  8093. };
  8094. SAXStrings.replace = function(strD, iB, iE, strF, strR) {
  8095. if (SAXStrings.isEmpty(strD)) {
  8096. return "";
  8097. }
  8098. iB = iB || 0;
  8099. iE = iE || strD.length;
  8100. return strD.substring(iB, iE).split(strF).join(strR);
  8101. };
  8102. Stack = function() {
  8103. this.m_arr = [];
  8104. };
  8105. Stack.prototype.clear = function() {
  8106. this.m_arr = [];
  8107. };
  8108. Stack.prototype.count = function() {
  8109. return this.m_arr.length;
  8110. };
  8111. Stack.prototype.destroy = function() {
  8112. this.m_arr = null;
  8113. };
  8114. Stack.prototype.peek = function() {
  8115. if (this.m_arr.length === 0) {
  8116. return null;
  8117. }
  8118. return this.m_arr[this.m_arr.length - 1];
  8119. };
  8120. Stack.prototype.pop = function() {
  8121. if (this.m_arr.length === 0) {
  8122. return null;
  8123. }
  8124. var o = this.m_arr[this.m_arr.length - 1];
  8125. this.m_arr.length--;
  8126. return o;
  8127. };
  8128. Stack.prototype.push = function(o) {
  8129. this.m_arr[this.m_arr.length] = o;
  8130. };
  8131. function isEmpty(str) {
  8132. return (str === null) || (str.length == 0);
  8133. }
  8134. function trim(_59ae, _59af, _59b0) {
  8135. if (isEmpty(_59ae)) {
  8136. return "";
  8137. }
  8138. if (_59af === null) {
  8139. _59af = true;
  8140. }
  8141. if (_59b0 === null) {
  8142. _59b0 = true;
  8143. }
  8144. var left = 0;
  8145. var right = 0;
  8146. var i = 0;
  8147. var k = 0;
  8148. if (_59af == true) {
  8149. while ((i < _59ae.length)
  8150. && (whitespace.indexOf(_59ae.charAt(i++)) != -1)) {
  8151. left++;
  8152. }
  8153. }
  8154. if (_59b0 == true) {
  8155. k = _59ae.length - 1;
  8156. while ((k >= left) && (whitespace.indexOf(_59ae.charAt(k--)) != -1)) {
  8157. right++;
  8158. }
  8159. }
  8160. return _59ae.substring(left, _59ae.length - right);
  8161. }
  8162. function __escapeString(str) {
  8163. var _59b6 = /&/g;
  8164. var _59b7 = /</g;
  8165. var _59b8 = />/g;
  8166. var _59b9 = /"/g;
  8167. var _59ba = /'/g;
  8168. str = str.replace(_59b6, "&amp;");
  8169. str = str.replace(_59b7, "&lt;");
  8170. str = str.replace(_59b8, "&gt;");
  8171. str = str.replace(_59b9, "&quot;");
  8172. str = str.replace(_59ba, "&apos;");
  8173. return str;
  8174. }
  8175. function __unescapeString(str) {
  8176. var _59bc = /&amp;/g;
  8177. var _59bd = /&lt;/g;
  8178. var _59be = /&gt;/g;
  8179. var _59bf = /&quot;/g;
  8180. var _59c0 = /&apos;/g;
  8181. str = str.replace(_59bc, "&");
  8182. str = str.replace(_59bd, "<");
  8183. str = str.replace(_59be, ">");
  8184. str = str.replace(_59bf, "\"");
  8185. str = str.replace(_59c0, "'");
  8186. return str;
  8187. }
  8188. function addClass(_619a, _619b) {
  8189. if (_619a) {
  8190. if (_619a.indexOf("|" + _619b + "|") < 0) {
  8191. _619a += _619b + "|";
  8192. }
  8193. } else {
  8194. _619a = "|" + _619b + "|";
  8195. }
  8196. return _619a;
  8197. }
  8198. DOMException = function(code) {
  8199. this._class = addClass(this._class, "DOMException");
  8200. this.code = code;
  8201. };
  8202. DOMException.INDEX_SIZE_ERR = 1;
  8203. DOMException.DOMSTRING_SIZE_ERR = 2;
  8204. DOMException.HIERARCHY_REQUEST_ERR = 3;
  8205. DOMException.WRONG_DOCUMENT_ERR = 4;
  8206. DOMException.INVALID_CHARACTER_ERR = 5;
  8207. DOMException.NO_DATA_ALLOWED_ERR = 6;
  8208. DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
  8209. DOMException.NOT_FOUND_ERR = 8;
  8210. DOMException.NOT_SUPPORTED_ERR = 9;
  8211. DOMException.INUSE_ATTRIBUTE_ERR = 10;
  8212. DOMException.INVALID_STATE_ERR = 11;
  8213. DOMException.SYNTAX_ERR = 12;
  8214. DOMException.INVALID_MODIFICATION_ERR = 13;
  8215. DOMException.NAMESPACE_ERR = 14;
  8216. DOMException.INVALID_ACCESS_ERR = 15;
  8217. DOMImplementation = function() {
  8218. this._class = addClass(this._class, "DOMImplementation");
  8219. this._p = null;
  8220. this.preserveWhiteSpace = false;
  8221. this.namespaceAware = true;
  8222. this.errorChecking = true;
  8223. };
  8224. DOMImplementation.prototype.escapeString = function DOMNode__escapeString(str) {
  8225. return __escapeString(str);
  8226. };
  8227. DOMImplementation.prototype.unescapeString = function DOMNode__unescapeString(
  8228. str) {
  8229. return __unescapeString(str);
  8230. };
  8231. DOMImplementation.prototype.hasFeature = function DOMImplementation_hasFeature(
  8232. _619f, _61a0) {
  8233. var ret = false;
  8234. if (_619f.toLowerCase() == "xml") {
  8235. ret = (!_61a0 || (_61a0 == "1.0") || (_61a0 == "2.0"));
  8236. } else {
  8237. if (_619f.toLowerCase() == "core") {
  8238. ret = (!_61a0 || (_61a0 == "2.0"));
  8239. }
  8240. }
  8241. return ret;
  8242. };
  8243. DOMImplementation.prototype.loadXML = function DOMImplementation_loadXML(_61a2) {
  8244. var _61a3;
  8245. try {
  8246. _61a3 = new XMLP(_61a2);
  8247. } catch (e) {
  8248. alert("Error Creating the SAX Parser. Did you include xmlsax.js or tinyxmlsax.js in your web page?\nThe SAX parser is needed to populate XML for <SCRIPT>'s W3C DOM Parser with data.");
  8249. }
  8250. var doc = new DOMDocument(this);
  8251. this._parseLoop(doc, _61a3);
  8252. doc._parseComplete = true;
  8253. return doc;
  8254. };
  8255. DOMImplementation.prototype.translateErrCode = function DOMImplementation_translateErrCode(
  8256. code) {
  8257. var msg = "";
  8258. switch (code) {
  8259. case DOMException.INDEX_SIZE_ERR:
  8260. msg = "INDEX_SIZE_ERR: Index out of bounds";
  8261. break;
  8262. case DOMException.DOMSTRING_SIZE_ERR:
  8263. msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString";
  8264. break;
  8265. case DOMException.HIERARCHY_REQUEST_ERR:
  8266. msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location";
  8267. break;
  8268. case DOMException.WRONG_DOCUMENT_ERR:
  8269. msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same";
  8270. break;
  8271. case DOMException.INVALID_CHARACTER_ERR:
  8272. msg = "INVALID_CHARACTER_ERR: The string contains an invalid character";
  8273. break;
  8274. case DOMException.NO_DATA_ALLOWED_ERR:
  8275. msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data";
  8276. break;
  8277. case DOMException.NO_MODIFICATION_ALLOWED_ERR:
  8278. msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified";
  8279. break;
  8280. case DOMException.NOT_FOUND_ERR:
  8281. msg = "NOT_FOUND_ERR: The item cannot be found";
  8282. break;
  8283. case DOMException.NOT_SUPPORTED_ERR:
  8284. msg = "NOT_SUPPORTED_ERR: This implementation does not support function";
  8285. break;
  8286. case DOMException.INUSE_ATTRIBUTE_ERR:
  8287. msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element";
  8288. break;
  8289. case DOMException.INVALID_STATE_ERR:
  8290. msg = "INVALID_STATE_ERR: The object is no longer usable";
  8291. break;
  8292. case DOMException.SYNTAX_ERR:
  8293. msg = "SYNTAX_ERR: Syntax error";
  8294. break;
  8295. case DOMException.INVALID_MODIFICATION_ERR:
  8296. msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object";
  8297. break;
  8298. case DOMException.NAMESPACE_ERR:
  8299. msg = "NAMESPACE_ERR: The namespace declaration is incorrect";
  8300. break;
  8301. case DOMException.INVALID_ACCESS_ERR:
  8302. msg = "INVALID_ACCESS_ERR: The object does not support this function";
  8303. break;
  8304. default:
  8305. msg = "UNKNOWN: Unknown Exception Code (" + code + ")";
  8306. }
  8307. return msg;
  8308. };
  8309. DOMImplementation.prototype._parseLoop = function DOMImplementation__parseLoop(
  8310. doc, p) {
  8311. var iEvt, iNode, iAttr, strName;
  8312. iNodeParent = doc;
  8313. var _61aa = 0;
  8314. var _61ab = [];
  8315. var _61ac = [];
  8316. if (this.namespaceAware) {
  8317. var iNS = doc.createNamespace("");
  8318. iNS.setValue("http://www.w3.org/2000/xmlns/");
  8319. doc._namespaces.setNamedItem(iNS);
  8320. }
  8321. while (true) {
  8322. iEvt = p.next();
  8323. if (iEvt == XMLP._ELM_B) {
  8324. var pName = p.getName();
  8325. pName = trim(pName, true, true);
  8326. if (!this.namespaceAware) {
  8327. iNode = doc.createElement(p.getName());
  8328. for ( var i = 0; i < p.getAttributeCount(); i++) {
  8329. strName = p.getAttributeName(i);
  8330. iAttr = iNode.getAttributeNode(strName);
  8331. if (!iAttr) {
  8332. iAttr = doc.createAttribute(strName);
  8333. }
  8334. iAttr.setValue(p.getAttributeValue(i));
  8335. iNode.setAttributeNode(iAttr);
  8336. }
  8337. } else {
  8338. iNode = doc.createElementNS("", p.getName());
  8339. iNode._namespaces = iNodeParent._namespaces._cloneNodes(iNode);
  8340. for ( var i = 0; i < p.getAttributeCount(); i++) {
  8341. strName = p.getAttributeName(i);
  8342. if (this._isNamespaceDeclaration(strName)) {
  8343. var _61b0 = this._parseNSName(strName);
  8344. if (strName != "xmlns") {
  8345. iNS = doc.createNamespace(strName);
  8346. } else {
  8347. iNS = doc.createNamespace("");
  8348. }
  8349. iNS.setValue(p.getAttributeValue(i));
  8350. iNode._namespaces.setNamedItem(iNS);
  8351. } else {
  8352. iAttr = iNode.getAttributeNode(strName);
  8353. if (!iAttr) {
  8354. iAttr = doc.createAttributeNS("", strName);
  8355. }
  8356. iAttr.setValue(p.getAttributeValue(i));
  8357. iNode.setAttributeNodeNS(iAttr);
  8358. if (this._isIdDeclaration(strName)) {
  8359. iNode.id = p.getAttributeValue(i);
  8360. }
  8361. }
  8362. }
  8363. if (iNode._namespaces.getNamedItem(iNode.prefix)) {
  8364. iNode.namespaceURI = iNode._namespaces
  8365. .getNamedItem(iNode.prefix).value;
  8366. }
  8367. for ( var i = 0; i < iNode.attributes.length; i++) {
  8368. if (iNode.attributes.item(i).prefix != "") {
  8369. if (iNode._namespaces.getNamedItem(iNode.attributes
  8370. .item(i).prefix)) {
  8371. iNode.attributes.item(i).namespaceURI = iNode._namespaces
  8372. .getNamedItem(iNode.attributes.item(i).prefix).value;
  8373. }
  8374. }
  8375. }
  8376. }
  8377. if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
  8378. iNodeParent.documentElement = iNode;
  8379. }
  8380. iNodeParent.appendChild(iNode);
  8381. iNodeParent = iNode;
  8382. } else {
  8383. if (iEvt == XMLP._ELM_E) {
  8384. iNodeParent = iNodeParent.parentNode;
  8385. } else {
  8386. if (iEvt == XMLP._ELM_EMP) {
  8387. pName = p.getName();
  8388. pName = trim(pName, true, true);
  8389. if (!this.namespaceAware) {
  8390. iNode = doc.createElement(pName);
  8391. for ( var i = 0; i < p.getAttributeCount(); i++) {
  8392. strName = p.getAttributeName(i);
  8393. iAttr = iNode.getAttributeNode(strName);
  8394. if (!iAttr) {
  8395. iAttr = doc.createAttribute(strName);
  8396. }
  8397. iAttr.setValue(p.getAttributeValue(i));
  8398. iNode.setAttributeNode(iAttr);
  8399. }
  8400. } else {
  8401. iNode = doc.createElementNS("", p.getName());
  8402. iNode._namespaces = iNodeParent._namespaces
  8403. ._cloneNodes(iNode);
  8404. for ( var i = 0; i < p.getAttributeCount(); i++) {
  8405. strName = p.getAttributeName(i);
  8406. if (this._isNamespaceDeclaration(strName)) {
  8407. var _61b0 = this._parseNSName(strName);
  8408. if (strName != "xmlns") {
  8409. iNS = doc.createNamespace(strName);
  8410. } else {
  8411. iNS = doc.createNamespace("");
  8412. }
  8413. iNS.setValue(p.getAttributeValue(i));
  8414. iNode._namespaces.setNamedItem(iNS);
  8415. } else {
  8416. iAttr = iNode.getAttributeNode(strName);
  8417. if (!iAttr) {
  8418. iAttr = doc.createAttributeNS("", strName);
  8419. }
  8420. iAttr.setValue(p.getAttributeValue(i));
  8421. iNode.setAttributeNodeNS(iAttr);
  8422. if (this._isIdDeclaration(strName)) {
  8423. iNode.id = p.getAttributeValue(i);
  8424. }
  8425. }
  8426. }
  8427. if (iNode._namespaces.getNamedItem(iNode.prefix)) {
  8428. iNode.namespaceURI = iNode._namespaces
  8429. .getNamedItem(iNode.prefix).value;
  8430. }
  8431. for ( var i = 0; i < iNode.attributes.length; i++) {
  8432. if (iNode.attributes.item(i).prefix != "") {
  8433. if (iNode._namespaces
  8434. .getNamedItem(iNode.attributes.item(i).prefix)) {
  8435. iNode.attributes.item(i).namespaceURI = iNode._namespaces
  8436. .getNamedItem(iNode.attributes
  8437. .item(i).prefix).value;
  8438. }
  8439. }
  8440. }
  8441. }
  8442. if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
  8443. iNodeParent.documentElement = iNode;
  8444. }
  8445. iNodeParent.appendChild(iNode);
  8446. } else {
  8447. if (iEvt == XMLP._TEXT || iEvt == XMLP._ENTITY) {
  8448. var _61b1 = p.getContent().substring(
  8449. p.getContentBegin(), p.getContentEnd());
  8450. if (!this.preserveWhiteSpace) {
  8451. if (trim(_61b1, true, true) == "") {
  8452. _61b1 = "";
  8453. }
  8454. }
  8455. if (_61b1.length > 0) {
  8456. var _61b2 = doc.createTextNode(_61b1);
  8457. iNodeParent.appendChild(_61b2);
  8458. if (iEvt == XMLP._ENTITY) {
  8459. _61ab[_61ab.length] = _61b2;
  8460. } else {
  8461. _61ac[_61ac.length] = _61b2;
  8462. }
  8463. }
  8464. } else {
  8465. if (iEvt == XMLP._PI) {
  8466. iNodeParent.appendChild(doc
  8467. .createProcessingInstruction(p.getName(), p
  8468. .getContent().substring(
  8469. p.getContentBegin(),
  8470. p.getContentEnd())));
  8471. } else {
  8472. if (iEvt == XMLP._CDATA) {
  8473. _61b1 = p.getContent().substring(
  8474. p.getContentBegin(), p.getContentEnd());
  8475. if (!this.preserveWhiteSpace) {
  8476. _61b1 = trim(_61b1, true, true);
  8477. _61b1.replace(/ +/g, " ");
  8478. }
  8479. if (_61b1.length > 0) {
  8480. iNodeParent.appendChild(doc
  8481. .createCDATASection(_61b1));
  8482. }
  8483. } else {
  8484. if (iEvt == XMLP._COMMENT) {
  8485. var _61b1 = p.getContent().substring(
  8486. p.getContentBegin(),
  8487. p.getContentEnd());
  8488. if (!this.preserveWhiteSpace) {
  8489. _61b1 = trim(_61b1, true, true);
  8490. _61b1.replace(/ +/g, " ");
  8491. }
  8492. if (_61b1.length > 0) {
  8493. iNodeParent.appendChild(doc
  8494. .createComment(_61b1));
  8495. }
  8496. } else {
  8497. if (iEvt == XMLP._DTD) {
  8498. } else {
  8499. if (iEvt == XMLP._ERROR) {
  8500. throw (new DOMException(
  8501. DOMException.SYNTAX_ERR));
  8502. } else {
  8503. if (iEvt == XMLP._NONE) {
  8504. if (iNodeParent == doc) {
  8505. break;
  8506. } else {
  8507. throw (new DOMException(
  8508. DOMException.SYNTAX_ERR));
  8509. }
  8510. }
  8511. }
  8512. }
  8513. }
  8514. }
  8515. }
  8516. }
  8517. }
  8518. }
  8519. }
  8520. }
  8521. var _61b3 = _61ab.length;
  8522. for (intLoop = 0; intLoop < _61b3; intLoop++) {
  8523. var _61b4 = _61ab[intLoop];
  8524. var _61b5 = _61b4.getParentNode();
  8525. if (_61b5) {
  8526. _61b5.normalize();
  8527. if (!this.preserveWhiteSpace) {
  8528. var _61b6 = _61b5.getChildNodes();
  8529. var _61b7 = _61b6.getLength();
  8530. for (intLoop2 = 0; intLoop2 < _61b7; intLoop2++) {
  8531. var child = _61b6.item(intLoop2);
  8532. if (child.getNodeType() == DOMNode.TEXT_NODE) {
  8533. var _61b9 = child.getData();
  8534. _61b9 = trim(_61b9, true, true);
  8535. _61b9.replace(/ +/g, " ");
  8536. child.setData(_61b9);
  8537. }
  8538. }
  8539. }
  8540. }
  8541. }
  8542. if (!this.preserveWhiteSpace) {
  8543. var _61b3 = _61ac.length;
  8544. for (intLoop = 0; intLoop < _61b3; intLoop++) {
  8545. var node = _61ac[intLoop];
  8546. if (node.getParentNode() !== null) {
  8547. var _61bb = node.getData();
  8548. _61bb = trim(_61bb, true, true);
  8549. _61bb.replace(/ +/g, " ");
  8550. node.setData(_61bb);
  8551. }
  8552. }
  8553. }
  8554. };
  8555. DOMImplementation.prototype._isNamespaceDeclaration = function DOMImplementation__isNamespaceDeclaration(
  8556. _61bc) {
  8557. return (_61bc.indexOf("xmlns") > -1);
  8558. };
  8559. DOMImplementation.prototype._isIdDeclaration = function DOMImplementation__isIdDeclaration(
  8560. _61bd) {
  8561. return (_61bd.toLowerCase() == "id");
  8562. };
  8563. DOMImplementation.prototype._isValidName = function DOMImplementation__isValidName(
  8564. name) {
  8565. return name.match(re_validName);
  8566. };
  8567. re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/;
  8568. DOMImplementation.prototype._isValidString = function DOMImplementation__isValidString(
  8569. name) {
  8570. return (name.search(re_invalidStringChars) < 0);
  8571. };
  8572. re_invalidStringChars = /\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/;
  8573. DOMImplementation.prototype._parseNSName = function DOMImplementation__parseNSName(
  8574. _61c0) {
  8575. var _61c1 = {};
  8576. _61c1.prefix = _61c0;
  8577. _61c1.namespaceName = "";
  8578. delimPos = _61c0.indexOf(":");
  8579. if (delimPos > -1) {
  8580. _61c1.prefix = _61c0.substring(0, delimPos);
  8581. _61c1.namespaceName = _61c0.substring(delimPos + 1, _61c0.length);
  8582. }
  8583. return _61c1;
  8584. };
  8585. DOMImplementation.prototype._parseQName = function DOMImplementation__parseQName(
  8586. _61c2) {
  8587. var _61c3 = {};
  8588. _61c3.localName = _61c2;
  8589. _61c3.prefix = "";
  8590. delimPos = _61c2.indexOf(":");
  8591. if (delimPos > -1) {
  8592. _61c3.prefix = _61c2.substring(0, delimPos);
  8593. _61c3.localName = _61c2.substring(delimPos + 1, _61c2.length);
  8594. }
  8595. return _61c3;
  8596. };
  8597. DOMNodeList = function(_61c4, _61c5) {
  8598. this._class = addClass(this._class, "DOMNodeList");
  8599. this._nodes = [];
  8600. this.length = 0;
  8601. this.parentNode = _61c5;
  8602. this.ownerDocument = _61c4;
  8603. this._readonly = false;
  8604. };
  8605. DOMNodeList.prototype.getLength = function DOMNodeList_getLength() {
  8606. return this.length;
  8607. };
  8608. DOMNodeList.prototype.item = function DOMNodeList_item(index) {
  8609. var ret = null;
  8610. if ((index >= 0) && (index < this._nodes.length)) {
  8611. ret = this._nodes[index];
  8612. }
  8613. return ret;
  8614. };
  8615. DOMNodeList.prototype._findItemIndex = function DOMNodeList__findItemIndex(id) {
  8616. var ret = -1;
  8617. if (id > -1) {
  8618. for ( var i = 0; i < this._nodes.length; i++) {
  8619. if (this._nodes[i]._id == id) {
  8620. ret = i;
  8621. break;
  8622. }
  8623. }
  8624. }
  8625. return ret;
  8626. };
  8627. DOMNodeList.prototype._insertBefore = function DOMNodeList__insertBefore(_61cb,
  8628. _61cc) {
  8629. if ((_61cc >= 0) && (_61cc < this._nodes.length)) {
  8630. var _61cd = [];
  8631. _61cd = this._nodes.slice(0, _61cc);
  8632. if (_61cb.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  8633. _61cd = _61cd.concat(_61cb.childNodes._nodes);
  8634. } else {
  8635. _61cd[_61cd.length] = _61cb;
  8636. }
  8637. this._nodes = _61cd.concat(this._nodes.slice(_61cc));
  8638. this.length = this._nodes.length;
  8639. }
  8640. };
  8641. DOMNodeList.prototype._replaceChild = function DOMNodeList__replaceChild(_61ce,
  8642. _61cf) {
  8643. var ret = null;
  8644. if ((_61cf >= 0) && (_61cf < this._nodes.length)) {
  8645. ret = this._nodes[_61cf];
  8646. if (_61ce.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  8647. var _61d1 = [];
  8648. _61d1 = this._nodes.slice(0, _61cf);
  8649. _61d1 = _61d1.concat(_61ce.childNodes._nodes);
  8650. this._nodes = _61d1.concat(this._nodes.slice(_61cf + 1));
  8651. } else {
  8652. this._nodes[_61cf] = _61ce;
  8653. }
  8654. }
  8655. return ret;
  8656. };
  8657. DOMNodeList.prototype._removeChild = function DOMNodeList__removeChild(_61d2) {
  8658. var ret = null;
  8659. if (_61d2 > -1) {
  8660. ret = this._nodes[_61d2];
  8661. var _61d4 = [];
  8662. _61d4 = this._nodes.slice(0, _61d2);
  8663. this._nodes = _61d4.concat(this._nodes.slice(_61d2 + 1));
  8664. this.length = this._nodes.length;
  8665. }
  8666. return ret;
  8667. };
  8668. DOMNodeList.prototype._appendChild = function DOMNodeList__appendChild(_61d5) {
  8669. if (_61d5.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  8670. this._nodes = this._nodes.concat(_61d5.childNodes._nodes);
  8671. } else {
  8672. this._nodes[this._nodes.length] = _61d5;
  8673. }
  8674. this.length = this._nodes.length;
  8675. };
  8676. DOMNodeList.prototype._cloneNodes = function DOMNodeList__cloneNodes(deep,
  8677. _61d7) {
  8678. var _61d8 = new DOMNodeList(this.ownerDocument, _61d7);
  8679. for ( var i = 0; i < this._nodes.length; i++) {
  8680. _61d8._appendChild(this._nodes[i].cloneNode(deep));
  8681. }
  8682. return _61d8;
  8683. };
  8684. DOMNodeList.prototype.toString = function DOMNodeList_toString() {
  8685. var ret = "";
  8686. for ( var i = 0; i < this.length; i++) {
  8687. ret += this._nodes[i].toString();
  8688. }
  8689. return ret;
  8690. };
  8691. DOMNamedNodeMap = function(_61dc, _61dd) {
  8692. this._class = addClass(this._class, "DOMNamedNodeMap");
  8693. this.DOMNodeList = DOMNodeList;
  8694. this.DOMNodeList(_61dc, _61dd);
  8695. };
  8696. DOMNamedNodeMap.prototype = new DOMNodeList;
  8697. DOMNamedNodeMap.prototype.getNamedItem = function DOMNamedNodeMap_getNamedItem(
  8698. name) {
  8699. var ret = null;
  8700. var _61e0 = this._findNamedItemIndex(name);
  8701. if (_61e0 > -1) {
  8702. ret = this._nodes[_61e0];
  8703. }
  8704. return ret;
  8705. };
  8706. DOMNamedNodeMap.prototype.setNamedItem = function DOMNamedNodeMap_setNamedItem(
  8707. arg) {
  8708. if (this.ownerDocument.implementation.errorChecking) {
  8709. if (this.ownerDocument != arg.ownerDocument) {
  8710. throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
  8711. }
  8712. if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
  8713. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8714. }
  8715. if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
  8716. throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
  8717. }
  8718. }
  8719. var _61e2 = this._findNamedItemIndex(arg.name);
  8720. var ret = null;
  8721. if (_61e2 > -1) {
  8722. ret = this._nodes[_61e2];
  8723. if (this.ownerDocument.implementation.errorChecking && ret._readonly) {
  8724. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8725. } else {
  8726. this._nodes[_61e2] = arg;
  8727. }
  8728. } else {
  8729. this._nodes[this.length] = arg;
  8730. }
  8731. this.length = this._nodes.length;
  8732. arg.ownerElement = this.parentNode;
  8733. return ret;
  8734. };
  8735. DOMNamedNodeMap.prototype.removeNamedItem = function DOMNamedNodeMap_removeNamedItem(
  8736. name) {
  8737. var ret = null;
  8738. if (this.ownerDocument.implementation.errorChecking
  8739. && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
  8740. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8741. }
  8742. var _61e6 = this._findNamedItemIndex(name);
  8743. if (this.ownerDocument.implementation.errorChecking && (_61e6 < 0)) {
  8744. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  8745. }
  8746. var _61e7 = this._nodes[_61e6];
  8747. if (this.ownerDocument.implementation.errorChecking && _61e7._readonly) {
  8748. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8749. }
  8750. return this._removeChild(_61e6);
  8751. };
  8752. DOMNamedNodeMap.prototype.getNamedItemNS = function DOMNamedNodeMap_getNamedItemNS(
  8753. _61e8, _61e9) {
  8754. var ret = null;
  8755. var _61eb = this._findNamedItemNSIndex(_61e8, _61e9);
  8756. if (_61eb > -1) {
  8757. ret = this._nodes[_61eb];
  8758. }
  8759. return ret;
  8760. };
  8761. DOMNamedNodeMap.prototype.setNamedItemNS = function DOMNamedNodeMap_setNamedItemNS(
  8762. arg) {
  8763. if (this.ownerDocument.implementation.errorChecking) {
  8764. if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
  8765. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8766. }
  8767. if (this.ownerDocument != arg.ownerDocument) {
  8768. throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
  8769. }
  8770. if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
  8771. throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
  8772. }
  8773. }
  8774. var _61ed = this._findNamedItemNSIndex(arg.namespaceURI, arg.localName);
  8775. var ret = null;
  8776. if (_61ed > -1) {
  8777. ret = this._nodes[_61ed];
  8778. if (this.ownerDocument.implementation.errorChecking && ret._readonly) {
  8779. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8780. } else {
  8781. this._nodes[_61ed] = arg;
  8782. }
  8783. } else {
  8784. this._nodes[this.length] = arg;
  8785. }
  8786. this.length = this._nodes.length;
  8787. arg.ownerElement = this.parentNode;
  8788. return ret;
  8789. };
  8790. DOMNamedNodeMap.prototype.removeNamedItemNS = function DOMNamedNodeMap_removeNamedItemNS(
  8791. _61ef, _61f0) {
  8792. var ret = null;
  8793. if (this.ownerDocument.implementation.errorChecking
  8794. && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
  8795. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8796. }
  8797. var _61f2 = this._findNamedItemNSIndex(_61ef, _61f0);
  8798. if (this.ownerDocument.implementation.errorChecking && (_61f2 < 0)) {
  8799. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  8800. }
  8801. var _61f3 = this._nodes[_61f2];
  8802. if (this.ownerDocument.implementation.errorChecking && _61f3._readonly) {
  8803. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8804. }
  8805. return this._removeChild(_61f2);
  8806. };
  8807. DOMNamedNodeMap.prototype._findNamedItemIndex = function DOMNamedNodeMap__findNamedItemIndex(
  8808. name) {
  8809. var ret = -1;
  8810. for ( var i = 0; i < this._nodes.length; i++) {
  8811. if (this._nodes[i].name == name) {
  8812. ret = i;
  8813. break;
  8814. }
  8815. }
  8816. return ret;
  8817. };
  8818. DOMNamedNodeMap.prototype._findNamedItemNSIndex = function DOMNamedNodeMap__findNamedItemNSIndex(
  8819. _61f7, _61f8) {
  8820. var ret = -1;
  8821. if (_61f8) {
  8822. for ( var i = 0; i < this._nodes.length; i++) {
  8823. if ((this._nodes[i].namespaceURI == _61f7)
  8824. && (this._nodes[i].localName == _61f8)) {
  8825. ret = i;
  8826. break;
  8827. }
  8828. }
  8829. }
  8830. return ret;
  8831. };
  8832. DOMNamedNodeMap.prototype._hasAttribute = function DOMNamedNodeMap__hasAttribute(
  8833. name) {
  8834. var ret = false;
  8835. var _61fd = this._findNamedItemIndex(name);
  8836. if (_61fd > -1) {
  8837. ret = true;
  8838. }
  8839. return ret;
  8840. };
  8841. DOMNamedNodeMap.prototype._hasAttributeNS = function DOMNamedNodeMap__hasAttributeNS(
  8842. _61fe, _61ff) {
  8843. var ret = false;
  8844. var _6201 = this._findNamedItemNSIndex(_61fe, _61ff);
  8845. if (_6201 > -1) {
  8846. ret = true;
  8847. }
  8848. return ret;
  8849. };
  8850. DOMNamedNodeMap.prototype._cloneNodes = function DOMNamedNodeMap__cloneNodes(
  8851. _6202) {
  8852. var _6203 = new DOMNamedNodeMap(this.ownerDocument, _6202);
  8853. for ( var i = 0; i < this._nodes.length; i++) {
  8854. _6203._appendChild(this._nodes[i].cloneNode(false));
  8855. }
  8856. return _6203;
  8857. };
  8858. DOMNamedNodeMap.prototype.toString = function DOMNamedNodeMap_toString() {
  8859. var ret = "";
  8860. for ( var i = 0; i < this.length - 1; i++) {
  8861. ret += this._nodes[i].toString() + " ";
  8862. }
  8863. if (this.length > 0) {
  8864. ret += this._nodes[this.length - 1].toString();
  8865. }
  8866. return ret;
  8867. };
  8868. DOMNamespaceNodeMap = function(_6207, _6208) {
  8869. this._class = addClass(this._class, "DOMNamespaceNodeMap");
  8870. this.DOMNamedNodeMap = DOMNamedNodeMap;
  8871. this.DOMNamedNodeMap(_6207, _6208);
  8872. };
  8873. DOMNamespaceNodeMap.prototype = new DOMNamedNodeMap;
  8874. DOMNamespaceNodeMap.prototype._findNamedItemIndex = function DOMNamespaceNodeMap__findNamedItemIndex(
  8875. _6209) {
  8876. var ret = -1;
  8877. for ( var i = 0; i < this._nodes.length; i++) {
  8878. if (this._nodes[i].localName == _6209) {
  8879. ret = i;
  8880. break;
  8881. }
  8882. }
  8883. return ret;
  8884. };
  8885. DOMNamespaceNodeMap.prototype._cloneNodes = function DOMNamespaceNodeMap__cloneNodes(
  8886. _620c) {
  8887. var _620d = new DOMNamespaceNodeMap(this.ownerDocument, _620c);
  8888. for ( var i = 0; i < this._nodes.length; i++) {
  8889. _620d._appendChild(this._nodes[i].cloneNode(false));
  8890. }
  8891. return _620d;
  8892. };
  8893. DOMNamespaceNodeMap.prototype.toString = function DOMNamespaceNodeMap_toString() {
  8894. var ret = "";
  8895. for ( var ind = 0; ind < this._nodes.length; ind++) {
  8896. var ns = null;
  8897. try {
  8898. var ns = this.parentNode.parentNode._namespaces
  8899. .getNamedItem(this._nodes[ind].localName);
  8900. } catch (e) {
  8901. break;
  8902. }
  8903. if (!(ns && ("" + ns.nodeValue == "" + this._nodes[ind].nodeValue))) {
  8904. ret += this._nodes[ind].toString() + " ";
  8905. }
  8906. }
  8907. return ret;
  8908. };
  8909. DOMNode = function(_6212) {
  8910. this._class = addClass(this._class, "DOMNode");
  8911. if (_6212) {
  8912. this._id = _6212._genId();
  8913. }
  8914. this.namespaceURI = "";
  8915. this.prefix = "";
  8916. this.localName = "";
  8917. this.nodeName = "";
  8918. this.nodeValue = "";
  8919. this.nodeType = 0;
  8920. this.parentNode = null;
  8921. this.childNodes = new DOMNodeList(_6212, this);
  8922. this.firstChild = null;
  8923. this.lastChild = null;
  8924. this.previousSibling = null;
  8925. this.nextSibling = null;
  8926. this.attributes = new DOMNamedNodeMap(_6212, this);
  8927. this.ownerDocument = _6212;
  8928. this._namespaces = new DOMNamespaceNodeMap(_6212, this);
  8929. this._readonly = false;
  8930. };
  8931. DOMNode.ELEMENT_NODE = 1;
  8932. DOMNode.ATTRIBUTE_NODE = 2;
  8933. DOMNode.TEXT_NODE = 3;
  8934. DOMNode.CDATA_SECTION_NODE = 4;
  8935. DOMNode.ENTITY_REFERENCE_NODE = 5;
  8936. DOMNode.ENTITY_NODE = 6;
  8937. DOMNode.PROCESSING_INSTRUCTION_NODE = 7;
  8938. DOMNode.COMMENT_NODE = 8;
  8939. DOMNode.DOCUMENT_NODE = 9;
  8940. DOMNode.DOCUMENT_TYPE_NODE = 10;
  8941. DOMNode.DOCUMENT_FRAGMENT_NODE = 11;
  8942. DOMNode.NOTATION_NODE = 12;
  8943. DOMNode.NAMESPACE_NODE = 13;
  8944. DOMNode.prototype.hasAttributes = function DOMNode_hasAttributes() {
  8945. if (this.attributes.length === 0) {
  8946. return false;
  8947. } else {
  8948. return true;
  8949. }
  8950. };
  8951. DOMNode.prototype.getNodeName = function DOMNode_getNodeName() {
  8952. return this.nodeName;
  8953. };
  8954. DOMNode.prototype.getNodeValue = function DOMNode_getNodeValue() {
  8955. return this.nodeValue;
  8956. };
  8957. DOMNode.prototype.setNodeValue = function DOMNode_setNodeValue(_6213) {
  8958. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  8959. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  8960. }
  8961. this.nodeValue = _6213;
  8962. };
  8963. DOMNode.prototype.getNodeType = function DOMNode_getNodeType() {
  8964. return this.nodeType;
  8965. };
  8966. DOMNode.prototype.getParentNode = function DOMNode_getParentNode() {
  8967. return this.parentNode;
  8968. };
  8969. DOMNode.prototype.getChildNodes = function DOMNode_getChildNodes() {
  8970. return this.childNodes;
  8971. };
  8972. DOMNode.prototype.getFirstChild = function DOMNode_getFirstChild() {
  8973. return this.firstChild;
  8974. };
  8975. DOMNode.prototype.getLastChild = function DOMNode_getLastChild() {
  8976. return this.lastChild;
  8977. };
  8978. DOMNode.prototype.getPreviousSibling = function DOMNode_getPreviousSibling() {
  8979. return this.previousSibling;
  8980. };
  8981. DOMNode.prototype.getNextSibling = function DOMNode_getNextSibling() {
  8982. return this.nextSibling;
  8983. };
  8984. DOMNode.prototype.getAttributes = function DOMNode_getAttributes() {
  8985. return this.attributes;
  8986. };
  8987. DOMNode.prototype.getOwnerDocument = function DOMNode_getOwnerDocument() {
  8988. return this.ownerDocument;
  8989. };
  8990. DOMNode.prototype.getNamespaceURI = function DOMNode_getNamespaceURI() {
  8991. return this.namespaceURI;
  8992. };
  8993. DOMNode.prototype.getPrefix = function DOMNode_getPrefix() {
  8994. return this.prefix;
  8995. };
  8996. DOMNode.prototype.setPrefix = function DOMNode_setPrefix(_6214) {
  8997. if (this.ownerDocument.implementation.errorChecking) {
  8998. if (this._readonly) {
  8999. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9000. }
  9001. if (!this.ownerDocument.implementation._isValidName(_6214)) {
  9002. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9003. }
  9004. if (!this.ownerDocument._isValidNamespace(this.namespaceURI, _6214
  9005. + ":" + this.localName)) {
  9006. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9007. }
  9008. if ((_6214 == "xmlns")
  9009. && (this.namespaceURI != "http://www.w3.org/2000/xmlns/")) {
  9010. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9011. }
  9012. if ((_6214 == "") && (this.localName == "xmlns")) {
  9013. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9014. }
  9015. }
  9016. this.prefix = _6214;
  9017. if (this.prefix != "") {
  9018. this.nodeName = this.prefix + ":" + this.localName;
  9019. } else {
  9020. this.nodeName = this.localName;
  9021. }
  9022. };
  9023. DOMNode.prototype.getLocalName = function DOMNode_getLocalName() {
  9024. return this.localName;
  9025. };
  9026. DOMNode.prototype.insertBefore = function DOMNode_insertBefore(_6215, _6216) {
  9027. var _6217;
  9028. if (this.ownerDocument.implementation.errorChecking) {
  9029. if (this._readonly) {
  9030. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9031. }
  9032. if (this.ownerDocument != _6215.ownerDocument) {
  9033. throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
  9034. }
  9035. if (this._isAncestor(_6215)) {
  9036. throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
  9037. }
  9038. }
  9039. if (_6216) {
  9040. var _6218 = this.childNodes._findItemIndex(_6216._id);
  9041. if (this.ownerDocument.implementation.errorChecking && (_6218 < 0)) {
  9042. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  9043. }
  9044. var _6219 = _6215.parentNode;
  9045. if (_6219) {
  9046. _6219.removeChild(_6215);
  9047. }
  9048. this.childNodes._insertBefore(_6215, this.childNodes
  9049. ._findItemIndex(_6216._id));
  9050. _6217 = _6216.previousSibling;
  9051. if (_6215.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  9052. if (_6215.childNodes._nodes.length > 0) {
  9053. for ( var ind = 0; ind < _6215.childNodes._nodes.length; ind++) {
  9054. _6215.childNodes._nodes[ind].parentNode = this;
  9055. }
  9056. _6216.previousSibling = _6215.childNodes._nodes[_6215.childNodes._nodes.length - 1];
  9057. }
  9058. } else {
  9059. _6215.parentNode = this;
  9060. _6216.previousSibling = _6215;
  9061. }
  9062. } else {
  9063. _6217 = this.lastChild;
  9064. this.appendChild(_6215);
  9065. }
  9066. if (_6215.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  9067. if (_6215.childNodes._nodes.length > 0) {
  9068. if (_6217) {
  9069. _6217.nextSibling = _6215.childNodes._nodes[0];
  9070. } else {
  9071. this.firstChild = _6215.childNodes._nodes[0];
  9072. }
  9073. _6215.childNodes._nodes[0].previousSibling = _6217;
  9074. _6215.childNodes._nodes[_6215.childNodes._nodes.length - 1].nextSibling = _6216;
  9075. }
  9076. } else {
  9077. if (_6217) {
  9078. _6217.nextSibling = _6215;
  9079. } else {
  9080. this.firstChild = _6215;
  9081. }
  9082. _6215.previousSibling = _6217;
  9083. _6215.nextSibling = _6216;
  9084. }
  9085. return _6215;
  9086. };
  9087. DOMNode.prototype.replaceChild = function DOMNode_replaceChild(_621b, _621c) {
  9088. var ret = null;
  9089. if (this.ownerDocument.implementation.errorChecking) {
  9090. if (this._readonly) {
  9091. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9092. }
  9093. if (this.ownerDocument != _621b.ownerDocument) {
  9094. throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
  9095. }
  9096. if (this._isAncestor(_621b)) {
  9097. throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
  9098. }
  9099. }
  9100. var index = this.childNodes._findItemIndex(_621c._id);
  9101. if (this.ownerDocument.implementation.errorChecking && (index < 0)) {
  9102. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  9103. }
  9104. var _621f = _621b.parentNode;
  9105. if (_621f) {
  9106. _621f.removeChild(_621b);
  9107. }
  9108. ret = this.childNodes._replaceChild(_621b, index);
  9109. if (_621b.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  9110. if (_621b.childNodes._nodes.length > 0) {
  9111. for ( var ind = 0; ind < _621b.childNodes._nodes.length; ind++) {
  9112. _621b.childNodes._nodes[ind].parentNode = this;
  9113. }
  9114. if (_621c.previousSibling) {
  9115. _621c.previousSibling.nextSibling = _621b.childNodes._nodes[0];
  9116. } else {
  9117. this.firstChild = _621b.childNodes._nodes[0];
  9118. }
  9119. if (_621c.nextSibling) {
  9120. _621c.nextSibling.previousSibling = _621b;
  9121. } else {
  9122. this.lastChild = _621b.childNodes._nodes[_621b.childNodes._nodes.length - 1];
  9123. }
  9124. _621b.childNodes._nodes[0].previousSibling = _621c.previousSibling;
  9125. _621b.childNodes._nodes[_621b.childNodes._nodes.length - 1].nextSibling = _621c.nextSibling;
  9126. }
  9127. } else {
  9128. _621b.parentNode = this;
  9129. if (_621c.previousSibling) {
  9130. _621c.previousSibling.nextSibling = _621b;
  9131. } else {
  9132. this.firstChild = _621b;
  9133. }
  9134. if (_621c.nextSibling) {
  9135. _621c.nextSibling.previousSibling = _621b;
  9136. } else {
  9137. this.lastChild = _621b;
  9138. }
  9139. _621b.previousSibling = _621c.previousSibling;
  9140. _621b.nextSibling = _621c.nextSibling;
  9141. }
  9142. return ret;
  9143. };
  9144. DOMNode.prototype.removeChild = function DOMNode_removeChild(_6221) {
  9145. if (this.ownerDocument.implementation.errorChecking
  9146. && (this._readonly || _6221._readonly)) {
  9147. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9148. }
  9149. var _6222 = this.childNodes._findItemIndex(_6221._id);
  9150. if (this.ownerDocument.implementation.errorChecking && (_6222 < 0)) {
  9151. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  9152. }
  9153. this.childNodes._removeChild(_6222);
  9154. _6221.parentNode = null;
  9155. if (_6221.previousSibling) {
  9156. _6221.previousSibling.nextSibling = _6221.nextSibling;
  9157. } else {
  9158. this.firstChild = _6221.nextSibling;
  9159. }
  9160. if (_6221.nextSibling) {
  9161. _6221.nextSibling.previousSibling = _6221.previousSibling;
  9162. } else {
  9163. this.lastChild = _6221.previousSibling;
  9164. }
  9165. _6221.previousSibling = null;
  9166. _6221.nextSibling = null;
  9167. return _6221;
  9168. };
  9169. DOMNode.prototype.appendChild = function DOMNode_appendChild(_6223) {
  9170. if (this.ownerDocument.implementation.errorChecking) {
  9171. if (this._readonly) {
  9172. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9173. }
  9174. if (this.ownerDocument != _6223.ownerDocument) {
  9175. throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
  9176. }
  9177. if (this._isAncestor(_6223)) {
  9178. throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
  9179. }
  9180. }
  9181. var _6224 = _6223.parentNode;
  9182. if (_6224) {
  9183. _6224.removeChild(_6223);
  9184. }
  9185. this.childNodes._appendChild(_6223);
  9186. if (_6223.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
  9187. if (_6223.childNodes._nodes.length > 0) {
  9188. for ( var ind = 0; ind < _6223.childNodes._nodes.length; ind++) {
  9189. _6223.childNodes._nodes[ind].parentNode = this;
  9190. }
  9191. if (this.lastChild) {
  9192. this.lastChild.nextSibling = _6223.childNodes._nodes[0];
  9193. _6223.childNodes._nodes[0].previousSibling = this.lastChild;
  9194. this.lastChild = _6223.childNodes._nodes[_6223.childNodes._nodes.length - 1];
  9195. } else {
  9196. this.lastChild = _6223.childNodes._nodes[_6223.childNodes._nodes.length - 1];
  9197. this.firstChild = _6223.childNodes._nodes[0];
  9198. }
  9199. }
  9200. } else {
  9201. _6223.parentNode = this;
  9202. if (this.lastChild) {
  9203. this.lastChild.nextSibling = _6223;
  9204. _6223.previousSibling = this.lastChild;
  9205. this.lastChild = _6223;
  9206. } else {
  9207. this.lastChild = _6223;
  9208. this.firstChild = _6223;
  9209. }
  9210. }
  9211. return _6223;
  9212. };
  9213. DOMNode.prototype.hasChildNodes = function DOMNode_hasChildNodes() {
  9214. return (this.childNodes.length > 0);
  9215. };
  9216. DOMNode.prototype.cloneNode = function DOMNode_cloneNode(deep) {
  9217. try {
  9218. return this.ownerDocument.importNode(this, deep);
  9219. } catch (e) {
  9220. return null;
  9221. }
  9222. };
  9223. DOMNode.prototype.normalize = function DOMNode_normalize() {
  9224. var inode;
  9225. var _6228 = new DOMNodeList();
  9226. if (this.nodeType == DOMNode.ELEMENT_NODE
  9227. || this.nodeType == DOMNode.DOCUMENT_NODE) {
  9228. var _6229 = null;
  9229. for ( var i = 0; i < this.childNodes.length; i++) {
  9230. inode = this.childNodes.item(i);
  9231. if (inode.nodeType == DOMNode.TEXT_NODE) {
  9232. if (inode.length < 1) {
  9233. _6228._appendChild(inode);
  9234. } else {
  9235. if (_6229) {
  9236. _6229.appendData(inode.data);
  9237. _6228._appendChild(inode);
  9238. } else {
  9239. _6229 = inode;
  9240. }
  9241. }
  9242. } else {
  9243. _6229 = null;
  9244. inode.normalize();
  9245. }
  9246. }
  9247. for ( var i = 0; i < _6228.length; i++) {
  9248. inode = _6228.item(i);
  9249. inode.parentNode.removeChild(inode);
  9250. }
  9251. }
  9252. };
  9253. DOMNode.prototype.isSupported = function DOMNode_isSupported(_622b, _622c) {
  9254. return this.ownerDocument.implementation.hasFeature(_622b, _622c);
  9255. };
  9256. DOMNode.prototype.getElementsByTagName = function DOMNode_getElementsByTagName(
  9257. _622d) {
  9258. return this._getElementsByTagNameRecursive(_622d, new DOMNodeList(
  9259. this.ownerDocument));
  9260. };
  9261. DOMNode.prototype._getElementsByTagNameRecursive = function DOMNode__getElementsByTagNameRecursive(
  9262. _622e, _622f) {
  9263. if (this.nodeType == DOMNode.ELEMENT_NODE
  9264. || this.nodeType == DOMNode.DOCUMENT_NODE) {
  9265. if ((this.nodeName == _622e) || (_622e == "*")) {
  9266. _622f._appendChild(this);
  9267. }
  9268. for ( var i = 0; i < this.childNodes.length; i++) {
  9269. _622f = this.childNodes.item(i)._getElementsByTagNameRecursive(
  9270. _622e, _622f);
  9271. }
  9272. }
  9273. return _622f;
  9274. };
  9275. DOMNode.prototype.getXML = function DOMNode_getXML() {
  9276. return this.toString();
  9277. };
  9278. DOMNode.prototype.getElementsByTagNameNS = function DOMNode_getElementsByTagNameNS(
  9279. _6231, _6232) {
  9280. return this._getElementsByTagNameNSRecursive(_6231, _6232, new DOMNodeList(
  9281. this.ownerDocument));
  9282. };
  9283. DOMNode.prototype._getElementsByTagNameNSRecursive = function DOMNode__getElementsByTagNameNSRecursive(
  9284. _6233, _6234, _6235) {
  9285. if (this.nodeType == DOMNode.ELEMENT_NODE
  9286. || this.nodeType == DOMNode.DOCUMENT_NODE) {
  9287. if (((this.namespaceURI == _6233) || (_6233 == "*"))
  9288. && ((this.localName == _6234) || (_6234 == "*"))) {
  9289. _6235._appendChild(this);
  9290. }
  9291. for ( var i = 0; i < this.childNodes.length; i++) {
  9292. _6235 = this.childNodes.item(i)._getElementsByTagNameNSRecursive(
  9293. _6233, _6234, _6235);
  9294. }
  9295. }
  9296. return _6235;
  9297. };
  9298. DOMNode.prototype._isAncestor = function DOMNode__isAncestor(node) {
  9299. return ((this == node) || ((this.parentNode) && (this.parentNode
  9300. ._isAncestor(node))));
  9301. };
  9302. DOMNode.prototype.importNode = function DOMNode_importNode(_6238, deep) {
  9303. var _623a;
  9304. this.getOwnerDocument()._performingImportNodeOperation = true;
  9305. try {
  9306. if (_6238.nodeType == DOMNode.ELEMENT_NODE) {
  9307. if (!this.ownerDocument.implementation.namespaceAware) {
  9308. _623a = this.ownerDocument.createElement(_6238.tagName);
  9309. for ( var i = 0; i < _6238.attributes.length; i++) {
  9310. _623a.setAttribute(_6238.attributes.item(i).name,
  9311. _6238.attributes.item(i).value);
  9312. }
  9313. } else {
  9314. _623a = this.ownerDocument.createElementNS(_6238.namespaceURI,
  9315. _6238.nodeName);
  9316. for ( var i = 0; i < _6238.attributes.length; i++) {
  9317. _623a.setAttributeNS(_6238.attributes.item(i).namespaceURI,
  9318. _6238.attributes.item(i).name, _6238.attributes
  9319. .item(i).value);
  9320. }
  9321. for ( var i = 0; i < _6238._namespaces.length; i++) {
  9322. _623a._namespaces._nodes[i] = this.ownerDocument
  9323. .createNamespace(_6238._namespaces.item(i).localName);
  9324. _623a._namespaces._nodes[i].setValue(_6238._namespaces
  9325. .item(i).value);
  9326. }
  9327. }
  9328. } else {
  9329. if (_6238.nodeType == DOMNode.ATTRIBUTE_NODE) {
  9330. if (!this.ownerDocument.implementation.namespaceAware) {
  9331. _623a = this.ownerDocument.createAttribute(_6238.name);
  9332. } else {
  9333. _623a = this.ownerDocument.createAttributeNS(
  9334. _6238.namespaceURI, _6238.nodeName);
  9335. for ( var i = 0; i < _6238._namespaces.length; i++) {
  9336. _623a._namespaces._nodes[i] = this.ownerDocument
  9337. .createNamespace(_6238._namespaces.item(i).localName);
  9338. _623a._namespaces._nodes[i].setValue(_6238._namespaces
  9339. .item(i).value);
  9340. }
  9341. }
  9342. _623a.setValue(_6238.value);
  9343. } else {
  9344. if (_6238.nodeType == DOMNode.DOCUMENT_FRAGMENT) {
  9345. _623a = this.ownerDocument.createDocumentFragment();
  9346. } else {
  9347. if (_6238.nodeType == DOMNode.NAMESPACE_NODE) {
  9348. _623a = this.ownerDocument
  9349. .createNamespace(_6238.nodeName);
  9350. _623a.setValue(_6238.value);
  9351. } else {
  9352. if (_6238.nodeType == DOMNode.TEXT_NODE) {
  9353. _623a = this.ownerDocument
  9354. .createTextNode(_6238.data);
  9355. } else {
  9356. if (_6238.nodeType == DOMNode.CDATA_SECTION_NODE) {
  9357. _623a = this.ownerDocument
  9358. .createCDATASection(_6238.data);
  9359. } else {
  9360. if (_6238.nodeType == DOMNode.PROCESSING_INSTRUCTION_NODE) {
  9361. _623a = this.ownerDocument
  9362. .createProcessingInstruction(
  9363. _6238.target, _6238.data);
  9364. } else {
  9365. if (_6238.nodeType == DOMNode.COMMENT_NODE) {
  9366. _623a = this.ownerDocument
  9367. .createComment(_6238.data);
  9368. } else {
  9369. throw (new DOMException(
  9370. DOMException.NOT_SUPPORTED_ERR));
  9371. }
  9372. }
  9373. }
  9374. }
  9375. }
  9376. }
  9377. }
  9378. }
  9379. if (deep) {
  9380. for ( var i = 0; i < _6238.childNodes.length; i++) {
  9381. _623a.appendChild(this.ownerDocument.importNode(
  9382. _6238.childNodes.item(i), true));
  9383. }
  9384. }
  9385. this.getOwnerDocument()._performingImportNodeOperation = false;
  9386. return _623a;
  9387. } catch (eAny) {
  9388. this.getOwnerDocument()._performingImportNodeOperation = false;
  9389. throw eAny;
  9390. }
  9391. };
  9392. DOMNode.prototype.__escapeString = function DOMNode__escapeString(str) {
  9393. return __escapeString(str);
  9394. };
  9395. DOMNode.prototype.__unescapeString = function DOMNode__unescapeString(str) {
  9396. return __unescapeString(str);
  9397. };
  9398. DOMDocument = function(_623e) {
  9399. this._class = addClass(this._class, "DOMDocument");
  9400. this.DOMNode = DOMNode;
  9401. this.DOMNode(this);
  9402. this.doctype = null;
  9403. this.implementation = _623e;
  9404. this.documentElement = null;
  9405. this.all = [];
  9406. this.nodeName = "#document";
  9407. this.nodeType = DOMNode.DOCUMENT_NODE;
  9408. this._id = 0;
  9409. this._lastId = 0;
  9410. this._parseComplete = false;
  9411. this.ownerDocument = this;
  9412. this._performingImportNodeOperation = false;
  9413. };
  9414. DOMDocument.prototype = new DOMNode;
  9415. DOMDocument.prototype.getDoctype = function DOMDocument_getDoctype() {
  9416. return this.doctype;
  9417. };
  9418. DOMDocument.prototype.getImplementation = function DOMDocument_implementation() {
  9419. return this.implementation;
  9420. };
  9421. DOMDocument.prototype.getDocumentElement = function DOMDocument_getDocumentElement() {
  9422. return this.documentElement;
  9423. };
  9424. DOMDocument.prototype.createElement = function DOMDocument_createElement(_623f) {
  9425. if (this.ownerDocument.implementation.errorChecking
  9426. && (!this.ownerDocument.implementation._isValidName(_623f))) {
  9427. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9428. }
  9429. var node = new DOMElement(this);
  9430. node.tagName = _623f;
  9431. node.nodeName = _623f;
  9432. this.all[this.all.length] = node;
  9433. return node;
  9434. };
  9435. DOMDocument.prototype.createDocumentFragment = function DOMDocument_createDocumentFragment() {
  9436. var node = new DOMDocumentFragment(this);
  9437. return node;
  9438. };
  9439. DOMDocument.prototype.createTextNode = function DOMDocument_createTextNode(data) {
  9440. var node = new DOMText(this);
  9441. node.data = data;
  9442. node.nodeValue = data;
  9443. node.length = data.length;
  9444. return node;
  9445. };
  9446. DOMDocument.prototype.createComment = function DOMDocument_createComment(data) {
  9447. var node = new DOMComment(this);
  9448. node.data = data;
  9449. node.nodeValue = data;
  9450. node.length = data.length;
  9451. return node;
  9452. };
  9453. DOMDocument.prototype.createCDATASection = function DOMDocument_createCDATASection(
  9454. data) {
  9455. var node = new DOMCDATASection(this);
  9456. node.data = data;
  9457. node.nodeValue = data;
  9458. node.length = data.length;
  9459. return node;
  9460. };
  9461. DOMDocument.prototype.createProcessingInstruction = function DOMDocument_createProcessingInstruction(
  9462. _6248, data) {
  9463. if (this.ownerDocument.implementation.errorChecking
  9464. && (!this.implementation._isValidName(_6248))) {
  9465. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9466. }
  9467. var node = new DOMProcessingInstruction(this);
  9468. node.target = _6248;
  9469. node.nodeName = _6248;
  9470. node.data = data;
  9471. node.nodeValue = data;
  9472. node.length = data.length;
  9473. return node;
  9474. };
  9475. DOMDocument.prototype.createAttribute = function DOMDocument_createAttribute(
  9476. name) {
  9477. if (this.ownerDocument.implementation.errorChecking
  9478. && (!this.ownerDocument.implementation._isValidName(name))) {
  9479. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9480. }
  9481. var node = new DOMAttr(this);
  9482. node.name = name;
  9483. node.nodeName = name;
  9484. return node;
  9485. };
  9486. DOMDocument.prototype.createElementNS = function DOMDocument_createElementNS(
  9487. _624d, _624e) {
  9488. if (this.ownerDocument.implementation.errorChecking) {
  9489. if (!this.ownerDocument._isValidNamespace(_624d, _624e)) {
  9490. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9491. }
  9492. if (!this.ownerDocument.implementation._isValidName(_624e)) {
  9493. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9494. }
  9495. }
  9496. var node = new DOMElement(this);
  9497. var qname = this.implementation._parseQName(_624e);
  9498. node.nodeName = _624e;
  9499. node.namespaceURI = _624d;
  9500. node.prefix = qname.prefix;
  9501. node.localName = qname.localName;
  9502. node.tagName = _624e;
  9503. this.all[this.all.length] = node;
  9504. return node;
  9505. };
  9506. DOMDocument.prototype.createAttributeNS = function DOMDocument_createAttributeNS(
  9507. _6251, _6252) {
  9508. if (this.ownerDocument.implementation.errorChecking) {
  9509. if (!this.ownerDocument._isValidNamespace(_6251, _6252, true)) {
  9510. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9511. }
  9512. if (!this.ownerDocument.implementation._isValidName(_6252)) {
  9513. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9514. }
  9515. }
  9516. var node = new DOMAttr(this);
  9517. var qname = this.implementation._parseQName(_6252);
  9518. node.nodeName = _6252;
  9519. node.namespaceURI = _6251;
  9520. node.prefix = qname.prefix;
  9521. node.localName = qname.localName;
  9522. node.name = _6252;
  9523. node.nodeValue = "";
  9524. return node;
  9525. };
  9526. DOMDocument.prototype.createNamespace = function DOMDocument_createNamespace(
  9527. _6255) {
  9528. var node = new DOMNamespace(this);
  9529. var qname = this.implementation._parseQName(_6255);
  9530. node.nodeName = _6255;
  9531. node.prefix = qname.prefix;
  9532. node.localName = qname.localName;
  9533. node.name = _6255;
  9534. node.nodeValue = "";
  9535. return node;
  9536. };
  9537. DOMDocument.prototype.getElementById = function DOMDocument_getElementById(
  9538. _6258) {
  9539. retNode = null;
  9540. for ( var i = 0; i < this.all.length; i++) {
  9541. var node = this.all[i];
  9542. if ((node.id == _6258)
  9543. && (node._isAncestor(node.ownerDocument.documentElement))) {
  9544. retNode = node;
  9545. break;
  9546. }
  9547. }
  9548. return retNode;
  9549. };
  9550. DOMDocument.prototype._genId = function DOMDocument__genId() {
  9551. this._lastId += 1;
  9552. return this._lastId;
  9553. };
  9554. DOMDocument.prototype._isValidNamespace = function DOMDocument__isValidNamespace(
  9555. _625b, _625c, _625d) {
  9556. if (this._performingImportNodeOperation == true) {
  9557. return true;
  9558. }
  9559. var valid = true;
  9560. var qName = this.implementation._parseQName(_625c);
  9561. if (this._parseComplete == true) {
  9562. if (qName.localName.indexOf(":") > -1) {
  9563. valid = false;
  9564. }
  9565. if ((valid) && (!_625d)) {
  9566. if (!_625b) {
  9567. valid = false;
  9568. }
  9569. }
  9570. if ((valid) && (qName.prefix == "")) {
  9571. valid = false;
  9572. }
  9573. }
  9574. if ((valid) && (qName.prefix == "xml")
  9575. && (_625b != "http://www.w3.org/XML/1998/namespace")) {
  9576. valid = false;
  9577. }
  9578. return valid;
  9579. };
  9580. DOMDocument.prototype.toString = function DOMDocument_toString() {
  9581. return "" + this.childNodes;
  9582. };
  9583. DOMElement = function(_6260) {
  9584. this._class = addClass(this._class, "DOMElement");
  9585. this.DOMNode = DOMNode;
  9586. this.DOMNode(_6260);
  9587. this.tagName = "";
  9588. this.id = "";
  9589. this.nodeType = DOMNode.ELEMENT_NODE;
  9590. };
  9591. DOMElement.prototype = new DOMNode;
  9592. DOMElement.prototype.getTagName = function DOMElement_getTagName() {
  9593. return this.tagName;
  9594. };
  9595. DOMElement.prototype.getAttribute = function DOMElement_getAttribute(name) {
  9596. var ret = "";
  9597. var attr = this.attributes.getNamedItem(name);
  9598. if (attr) {
  9599. ret = attr.value;
  9600. }
  9601. return ret;
  9602. };
  9603. DOMElement.prototype.setAttribute = function DOMElement_setAttribute(name,
  9604. value) {
  9605. var attr = this.attributes.getNamedItem(name);
  9606. if (!attr) {
  9607. attr = this.ownerDocument.createAttribute(name);
  9608. }
  9609. var value = new String(value);
  9610. if (this.ownerDocument.implementation.errorChecking) {
  9611. if (attr._readonly) {
  9612. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9613. }
  9614. if (!this.ownerDocument.implementation._isValidString(value)) {
  9615. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9616. }
  9617. }
  9618. if (this.ownerDocument.implementation._isIdDeclaration(name)) {
  9619. this.id = value;
  9620. }
  9621. attr.value = value;
  9622. attr.nodeValue = value;
  9623. if (value.length > 0) {
  9624. attr.specified = true;
  9625. } else {
  9626. attr.specified = false;
  9627. }
  9628. this.attributes.setNamedItem(attr);
  9629. };
  9630. DOMElement.prototype.removeAttribute = function DOMElement_removeAttribute(name) {
  9631. return this.attributes.removeNamedItem(name);
  9632. };
  9633. DOMElement.prototype.getAttributeNode = function DOMElement_getAttributeNode(
  9634. name) {
  9635. return this.attributes.getNamedItem(name);
  9636. };
  9637. DOMElement.prototype.setAttributeNode = function DOMElement_setAttributeNode(
  9638. _6269) {
  9639. if (this.ownerDocument.implementation._isIdDeclaration(_6269.name)) {
  9640. this.id = _6269.value;
  9641. }
  9642. return this.attributes.setNamedItem(_6269);
  9643. };
  9644. DOMElement.prototype.removeAttributeNode = function DOMElement_removeAttributeNode(
  9645. _626a) {
  9646. if (this.ownerDocument.implementation.errorChecking && _626a._readonly) {
  9647. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9648. }
  9649. var _626b = this.attributes._findItemIndex(_626a._id);
  9650. if (this.ownerDocument.implementation.errorChecking && (_626b < 0)) {
  9651. throw (new DOMException(DOMException.NOT_FOUND_ERR));
  9652. }
  9653. return this.attributes._removeChild(_626b);
  9654. };
  9655. DOMElement.prototype.getAttributeNS = function DOMElement_getAttributeNS(_626c,
  9656. _626d) {
  9657. var ret = "";
  9658. var attr = this.attributes.getNamedItemNS(_626c, _626d);
  9659. if (attr) {
  9660. ret = attr.value;
  9661. }
  9662. return ret;
  9663. };
  9664. DOMElement.prototype.setAttributeNS = function DOMElement_setAttributeNS(_6270,
  9665. _6271, value) {
  9666. var attr = this.attributes.getNamedItem(_6270, _6271);
  9667. if (!attr) {
  9668. attr = this.ownerDocument.createAttributeNS(_6270, _6271);
  9669. }
  9670. var value = new String(value);
  9671. if (this.ownerDocument.implementation.errorChecking) {
  9672. if (attr._readonly) {
  9673. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9674. }
  9675. if (!this.ownerDocument._isValidNamespace(_6270, _6271)) {
  9676. throw (new DOMException(DOMException.NAMESPACE_ERR));
  9677. }
  9678. if (!this.ownerDocument.implementation._isValidString(value)) {
  9679. throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
  9680. }
  9681. }
  9682. if (this.ownerDocument.implementation._isIdDeclaration(name)) {
  9683. this.id = value;
  9684. }
  9685. attr.value = value;
  9686. attr.nodeValue = value;
  9687. if (value.length > 0) {
  9688. attr.specified = true;
  9689. } else {
  9690. attr.specified = false;
  9691. }
  9692. this.attributes.setNamedItemNS(attr);
  9693. };
  9694. DOMElement.prototype.removeAttributeNS = function DOMElement_removeAttributeNS(
  9695. _6274, _6275) {
  9696. return this.attributes.removeNamedItemNS(_6274, _6275);
  9697. };
  9698. DOMElement.prototype.getAttributeNodeNS = function DOMElement_getAttributeNodeNS(
  9699. _6276, _6277) {
  9700. return this.attributes.getNamedItemNS(_6276, _6277);
  9701. };
  9702. DOMElement.prototype.setAttributeNodeNS = function DOMElement_setAttributeNodeNS(
  9703. _6278) {
  9704. if ((_6278.prefix == "")
  9705. && this.ownerDocument.implementation._isIdDeclaration(_6278.name)) {
  9706. this.id = _6278.value;
  9707. }
  9708. return this.attributes.setNamedItemNS(_6278);
  9709. };
  9710. DOMElement.prototype.hasAttribute = function DOMElement_hasAttribute(name) {
  9711. return this.attributes._hasAttribute(name);
  9712. };
  9713. DOMElement.prototype.hasAttributeNS = function DOMElement_hasAttributeNS(_627a,
  9714. _627b) {
  9715. return this.attributes._hasAttributeNS(_627a, _627b);
  9716. };
  9717. DOMElement.prototype.toString = function DOMElement_toString() {
  9718. var ret = "";
  9719. var ns = this._namespaces.toString();
  9720. if (ns.length > 0) {
  9721. ns = " " + ns;
  9722. }
  9723. var attrs = this.attributes.toString();
  9724. if (attrs.length > 0) {
  9725. attrs = " " + attrs;
  9726. }
  9727. ret += "<" + this.nodeName + ns + attrs + ">";
  9728. ret += this.childNodes.toString();
  9729. ret += "</" + this.nodeName + ">";
  9730. return ret;
  9731. };
  9732. DOMAttr = function(_627f) {
  9733. this._class = addClass(this._class, "DOMAttr");
  9734. this.DOMNode = DOMNode;
  9735. this.DOMNode(_627f);
  9736. this.name = "";
  9737. this.specified = false;
  9738. this.value = "";
  9739. this.nodeType = DOMNode.ATTRIBUTE_NODE;
  9740. this.ownerElement = null;
  9741. this.childNodes = null;
  9742. this.attributes = null;
  9743. };
  9744. DOMAttr.prototype = new DOMNode;
  9745. DOMAttr.prototype.getName = function DOMAttr_getName() {
  9746. return this.nodeName;
  9747. };
  9748. DOMAttr.prototype.getSpecified = function DOMAttr_getSpecified() {
  9749. return this.specified;
  9750. };
  9751. DOMAttr.prototype.getValue = function DOMAttr_getValue() {
  9752. return this.nodeValue;
  9753. };
  9754. DOMAttr.prototype.setValue = function DOMAttr_setValue(value) {
  9755. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9756. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9757. }
  9758. this.setNodeValue(value);
  9759. };
  9760. DOMAttr.prototype.setNodeValue = function DOMAttr_setNodeValue(value) {
  9761. this.nodeValue = new String(value);
  9762. this.value = this.nodeValue;
  9763. this.specified = (this.value.length > 0);
  9764. };
  9765. DOMAttr.prototype.toString = function DOMAttr_toString() {
  9766. var ret = "";
  9767. ret += this.nodeName + "=\"" + this.__escapeString(this.nodeValue) + "\"";
  9768. return ret;
  9769. };
  9770. DOMAttr.prototype.getOwnerElement = function() {
  9771. return this.ownerElement;
  9772. };
  9773. DOMNamespace = function(_6283) {
  9774. this._class = addClass(this._class, "DOMNamespace");
  9775. this.DOMNode = DOMNode;
  9776. this.DOMNode(_6283);
  9777. this.name = "";
  9778. this.specified = false;
  9779. this.value = "";
  9780. this.nodeType = DOMNode.NAMESPACE_NODE;
  9781. };
  9782. DOMNamespace.prototype = new DOMNode;
  9783. DOMNamespace.prototype.getValue = function DOMNamespace_getValue() {
  9784. return this.nodeValue;
  9785. };
  9786. DOMNamespace.prototype.setValue = function DOMNamespace_setValue(value) {
  9787. this.nodeValue = new String(value);
  9788. this.value = this.nodeValue;
  9789. };
  9790. DOMNamespace.prototype.toString = function DOMNamespace_toString() {
  9791. var ret = "";
  9792. if (this.nodeName != "") {
  9793. ret += this.nodeName + "=\"" + this.__escapeString(this.nodeValue)
  9794. + "\"";
  9795. } else {
  9796. ret += "xmlns=\"" + this.__escapeString(this.nodeValue) + "\"";
  9797. }
  9798. return ret;
  9799. };
  9800. DOMCharacterData = function(_6286) {
  9801. this._class = addClass(this._class, "DOMCharacterData");
  9802. this.DOMNode = DOMNode;
  9803. this.DOMNode(_6286);
  9804. this.data = "";
  9805. this.length = 0;
  9806. };
  9807. DOMCharacterData.prototype = new DOMNode;
  9808. DOMCharacterData.prototype.getData = function DOMCharacterData_getData() {
  9809. return this.nodeValue;
  9810. };
  9811. DOMCharacterData.prototype.setData = function DOMCharacterData_setData(data) {
  9812. this.setNodeValue(data);
  9813. };
  9814. DOMCharacterData.prototype.setNodeValue = function DOMCharacterData_setNodeValue(
  9815. data) {
  9816. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9817. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9818. }
  9819. this.nodeValue = new String(data);
  9820. this.data = this.nodeValue;
  9821. this.length = this.nodeValue.length;
  9822. };
  9823. DOMCharacterData.prototype.getLength = function DOMCharacterData_getLength() {
  9824. return this.nodeValue.length;
  9825. };
  9826. DOMCharacterData.prototype.substringData = function DOMCharacterData_substringData(
  9827. _6289, count) {
  9828. var ret = null;
  9829. if (this.data) {
  9830. if (this.ownerDocument.implementation.errorChecking
  9831. && ((_6289 < 0) || (_6289 > this.data.length) || (count < 0))) {
  9832. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9833. }
  9834. if (!count) {
  9835. ret = this.data.substring(_6289);
  9836. } else {
  9837. ret = this.data.substring(_6289, _6289 + count);
  9838. }
  9839. }
  9840. return ret;
  9841. };
  9842. DOMCharacterData.prototype.appendData = function DOMCharacterData_appendData(
  9843. arg) {
  9844. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9845. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9846. }
  9847. this.setData("" + this.data + arg);
  9848. };
  9849. DOMCharacterData.prototype.insertData = function DOMCharacterData_insertData(
  9850. _628d, arg) {
  9851. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9852. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9853. }
  9854. if (this.data) {
  9855. if (this.ownerDocument.implementation.errorChecking
  9856. && ((_628d < 0) || (_628d > this.data.length))) {
  9857. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9858. }
  9859. this.setData(this.data.substring(0, _628d).concat(arg,
  9860. this.data.substring(_628d)));
  9861. } else {
  9862. if (this.ownerDocument.implementation.errorChecking && (_628d != 0)) {
  9863. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9864. }
  9865. this.setData(arg);
  9866. }
  9867. };
  9868. DOMCharacterData.prototype.deleteData = function DOMCharacterData_deleteData(
  9869. _628f, count) {
  9870. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9871. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9872. }
  9873. if (this.data) {
  9874. if (this.ownerDocument.implementation.errorChecking
  9875. && ((_628f < 0) || (_628f > this.data.length) || (count < 0))) {
  9876. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9877. }
  9878. if (!count || (_628f + count) > this.data.length) {
  9879. this.setData(this.data.substring(0, _628f));
  9880. } else {
  9881. this.setData(this.data.substring(0, _628f).concat(
  9882. this.data.substring(_628f + count)));
  9883. }
  9884. }
  9885. };
  9886. DOMCharacterData.prototype.replaceData = function DOMCharacterData_replaceData(
  9887. _6291, count, arg) {
  9888. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  9889. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9890. }
  9891. if (this.data) {
  9892. if (this.ownerDocument.implementation.errorChecking
  9893. && ((_6291 < 0) || (_6291 > this.data.length) || (count < 0))) {
  9894. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9895. }
  9896. this.setData(this.data.substring(0, _6291).concat(arg,
  9897. this.data.substring(_6291 + count)));
  9898. } else {
  9899. this.setData(arg);
  9900. }
  9901. };
  9902. DOMText = function(_6294) {
  9903. this._class = addClass(this._class, "DOMText");
  9904. this.DOMCharacterData = DOMCharacterData;
  9905. this.DOMCharacterData(_6294);
  9906. this.nodeName = "#text";
  9907. this.nodeType = DOMNode.TEXT_NODE;
  9908. };
  9909. DOMText.prototype = new DOMCharacterData;
  9910. DOMText.prototype.splitText = function DOMText_splitText(_6295) {
  9911. var data, inode;
  9912. if (this.ownerDocument.implementation.errorChecking) {
  9913. if (this._readonly) {
  9914. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9915. }
  9916. if ((_6295 < 0) || (_6295 > this.data.length)) {
  9917. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9918. }
  9919. }
  9920. if (this.parentNode) {
  9921. data = this.substringData(_6295);
  9922. inode = this.ownerDocument.createTextNode(data);
  9923. if (this.nextSibling) {
  9924. this.parentNode.insertBefore(inode, this.nextSibling);
  9925. } else {
  9926. this.parentNode.appendChild(inode);
  9927. }
  9928. this.deleteData(_6295);
  9929. }
  9930. return inode;
  9931. };
  9932. DOMText.prototype.toString = function DOMText_toString() {
  9933. return this.__escapeString("" + this.nodeValue);
  9934. };
  9935. DOMCDATASection = function(_6297) {
  9936. this._class = addClass(this._class, "DOMCDATASection");
  9937. this.DOMCharacterData = DOMCharacterData;
  9938. this.DOMCharacterData(_6297);
  9939. this.nodeName = "#cdata-section";
  9940. this.nodeType = DOMNode.CDATA_SECTION_NODE;
  9941. };
  9942. DOMCDATASection.prototype = new DOMCharacterData;
  9943. DOMCDATASection.prototype.splitText = function DOMCDATASection_splitText(_6298) {
  9944. var data, inode;
  9945. if (this.ownerDocument.implementation.errorChecking) {
  9946. if (this._readonly) {
  9947. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  9948. }
  9949. if ((_6298 < 0) || (_6298 > this.data.length)) {
  9950. throw (new DOMException(DOMException.INDEX_SIZE_ERR));
  9951. }
  9952. }
  9953. if (this.parentNode) {
  9954. data = this.substringData(_6298);
  9955. inode = this.ownerDocument.createCDATASection(data);
  9956. if (this.nextSibling) {
  9957. this.parentNode.insertBefore(inode, this.nextSibling);
  9958. } else {
  9959. this.parentNode.appendChild(inode);
  9960. }
  9961. this.deleteData(_6298);
  9962. }
  9963. return inode;
  9964. };
  9965. DOMCDATASection.prototype.toString = function DOMCDATASection_toString() {
  9966. var ret = "";
  9967. ret += "<![CDATA[" + this.nodeValue + "]]>";
  9968. return ret;
  9969. };
  9970. DOMComment = function(_629b) {
  9971. this._class = addClass(this._class, "DOMComment");
  9972. this.DOMCharacterData = DOMCharacterData;
  9973. this.DOMCharacterData(_629b);
  9974. this.nodeName = "#comment";
  9975. this.nodeType = DOMNode.COMMENT_NODE;
  9976. };
  9977. DOMComment.prototype = new DOMCharacterData;
  9978. DOMComment.prototype.toString = function DOMComment_toString() {
  9979. var ret = "";
  9980. ret += "<!--" + this.nodeValue + "-->";
  9981. return ret;
  9982. };
  9983. DOMProcessingInstruction = function(_629d) {
  9984. this._class = addClass(this._class, "DOMProcessingInstruction");
  9985. this.DOMNode = DOMNode;
  9986. this.DOMNode(_629d);
  9987. this.target = "";
  9988. this.data = "";
  9989. this.nodeType = DOMNode.PROCESSING_INSTRUCTION_NODE;
  9990. };
  9991. DOMProcessingInstruction.prototype = new DOMNode;
  9992. DOMProcessingInstruction.prototype.getTarget = function DOMProcessingInstruction_getTarget() {
  9993. return this.nodeName;
  9994. };
  9995. DOMProcessingInstruction.prototype.getData = function DOMProcessingInstruction_getData() {
  9996. return this.nodeValue;
  9997. };
  9998. DOMProcessingInstruction.prototype.setData = function DOMProcessingInstruction_setData(
  9999. data) {
  10000. this.setNodeValue(data);
  10001. };
  10002. DOMProcessingInstruction.prototype.setNodeValue = function DOMProcessingInstruction_setNodeValue(
  10003. data) {
  10004. if (this.ownerDocument.implementation.errorChecking && this._readonly) {
  10005. throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
  10006. }
  10007. this.nodeValue = new String(data);
  10008. this.data = this.nodeValue;
  10009. };
  10010. DOMProcessingInstruction.prototype.toString = function DOMProcessingInstruction_toString() {
  10011. var ret = "";
  10012. ret += "<?" + this.nodeName + " " + this.nodeValue + " ?>";
  10013. return ret;
  10014. };
  10015. DOMDocumentFragment = function(_62a1) {
  10016. this._class = addClass(this._class, "DOMDocumentFragment");
  10017. this.DOMNode = DOMNode;
  10018. this.DOMNode(_62a1);
  10019. this.nodeName = "#document-fragment";
  10020. this.nodeType = DOMNode.DOCUMENT_FRAGMENT_NODE;
  10021. };
  10022. DOMDocumentFragment.prototype = new DOMNode;
  10023. DOMDocumentFragment.prototype.toString = function DOMDocumentFragment_toString() {
  10024. var xml = "";
  10025. var _62a3 = this.getChildNodes().getLength();
  10026. for (intLoop = 0; intLoop < _62a3; intLoop++) {
  10027. xml += this.getChildNodes().item(intLoop).toString();
  10028. }
  10029. return xml;
  10030. };
  10031. DOMDocumentType = function() {
  10032. alert("DOMDocumentType.constructor(): Not Implemented");
  10033. };
  10034. DOMEntity = function() {
  10035. alert("DOMEntity.constructor(): Not Implemented");
  10036. };
  10037. DOMEntityReference = function() {
  10038. alert("DOMEntityReference.constructor(): Not Implemented");
  10039. };
  10040. DOMNotation = function() {
  10041. alert("DOMNotation.constructor(): Not Implemented");
  10042. };
  10043. Strings = new Object();
  10044. Strings.WHITESPACE = " \t\n\r";
  10045. Strings.QUOTES = "\"'";
  10046. Strings.isEmpty = function Strings_isEmpty(strD) {
  10047. return (strD === null) || (strD.length === 0);
  10048. };
  10049. Strings.indexOfNonWhitespace = function Strings_indexOfNonWhitespace(strD, iB,
  10050. iE) {
  10051. if (Strings.isEmpty(strD)) {
  10052. return -1;
  10053. }
  10054. iB = iB || 0;
  10055. iE = iE || strD.length;
  10056. for ( var i = iB; i < iE; i++) {
  10057. if (Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
  10058. return i;
  10059. }
  10060. }
  10061. return -1;
  10062. };
  10063. Strings.lastIndexOfNonWhitespace = function Strings_lastIndexOfNonWhitespace(
  10064. strD, iB, iE) {
  10065. if (Strings.isEmpty(strD)) {
  10066. return -1;
  10067. }
  10068. iB = iB || 0;
  10069. iE = iE || strD.length;
  10070. for ( var i = iE - 1; i >= iB; i--) {
  10071. if (Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
  10072. return i;
  10073. }
  10074. }
  10075. return -1;
  10076. };
  10077. Strings.indexOfWhitespace = function Strings_indexOfWhitespace(strD, iB, iE) {
  10078. if (Strings.isEmpty(strD)) {
  10079. return -1;
  10080. }
  10081. iB = iB || 0;
  10082. iE = iE || strD.length;
  10083. for ( var i = iB; i < iE; i++) {
  10084. if (Strings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
  10085. return i;
  10086. }
  10087. }
  10088. return -1;
  10089. };
  10090. Strings.replace = function Strings_replace(strD, iB, iE, strF, strR) {
  10091. if (Strings.isEmpty(strD)) {
  10092. return "";
  10093. }
  10094. iB = iB || 0;
  10095. iE = iE || strD.length;
  10096. return strD.substring(iB, iE).split(strF).join(strR);
  10097. };
  10098. Strings.getLineNumber = function Strings_getLineNumber(strD, iP) {
  10099. if (Strings.isEmpty(strD)) {
  10100. return -1;
  10101. }
  10102. iP = iP || strD.length;
  10103. return strD.substring(0, iP).split("\n").length;
  10104. };
  10105. Strings.getColumnNumber = function Strings_getColumnNumber(strD, iP) {
  10106. if (Strings.isEmpty(strD)) {
  10107. return -1;
  10108. }
  10109. iP = iP || strD.length;
  10110. var arrD = strD.substring(0, iP).split("\n");
  10111. var _62bb = arrD[arrD.length - 1];
  10112. arrD.length--;
  10113. var _62bc = arrD.join("\n").length;
  10114. return iP - _62bc;
  10115. };
  10116. StringBuffer = function() {
  10117. this._a = [];
  10118. };
  10119. StringBuffer.prototype.append = function StringBuffer_append(d) {
  10120. this._a[this._a.length] = d;
  10121. };
  10122. StringBuffer.prototype.toString = function StringBuffer_toString() {
  10123. return this._a.join("");
  10124. };
  10125. draw2d.XMLSerializer = function() {
  10126. alert("do not init this class. Use the static methods instead");
  10127. };
  10128. draw2d.XMLSerializer.toXML = function(obj, _5717, _5718) {
  10129. if (_5717 == undefined) {
  10130. _5717 = "model";
  10131. }
  10132. _5718 = _5718 ? _5718 : "";
  10133. var t = draw2d.XMLSerializer.getTypeName(obj);
  10134. var s = _5718 + "<" + _5717 + " type=\"" + t + "\">";
  10135. switch (t) {
  10136. case "int":
  10137. case "number":
  10138. case "boolean":
  10139. s += obj;
  10140. break;
  10141. case "string":
  10142. s += draw2d.XMLSerializer.xmlEncode(obj);
  10143. break;
  10144. case "date":
  10145. s += obj.toLocaleString();
  10146. break;
  10147. case "Array":
  10148. case "array":
  10149. s += "\n";
  10150. var _571b = _5718 + " ";
  10151. for ( var i = 0; i < obj.length; i++) {
  10152. s += draw2d.XMLSerializer.toXML(obj[i], ("element"), _571b);
  10153. }
  10154. s += _5718;
  10155. break;
  10156. default:
  10157. if (obj !== null) {
  10158. s += "\n";
  10159. if (obj instanceof draw2d.ArrayList) {
  10160. obj.trimToSize();
  10161. }
  10162. var _571d = obj.getPersistentAttributes();
  10163. var _571b = _5718 + " ";
  10164. for ( var name in _571d) {
  10165. s += draw2d.XMLSerializer.toXML(_571d[name], name, _571b);
  10166. }
  10167. s += _5718;
  10168. }
  10169. break;
  10170. }
  10171. s += "</" + _5717 + ">\n";
  10172. return s;
  10173. };
  10174. draw2d.XMLSerializer.isSimpleVar = function(t) {
  10175. switch (t) {
  10176. case "int":
  10177. case "string":
  10178. case "String":
  10179. case "Number":
  10180. case "number":
  10181. case "Boolean":
  10182. case "boolean":
  10183. case "bool":
  10184. case "dateTime":
  10185. case "Date":
  10186. case "date":
  10187. case "float":
  10188. return true;
  10189. }
  10190. return false;
  10191. };
  10192. draw2d.XMLSerializer.getTypeName = function(obj) {
  10193. if (obj === null) {
  10194. return "undefined";
  10195. }
  10196. if (obj instanceof Array) {
  10197. return "Array";
  10198. }
  10199. if (obj instanceof Date) {
  10200. return "Date";
  10201. }
  10202. var t = typeof (obj);
  10203. if (t == "number") {
  10204. return (parseInt(obj).toString() == obj) ? "int" : "number";
  10205. }
  10206. if (draw2d.XMLSerializer.isSimpleVar(t)) {
  10207. return t;
  10208. }
  10209. return obj.type.replace("@NAMESPACE" + "@", "");
  10210. };
  10211. draw2d.XMLSerializer.xmlEncode = function(_5722) {
  10212. var _5723 = _5722;
  10213. var amp = /&/gi;
  10214. var gt = />/gi;
  10215. var lt = /</gi;
  10216. var quot = /"/gi;
  10217. var apos = /'/gi;
  10218. var _5729 = "&#62;";
  10219. var _572a = "&#38;#60;";
  10220. var _572b = "&#38;#38;";
  10221. var _572c = "&#34;";
  10222. var _572d = "&#39;";
  10223. _5723 = _5723.replace(amp, _572b);
  10224. _5723 = _5723.replace(quot, _572c);
  10225. _5723 = _5723.replace(lt, _572a);
  10226. _5723 = _5723.replace(gt, _5729);
  10227. _5723 = _5723.replace(apos, _572d);
  10228. return _5723;
  10229. };
  10230. draw2d.XMLDeserializer = function() {
  10231. alert("do not init this class. Use the static methods instead");
  10232. };
  10233. draw2d.XMLDeserializer.fromXML = function(node, _4fe9) {
  10234. var _4fea = "" + node.getAttributes().getNamedItem("type").getNodeValue();
  10235. var value = node.getNodeValue();
  10236. switch (_4fea) {
  10237. case "int":
  10238. try {
  10239. return parseInt("" + node.getChildNodes().item(0).getNodeValue());
  10240. } catch (e) {
  10241. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10242. }
  10243. case "string":
  10244. case "String":
  10245. try {
  10246. if (node.getChildNodes().getLength() > 0) {
  10247. return "" + node.getChildNodes().item(0).getNodeValue();
  10248. }
  10249. return "";
  10250. } catch (e) {
  10251. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10252. }
  10253. case "Number":
  10254. case "number":
  10255. try {
  10256. return parseFloat("" + node.getChildNodes().item(0).getNodeValue());
  10257. } catch (e) {
  10258. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10259. }
  10260. case "Boolean":
  10261. case "boolean":
  10262. case "bool":
  10263. try {
  10264. return "true" == ("" + node.getChildNodes().item(0).getNodeValue())
  10265. .toLowerCase();
  10266. } catch (e) {
  10267. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10268. }
  10269. case "dateTime":
  10270. case "Date":
  10271. case "date":
  10272. try {
  10273. return new Date("" + node.getChildNodes().item(0).getNodeValue());
  10274. } catch (e) {
  10275. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10276. }
  10277. case "float":
  10278. try {
  10279. return parseFloat("" + node.getChildNodes().item(0).getNodeValue());
  10280. } catch (e) {
  10281. alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
  10282. }
  10283. break;
  10284. }
  10285. _4fea = _4fea.replace("@NAMESPACE" + "@", "");
  10286. var obj = eval("new " + _4fea + "()");
  10287. if (_4fe9 != undefined && obj.setModelParent != undefined) {
  10288. obj.setModelParent(_4fe9);
  10289. }
  10290. var _4fed = node.getChildNodes();
  10291. for ( var i = 0; i < _4fed.length; i++) {
  10292. var child = _4fed.item(i);
  10293. var _4ff0 = child.getNodeName();
  10294. if (obj instanceof Array) {
  10295. _4ff0 = i;
  10296. }
  10297. obj[_4ff0] = draw2d.XMLDeserializer.fromXML(child,
  10298. obj instanceof draw2d.AbstractObjectModel ? obj : _4fe9);
  10299. }
  10300. return obj;
  10301. };
  10302. draw2d.EditPolicy = function(_5cb1) {
  10303. this.policy = _5cb1;
  10304. };
  10305. draw2d.EditPolicy.DELETE = "DELETE";
  10306. draw2d.EditPolicy.MOVE = "MOVE";
  10307. draw2d.EditPolicy.CONNECT = "CONNECT";
  10308. draw2d.EditPolicy.RESIZE = "RESIZE";
  10309. draw2d.EditPolicy.prototype.type = "draw2d.EditPolicy";
  10310. draw2d.EditPolicy.prototype.getPolicy = function() {
  10311. return this.policy;
  10312. };
  10313. draw2d.AbstractPalettePart = function() {
  10314. this.x = 0;
  10315. this.y = 0;
  10316. this.html = null;
  10317. };
  10318. draw2d.AbstractPalettePart.prototype.type = "draw2d.AbstractPalettePart";
  10319. draw2d.AbstractPalettePart.prototype = new draw2d.Draggable();
  10320. draw2d.AbstractPalettePart.prototype.createHTMLElement = function() {
  10321. var item = document.createElement("div");
  10322. item.id = this.id;
  10323. item.style.position = "absolute";
  10324. item.style.height = "24px";
  10325. item.style.width = "24px";
  10326. return item;
  10327. };
  10328. draw2d.AbstractPalettePart.prototype.setEnviroment = function(_6008, _6009) {
  10329. this.palette = _6009;
  10330. this.workflow = _6008;
  10331. };
  10332. draw2d.AbstractPalettePart.prototype.getHTMLElement = function() {
  10333. if (this.html === null) {
  10334. this.html = this.createHTMLElement();
  10335. draw2d.Draggable.call(this, this.html);
  10336. }
  10337. return this.html;
  10338. };
  10339. draw2d.AbstractPalettePart.prototype.onDrop = function(_600a, _600b) {
  10340. var _600c = this.workflow.getScrollLeft();
  10341. var _600d = this.workflow.getScrollTop();
  10342. var _600e = this.workflow.getAbsoluteX();
  10343. var _600f = this.workflow.getAbsoluteY();
  10344. this.setPosition(this.x, this.y);
  10345. this.execute(_600a + _600c - _600e, _600b + _600d - _600f);
  10346. };
  10347. draw2d.AbstractPalettePart.prototype.execute = function(x, y) {
  10348. alert("inerited class should override the method 'draw2d.AbstractPalettePart.prototype.execute'");
  10349. };
  10350. draw2d.AbstractPalettePart.prototype.setTooltip = function(_6012) {
  10351. this.tooltip = _6012;
  10352. if (this.tooltip !== null) {
  10353. this.html.title = this.tooltip;
  10354. } else {
  10355. this.html.title = "";
  10356. }
  10357. };
  10358. draw2d.AbstractPalettePart.prototype.setDimension = function(w, h) {
  10359. this.width = w;
  10360. this.height = h;
  10361. if (this.html === null) {
  10362. return;
  10363. }
  10364. this.html.style.width = this.width + "px";
  10365. this.html.style.height = this.height + "px";
  10366. };
  10367. draw2d.AbstractPalettePart.prototype.setPosition = function(xPos, yPos) {
  10368. this.x = Math.max(0, xPos);
  10369. this.y = Math.max(0, yPos);
  10370. if (this.html === null) {
  10371. return;
  10372. }
  10373. this.html.style.left = this.x + "px";
  10374. this.html.style.top = this.y + "px";
  10375. this.html.style.cursor = "move";
  10376. };
  10377. draw2d.AbstractPalettePart.prototype.getWidth = function() {
  10378. return this.width;
  10379. };
  10380. draw2d.AbstractPalettePart.prototype.getHeight = function() {
  10381. return this.height;
  10382. };
  10383. draw2d.AbstractPalettePart.prototype.getY = function() {
  10384. return this.y;
  10385. };
  10386. draw2d.AbstractPalettePart.prototype.getX = function() {
  10387. return this.x;
  10388. };
  10389. draw2d.AbstractPalettePart.prototype.getPosition = function() {
  10390. return new draw2d.Point(this.x, this.y);
  10391. };
  10392. draw2d.AbstractPalettePart.prototype.disableTextSelection = function(e) {
  10393. if (typeof e.onselectstart != "undefined") {
  10394. e.onselectstart = function() {
  10395. return false;
  10396. };
  10397. } else {
  10398. if (typeof e.style.MozUserSelect != "undefined") {
  10399. e.style.MozUserSelect = "none";
  10400. }
  10401. }
  10402. };
  10403. draw2d.ExternalPalette = function(_5b29, divId) {
  10404. this.html = document.getElementById(divId);
  10405. this.workflow = _5b29;
  10406. this.parts = new draw2d.ArrayList();
  10407. };
  10408. draw2d.ExternalPalette.prototype.type = "draw2d.ExternalPalette";
  10409. draw2d.ExternalPalette.prototype.getHTMLElement = function() {
  10410. return this.html;
  10411. };
  10412. draw2d.ExternalPalette.prototype.addPalettePart = function(part) {
  10413. if (!(part instanceof draw2d.AbstractPalettePart)) {
  10414. throw "parameter is not instanceof [draw2d.AbstractPalettePart]";
  10415. }
  10416. this.parts.add(part);
  10417. this.html.appendChild(part.getHTMLElement());
  10418. part.setEnviroment(this.workflow, this);
  10419. };