| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427 |
- /**
- * This notice must be untouched at all times. This is the COMPRESSED version of
- * the Draw2D Library WebSite: http://www.draw2d.org Copyright: 2006 Andreas
- * Herz. All rights reserved. Created: 5.11.2006 by Andreas Herz (Web:
- * http://www.freegroup.de ) LICENSE: LGPL
- */
- var draw2d = new Object();
- var _errorStack_ = [];
- function pushErrorStack(e, _56b2) {
- _errorStack_.push(_56b2 + "\n");
- throw e;
- }
- draw2d.AbstractEvent = function() {
- this.type = null;
- this.target = null;
- this.relatedTarget = null;
- this.cancelable = false;
- this.timeStamp = null;
- this.returnValue = true;
- };
- draw2d.AbstractEvent.prototype.initEvent = function(sType, _56b4) {
- this.type = sType;
- this.cancelable = _56b4;
- this.timeStamp = (new Date()).getTime();
- };
- draw2d.AbstractEvent.prototype.preventDefault = function() {
- if (this.cancelable) {
- this.returnValue = false;
- }
- };
- draw2d.AbstractEvent.fireDOMEvent = function(_56b5, _56b6) {
- if (document.createEvent) {
- var evt = document.createEvent("Events");
- evt.initEvent(_56b5, true, true);
- _56b6.dispatchEvent(evt);
- } else {
- if (document.createEventObject) {
- var evt = document.createEventObject();
- _56b6.fireEvent("on" + _56b5, evt);
- }
- }
- };
- draw2d.EventTarget = function() {
- this.eventhandlers = {};
- };
- draw2d.EventTarget.prototype.addEventListener = function(sType, _56b9) {
- if (typeof this.eventhandlers[sType] == "undefined") {
- this.eventhandlers[sType] = [];
- }
- this.eventhandlers[sType][this.eventhandlers[sType].length] = _56b9;
- };
- draw2d.EventTarget.prototype.dispatchEvent = function(_56ba) {
- _56ba.target = this;
- if (typeof this.eventhandlers[_56ba.type] != "undefined") {
- for ( var i = 0; i < this.eventhandlers[_56ba.type].length; i++) {
- this.eventhandlers[_56ba.type][i](_56ba);
- }
- }
- return _56ba.returnValue;
- };
- draw2d.EventTarget.prototype.removeEventListener = function(sType, _56bd) {
- if (typeof this.eventhandlers[sType] != "undefined") {
- var _56be = [];
- for ( var i = 0; i < this.eventhandlers[sType].length; i++) {
- if (this.eventhandlers[sType][i] != _56bd) {
- _56be[_56be.length] = this.eventhandlers[sType][i];
- }
- }
- this.eventhandlers[sType] = _56be;
- }
- };
- String.prototype.trim = function() {
- return (this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), ""));
- };
- String.prototype.lefttrim = function() {
- return (this.replace(new RegExp("^[\\s]+", "gm"), ""));
- };
- String.prototype.righttrim = function() {
- return (this.replace(new RegExp("[\\s]+$", "gm"), ""));
- };
- String.prototype.between = function(left, right, _558a) {
- if (!_558a) {
- _558a = 0;
- }
- var li = this.indexOf(left, _558a);
- if (li == -1) {
- return null;
- }
- var ri = this.indexOf(right, li);
- if (ri == -1) {
- return null;
- }
- return this.substring(li + left.length, ri);
- };
- draw2d.UUID = function() {
- };
- draw2d.UUID.prototype.type = "draw2d.UUID";
- draw2d.UUID.create = function() {
- var _4a13 = function() {
- return (((1 + Math.random()) * 65536) | 0).toString(16).substring(1);
- };
- return (_4a13() + _4a13() + "-" + _4a13() + "-" + _4a13() + "-" + _4a13()
- + "-" + _4a13() + _4a13() + _4a13());
- };
- draw2d.ArrayList = function() {
- this.increment = 10;
- this.size = 0;
- this.data = new Array(this.increment);
- };
- draw2d.ArrayList.EMPTY_LIST = new draw2d.ArrayList();
- draw2d.ArrayList.prototype.type = "draw2d.ArrayList";
- draw2d.ArrayList.prototype.reverse = function() {
- var _4b1e = new Array(this.size);
- for ( var i = 0; i < this.size; i++) {
- _4b1e[i] = this.data[this.size - i - 1];
- }
- this.data = _4b1e;
- };
- draw2d.ArrayList.prototype.getCapacity = function() {
- return this.data.length;
- };
- draw2d.ArrayList.prototype.getSize = function() {
- return this.size;
- };
- draw2d.ArrayList.prototype.isEmpty = function() {
- return this.getSize() === 0;
- };
- draw2d.ArrayList.prototype.getLastElement = function() {
- if (this.data[this.getSize() - 1] !== null) {
- return this.data[this.getSize() - 1];
- }
- };
- draw2d.ArrayList.prototype.getFirstElement = function() {
- if (this.data[0] !== null && this.data[0] !== undefined) {
- return this.data[0];
- }
- return null;
- };
- draw2d.ArrayList.prototype.get = function(i) {
- return this.data[i];
- };
- draw2d.ArrayList.prototype.add = function(obj) {
- if (this.getSize() == this.data.length) {
- this.resize();
- }
- this.data[this.size++] = obj;
- };
- draw2d.ArrayList.prototype.addAll = function(obj) {
- for ( var i = 0; i < obj.getSize(); i++) {
- this.add(obj.get(i));
- }
- };
- draw2d.ArrayList.prototype.remove = function(obj) {
- var index = this.indexOf(obj);
- if (index >= 0) {
- return this.removeElementAt(index);
- }
- return null;
- };
- draw2d.ArrayList.prototype.insertElementAt = function(obj, index) {
- if (this.size == this.capacity) {
- this.resize();
- }
- for ( var i = this.getSize(); i > index; i--) {
- this.data[i] = this.data[i - 1];
- }
- this.data[index] = obj;
- this.size++;
- };
- draw2d.ArrayList.prototype.removeElementAt = function(index) {
- var _4b2a = this.data[index];
- for ( var i = index; i < (this.getSize() - 1); i++) {
- this.data[i] = this.data[i + 1];
- }
- this.data[this.getSize() - 1] = null;
- this.size--;
- return _4b2a;
- };
- draw2d.ArrayList.prototype.removeAllElements = function() {
- this.size = 0;
- for ( var i = 0; i < this.data.length; i++) {
- this.data[i] = null;
- }
- };
- draw2d.ArrayList.prototype.indexOf = function(obj) {
- for ( var i = 0; i < this.getSize(); i++) {
- if (this.data[i] == obj) {
- return i;
- }
- }
- return -1;
- };
- draw2d.ArrayList.prototype.contains = function(obj) {
- for ( var i = 0; i < this.getSize(); i++) {
- if (this.data[i] == obj) {
- return true;
- }
- }
- return false;
- };
- draw2d.ArrayList.prototype.resize = function() {
- newData = new Array(this.data.length + this.increment);
- for ( var i = 0; i < this.data.length; i++) {
- newData[i] = this.data[i];
- }
- this.data = newData;
- };
- draw2d.ArrayList.prototype.trimToSize = function() {
- if (this.data.length == this.size) {
- return;
- }
- var temp = new Array(this.getSize());
- for ( var i = 0; i < this.getSize(); i++) {
- temp[i] = this.data[i];
- }
- this.size = temp.length;
- this.data = temp;
- };
- draw2d.ArrayList.prototype.sort = function(f) {
- var i, j;
- var _4b36;
- var _4b37;
- var _4b38;
- var _4b39;
- for (i = 1; i < this.getSize(); i++) {
- _4b37 = this.data[i];
- _4b36 = _4b37[f];
- j = i - 1;
- _4b38 = this.data[j];
- _4b39 = _4b38[f];
- while (j >= 0 && _4b39 > _4b36) {
- this.data[j + 1] = this.data[j];
- j--;
- if (j >= 0) {
- _4b38 = this.data[j];
- _4b39 = _4b38[f];
- }
- }
- this.data[j + 1] = _4b37;
- }
- };
- draw2d.ArrayList.prototype.clone = function() {
- var _4b3a = new draw2d.ArrayList(this.size);
- for ( var i = 0; i < this.size; i++) {
- _4b3a.add(this.data[i]);
- }
- return _4b3a;
- };
- draw2d.ArrayList.prototype.overwriteElementAt = function(obj, index) {
- this.data[index] = obj;
- };
- draw2d.ArrayList.prototype.getPersistentAttributes = function() {
- return {
- data : this.data,
- increment : this.increment,
- size : this.getSize()
- };
- };
- function trace(_5cb5) {
- var _5cb6 = openwindow("about:blank", 700, 400);
- _5cb6.document.writeln("<pre>" + _5cb5 + "</pre>");
- }
- function openwindow(url, width, _5cb9) {
- var left = (screen.width - width) / 2;
- var top = (screen.height - _5cb9) / 2;
- property = "left="
- + left
- + ", top="
- + top
- + ", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,alwaysRaised,width="
- + width + ",height=" + _5cb9;
- return window.open(url, "_blank", property);
- }
- function dumpObject(obj) {
- trace("----------------------------------------------------------------------------");
- trace("- Object dump");
- trace("----------------------------------------------------------------------------");
- for ( var i in obj) {
- try {
- if (typeof obj[i] != "function") {
- trace(i + " --> " + obj[i]);
- }
- } catch (e) {
- }
- }
- for ( var i in obj) {
- try {
- if (typeof obj[i] == "function") {
- trace(i + " --> " + obj[i]);
- }
- } catch (e) {
- }
- }
- trace("----------------------------------------------------------------------------");
- }
- draw2d.Drag = function() {
- };
- draw2d.Drag.current = null;
- draw2d.Drag.currentTarget = null;
- draw2d.Drag.currentHover = null;
- draw2d.Drag.currentCompartment = null;
- draw2d.Drag.dragging = false;
- draw2d.Drag.isDragging = function() {
- return this.dragging;
- };
- draw2d.Drag.setCurrent = function(_604e) {
- this.current = _604e;
- this.dragging = true;
- };
- draw2d.Drag.getCurrent = function() {
- return this.current;
- };
- draw2d.Drag.clearCurrent = function() {
- this.current = null;
- this.dragging = false;
- this.currentTarget = null;
- };
- draw2d.Draggable = function(_604f, _6050) {
- this.id = draw2d.UUID.create();
- this.node = null;
- draw2d.EventTarget.call(this);
- this.construct(_604f, _6050);
- this.diffX = 0;
- this.diffY = 0;
- this.targets = new draw2d.ArrayList();
- };
- draw2d.Draggable.prototype = new draw2d.EventTarget();
- draw2d.Draggable.prototype.construct = function(_6051) {
- if (_6051 === null || _6051 === undefined) {
- return;
- }
- this.element = _6051;
- var oThis = this;
- var _6053 = function() {
- var _6054 = new draw2d.DragDropEvent();
- _6054.initDragDropEvent("dblclick", true);
- oThis.dispatchEvent(_6054);
- var _6055 = arguments[0] || window.event;
- _6055.cancelBubble = true;
- _6055.returnValue = false;
- };
- var _6056 = function() {
- var _6057 = arguments[0] || window.event;
- var _6058 = new draw2d.DragDropEvent();
- if (oThis.node !== null) {
- var _6059 = oThis.node.getWorkflow().getAbsoluteX();
- var _605a = oThis.node.getWorkflow().getAbsoluteY();
- var _605b = oThis.node.getWorkflow().getScrollLeft();
- var _605c = oThis.node.getWorkflow().getScrollTop();
- _6058.x = _6057.clientX - oThis.element.offsetLeft + _605b - _6059;
- _6058.y = _6057.clientY - oThis.element.offsetTop + _605c - _605a;
- }
- if (_6057.button === 2) {
- _6058.initDragDropEvent("contextmenu", true);
- oThis.dispatchEvent(_6058);
- } else {
- _6058.initDragDropEvent("dragstart", true);
- if (oThis.dispatchEvent(_6058)) {
- oThis.diffX = _6057.clientX - oThis.element.offsetLeft;
- oThis.diffY = _6057.clientY - oThis.element.offsetTop;
- draw2d.Drag.setCurrent(oThis);
- if (oThis.isAttached == true) {
- oThis.detachEventHandlers();
- }
- oThis.attachEventHandlers();
- }
- }
- _6057.cancelBubble = true;
- _6057.returnValue = false;
- };
- var _605d = function() {
- if (draw2d.Drag.getCurrent() === null) {
- var _605e = arguments[0] || window.event;
- if (draw2d.Drag.currentHover !== null
- && oThis !== draw2d.Drag.currentHover) {
- var _605f = new draw2d.DragDropEvent();
- _605f.initDragDropEvent("mouseleave", false, oThis);
- draw2d.Drag.currentHover.dispatchEvent(_605f);
- }
- if (oThis !== null && oThis !== draw2d.Drag.currentHover) {
- var _605f = new draw2d.DragDropEvent();
- _605f.initDragDropEvent("mouseenter", false, oThis);
- oThis.dispatchEvent(_605f);
- }
- draw2d.Drag.currentHover = oThis;
- } else {
- }
- };
- if (this.element.addEventListener) {
- this.element.addEventListener("mousemove", _605d, false);
- this.element.addEventListener("mousedown", _6056, false);
- this.element.addEventListener("dblclick", _6053, false);
- } else {
- if (this.element.attachEvent) {
- this.element.attachEvent("onmousemove", _605d);
- this.element.attachEvent("onmousedown", _6056);
- this.element.attachEvent("ondblclick", _6053);
- } else {
- throw "Drag not supported in this browser.";
- }
- }
- };
- draw2d.Draggable.prototype.onDrop = function(_6060, _6061) {
- };
- draw2d.Draggable.prototype.attachEventHandlers = function() {
- var oThis = this;
- oThis.isAttached = true;
- this.tempMouseMove = function() {
- var _6063 = arguments[0] || window.event;
- var _6064 = new draw2d.Point(_6063.clientX - oThis.diffX, _6063.clientY
- - oThis.diffY);
- if (oThis.node !== null && oThis.node.getCanSnapToHelper()) {
- _6064 = oThis.node.getWorkflow().snapToHelper(oThis.node, _6064);
- }
- oThis.element.style.left = _6064.x + "px";
- oThis.element.style.top = _6064.y + "px";
- if (oThis.node !== null) {
- var _6065 = oThis.node.getWorkflow().getScrollLeft();
- var _6066 = oThis.node.getWorkflow().getScrollTop();
- var _6067 = oThis.node.getWorkflow().getAbsoluteX();
- var _6068 = oThis.node.getWorkflow().getAbsoluteY();
- var _6069 = oThis.getDropTarget(_6063.clientX + _6065 - _6067,
- _6063.clientY + _6066 - _6068);
- var _606a = oThis.getCompartment(_6063.clientX + _6065 - _6067,
- _6063.clientY + _6066 - _6068);
- if (draw2d.Drag.currentTarget !== null
- && _6069 != draw2d.Drag.currentTarget) {
- var _606b = new draw2d.DragDropEvent();
- _606b.initDragDropEvent("dragleave", false, oThis);
- draw2d.Drag.currentTarget.dispatchEvent(_606b);
- }
- if (_6069 !== null && _6069 !== draw2d.Drag.currentTarget) {
- var _606b = new draw2d.DragDropEvent();
- _606b.initDragDropEvent("dragenter", false, oThis);
- _6069.dispatchEvent(_606b);
- }
- draw2d.Drag.currentTarget = _6069;
- if (draw2d.Drag.currentCompartment !== null
- && _606a !== draw2d.Drag.currentCompartment) {
- var _606b = new draw2d.DragDropEvent();
- _606b.initDragDropEvent("figureleave", false, oThis);
- draw2d.Drag.currentCompartment.dispatchEvent(_606b);
- }
- if (_606a !== null && _606a.node != oThis.node
- && _606a !== draw2d.Drag.currentCompartment) {
- var _606b = new draw2d.DragDropEvent();
- _606b.initDragDropEvent("figureenter", false, oThis);
- _606a.dispatchEvent(_606b);
- }
- draw2d.Drag.currentCompartment = _606a;
- }
- var _606c = new draw2d.DragDropEvent();
- _606c.initDragDropEvent("drag", false);
- oThis.dispatchEvent(_606c);
- };
- oThis.tempMouseUp = function() {
- oThis.detachEventHandlers();
- var _606d = arguments[0] || window.event;
- if (oThis.node !== null) {
- var _606e = oThis.node.getWorkflow().getScrollLeft();
- var _606f = oThis.node.getWorkflow().getScrollTop();
- var _6070 = oThis.node.getWorkflow().getAbsoluteX();
- var _6071 = oThis.node.getWorkflow().getAbsoluteY();
- var _6072 = oThis.getDropTarget(_606d.clientX + _606e - _6070,
- _606d.clientY + _606f - _6071);
- var _6073 = oThis.getCompartment(_606d.clientX + _606e - _6070,
- _606d.clientY + _606f - _6071);
- if (_6072 !== null) {
- var _6074 = new draw2d.DragDropEvent();
- _6074.initDragDropEvent("drop", false, oThis);
- _6072.dispatchEvent(_6074);
- }
- if (_6073 !== null && _6073.node !== oThis.node) {
- var _6074 = new draw2d.DragDropEvent();
- _6074.initDragDropEvent("figuredrop", false, oThis);
- _6073.dispatchEvent(_6074);
- }
- if (draw2d.Drag.currentTarget !== null) {
- var _6074 = new draw2d.DragDropEvent();
- _6074.initDragDropEvent("dragleave", false, oThis);
- draw2d.Drag.currentTarget.dispatchEvent(_6074);
- draw2d.Drag.currentTarget = null;
- }
- }
- var _6075 = new draw2d.DragDropEvent();
- _6075.initDragDropEvent("dragend", false);
- oThis.dispatchEvent(_6075);
- oThis.onDrop(_606d.clientX, _606d.clientY);
- draw2d.Drag.currentCompartment = null;
- draw2d.Drag.clearCurrent();
- };
- if (document.body.addEventListener) {
- document.body.addEventListener("mousemove", this.tempMouseMove, false);
- document.body.addEventListener("mouseup", this.tempMouseUp, false);
- } else {
- if (document.body.attachEvent) {
- document.body.attachEvent("onmousemove", this.tempMouseMove);
- document.body.attachEvent("onmouseup", this.tempMouseUp);
- } else {
- throw new Error("Drag doesn't support this browser.");
- }
- }
- };
- draw2d.Draggable.prototype.detachEventHandlers = function() {
- this.isAttached = false;
- if (document.body.removeEventListener) {
- document.body.removeEventListener("mousemove", this.tempMouseMove,
- false);
- document.body.removeEventListener("mouseup", this.tempMouseUp, false);
- } else {
- if (document.body.detachEvent) {
- document.body.detachEvent("onmousemove", this.tempMouseMove);
- document.body.detachEvent("onmouseup", this.tempMouseUp);
- } else {
- throw new Error("Drag doesn't support this browser.");
- }
- }
- };
- draw2d.Draggable.prototype.getDropTarget = function(x, y) {
- for ( var i = 0; i < this.targets.getSize(); i++) {
- var _6079 = this.targets.get(i);
- if (_6079.node.isOver(x, y) && _6079.node !== this.node) {
- return _6079;
- }
- }
- return null;
- };
- draw2d.Draggable.prototype.getCompartment = function(x, y) {
- var _607c = null;
- for ( var i = 0; i < this.node.getWorkflow().compartments.getSize(); i++) {
- var _607e = this.node.getWorkflow().compartments.get(i);
- if (_607e.isOver(x, y) && _607e !== this.node) {
- if (_607c === null) {
- _607c = _607e;
- } else {
- if (_607c.getZOrder() < _607e.getZOrder()) {
- _607c = _607e;
- }
- }
- }
- }
- return _607c === null ? null : _607c.dropable;
- };
- draw2d.Draggable.prototype.getLeft = function() {
- return this.element.offsetLeft;
- };
- draw2d.Draggable.prototype.getTop = function() {
- return this.element.offsetTop;
- };
- draw2d.DragDropEvent = function() {
- draw2d.AbstractEvent.call(this);
- };
- draw2d.DragDropEvent.prototype = new draw2d.AbstractEvent();
- draw2d.DragDropEvent.prototype.initDragDropEvent = function(sType, _6080, _6081) {
- this.initEvent(sType, _6080);
- this.relatedTarget = _6081;
- };
- draw2d.DropTarget = function(_6082) {
- draw2d.EventTarget.call(this);
- this.construct(_6082);
- };
- draw2d.DropTarget.prototype = new draw2d.EventTarget();
- draw2d.DropTarget.prototype.construct = function(_6083) {
- this.element = _6083;
- };
- draw2d.DropTarget.prototype.getLeft = function() {
- var el = this.element;
- var ol = el.offsetLeft;
- while ((el = el.offsetParent) !== null) {
- ol += el.offsetLeft;
- }
- return ol;
- };
- draw2d.DropTarget.prototype.getTop = function() {
- var el = this.element;
- var ot = el.offsetTop;
- while ((el = el.offsetParent) !== null) {
- ot += el.offsetTop;
- }
- return ot;
- };
- draw2d.DropTarget.prototype.getHeight = function() {
- return this.element.offsetHeight;
- };
- draw2d.DropTarget.prototype.getWidth = function() {
- return this.element.offsetWidth;
- };
- draw2d.PositionConstants = function() {
- };
- draw2d.PositionConstants.NORTH = 1;
- draw2d.PositionConstants.SOUTH = 4;
- draw2d.PositionConstants.WEST = 8;
- draw2d.PositionConstants.EAST = 16;
- draw2d.Color = function(red, green, blue) {
- if (typeof green == "undefined") {
- var rgb = this.hex2rgb(red);
- this.red = rgb[0];
- this.green = rgb[1];
- this.blue = rgb[2];
- } else {
- this.red = red;
- this.green = green;
- this.blue = blue;
- }
- };
- draw2d.Color.prototype.type = "draw2d.Color";
- draw2d.Color.prototype.getHTMLStyle = function() {
- return "rgb(" + this.red + "," + this.green + "," + this.blue + ")";
- };
- draw2d.Color.prototype.getRed = function() {
- return this.red;
- };
- draw2d.Color.prototype.getGreen = function() {
- return this.green;
- };
- draw2d.Color.prototype.getBlue = function() {
- return this.blue;
- };
- draw2d.Color.prototype.getIdealTextColor = function() {
- var _5062 = 105;
- var _5063 = (this.red * 0.299) + (this.green * 0.587) + (this.blue * 0.114);
- return (255 - _5063 < _5062) ? new draw2d.Color(0, 0, 0)
- : new draw2d.Color(255, 255, 255);
- };
- draw2d.Color.prototype.hex2rgb = function(_5064) {
- _5064 = _5064.replace("#", "");
- return ( {
- 0 : parseInt(_5064.substr(0, 2), 16),
- 1 : parseInt(_5064.substr(2, 2), 16),
- 2 : parseInt(_5064.substr(4, 2), 16)
- });
- };
- draw2d.Color.prototype.hex = function() {
- return (this.int2hex(this.red) + this.int2hex(this.green) + this
- .int2hex(this.blue));
- };
- draw2d.Color.prototype.int2hex = function(v) {
- v = Math.round(Math.min(Math.max(0, v), 255));
- return ("0123456789ABCDEF".charAt((v - v % 16) / 16) + "0123456789ABCDEF"
- .charAt(v % 16));
- };
- draw2d.Color.prototype.darker = function(_5066) {
- var red = parseInt(Math.round(this.getRed() * (1 - _5066)));
- var green = parseInt(Math.round(this.getGreen() * (1 - _5066)));
- var blue = parseInt(Math.round(this.getBlue() * (1 - _5066)));
- if (red < 0) {
- red = 0;
- } else {
- if (red > 255) {
- red = 255;
- }
- }
- if (green < 0) {
- green = 0;
- } else {
- if (green > 255) {
- green = 255;
- }
- }
- if (blue < 0) {
- blue = 0;
- } else {
- if (blue > 255) {
- blue = 255;
- }
- }
- return new draw2d.Color(red, green, blue);
- };
- draw2d.Color.prototype.lighter = function(_506a) {
- var red = parseInt(Math.round(this.getRed() * (1 + _506a)));
- var green = parseInt(Math.round(this.getGreen() * (1 + _506a)));
- var blue = parseInt(Math.round(this.getBlue() * (1 + _506a)));
- if (red < 0) {
- red = 0;
- } else {
- if (red > 255) {
- red = 255;
- }
- }
- if (green < 0) {
- green = 0;
- } else {
- if (green > 255) {
- green = 255;
- }
- }
- if (blue < 0) {
- blue = 0;
- } else {
- if (blue > 255) {
- blue = 255;
- }
- }
- return new draw2d.Color(red, green, blue);
- };
- draw2d.Point = function(x, y) {
- this.x = x;
- this.y = y;
- };
- draw2d.Point.prototype.type = "draw2d.Point";
- draw2d.Point.prototype.getX = function() {
- return this.x;
- };
- draw2d.Point.prototype.getY = function() {
- return this.y;
- };
- draw2d.Point.prototype.getPosition = function(p) {
- var dx = p.x - this.x;
- var dy = p.y - this.y;
- if (Math.abs(dx) > Math.abs(dy)) {
- if (dx < 0) {
- return draw2d.PositionConstants.WEST;
- }
- return draw2d.PositionConstants.EAST;
- }
- if (dy < 0) {
- return draw2d.PositionConstants.NORTH;
- }
- return draw2d.PositionConstants.SOUTH;
- };
- draw2d.Point.prototype.equals = function(o) {
- return this.x == o.x && this.y == o.y;
- };
- draw2d.Point.prototype.getDistance = function(other) {
- return Math.sqrt((this.x - other.x) * (this.x - other.x)
- + (this.y - other.y) * (this.y - other.y));
- };
- draw2d.Point.prototype.getTranslated = function(other) {
- return new draw2d.Point(this.x + other.x, this.y + other.y);
- };
- draw2d.Point.prototype.getPersistentAttributes = function() {
- return {
- x : this.x,
- y : this.y
- };
- };
- draw2d.Dimension = function(x, y, w, h) {
- draw2d.Point.call(this, x, y);
- this.w = w;
- this.h = h;
- };
- draw2d.Dimension.prototype = new draw2d.Point();
- draw2d.Dimension.prototype.type = "draw2d.Dimension";
- draw2d.Dimension.prototype.translate = function(dx, dy) {
- this.x += dx;
- this.y += dy;
- return this;
- };
- draw2d.Dimension.prototype.resize = function(dw, dh) {
- this.w += dw;
- this.h += dh;
- return this;
- };
- draw2d.Dimension.prototype.setBounds = function(rect) {
- this.x = rect.x;
- this.y = rect.y;
- this.w = rect.w;
- this.h = rect.h;
- return this;
- };
- draw2d.Dimension.prototype.isEmpty = function() {
- return this.w <= 0 || this.h <= 0;
- };
- draw2d.Dimension.prototype.getWidth = function() {
- return this.w;
- };
- draw2d.Dimension.prototype.getHeight = function() {
- return this.h;
- };
- draw2d.Dimension.prototype.getRight = function() {
- return this.x + this.w;
- };
- draw2d.Dimension.prototype.getBottom = function() {
- return this.y + this.h;
- };
- draw2d.Dimension.prototype.getTopLeft = function() {
- return new draw2d.Point(this.x, this.y);
- };
- draw2d.Dimension.prototype.getCenter = function() {
- return new draw2d.Point(this.x + this.w / 2, this.y + this.h / 2);
- };
- draw2d.Dimension.prototype.getBottomRight = function() {
- return new draw2d.Point(this.x + this.w, this.y + this.h);
- };
- draw2d.Dimension.prototype.equals = function(o) {
- return this.x == o.x && this.y == o.y && this.w == o.w && this.h == o.h;
- };
- draw2d.SnapToHelper = function(_5932) {
- this.workflow = _5932;
- };
- draw2d.SnapToHelper.NORTH = 1;
- draw2d.SnapToHelper.SOUTH = 4;
- draw2d.SnapToHelper.WEST = 8;
- draw2d.SnapToHelper.EAST = 16;
- draw2d.SnapToHelper.CENTER = 32;
- draw2d.SnapToHelper.NORTH_EAST = draw2d.SnapToHelper.NORTH
- | draw2d.SnapToHelper.EAST;
- draw2d.SnapToHelper.NORTH_WEST = draw2d.SnapToHelper.NORTH
- | draw2d.SnapToHelper.WEST;
- draw2d.SnapToHelper.SOUTH_EAST = draw2d.SnapToHelper.SOUTH
- | draw2d.SnapToHelper.EAST;
- draw2d.SnapToHelper.SOUTH_WEST = draw2d.SnapToHelper.SOUTH
- | draw2d.SnapToHelper.WEST;
- draw2d.SnapToHelper.NORTH_SOUTH = draw2d.SnapToHelper.NORTH
- | draw2d.SnapToHelper.SOUTH;
- draw2d.SnapToHelper.EAST_WEST = draw2d.SnapToHelper.EAST
- | draw2d.SnapToHelper.WEST;
- draw2d.SnapToHelper.NSEW = draw2d.SnapToHelper.NORTH_SOUTH
- | draw2d.SnapToHelper.EAST_WEST;
- draw2d.SnapToHelper.prototype.snapPoint = function(_5933, _5934, _5935) {
- return _5934;
- };
- draw2d.SnapToHelper.prototype.snapRectangle = function(_5936, _5937) {
- return _5936;
- };
- draw2d.SnapToHelper.prototype.onSetDocumentDirty = function() {
- };
- draw2d.SnapToGrid = function(_4a14) {
- draw2d.SnapToHelper.call(this, _4a14);
- };
- draw2d.SnapToGrid.prototype = new draw2d.SnapToHelper();
- draw2d.SnapToGrid.prototype.type = "draw2d.SnapToGrid";
- draw2d.SnapToGrid.prototype.snapPoint = function(_4a15, _4a16, _4a17) {
- _4a17.x = this.workflow.gridWidthX
- * Math
- .floor(((_4a16.x + this.workflow.gridWidthX / 2) / this.workflow.gridWidthX));
- _4a17.y = this.workflow.gridWidthY
- * Math
- .floor(((_4a16.y + this.workflow.gridWidthY / 2) / this.workflow.gridWidthY));
- return 0;
- };
- draw2d.SnapToGrid.prototype.snapRectangle = function(_4a18, _4a19) {
- _4a19.x = _4a18.x;
- _4a19.y = _4a18.y;
- _4a19.w = _4a18.w;
- _4a19.h = _4a18.h;
- return 0;
- };
- draw2d.SnapToGeometryEntry = function(type, _5944) {
- this.type = type;
- this.location = _5944;
- };
- draw2d.SnapToGeometryEntry.prototype.getLocation = function() {
- return this.location;
- };
- draw2d.SnapToGeometryEntry.prototype.getType = function() {
- return this.type;
- };
- draw2d.SnapToGeometry = function(_5afe) {
- draw2d.SnapToHelper.call(this, _5afe);
- this.rows = null;
- this.cols = null;
- };
- draw2d.SnapToGeometry.prototype = new draw2d.SnapToHelper();
- draw2d.SnapToGeometry.THRESHOLD = 5;
- draw2d.SnapToGeometry.prototype.snapPoint = function(_5aff, _5b00, _5b01) {
- if (this.rows === null || this.cols === null) {
- this.populateRowsAndCols();
- }
- if ((_5aff & draw2d.SnapToHelper.EAST) !== 0) {
- var _5b02 = this.getCorrectionFor(this.cols, _5b00.getX() - 1, 1);
- if (_5b02 !== draw2d.SnapToGeometry.THRESHOLD) {
- _5aff &= ~draw2d.SnapToHelper.EAST;
- _5b01.x += _5b02;
- }
- }
- if ((_5aff & draw2d.SnapToHelper.WEST) !== 0) {
- var _5b03 = this.getCorrectionFor(this.cols, _5b00.getX(), -1);
- if (_5b03 !== draw2d.SnapToGeometry.THRESHOLD) {
- _5aff &= ~draw2d.SnapToHelper.WEST;
- _5b01.x += _5b03;
- }
- }
- if ((_5aff & draw2d.SnapToHelper.SOUTH) !== 0) {
- var _5b04 = this.getCorrectionFor(this.rows, _5b00.getY() - 1, 1);
- if (_5b04 !== draw2d.SnapToGeometry.THRESHOLD) {
- _5aff &= ~draw2d.SnapToHelper.SOUTH;
- _5b01.y += _5b04;
- }
- }
- if ((_5aff & draw2d.SnapToHelper.NORTH) !== 0) {
- var _5b05 = this.getCorrectionFor(this.rows, _5b00.getY(), -1);
- if (_5b05 !== draw2d.SnapToGeometry.THRESHOLD) {
- _5aff &= ~draw2d.SnapToHelper.NORTH;
- _5b01.y += _5b05;
- }
- }
- return _5aff;
- };
- draw2d.SnapToGeometry.prototype.snapRectangle = function(_5b06, _5b07) {
- var _5b08 = _5b06.getTopLeft();
- var _5b09 = _5b06.getBottomRight();
- var _5b0a = this.snapPoint(draw2d.SnapToHelper.NORTH_WEST, _5b06
- .getTopLeft(), _5b08);
- _5b07.x = _5b08.x;
- _5b07.y = _5b08.y;
- var _5b0b = this.snapPoint(draw2d.SnapToHelper.SOUTH_EAST, _5b06
- .getBottomRight(), _5b09);
- if (_5b0a & draw2d.SnapToHelper.WEST) {
- _5b07.x = _5b09.x - _5b06.getWidth();
- }
- if (_5b0a & draw2d.SnapToHelper.NORTH) {
- _5b07.y = _5b09.y - _5b06.getHeight();
- }
- return _5b0a | _5b0b;
- };
- draw2d.SnapToGeometry.prototype.populateRowsAndCols = function() {
- this.rows = [];
- this.cols = [];
- var _5b0c = this.workflow.getDocument().getFigures();
- var index = 0;
- for ( var i = 0; i < _5b0c.getSize(); i++) {
- var _5b0f = _5b0c.get(i);
- if (_5b0f != this.workflow.getCurrentSelection()) {
- var _5b10 = _5b0f.getBounds();
- this.cols[index * 3] = new draw2d.SnapToGeometryEntry(-1, _5b10
- .getX());
- this.rows[index * 3] = new draw2d.SnapToGeometryEntry(-1, _5b10
- .getY());
- this.cols[index * 3 + 1] = new draw2d.SnapToGeometryEntry(0,
- _5b10.x + (_5b10.getWidth() - 1) / 2);
- this.rows[index * 3 + 1] = new draw2d.SnapToGeometryEntry(0,
- _5b10.y + (_5b10.getHeight() - 1) / 2);
- this.cols[index * 3 + 2] = new draw2d.SnapToGeometryEntry(1, _5b10
- .getRight() - 1);
- this.rows[index * 3 + 2] = new draw2d.SnapToGeometryEntry(1, _5b10
- .getBottom() - 1);
- index++;
- }
- }
- };
- draw2d.SnapToGeometry.prototype.getCorrectionFor = function(_5b11, value, side) {
- var _5b14 = draw2d.SnapToGeometry.THRESHOLD;
- var _5b15 = draw2d.SnapToGeometry.THRESHOLD;
- for ( var i = 0; i < _5b11.length; i++) {
- var entry = _5b11[i];
- var _5b18;
- if (entry.type === -1 && side !== 0) {
- _5b18 = Math.abs(value - entry.location);
- if (_5b18 < _5b14) {
- _5b14 = _5b18;
- _5b15 = entry.location - value;
- }
- } else {
- if (entry.type === 0 && side === 0) {
- _5b18 = Math.abs(value - entry.location);
- if (_5b18 < _5b14) {
- _5b14 = _5b18;
- _5b15 = entry.location - value;
- }
- } else {
- if (entry.type === 1 && side !== 0) {
- _5b18 = Math.abs(value - entry.location);
- if (_5b18 < _5b14) {
- _5b14 = _5b18;
- _5b15 = entry.location - value;
- }
- }
- }
- }
- }
- return _5b15;
- };
- draw2d.SnapToGeometry.prototype.onSetDocumentDirty = function() {
- this.rows = null;
- this.cols = null;
- };
- draw2d.Border = function() {
- this.color = null;
- };
- draw2d.Border.prototype.type = "draw2d.Border";
- draw2d.Border.prototype.dispose = function() {
- this.color = null;
- };
- draw2d.Border.prototype.getHTMLStyle = function() {
- return "";
- };
- draw2d.Border.prototype.setColor = function(c) {
- this.color = c;
- };
- draw2d.Border.prototype.getColor = function() {
- return this.color;
- };
- draw2d.Border.prototype.refresh = function() {
- };
- draw2d.LineBorder = function(width) {
- draw2d.Border.call(this);
- this.width = 1;
- if (width) {
- this.width = width;
- }
- this.figure = null;
- };
- draw2d.LineBorder.prototype = new draw2d.Border();
- draw2d.LineBorder.prototype.type = "draw2d.LineBorder";
- draw2d.LineBorder.prototype.dispose = function() {
- draw2d.Border.prototype.dispose.call(this);
- this.figure = null;
- };
- draw2d.LineBorder.prototype.setLineWidth = function(w) {
- this.width = w;
- if (this.figure !== null) {
- this.figure.html.style.border = this.getHTMLStyle();
- }
- };
- draw2d.LineBorder.prototype.getHTMLStyle = function() {
- if (this.getColor() !== null) {
- return this.width + "px solid " + this.getColor().getHTMLStyle();
- }
- return this.width + "px solid black";
- };
- draw2d.LineBorder.prototype.refresh = function() {
- this.setLineWidth(this.width);
- };
- draw2d.Figure = function() {
- this.construct();
- };
- draw2d.Figure.prototype.type = "draw2d.Figure";
- draw2d.Figure.ZOrderBaseIndex = 100;
- draw2d.Figure.setZOrderBaseIndex = function(index) {
- draw2d.Figure.ZOrderBaseIndex = index;
- };
- draw2d.Figure.prototype.construct = function() {
- this.lastDragStartTime = 0;
- this.x = 0;
- this.y = 0;
- this.width = 10;
- this.height = 10;
- this.border = null;
- this.id = draw2d.UUID.create();
- this.html = this.createHTMLElement();
- this.canvas = null;
- this.workflow = null;
- this.draggable = null;
- this.parent = null;
- this.isMoving = false;
- this.canSnapToHelper = true;
- this.snapToGridAnchor = new draw2d.Point(0, 0);
- this.timer = -1;
- this.model = null;
- this.alpha = 1;
- this.alphaBeforeOnDrag = 1;
- this.properties = {};
- this.moveListener = new draw2d.ArrayList();
- this.setDimension(this.width, this.height);
- this.setDeleteable(true);
- this.setCanDrag(true);
- this.setResizeable(true);
- this.setSelectable(true);
- };
- draw2d.Figure.prototype.dispose = function() {
-
- this.canvas = null;
- this.workflow = null;
- this.moveListener = null;
- if (this.draggable !== null) {
- this.draggable.removeEventListener("mouseenter", this.tmpMouseEnter);
- this.draggable.removeEventListener("mouseleave", this.tmpMouseLeave);
- this.draggable.removeEventListener("dragend", this.tmpDragend);
- this.draggable.removeEventListener("dragstart", this.tmpDragstart);
- this.draggable.removeEventListener("drag", this.tmpDrag);
- this.draggable.removeEventListener("dblclick", this.tmpDoubleClick);
- this.draggable.node = null;
- this.draggable.target.removeAllElements();
- }
- this.draggable = null;
- if (this.border !== null) {
- this.border.dispose();
- }
- this.border = null;
- if (this.parent !== null) {
- this.parent.removeChild(this);
- }
- };
- draw2d.Figure.prototype.getProperties = function() {
- return this.properties;
- };
- draw2d.Figure.prototype.getProperty = function(key) {
- return this.properties[key];
- };
- draw2d.Figure.prototype.setProperty = function(key, value) {
- this.properties[key] = value;
- this.setDocumentDirty();
- };
- draw2d.Figure.prototype.getId = function() {
- return this.id;
- };
- draw2d.Figure.prototype.setId = function(id) {
- this.id = id;
- if (this.html !== null) {
- this.html.id = id;
- }
- };
- draw2d.Figure.prototype.setCanvas = function(_59c6) {
- this.canvas = _59c6;
- };
- draw2d.Figure.prototype.getWorkflow = function() {
- return this.workflow;
- };
- draw2d.Figure.prototype.setWorkflow = function(_59c7) {
-
- if (this.draggable === null) {
- this.html.tabIndex = "0";
- var oThis = this;
- this.keyDown = function(event) {
- event.cancelBubble = true;
- event.returnValue = true;
- oThis.onKeyDown(event.keyCode, event.ctrlKey);
- };
- if (this.html.addEventListener) {
- this.html.addEventListener("keydown", this.keyDown, false);
- } else {
- if (this.html.attachEvent) {
- this.html.attachEvent("onkeydown", this.keyDown);
- }
- }
- this.draggable = new draw2d.Draggable(this.html,
- draw2d.Draggable.DRAG_X | draw2d.Draggable.DRAG_Y);
- this.draggable.node = this;
- this.tmpContextMenu = function(_59ca) {
- oThis.onContextMenu(oThis.x + _59ca.x, _59ca.y + oThis.y);
- };
- this.tmpMouseEnter = function(_59cb) {
- oThis.onMouseEnter();
- };
- this.tmpMouseLeave = function(_59cc) {
- oThis.onMouseLeave();
- };
- this.tmpDragend = function(_59cd) {
- oThis.onDragend();
- };
- this.tmpDragstart = function(_59ce) {
- var w = oThis.workflow;
- w.showMenu(null);
- if (w.toolPalette && w.toolPalette.activeTool) {
- _59ce.returnValue = false;
- w.onMouseDown(oThis.x + _59ce.x, _59ce.y + oThis.y);
- w.onMouseUp(oThis.x + _59ce.x, _59ce.y + oThis.y);
- return;
- }
- if (!(oThis instanceof draw2d.ResizeHandle)
- && !(oThis instanceof draw2d.Port)) {
- var line = w.getBestLine(oThis.x + _59ce.x, _59ce.y + oThis.y);
- if (line !== null) {
- _59ce.returnValue = false;
- w.setCurrentSelection(line);
- w.showLineResizeHandles(line);
- w.onMouseDown(oThis.x + _59ce.x, _59ce.y + oThis.y);
- return;
- } else {
- if (oThis.isSelectable()) {
- w.showResizeHandles(oThis);
- w.setCurrentSelection(oThis);
- }
- }
- }
- _59ce.returnValue = oThis.onDragstart(_59ce.x, _59ce.y);
- };
- this.tmpDrag = function(_59d1) {
- oThis.onDrag();
- };
- this.tmpDoubleClick = function(_59d2) {
- oThis.onDoubleClick();
- };
- this.draggable.addEventListener("contextmenu", this.tmpContextMenu);
- this.draggable.addEventListener("mouseenter", this.tmpMouseEnter);
- this.draggable.addEventListener("mouseleave", this.tmpMouseLeave);
- this.draggable.addEventListener("dragend", this.tmpDragend);
- this.draggable.addEventListener("dragstart", this.tmpDragstart);
- this.draggable.addEventListener("drag", this.tmpDrag);
- this.draggable.addEventListener("dblclick", this.tmpDoubleClick);
- }
- this.workflow = _59c7;
- };
- draw2d.Figure.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.height = this.width + "px";
- item.style.width = this.height + "px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.outline = "none";
- item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
- return item;
- };
- draw2d.Figure.prototype.setParent = function(_59d4) {
- this.parent = _59d4;
- };
- draw2d.Figure.prototype.getParent = function() {
- return this.parent;
- };
- draw2d.Figure.prototype.getZOrder = function() {
- return this.html.style.zIndex;
- };
- draw2d.Figure.prototype.setZOrder = function(index) {
- this.html.style.zIndex = index;
- };
- draw2d.Figure.prototype.hasFixedPosition = function() {
- return false;
- };
- draw2d.Figure.prototype.getMinWidth = function() {
- return 5;
- };
- draw2d.Figure.prototype.getMinHeight = function() {
- return 5;
- };
- draw2d.Figure.prototype.getHTMLElement = function() {
- if (this.html === null) {
- this.html = this.createHTMLElement();
- }
- return this.html;
- };
- draw2d.Figure.prototype.paint = function() {
- };
- draw2d.Figure.prototype.setBorder = function(_59d6) {
- if (this.border !== null) {
- this.border.figure = null;
- }
- this.border = _59d6;
- this.border.figure = this;
- this.border.refresh();
- this.setDocumentDirty();
- };
- draw2d.Figure.prototype.onRemove = function(_59d7) {
- };
- draw2d.Figure.prototype.onContextMenu = function(x, y) {
- var menu = this.getContextMenu();
- if (menu !== null) {
- this.workflow.showMenu(menu, x, y);
- }
- };
- draw2d.Figure.prototype.getContextMenu = function() {
- return null;
- };
- draw2d.Figure.prototype.onDoubleClick = function() {
- this.figureDoubleClick();
-
- };
- draw2d.Figure.prototype.figureDoubleClick = function() {
- return null;
- };
- draw2d.Figure.prototype.onMouseEnter = function() {
- };
- draw2d.Figure.prototype.onMouseLeave = function() {
- };
- draw2d.Figure.prototype.onDrag = function() {
- this.x = this.draggable.getLeft();
- this.y = this.draggable.getTop();
- if (this.isMoving == false) {
- this.isMoving = true;
- this.alphaBeforeOnDrag = this.getAlpha();
- this.setAlpha(this.alphaBeforeOnDrag * 0.5);
- }
- this.fireMoveEvent();
- };
- draw2d.Figure.prototype.onDragend = function() {
- if (this.getWorkflow().getEnableSmoothFigureHandling() === true) {
- var oThis = this;
- var _59dc = function() {
- if (oThis.alpha < oThis.alphaBeforeOnDrag) {
- oThis.setAlpha(Math.min(1, oThis.alpha + 0.05));
- } else {
- window.clearInterval(oThis.timer);
- oThis.timer = -1;
- }
- };
- if (oThis.timer > 0) {
- window.clearInterval(oThis.timer);
- }
- oThis.timer = window.setInterval(_59dc, 20);
- } else {
- this.setAlpha(this.alphaBeforeOnDrag);
- }
- this.command.setPosition(this.x, this.y);
- this.workflow.commandStack.execute(this.command);
- this.command = null;
- this.isMoving = false;
- this.workflow.hideSnapToHelperLines();
- this.fireMoveEvent();
- };
- draw2d.Figure.prototype.onDragstart = function(x, y) {
- this.command = this.createCommand(new draw2d.EditPolicy(
- draw2d.EditPolicy.MOVE));
- return this.command !== null;
- };
- draw2d.Figure.prototype.setCanDrag = function(flag) {
- this.canDrag = flag;
- if (flag) {
- this.html.style.cursor = "move";
- } else {
- this.html.style.cursor = "";
- }
- };
- draw2d.Figure.prototype.getCanDrag = function() {
- return this.canDrag;
- };
- draw2d.Figure.prototype.setAlpha = function(_59e0) {
- if (this.alpha === _59e0) {
- return;
- }
- this.alpha = Math.max(0, Math.min(1, _59e0));
- if (this.alpha == 1) {
- this.html.style.filter = "";
- this.html.style.opacity = "";
- } else {
- this.html.style.filter = "alpha(opacity="
- + Math.round(this.alpha * 100) + ")";
- this.html.style.opacity = this.alpha;
- }
- };
- draw2d.Figure.prototype.getAlpha = function() {
- return this.alpha;
- };
- draw2d.Figure.prototype.setDimension = function(w, h) {
- this.width = Math.max(this.getMinWidth(), w);
- this.height = Math.max(this.getMinHeight(), h);
- if (this.html === null) {
- return;
- }
- this.html.style.width = this.width + "px";
- this.html.style.height = this.height + "px";
- this.fireMoveEvent();
- if (this.workflow !== null && this.workflow.getCurrentSelection() == this) {
- this.workflow.showResizeHandles(this);
- }
- };
- draw2d.Figure.prototype.setPosition = function(xPos, yPos) {
- this.x = xPos;
- this.y = yPos;
- if (this.html === null) {
- return;
- }
- this.html.style.left = this.x + "px";
- this.html.style.top = this.y + "px";
- this.fireMoveEvent();
- if (this.workflow !== null && this.workflow.getCurrentSelection() == this) {
- this.workflow.showResizeHandles(this);
- }
- };
- draw2d.Figure.prototype.isResizeable = function() {
- return this.resizeable;
- };
- draw2d.Figure.prototype.setResizeable = function(flag) {
- this.resizeable = flag;
- };
- draw2d.Figure.prototype.isSelectable = function() {
- return this.selectable;
- };
- draw2d.Figure.prototype.setSelectable = function(flag) {
- this.selectable = flag;
- };
- draw2d.Figure.prototype.isStrechable = function() {
- return true;
- };
- draw2d.Figure.prototype.isDeleteable = function() {
- return this.deleteable;
- };
- draw2d.Figure.prototype.setDeleteable = function(flag) {
- this.deleteable = flag;
- };
- draw2d.Figure.prototype.setCanSnapToHelper = function(flag) {
- this.canSnapToHelper = flag;
- };
- draw2d.Figure.prototype.getCanSnapToHelper = function() {
- return this.canSnapToHelper;
- };
- draw2d.Figure.prototype.getSnapToGridAnchor = function() {
- return this.snapToGridAnchor;
- };
- draw2d.Figure.prototype.setSnapToGridAnchor = function(point) {
- this.snapToGridAnchor = point;
- };
- draw2d.Figure.prototype.getBounds = function() {
- return new draw2d.Dimension(this.getX(), this.getY(), this.getWidth(), this
- .getHeight());
- };
- draw2d.Figure.prototype.getWidth = function() {
- return this.width;
- };
- draw2d.Figure.prototype.getHeight = function() {
- return this.height;
- };
- draw2d.Figure.prototype.getY = function() {
- return this.y;
- };
- draw2d.Figure.prototype.getX = function() {
- return this.x;
- };
- draw2d.Figure.prototype.getAbsoluteY = function() {
- return this.y;
- };
- draw2d.Figure.prototype.getAbsoluteX = function() {
- return this.x;
- };
- draw2d.Figure.prototype.onKeyDown = function(_59ea, ctrl) {
- if (_59ea == 46) {
- this.workflow.getCommandStack().execute(
- this.createCommand(new draw2d.EditPolicy(
- draw2d.EditPolicy.DELETE)));
- }
- if (ctrl) {
- this.workflow.onKeyDown(_59ea, ctrl);
- }
- };
- draw2d.Figure.prototype.getPosition = function() {
- return new draw2d.Point(this.x, this.y);
- };
- draw2d.Figure.prototype.isOver = function(iX, iY) {
- var x = this.getAbsoluteX();
- var y = this.getAbsoluteY();
- var iX2 = x + this.width;
- var iY2 = y + this.height;
- return (iX >= x && iX <= iX2 && iY >= y && iY <= iY2);
- };
- draw2d.Figure.prototype.attachMoveListener = function(_59f2) {
-
- if (_59f2 === null || this.moveListener === null) {
- return;
- }
- this.moveListener.add(_59f2);
- };
- draw2d.Figure.prototype.detachMoveListener = function(_59f3) {
- if (_59f3 === null || this.moveListener === null) {
- return;
- }
- this.moveListener.remove(_59f3);
- };
- draw2d.Figure.prototype.fireMoveEvent = function() {
-
- this.setDocumentDirty();
- var size = this.moveListener.getSize();
- for ( var i = 0; i < size; i++) {
- this.moveListener.get(i).onOtherFigureMoved(this);
- }
- };
- draw2d.Figure.prototype.setModel = function(model) {
- if (this.model !== null) {
- this.model.removePropertyChangeListener(this);
- }
- this.model = model;
- if (this.model !== null) {
- this.model.addPropertyChangeListener(this);
- }
- };
- draw2d.Figure.prototype.getModel = function() {
- return this.model;
- };
- draw2d.Figure.prototype.onOtherFigureMoved = function(_59f7) {
- };
- draw2d.Figure.prototype.setDocumentDirty = function() {
- if (this.workflow !== null) {
- this.workflow.setDocumentDirty();
- }
- };
- draw2d.Figure.prototype.disableTextSelection = function(_59f8) {
- _59f8.onselectstart = function() {
- return false;
- };
- _59f8.unselectable = "on";
- _59f8.style.MozUserSelect = "none";
- _59f8.onmousedown = function() {
- return false;
- };
- };
- draw2d.Figure.prototype.createCommand = function(_59f9) {
- if (_59f9.getPolicy() == draw2d.EditPolicy.MOVE) {
- if (!this.canDrag) {
- return null;
- }
- return new draw2d.CommandMove(this);
- }
- if (_59f9.getPolicy() == draw2d.EditPolicy.DELETE) {
- if (!this.isDeleteable()) {
- return null;
- }
- return new draw2d.CommandDelete(this);
- }
- if (_59f9.getPolicy() == draw2d.EditPolicy.RESIZE) {
- if (!this.isResizeable()) {
- return null;
- }
- return new draw2d.CommandResize(this);
- }
- return null;
- };
- draw2d.Node = function() {
- this.bgColor = null;
- this.lineColor = new draw2d.Color(128, 128, 255);
- this.lineStroke = 1;
- this.ports = new draw2d.ArrayList();
- draw2d.Figure.call(this);
- };
- draw2d.Node.prototype = new draw2d.Figure();
- draw2d.Node.prototype.type = "draw2d.Node";
- draw2d.Node.prototype.dispose = function() {
- for ( var i = 0; i < this.ports.getSize(); i++) {
- this.ports.get(i).dispose();
- }
- this.ports = null;
- draw2d.Figure.prototype.dispose.call(this);
- };
- draw2d.Node.prototype.createHTMLElement = function() {
- var item = draw2d.Figure.prototype.createHTMLElement.call(this);
- item.style.width = "auto";
- item.style.height = "auto";
- item.style.margin = "0px";
- item.style.padding = "0px";
- if (this.lineColor !== null) {
- item.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- }
- item.style.fontSize = "1px";
- if (this.bgColor !== null) {
- item.style.backgroundColor = this.bgColor.getHTMLStyle();
- }
- return item;
- };
- draw2d.Node.prototype.paint = function() {
- draw2d.Figure.prototype.paint.call(this);
- for ( var i = 0; i < this.ports.getSize(); i++) {
- this.ports.get(i).paint();
- }
- };
- draw2d.Node.prototype.getPorts = function() {
- return this.ports;
- };
- draw2d.Node.prototype.getInputPorts = function() {
- var _4ad8 = new draw2d.ArrayList();
- for ( var i = 0; i < this.ports.getSize(); i++) {
- var port = this.ports.get(i);
- if (port instanceof draw2d.InputPort) {
- _4ad8.add(port);
- }
- }
- return _4ad8;
- };
- draw2d.Node.prototype.getOutputPorts = function() {
- var _4adb = new draw2d.ArrayList();
- for ( var i = 0; i < this.ports.getSize(); i++) {
- var port = this.ports.get(i);
- if (port instanceof draw2d.OutputPort) {
- _4adb.add(port);
- }
- }
- return _4adb;
- };
- draw2d.Node.prototype.getPort = function(_4ade) {
- if (this.ports === null) {
- return null;
- }
- for ( var i = 0; i < this.ports.getSize(); i++) {
- var port = this.ports.get(i);
- if (port.getName() == _4ade) {
- return port;
- }
- }
- };
- draw2d.Node.prototype.getInputPort = function(_4ae1) {
- if (this.ports === null) {
- return null;
- }
- for ( var i = 0; i < this.ports.getSize(); i++) {
- var port = this.ports.get(i);
- if (port.getName() == _4ae1 && port instanceof draw2d.InputPort) {
- return port;
- }
- }
- };
- draw2d.Node.prototype.getOutputPort = function(_4ae4) {
- if (this.ports === null) {
- return null;
- }
- for ( var i = 0; i < this.ports.getSize(); i++) {
- var port = this.ports.get(i);
- if (port.getName() == _4ae4 && port instanceof draw2d.OutputPort) {
- return port;
- }
- }
- };
- draw2d.Node.prototype.addPort = function(port, x, y) {
- this.ports.add(port);
- port.setOrigin(x, y);
- port.setPosition(x, y);
- port.setParent(this);
- port.setDeleteable(false);
- this.html.appendChild(port.getHTMLElement());
- if (this.workflow !== null) {
- this.workflow.registerPort(port);
- }
- };
- draw2d.Node.prototype.removePort = function(port) {
- if (this.ports !== null) {
- this.ports.remove(port);
- }
- try {
- this.html.removeChild(port.getHTMLElement());
- } catch (exc) {
- }
- if (this.workflow !== null) {
- this.workflow.unregisterPort(port);
- }
- var _4aeb = port.getConnections();
- for ( var i = 0; i < _4aeb.getSize(); ++i) {
- this.workflow.removeFigure(_4aeb.get(i));
- }
- };
- draw2d.Node.prototype.setWorkflow = function(_4aed) {
- var _4aee = this.workflow;
- draw2d.Figure.prototype.setWorkflow.call(this, _4aed);
- if (_4aee !== null) {
- for ( var i = 0; i < this.ports.getSize(); i++) {
- _4aee.unregisterPort(this.ports.get(i));
- }
- }
- if (this.workflow !== null) {
- for ( var i = 0; i < this.ports.getSize(); i++) {
- this.workflow.registerPort(this.ports.get(i));
- }
- }
- };
- draw2d.Node.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.bgColor !== null) {
- this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
- } else {
- this.html.style.backgroundColor = "transparent";
- }
- };
- draw2d.Node.prototype.getBackgroundColor = function() {
- return this.bgColor;
- };
- draw2d.Node.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.lineColor !== null) {
- this.html.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- } else {
- this.html.style.border = "0px";
- }
- };
- draw2d.Node.prototype.setLineWidth = function(w) {
- this.lineStroke = w;
- if (this.lineColor !== null) {
- this.html.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- } else {
- this.html.style.border = "0px";
- }
- };
- draw2d.Node.prototype.getModelSourceConnections = function() {
- throw "You must override the method [Node.prototype.getModelSourceConnections]";
- };
- draw2d.Node.prototype.refreshConnections = function() {
- if (this.workflow !== null) {
- this.workflow.refreshConnections(this);
- }
- };
- draw2d.VectorFigure = function() {
- this.bgColor = null;
- this.lineColor = new draw2d.Color(0, 0, 0);
- this.stroke = 1;
- this.graphics = null;
- draw2d.Node.call(this);
- };
- draw2d.VectorFigure.prototype = new draw2d.Node;
- draw2d.VectorFigure.prototype.type = "draw2d.VectorFigure";
- draw2d.VectorFigure.prototype.dispose = function() {
- draw2d.Node.prototype.dispose.call(this);
- this.bgColor = null;
- this.lineColor = null;
- if (this.graphics !== null) {
- this.graphics.clear();
- }
- this.graphics = null;
- };
- draw2d.VectorFigure.prototype.createHTMLElement = function() {
- var item = draw2d.Node.prototype.createHTMLElement.call(this);
- item.style.border = "0px";
- item.style.backgroundColor = "transparent";
- return item;
- };
- draw2d.VectorFigure.prototype.setWorkflow = function(_4b44) {
- draw2d.Node.prototype.setWorkflow.call(this, _4b44);
- if (this.workflow === null) {
- this.graphics.clear();
- this.graphics = null;
- }
- };
- draw2d.VectorFigure.prototype.paint = function() {
- if (this.html === null) {
- return;
- }
- try {
- if (this.graphics === null) {
- this.graphics = new jsGraphics(this.html);
- } else {
- this.graphics.clear();
- }
- draw2d.Node.prototype.paint.call(this);
- for ( var i = 0; i < this.ports.getSize(); i++) {
- this.getHTMLElement().appendChild(
- this.ports.get(i).getHTMLElement());
- }
- } catch (e) {
- pushErrorStack(e, "draw2d.VectorFigure.prototype.paint=function()["
- + area + "]");
- }
- };
- draw2d.VectorFigure.prototype.setDimension = function(w, h) {
- draw2d.Node.prototype.setDimension.call(this, w, h);
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.VectorFigure.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.VectorFigure.prototype.getBackgroundColor = function() {
- return this.bgColor;
- };
- draw2d.VectorFigure.prototype.setLineWidth = function(w) {
- this.stroke = w;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.VectorFigure.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.VectorFigure.prototype.getColor = function() {
- return this.lineColor;
- };
- draw2d.SVGFigure = function(width, _5070) {
- this.bgColor = null;
- this.lineColor = new draw2d.Color(0, 0, 0);
- this.stroke = 1;
- this.context = null;
- draw2d.Node.call(this);
- if (width && _5070) {
- this.setDimension(width, _5070);
- }
- };
- draw2d.SVGFigure.prototype = new draw2d.Node();
- draw2d.SVGFigure.prototype.type = "draw2d.SVGFigure";
- draw2d.SVGFigure.prototype.createHTMLElement = function() {
- var item = new MooCanvas(this.id, {
- width : 100,
- height : 100
- });
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
- this.context = item.getContext("2d");
- return item;
- };
- draw2d.SVGFigure.prototype.paint = function() {
- this.context.clearRect(0, 0, this.getWidth(), this.getHeight());
- this.context.fillStyle = "rgba(200,0,0,0.3)";
- this.context.fillRect(0, 0, this.getWidth(), this.getHeight());
- };
- draw2d.SVGFigure.prototype.setDimension = function(w, h) {
- draw2d.Node.prototype.setDimension.call(this, w, h);
- this.html.width = w;
- this.html.height = h;
- this.html.style.width = w + "px";
- this.html.style.height = h + "px";
- if (this.context !== null) {
- if (this.context.element) {
- this.context.element.style.width = w + "px";
- this.context.element.style.height = h + "px";
- }
- this.paint();
- }
- };
- draw2d.SVGFigure.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.SVGFigure.prototype.getBackgroundColor = function() {
- return this.bgColor;
- };
- draw2d.SVGFigure.prototype.setLineWidth = function(w) {
- this.stroke = w;
- if (this.context !== null) {
- this.paint();
- }
- };
- draw2d.SVGFigure.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.context !== null) {
- this.paint();
- }
- };
- draw2d.SVGFigure.prototype.getColor = function() {
- return this.lineColor;
- };
- draw2d.Label = function(msg) {
- this.msg = msg;
- this.bgColor = null;
- this.color = new draw2d.Color(0, 0, 0);
- this.fontSize = 10;
- this.textNode = null;
- this.align = "center";
- draw2d.Figure.call(this);
- };
- draw2d.Label.prototype = new draw2d.Figure();
- draw2d.Label.prototype.type = "draw2d.Label";
- draw2d.Label.prototype.createHTMLElement = function() {
- var item = draw2d.Figure.prototype.createHTMLElement.call(this);
- this.textNode = document.createTextNode(this.msg);
- item.appendChild(this.textNode);
- item.style.color = this.color.getHTMLStyle();
- item.style.fontSize = this.fontSize + "pt";
- item.style.width = "auto";
- item.style.height = "auto";
- item.style.paddingLeft = "3px";
- item.style.paddingRight = "3px";
- item.style.textAlign = this.align;
- item.style.MozUserSelect = "none";
- this.disableTextSelection(item);
- if (this.bgColor !== null) {
- item.style.backgroundColor = this.bgColor.getHTMLStyle();
- }
- return item;
- };
- draw2d.Label.prototype.isResizeable = function() {
- return false;
- };
- draw2d.Label.prototype.setWordwrap = function(flag) {
- this.html.style.whiteSpace = flag ? "wrap" : "nowrap";
- };
- draw2d.Label.prototype.setAlign = function(align) {
- this.align = align;
- this.html.style.textAlign = align;
- };
- draw2d.Label.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.bgColor !== null) {
- this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
- } else {
- this.html.style.backgroundColor = "transparent";
- }
- };
- draw2d.Label.prototype.setColor = function(color) {
- this.color = color;
- this.html.style.color = this.color.getHTMLStyle();
- };
- draw2d.Label.prototype.setFontSize = function(size) {
- this.fontSize = size;
- this.html.style.fontSize = this.fontSize + "pt";
- };
- draw2d.Label.prototype.setDimension = function(w, h) {
- };
- draw2d.Label.prototype.getWidth = function() {
- if (window.getComputedStyle) {
- return parseInt(getComputedStyle(this.html, "").getPropertyValue(
- "width"));
- }
- return parseInt(this.html.clientWidth);
- };
- draw2d.Label.prototype.getHeight = function() {
- if (window.getComputedStyle) {
- return parseInt(getComputedStyle(this.html, "").getPropertyValue(
- "height"));
- }
- return parseInt(this.html.clientHeight);
- };
- draw2d.Label.prototype.getText = function() {
- return this.msg;
- };
- draw2d.Label.prototype.setText = function(text) {
- this.msg = text;
- this.html.removeChild(this.textNode);
- this.textNode = document.createTextNode(this.msg);
- this.html.appendChild(this.textNode);
- };
- draw2d.Label.prototype.setStyledText = function(text) {
- this.msg = text;
- this.html.removeChild(this.textNode);
- this.textNode = document.createElement("div");
- this.textNode.style.whiteSpace = "nowrap";
- this.textNode.innerHTML = text;
- this.html.appendChild(this.textNode);
- };
- draw2d.Oval = function() {
- draw2d.VectorFigure.call(this);
- };
- draw2d.Oval.prototype = new draw2d.VectorFigure();
- draw2d.Oval.prototype.type = "draw2d.Oval";
- draw2d.Oval.prototype.paint = function() {
- if (this.html === null) {
- return;
- }
- try {
- draw2d.VectorFigure.prototype.paint.call(this);
- this.graphics.setStroke(this.stroke);
- if (this.bgColor !== null) {
- this.graphics.setColor(this.bgColor.getHTMLStyle());
- this.graphics.fillOval(0, 0, this.getWidth() - 1,
- this.getHeight() - 1);
- }
- if (this.lineColor !== null) {
- this.graphics.setColor(this.lineColor.getHTMLStyle());
- this.graphics.drawOval(0, 0, this.getWidth() - 1,
- this.getHeight() - 1);
- }
- this.graphics.paint();
- } catch (e) {
- pushErrorStack(e, "draw2d.Oval.prototype.paint=function()");
- }
- };
- draw2d.Circle = function(_5044) {
- draw2d.Oval.call(this);
- if (_5044) {
- this.setDimension(_5044, _5044);
- }
- };
- draw2d.Circle.prototype = new draw2d.Oval();
- draw2d.Circle.prototype.type = "draw2d.Circle";
- draw2d.Circle.prototype.setDimension = function(w, h) {
- if (w > h) {
- draw2d.Oval.prototype.setDimension.call(this, w, w);
- } else {
- draw2d.Oval.prototype.setDimension.call(this, h, h);
- }
- };
- draw2d.Circle.prototype.isStrechable = function() {
- return false;
- };
- draw2d.Rectangle = function(width, _5698) {
- this.bgColor = null;
- this.lineColor = new draw2d.Color(0, 0, 0);
- this.lineStroke = 1;
- draw2d.Figure.call(this);
- if (width && _5698) {
- this.setDimension(width, _5698);
- }
- };
- draw2d.Rectangle.prototype = new draw2d.Figure();
- draw2d.Rectangle.prototype.type = "draw2d.Rectangle";
- draw2d.Rectangle.prototype.dispose = function() {
- draw2d.Figure.prototype.dispose.call(this);
- this.bgColor = null;
- this.lineColor = null;
- };
- draw2d.Rectangle.prototype.createHTMLElement = function() {
- var item = draw2d.Figure.prototype.createHTMLElement.call(this);
- item.style.width = "auto";
- item.style.height = "auto";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- item.style.fontSize = "1px";
- item.style.lineHeight = "1px";
- item.innerHTML = " ";
- if (this.bgColor !== null) {
- item.style.backgroundColor = this.bgColor.getHTMLStyle();
- }
- return item;
- };
- draw2d.Rectangle.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.bgColor !== null) {
- this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
- } else {
- this.html.style.backgroundColor = "transparent";
- }
- };
- draw2d.Rectangle.prototype.getBackgroundColor = function() {
- return this.bgColor;
- };
- draw2d.Rectangle.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.lineColor !== null) {
- this.html.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- } else {
- this.html.style.border = this.lineStroke + "0px";
- }
- };
- draw2d.Rectangle.prototype.getColor = function() {
- return this.lineColor;
- };
- draw2d.Rectangle.prototype.getWidth = function() {
- return draw2d.Figure.prototype.getWidth.call(this) + 2 * this.lineStroke;
- };
- draw2d.Rectangle.prototype.getHeight = function() {
- return draw2d.Figure.prototype.getHeight.call(this) + 2 * this.lineStroke;
- };
- draw2d.Rectangle.prototype.setDimension = function(w, h) {
- draw2d.Figure.prototype.setDimension.call(this, w - 2 * this.lineStroke, h
- - 2 * this.lineStroke);
- };
- draw2d.Rectangle.prototype.setLineWidth = function(w) {
- var diff = w - this.lineStroke;
- this.setDimension(this.getWidth() - 2 * diff, this.getHeight() - 2 * diff);
- this.lineStroke = w;
- var c = "transparent";
- if (this.lineColor !== null) {
- c = this.lineColor.getHTMLStyle();
- }
- this.html.style.border = this.lineStroke + "px solid " + c;
- };
- draw2d.Rectangle.prototype.getLineWidth = function() {
- return this.lineStroke;
- };
- draw2d.ImageFigure = function(url) {
- if (url === undefined) {
- url = null;
- }
- this.url = url;
- draw2d.Node.call(this);
- this.setDimension(40, 40);
- };
- draw2d.ImageFigure.prototype = new draw2d.Node;
- draw2d.ImageFigure.prototype.type = "draw2d.Image";
- draw2d.ImageFigure.prototype.createHTMLElement = function() {
- var item = draw2d.Node.prototype.createHTMLElement.call(this);
- item.style.width = this.width + "px";
- item.style.height = this.height + "px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.border = "0px";
- if (this.url !== null) {
- item.style.backgroundImage = "url(" + this.url + ")";
- } else {
- item.style.backgroundImage = "";
- }
- return item;
- };
- draw2d.ImageFigure.prototype.setColor = function(color) {
- };
- draw2d.ImageFigure.prototype.isResizeable = function() {
- return false;
- };
- draw2d.ImageFigure.prototype.setImage = function(url) {
- if (url === undefined) {
- url = null;
- }
- this.url = url;
- if (this.url !== null) {
- this.html.style.backgroundImage = "url(" + this.url + ")";
- } else {
- this.html.style.backgroundImage = "";
- }
- };
- draw2d.Port = function(_5730, _5731) {
- Corona = function() {
- };
- Corona.prototype = new draw2d.Circle();
- Corona.prototype.setAlpha = function(_5732) {
- draw2d.Circle.prototype.setAlpha.call(this, Math.min(0.3, _5732));
- this.setDeleteable(false);
- this.setCanDrag(false);
- this.setResizeable(false);
- this.setSelectable(false);
- };
- if (_5730 === null || _5730 === undefined) {
- this.currentUIRepresentation = new draw2d.Circle();
- } else {
- this.currentUIRepresentation = _5730;
- }
- if (_5731 === null || _5731 === undefined) {
- this.connectedUIRepresentation = new draw2d.Circle();
- this.connectedUIRepresentation.setColor(null);
- } else {
- this.connectedUIRepresentation = _5731;
- }
- this.disconnectedUIRepresentation = this.currentUIRepresentation;
- this.hideIfConnected = false;
- this.uiRepresentationAdded = true;
- this.parentNode = null;
- this.originX = 0;
- this.originY = 0;
- this.coronaWidth = 10;
- this.corona = null;
- draw2d.Rectangle.call(this);
- this.setDimension(8, 8);
- this.setBackgroundColor(new draw2d.Color(100, 180, 100));
- this.setColor(new draw2d.Color(90, 150, 90));
- draw2d.Rectangle.prototype.setColor.call(this, null);
- this.dropable = new draw2d.DropTarget(this.html);
- this.dropable.node = this;
- this.dropable.addEventListener("dragenter", function(_5733) {
- _5733.target.node.onDragEnter(_5733.relatedTarget.node);
- });
- this.dropable.addEventListener("dragleave", function(_5734) {
- _5734.target.node.onDragLeave(_5734.relatedTarget.node);
- });
- this.dropable.addEventListener("drop", function(_5735) {
- _5735.relatedTarget.node.onDrop(_5735.target.node);
- });
- };
- draw2d.Port.prototype = new draw2d.Rectangle();
- draw2d.Port.prototype.type = "draw2d.Port";
- draw2d.Port.ZOrderBaseIndex = 5000;
- draw2d.Port.setZOrderBaseIndex = function(index) {
- draw2d.Port.ZOrderBaseIndex = index;
- };
- draw2d.Port.prototype.setHideIfConnected = function(flag) {
- this.hideIfConnected = flag;
- };
- draw2d.Port.prototype.dispose = function() {
- var size = this.moveListener.getSize();
- for ( var i = 0; i < size; i++) {
- var _573a = this.moveListener.get(i);
- this.parentNode.workflow.removeFigure(_573a);
- _573a.dispose();
- }
- draw2d.Rectangle.prototype.dispose.call(this);
- this.parentNode = null;
- this.dropable.node = null;
- this.dropable = null;
- this.disconnectedUIRepresentation.dispose();
- this.connectedUIRepresentation.dispose();
- };
- draw2d.Port.prototype.createHTMLElement = function() {
- var item = draw2d.Rectangle.prototype.createHTMLElement.call(this);
- item.style.zIndex = draw2d.Port.ZOrderBaseIndex;
- this.currentUIRepresentation.html.zIndex = draw2d.Port.ZOrderBaseIndex;
- item.appendChild(this.currentUIRepresentation.html);
- this.uiRepresentationAdded = true;
- return item;
- };
- draw2d.Port.prototype.setUiRepresentation = function(_573c) {
- if (_573c === null) {
- _573c = new draw2d.Figure();
- }
- if (this.uiRepresentationAdded) {
- this.html.removeChild(this.currentUIRepresentation.getHTMLElement());
- }
- this.html.appendChild(_573c.getHTMLElement());
- _573c.paint();
- this.currentUIRepresentation = _573c;
- };
- draw2d.Port.prototype.onMouseEnter = function() {
- this.setLineWidth(2);
- };
- draw2d.Port.prototype.onMouseLeave = function() {
- this.setLineWidth(0);
- };
- draw2d.Port.prototype.setDimension = function(width, _573e) {
- draw2d.Rectangle.prototype.setDimension.call(this, width, _573e);
- this.connectedUIRepresentation.setDimension(width, _573e);
- this.disconnectedUIRepresentation.setDimension(width, _573e);
- this.setPosition(this.x, this.y);
- };
- draw2d.Port.prototype.setBackgroundColor = function(color) {
- this.currentUIRepresentation.setBackgroundColor(color);
- };
- draw2d.Port.prototype.getBackgroundColor = function() {
- return this.currentUIRepresentation.getBackgroundColor();
- };
- draw2d.Port.prototype.getConnections = function() {
- var _5740 = new draw2d.ArrayList();
- var size = this.moveListener.getSize();
- for ( var i = 0; i < size; i++) {
- var _5743 = this.moveListener.get(i);
- if (_5743 instanceof draw2d.Connection) {
- _5740.add(_5743);
- }
- }
- return _5740;
- };
- draw2d.Port.prototype.setColor = function(color) {
- this.currentUIRepresentation.setColor(color);
- };
- draw2d.Port.prototype.getColor = function() {
- return this.currentUIRepresentation.getColor();
- };
- draw2d.Port.prototype.setLineWidth = function(width) {
- this.currentUIRepresentation.setLineWidth(width);
- };
- draw2d.Port.prototype.getLineWidth = function() {
- return this.currentUIRepresentation.getLineWidth();
- };
- draw2d.Port.prototype.paint = function() {
- try {
- this.currentUIRepresentation.paint();
- } catch (e) {
- pushErrorStack(e, "draw2d.Port.prototype.paint=function()");
- }
- };
- draw2d.Port.prototype.setPosition = function(xPos, yPos) {
- this.originX = xPos;
- this.originY = yPos;
- draw2d.Rectangle.prototype.setPosition.call(this, xPos, yPos);
- if (this.html === null) {
- return;
- }
- this.html.style.left = (this.x - this.getWidth() / 2) + "px";
- this.html.style.top = (this.y - this.getHeight() / 2) + "px";
- };
- draw2d.Port.prototype.setParent = function(_5748) {
- if (this.parentNode !== null) {
- this.parentNode.detachMoveListener(this);
- }
- this.parentNode = _5748;
- if (this.parentNode !== null) {
- this.parentNode.attachMoveListener(this);
- }
- };
- draw2d.Port.prototype.attachMoveListener = function(_5749) {
- draw2d.Rectangle.prototype.attachMoveListener.call(this, _5749);
- if (this.hideIfConnected == true) {
- this.setUiRepresentation(this.connectedUIRepresentation);
- }
- };
- draw2d.Port.prototype.detachMoveListener = function(_574a) {
- draw2d.Rectangle.prototype.detachMoveListener.call(this, _574a);
- if (this.getConnections().getSize() == 0) {
- this.setUiRepresentation(this.disconnectedUIRepresentation);
- }
- };
- draw2d.Port.prototype.getParent = function() {
- return this.parentNode;
- };
- draw2d.Port.prototype.onDrag = function() {
- draw2d.Rectangle.prototype.onDrag.call(this);
- this.parentNode.workflow.showConnectionLine(this.parentNode.x + this.x,
- this.parentNode.y + this.y, this.parentNode.x + this.originX,
- this.parentNode.y + this.originY);
- };
- draw2d.Port.prototype.getCoronaWidth = function() {
- return this.coronaWidth;
- };
- draw2d.Port.prototype.setCoronaWidth = function(width) {
- this.coronaWidth = width;
- };
- draw2d.Port.prototype.setOrigin = function(x, y) {
- this.originX = x;
- this.originY = y;
- };
- draw2d.Port.prototype.onDragend = function() {
- this.setAlpha(1);
- this.setPosition(this.originX, this.originY);
- this.parentNode.workflow.hideConnectionLine();
- document.body.focus();
- };
- draw2d.Port.prototype.onDragEnter = function(port) {
- var _574f = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
- _574f.canvas = this.parentNode.workflow;
- _574f.source = port;
- _574f.target = this;
- var _5750 = this.createCommand(_574f);
- if (_5750 === null) {
- return;
- }
- this.parentNode.workflow.connectionLine
- .setColor(new draw2d.Color(0, 150, 0));
- this.parentNode.workflow.connectionLine.setLineWidth(3);
- this.showCorona(true);
- };
- draw2d.Port.prototype.onDragLeave = function(port) {
- this.parentNode.workflow.connectionLine.setColor(new draw2d.Color(0, 0, 0));
- this.parentNode.workflow.connectionLine.setLineWidth(1);
- this.showCorona(false);
- };
- draw2d.Port.prototype.onDrop = function(port) {
- var _5753 = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
- _5753.canvas = this.parentNode.workflow;
- _5753.source = port;
- _5753.target = this;
- var _5754 = this.createCommand(_5753);
- if (_5754 !== null) {
- this.parentNode.workflow.getCommandStack().execute(_5754);
- }
- };
- draw2d.Port.prototype.getAbsolutePosition = function() {
- return new draw2d.Point(this.getAbsoluteX(), this.getAbsoluteY());
- };
- draw2d.Port.prototype.getAbsoluteBounds = function() {
- return new draw2d.Dimension(this.getAbsoluteX(), this.getAbsoluteY(), this
- .getWidth(), this.getHeight());
- };
- draw2d.Port.prototype.getAbsoluteY = function() {
- return this.originY + this.parentNode.getY();
- };
- draw2d.Port.prototype.getAbsoluteX = function() {
- return this.originX + this.parentNode.getX();
- };
- draw2d.Port.prototype.onOtherFigureMoved = function(_5755) {
- this.fireMoveEvent();
- };
- draw2d.Port.prototype.getName = function() {
- return this.name;
- };
- draw2d.Port.prototype.setName = function(name) {
- this.name = name;
- };
- draw2d.Port.prototype.isOver = function(iX, iY) {
- var x = this.getAbsoluteX() - this.coronaWidth - this.getWidth() / 2;
- var y = this.getAbsoluteY() - this.coronaWidth - this.getHeight() / 2;
- var iX2 = x + this.width + (this.coronaWidth * 2) + this.getWidth() / 2;
- var iY2 = y + this.height + (this.coronaWidth * 2) + this.getHeight() / 2;
- return (iX >= x && iX <= iX2 && iY >= y && iY <= iY2);
- };
- draw2d.Port.prototype.showCorona = function(flag, _575e) {
- if (flag === true) {
- this.corona = new Corona();
- this.corona.setAlpha(0.3);
- this.corona.setBackgroundColor(new draw2d.Color(0, 125, 125));
- this.corona.setColor(null);
- this.corona.setDimension(this.getWidth() + (this.getCoronaWidth() * 2),
- this.getWidth() + (this.getCoronaWidth() * 2));
- this.parentNode.getWorkflow().addFigure(
- this.corona,
- this.getAbsoluteX() - this.getCoronaWidth() - this.getWidth()
- / 2,
- this.getAbsoluteY() - this.getCoronaWidth() - this.getHeight()
- / 2);
- } else {
- if (flag === false && this.corona !== null) {
- this.parentNode.getWorkflow().removeFigure(this.corona);
- this.corona = null;
- }
- }
- };
- draw2d.Port.prototype.createCommand = function(_575f) {
- if (_575f.getPolicy() === draw2d.EditPolicy.MOVE) {
- if (!this.canDrag) {
- return null;
- }
- return new draw2d.CommandMovePort(this);
- }
- if (_575f.getPolicy() === draw2d.EditPolicy.CONNECT) {
- if (_575f.source.parentNode.id === _575f.target.parentNode.id) {
- return null;
- } else {
- return new draw2d.CommandConnect(_575f.canvas, _575f.source,
- _575f.target);
- }
- }
- return null;
- };
- draw2d.InputPort = function(_590b) {
- draw2d.Port.call(this, _590b);
- };
- draw2d.InputPort.prototype = new draw2d.Port();
- draw2d.InputPort.prototype.type = "draw2d.InputPort";
- draw2d.InputPort.prototype.onDragstart = function(x, y) {
- if (!this.canDrag) {
- return false;
- }
- return true;
- };
- draw2d.InputPort.prototype.onDragEnter = function(port) {
- if (port instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, port);
- } else {
- if (port instanceof draw2d.LineStartResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getSource() instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, line.getTarget());
- }
- } else {
- if (port instanceof draw2d.LineEndResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getTarget() instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, line
- .getSource());
- }
- }
- }
- }
- };
- draw2d.InputPort.prototype.onDragLeave = function(port) {
- if (port instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, port);
- } else {
- if (port instanceof draw2d.LineStartResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getSource() instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, line.getTarget());
- }
- } else {
- if (port instanceof draw2d.LineEndResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getTarget() instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, line
- .getSource());
- }
- }
- }
- }
- };
- draw2d.InputPort.prototype.createCommand = function(_5912) {
- if (_5912.getPolicy() == draw2d.EditPolicy.CONNECT) {
- if (_5912.source.parentNode.id == _5912.target.parentNode.id) {
- return null;
- }
- if (_5912.source instanceof draw2d.OutputPort) {
- return new draw2d.CommandConnect(_5912.canvas, _5912.source,
- _5912.target);
- }
- return null;
- }
- return draw2d.Port.prototype.createCommand.call(this, _5912);
- };
- draw2d.OutputPort = function(_5ca2) {
- draw2d.Port.call(this, _5ca2);
- this.maxFanOut = 100;
- };
- draw2d.OutputPort.prototype = new draw2d.Port();
- draw2d.OutputPort.prototype.type = "draw2d.OutputPort";
- draw2d.OutputPort.prototype.onDragEnter = function(port) {
- if (this.getMaxFanOut() <= this.getFanOut()) {
- return;
- }
- if (port instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, port);
- } else {
- if (port instanceof draw2d.LineStartResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getSource() instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, line.getTarget());
- }
- } else {
- if (port instanceof draw2d.LineEndResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getTarget() instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragEnter.call(this, line
- .getSource());
- }
- }
- }
- }
- };
- draw2d.OutputPort.prototype.onDragLeave = function(port) {
- if (port instanceof draw2d.InputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, port);
- } else {
- if (port instanceof draw2d.LineStartResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getSource() instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, line.getTarget());
- }
- } else {
- if (port instanceof draw2d.LineEndResizeHandle) {
- var line = this.workflow.currentSelection;
- if (line instanceof draw2d.Connection
- && line.getTarget() instanceof draw2d.OutputPort) {
- draw2d.Port.prototype.onDragLeave.call(this, line
- .getSource());
- }
- }
- }
- }
- };
- draw2d.OutputPort.prototype.onDragstart = function(x, y) {
- if (!this.canDrag) {
- return false;
- }
- if (this.maxFanOut === -1) {
- return true;
- }
- if (this.getMaxFanOut() <= this.getFanOut()) {
- return false;
- }
- return true;
- };
- draw2d.OutputPort.prototype.setMaxFanOut = function(count) {
- this.maxFanOut = count;
- };
- draw2d.OutputPort.prototype.getMaxFanOut = function() {
- return this.maxFanOut;
- };
- draw2d.OutputPort.prototype.getFanOut = function() {
- if (this.getParent().workflow === null) {
- return 0;
- }
- var count = 0;
- var lines = this.getParent().workflow.getLines();
- var size = lines.getSize();
- for ( var i = 0; i < size; i++) {
- var line = lines.get(i);
- if (line instanceof draw2d.Connection) {
- if (line.getSource() == this) {
- count++;
- } else {
- if (line.getTarget() == this) {
- count++;
- }
- }
- }
- }
- return count;
- };
- draw2d.OutputPort.prototype.createCommand = function(_5caf) {
- if (_5caf.getPolicy() === draw2d.EditPolicy.CONNECT) {
- if (_5caf.source.parentNode.id === _5caf.target.parentNode.id) {
- return null;
- }
- if (_5caf.source instanceof draw2d.InputPort) {
- return new draw2d.CommandConnect(_5caf.canvas, _5caf.target,
- _5caf.source);
- }
- return null;
- }
- return draw2d.Port.prototype.createCommand.call(this, _5caf);
- };
- draw2d.Line = function() {
- this.lineColor = new draw2d.Color(0, 0, 0);
- this.stroke = 1;
- this.canvas = null;
- this.parent = null;
- this.workflow = null;
- this.html = null;
- this.graphics = null;
- this.id = draw2d.UUID.create();
- this.startX = 30;
- this.startY = 30;
- this.endX = 100;
- this.endY = 100;
- this.alpha = 1;
- this.isMoving = false;
- this.model = null;
- this.zOrder = draw2d.Line.ZOrderBaseIndex;
- this.corona = draw2d.Line.CoronaWidth;
- this.properties = {};
- this.moveListener = new draw2d.ArrayList();
- this.setSelectable(true);
- this.setDeleteable(true);
- };
- draw2d.Line.prototype.type = "draw2d.Line";
- draw2d.Line.ZOrderBaseIndex = 200;
- draw2d.Line.ZOrderBaseIndex = 200;
- draw2d.Line.CoronaWidth = 5;
- draw2d.Line.setZOrderBaseIndex = function(index) {
- draw2d.Line.ZOrderBaseIndex = index;
- };
- draw2d.Line.setDefaultCoronaWidth = function(width) {
- draw2d.Line.CoronaWidth = width;
- };
- draw2d.Line.prototype.dispose = function() {
- this.canvas = null;
- this.workflow = null;
- if (this.graphics !== null) {
- this.graphics.clear();
- }
- this.graphics = null;
- };
- draw2d.Line.prototype.getZOrder = function() {
- return this.zOrder;
- };
- draw2d.Line.prototype.setZOrder = function(index) {
- if (this.html !== null) {
- this.html.style.zIndex = index;
- }
- this.zOrder = index;
- };
- draw2d.Line.prototype.setCoronaWidth = function(width) {
- this.corona = width;
- };
- draw2d.Line.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.left = "0px";
- item.style.top = "0px";
- item.style.height = "0px";
- item.style.width = "0px";
- item.style.zIndex = this.zOrder;
- return item;
- };
- draw2d.Line.prototype.setId = function(id) {
- this.id = id;
- if (this.html !== null) {
- this.html.id = id;
- }
- };
- draw2d.Line.prototype.getId = function() {
- return this.id;
- };
- draw2d.Line.prototype.getProperties = function() {
- return this.properties;
- };
- draw2d.Line.prototype.getProperty = function(key) {
- return this.properties[key];
- };
- draw2d.Line.prototype.setProperty = function(key, value) {
- this.properties[key] = value;
- this.setDocumentDirty();
- };
- draw2d.Line.prototype.getHTMLElement = function() {
- if (this.html === null) {
- this.html = this.createHTMLElement();
- }
- return this.html;
- };
- draw2d.Line.prototype.getWorkflow = function() {
- return this.workflow;
- };
- draw2d.Line.prototype.isResizeable = function() {
- return true;
- };
- draw2d.Line.prototype.setCanvas = function(_56ed) {
- this.canvas = _56ed;
- if (this.graphics !== null) {
- this.graphics.clear();
- }
- this.graphics = null;
- };
- draw2d.Line.prototype.setWorkflow = function(_56ee) {
- this.workflow = _56ee;
- if (this.graphics !== null) {
- this.graphics.clear();
- }
- this.graphics = null;
- };
- draw2d.Line.prototype.paint = function() {
- if (this.html === null) {
- return;
- }
- try {
- if (this.graphics === null) {
- this.graphics = new jsGraphics(this.html);
- } else {
- this.graphics.clear();
- }
- this.graphics.setStroke(this.stroke);
- this.graphics.setColor(this.lineColor.getHTMLStyle());
- this.graphics.drawLine(this.startX, this.startY, this.endX, this.endY);
- this.graphics.paint();
- } catch (e) {
- pushErrorStack(e, "draw2d.Line.prototype.paint=function()");
- }
- };
- draw2d.Line.prototype.attachMoveListener = function(_56ef) {
- this.moveListener.add(_56ef);
- };
- draw2d.Line.prototype.detachMoveListener = function(_56f0) {
- this.moveListener.remove(_56f0);
- };
- draw2d.Line.prototype.fireMoveEvent = function() {
- var size = this.moveListener.getSize();
- for ( var i = 0; i < size; i++) {
- this.moveListener.get(i).onOtherFigureMoved(this);
- }
- };
- draw2d.Line.prototype.onOtherFigureMoved = function(_56f3) {
- };
- draw2d.Line.prototype.setLineWidth = function(w) {
- this.stroke = w;
- if (this.graphics !== null) {
- this.paint();
- }
- this.setDocumentDirty();
- };
- draw2d.Line.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.graphics !== null) {
- this.paint();
- }
- this.setDocumentDirty();
- };
- draw2d.Line.prototype.getColor = function() {
- return this.lineColor;
- };
- draw2d.Line.prototype.setAlpha = function(_56f6) {
- if (_56f6 == this.alpha) {
- return;
- }
- try {
- this.html.style.MozOpacity = _56f6;
- } catch (exc1) {
- }
- try {
- this.html.style.opacity = _56f6;
- } catch (exc2) {
- }
- try {
- var _56f7 = Math.round(_56f6 * 100);
- if (_56f7 >= 99) {
- this.html.style.filter = "";
- } else {
- this.html.style.filter = "alpha(opacity=" + _56f7 + ")";
- }
- } catch (exc3) {
- }
- this.alpha = _56f6;
- };
- draw2d.Line.prototype.setStartPoint = function(x, y) {
- this.startX = x;
- this.startY = y;
- if (this.graphics !== null) {
- this.paint();
- }
- this.setDocumentDirty();
- };
- draw2d.Line.prototype.setEndPoint = function(x, y) {
- this.endX = x;
- this.endY = y;
- if (this.graphics !== null) {
- this.paint();
- }
- this.setDocumentDirty();
- };
- draw2d.Line.prototype.getStartX = function() {
- return this.startX;
- };
- draw2d.Line.prototype.getStartY = function() {
- return this.startY;
- };
- draw2d.Line.prototype.getStartPoint = function() {
- return new draw2d.Point(this.startX, this.startY);
- };
- draw2d.Line.prototype.getEndX = function() {
- return this.endX;
- };
- draw2d.Line.prototype.getEndY = function() {
- return this.endY;
- };
- draw2d.Line.prototype.getEndPoint = function() {
- return new draw2d.Point(this.endX, this.endY);
- };
- draw2d.Line.prototype.isSelectable = function() {
- return this.selectable;
- };
- draw2d.Line.prototype.setSelectable = function(flag) {
- this.selectable = flag;
- };
- draw2d.Line.prototype.isDeleteable = function() {
- return this.deleteable;
- };
- draw2d.Line.prototype.setDeleteable = function(flag) {
- this.deleteable = flag;
- };
- draw2d.Line.prototype.getLength = function() {
- return Math.sqrt((this.startX - this.endX) * (this.startX - this.endX)
- + (this.startY - this.endY) * (this.startY - this.endY));
- };
- draw2d.Line.prototype.getAngle = function() {
- var _56fe = this.getLength();
- var angle = -(180 / Math.PI) * Math.asin((this.startY - this.endY) / _56fe);
- if (angle < 0) {
- if (this.endX < this.startX) {
- angle = Math.abs(angle) + 180;
- } else {
- angle = 360 - Math.abs(angle);
- }
- } else {
- if (this.endX < this.startX) {
- angle = 180 - angle;
- }
- }
- return angle;
- };
- draw2d.Line.prototype.createCommand = function(_5700) {
- if (_5700.getPolicy() == draw2d.EditPolicy.MOVE) {
- var x1 = this.getStartX();
- var y1 = this.getStartY();
- var x2 = this.getEndX();
- var y2 = this.getEndY();
- return new draw2d.CommandMoveLine(this, x1, y1, x2, y2);
- }
- if (_5700.getPolicy() == draw2d.EditPolicy.DELETE) {
- if (this.isDeleteable() == false) {
- return null;
- }
- return new draw2d.CommandDelete(this);
- }
- return null;
- };
- draw2d.Line.prototype.setModel = function(model) {
- if (this.model !== null) {
- this.model.removePropertyChangeListener(this);
- }
- this.model = model;
- if (this.model !== null) {
- this.model.addPropertyChangeListener(this);
- }
- };
- draw2d.Line.prototype.getModel = function() {
- return this.model;
- };
- draw2d.Line.prototype.onRemove = function(_5706) {
- };
- draw2d.Line.prototype.onContextMenu = function(x, y) {
- var menu = this.getContextMenu();
- if (menu !== null) {
- this.workflow.showMenu(menu, x, y);
- }
- };
- draw2d.Line.prototype.getContextMenu = function() {
- return null;
- };
- draw2d.Line.prototype.onDoubleClick = function() {
- };
- draw2d.Line.prototype.setDocumentDirty = function() {
- if (this.workflow !== null) {
- this.workflow.setDocumentDirty();
- }
- };
- draw2d.Line.prototype.containsPoint = function(px, py) {
- return draw2d.Line.hit(this.corona, this.startX, this.startY, this.endX,
- this.endY, px, py);
- };
- draw2d.Line.hit = function(_570c, X1, Y1, X2, Y2, px, py) {
- X2 -= X1;
- Y2 -= Y1;
- px -= X1;
- py -= Y1;
- var _5713 = px * X2 + py * Y2;
- var _5714;
- if (_5713 <= 0) {
- _5714 = 0;
- } else {
- px = X2 - px;
- py = Y2 - py;
- _5713 = px * X2 + py * Y2;
- if (_5713 <= 0) {
- _5714 = 0;
- } else {
- _5714 = _5713 * _5713 / (X2 * X2 + Y2 * Y2);
- }
- }
- var lenSq = px * px + py * py - _5714;
- if (lenSq < 0) {
- lenSq = 0;
- }
- return Math.sqrt(lenSq) < _570c;
- };
- draw2d.ConnectionRouter = function() {
- };
- draw2d.ConnectionRouter.prototype.type = "draw2d.ConnectionRouter";
- draw2d.ConnectionRouter.prototype.getDirection = function(r, p) {
- var _5b2e = Math.abs(r.x - p.x);
- var _5b2f = 3;
- var i = Math.abs(r.y - p.y);
- if (i <= _5b2e) {
- _5b2e = i;
- _5b2f = 0;
- }
- i = Math.abs(r.getBottom() - p.y);
- if (i <= _5b2e) {
- _5b2e = i;
- _5b2f = 2;
- }
- i = Math.abs(r.getRight() - p.x);
- if (i < _5b2e) {
- _5b2e = i;
- _5b2f = 1;
- }
- return _5b2f;
- };
- draw2d.ConnectionRouter.prototype.getEndDirection = function(conn) {
- var p = conn.getEndPoint();
- var rect = conn.getTarget().getParent().getBounds();
- return this.getDirection(rect, p);
- };
- draw2d.ConnectionRouter.prototype.getStartDirection = function(conn) {
- var p = conn.getStartPoint();
- var rect = conn.getSource().getParent().getBounds();
- return this.getDirection(rect, p);
- };
- draw2d.ConnectionRouter.prototype.route = function(_5b37) {
- };
- draw2d.NullConnectionRouter = function() {
- };
- draw2d.NullConnectionRouter.prototype = new draw2d.ConnectionRouter();
- draw2d.NullConnectionRouter.prototype.type = "draw2d.NullConnectionRouter";
- draw2d.NullConnectionRouter.prototype.invalidate = function() {
- };
- draw2d.NullConnectionRouter.prototype.route = function(_4a11) {
- _4a11.addPoint(_4a11.getStartPoint());
- _4a11.addPoint(_4a11.getEndPoint());
- };
- draw2d.ManhattanConnectionRouter = function() {
- this.MINDIST = 20;
- };
- draw2d.ManhattanConnectionRouter.prototype = new draw2d.ConnectionRouter();
- draw2d.ManhattanConnectionRouter.prototype.type = "draw2d.ManhattanConnectionRouter";
- draw2d.ManhattanConnectionRouter.prototype.route = function(conn) {
- var _5525 = conn.getStartPoint();
- var _5526 = this.getStartDirection(conn);
- var toPt = conn.getEndPoint();
- var toDir = this.getEndDirection(conn);
- this._route(conn, toPt, toDir, _5525, _5526);
- };
- draw2d.ManhattanConnectionRouter.prototype._route = function(conn, _552a,
- _552b, toPt, toDir) {
- var TOL = 0.1;
- var _552f = 0.01;
- var UP = 0;
- var RIGHT = 1;
- var DOWN = 2;
- var LEFT = 3;
- var xDiff = _552a.x - toPt.x;
- var yDiff = _552a.y - toPt.y;
- var point;
- var dir;
- if (((xDiff * xDiff) < (_552f)) && ((yDiff * yDiff) < (_552f))) {
- conn.addPoint(new draw2d.Point(toPt.x, toPt.y));
- return;
- }
- if (_552b == LEFT) {
- if ((xDiff > 0) && ((yDiff * yDiff) < TOL) && (toDir === RIGHT)) {
- point = toPt;
- dir = toDir;
- } else {
- if (xDiff < 0) {
- point = new draw2d.Point(_552a.x - this.MINDIST, _552a.y);
- } else {
- if (((yDiff > 0) && (toDir === DOWN))
- || ((yDiff < 0) && (toDir == UP))) {
- point = new draw2d.Point(toPt.x, _552a.y);
- } else {
- if (_552b == toDir) {
- var pos = Math.min(_552a.x, toPt.x) - this.MINDIST;
- point = new draw2d.Point(pos, _552a.y);
- } else {
- point = new draw2d.Point(_552a.x - (xDiff / 2), _552a.y);
- }
- }
- }
- if (yDiff > 0) {
- dir = UP;
- } else {
- dir = DOWN;
- }
- }
- } else {
- if (_552b == RIGHT) {
- if ((xDiff < 0) && ((yDiff * yDiff) < TOL) && (toDir === LEFT)) {
- point = toPt;
- dir = toDir;
- } else {
- if (xDiff > 0) {
- point = new draw2d.Point(_552a.x + this.MINDIST, _552a.y);
- } else {
- if (((yDiff > 0) && (toDir === DOWN))
- || ((yDiff < 0) && (toDir === UP))) {
- point = new draw2d.Point(toPt.x, _552a.y);
- } else {
- if (_552b == toDir) {
- var pos = Math.max(_552a.x, toPt.x) + this.MINDIST;
- point = new draw2d.Point(pos, _552a.y);
- } else {
- point = new draw2d.Point(_552a.x - (xDiff / 2),
- _552a.y);
- }
- }
- }
- if (yDiff > 0) {
- dir = UP;
- } else {
- dir = DOWN;
- }
- }
- } else {
- if (_552b == DOWN) {
- if (((xDiff * xDiff) < TOL) && (yDiff < 0) && (toDir == UP)) {
- point = toPt;
- dir = toDir;
- } else {
- if (yDiff > 0) {
- point = new draw2d.Point(_552a.x, _552a.y
- + this.MINDIST);
- } else {
- if (((xDiff > 0) && (toDir === RIGHT))
- || ((xDiff < 0) && (toDir === LEFT))) {
- point = new draw2d.Point(_552a.x, toPt.y);
- } else {
- if (_552b === toDir) {
- var pos = Math.max(_552a.y, toPt.y)
- + this.MINDIST;
- point = new draw2d.Point(_552a.x, pos);
- } else {
- point = new draw2d.Point(_552a.x, _552a.y
- - (yDiff / 2));
- }
- }
- }
- if (xDiff > 0) {
- dir = LEFT;
- } else {
- dir = RIGHT;
- }
- }
- } else {
- if (_552b == UP) {
- if (((xDiff * xDiff) < TOL) && (yDiff > 0)
- && (toDir === DOWN)) {
- point = toPt;
- dir = toDir;
- } else {
- if (yDiff < 0) {
- point = new draw2d.Point(_552a.x, _552a.y
- - this.MINDIST);
- } else {
- if (((xDiff > 0) && (toDir === RIGHT))
- || ((xDiff < 0) && (toDir === LEFT))) {
- point = new draw2d.Point(_552a.x, toPt.y);
- } else {
- if (_552b === toDir) {
- var pos = Math.min(_552a.y, toPt.y)
- - this.MINDIST;
- point = new draw2d.Point(_552a.x, pos);
- } else {
- point = new draw2d.Point(_552a.x, _552a.y
- - (yDiff / 2));
- }
- }
- }
- if (xDiff > 0) {
- dir = LEFT;
- } else {
- dir = RIGHT;
- }
- }
- }
- }
- }
- }
- this._route(conn, point, dir, toPt, toDir);
- conn.addPoint(_552a);
- };
- draw2d.BezierConnectionRouter = function(_5fa4) {
- if (!_5fa4) {
- this.cheapRouter = new draw2d.ManhattanConnectionRouter();
- } else {
- this.cheapRouter = null;
- }
- this.iteration = 5;
- };
- draw2d.BezierConnectionRouter.prototype = new draw2d.ConnectionRouter();
- draw2d.BezierConnectionRouter.prototype.type = "draw2d.BezierConnectionRouter";
- draw2d.BezierConnectionRouter.prototype.drawBezier = function(_5fa5, _5fa6, t,
- iter) {
- var n = _5fa5.length - 1;
- var q = [];
- var _5fab = n + 1;
- for ( var i = 0; i < _5fab; i++) {
- q[i] = [];
- q[i][0] = _5fa5[i];
- }
- for ( var j = 1; j <= n; j++) {
- for ( var i = 0; i <= (n - j); i++) {
- q[i][j] = new draw2d.Point((1 - t) * q[i][j - 1].x + t
- * q[i + 1][j - 1].x, (1 - t) * q[i][j - 1].y + t
- * q[i + 1][j - 1].y);
- }
- }
- var c1 = [];
- var c2 = [];
- for ( var i = 0; i < n + 1; i++) {
- c1[i] = q[0][i];
- c2[i] = q[i][n - i];
- }
- if (iter >= 0) {
- this.drawBezier(c1, _5fa6, t, --iter);
- this.drawBezier(c2, _5fa6, t, --iter);
- } else {
- for ( var i = 0; i < n; i++) {
- _5fa6.push(q[i][n - i]);
- }
- }
- };
- draw2d.BezierConnectionRouter.prototype.route = function(conn) {
- if (this.cheapRouter !== null
- && (conn.getSource().getParent().isMoving === true || conn
- .getTarget().getParent().isMoving === true)) {
- this.cheapRouter.route(conn);
- return;
- }
- var _5fb1 = [];
- var _5fb2 = conn.getStartPoint();
- var toPt = conn.getEndPoint();
- this._route(_5fb1, conn, toPt, this.getEndDirection(conn), _5fb2, this
- .getStartDirection(conn));
- var _5fb4 = [];
- this.drawBezier(_5fb1, _5fb4, 0.5, this.iteration);
- for ( var i = 0; i < _5fb4.length; i++) {
- conn.addPoint(_5fb4[i]);
- }
- conn.addPoint(toPt);
- };
- draw2d.BezierConnectionRouter.prototype._route = function(_5fb6, conn, _5fb8,
- _5fb9, toPt, toDir) {
- var TOL = 0.1;
- var _5fbd = 0.01;
- var _5fbe = 90;
- var UP = 0;
- var RIGHT = 1;
- var DOWN = 2;
- var LEFT = 3;
- var xDiff = _5fb8.x - toPt.x;
- var yDiff = _5fb8.y - toPt.y;
- var point;
- var dir;
- if (((xDiff * xDiff) < (_5fbd)) && ((yDiff * yDiff) < (_5fbd))) {
- _5fb6.push(new draw2d.Point(toPt.x, toPt.y));
- return;
- }
- if (_5fb9 === LEFT) {
- if ((xDiff > 0) && ((yDiff * yDiff) < TOL) && (toDir === RIGHT)) {
- point = toPt;
- dir = toDir;
- } else {
- if (xDiff < 0) {
- point = new draw2d.Point(_5fb8.x - _5fbe, _5fb8.y);
- } else {
- if (((yDiff > 0) && (toDir === DOWN))
- || ((yDiff < 0) && (toDir === UP))) {
- point = new draw2d.Point(toPt.x, _5fb8.y);
- } else {
- if (_5fb9 === toDir) {
- var pos = Math.min(_5fb8.x, toPt.x) - _5fbe;
- point = new draw2d.Point(pos, _5fb8.y);
- } else {
- point = new draw2d.Point(_5fb8.x - (xDiff / 2), _5fb8.y);
- }
- }
- }
- if (yDiff > 0) {
- dir = UP;
- } else {
- dir = DOWN;
- }
- }
- } else {
- if (_5fb9 === RIGHT) {
- if ((xDiff < 0) && ((yDiff * yDiff) < TOL) && (toDir == LEFT)) {
- point = toPt;
- dir = toDir;
- } else {
- if (xDiff > 0) {
- point = new draw2d.Point(_5fb8.x + _5fbe, _5fb8.y);
- } else {
- if (((yDiff > 0) && (toDir === DOWN))
- || ((yDiff < 0) && (toDir === UP))) {
- point = new draw2d.Point(toPt.x, _5fb8.y);
- } else {
- if (_5fb9 === toDir) {
- var pos = Math.max(_5fb8.x, toPt.x) + _5fbe;
- point = new draw2d.Point(pos, _5fb8.y);
- } else {
- point = new draw2d.Point(_5fb8.x - (xDiff / 2),
- _5fb8.y);
- }
- }
- }
- if (yDiff > 0) {
- dir = UP;
- } else {
- dir = DOWN;
- }
- }
- } else {
- if (_5fb9 === DOWN) {
- if (((xDiff * xDiff) < TOL) && (yDiff < 0) && (toDir === UP)) {
- point = toPt;
- dir = toDir;
- } else {
- if (yDiff > 0) {
- point = new draw2d.Point(_5fb8.x, _5fb8.y + _5fbe);
- } else {
- if (((xDiff > 0) && (toDir === RIGHT))
- || ((xDiff < 0) && (toDir === LEFT))) {
- point = new draw2d.Point(_5fb8.x, toPt.y);
- } else {
- if (_5fb9 === toDir) {
- var pos = Math.max(_5fb8.y, toPt.y) + _5fbe;
- point = new draw2d.Point(_5fb8.x, pos);
- } else {
- point = new draw2d.Point(_5fb8.x, _5fb8.y
- - (yDiff / 2));
- }
- }
- }
- if (xDiff > 0) {
- dir = LEFT;
- } else {
- dir = RIGHT;
- }
- }
- } else {
- if (_5fb9 === UP) {
- if (((xDiff * xDiff) < TOL) && (yDiff > 0)
- && (toDir === DOWN)) {
- point = toPt;
- dir = toDir;
- } else {
- if (yDiff < 0) {
- point = new draw2d.Point(_5fb8.x, _5fb8.y - _5fbe);
- } else {
- if (((xDiff > 0) && (toDir === RIGHT))
- || ((xDiff < 0) && (toDir === LEFT))) {
- point = new draw2d.Point(_5fb8.x, toPt.y);
- } else {
- if (_5fb9 === toDir) {
- var pos = Math.min(_5fb8.y, toPt.y) - _5fbe;
- point = new draw2d.Point(_5fb8.x, pos);
- } else {
- point = new draw2d.Point(_5fb8.x, _5fb8.y
- - (yDiff / 2));
- }
- }
- }
- if (xDiff > 0) {
- dir = LEFT;
- } else {
- dir = RIGHT;
- }
- }
- }
- }
- }
- }
- this._route(_5fb6, conn, point, dir, toPt, toDir);
- _5fb6.push(_5fb8);
- };
- draw2d.FanConnectionRouter = function() {
- };
- draw2d.FanConnectionRouter.prototype = new draw2d.NullConnectionRouter();
- draw2d.FanConnectionRouter.prototype.type = "draw2d.FanConnectionRouter";
- draw2d.FanConnectionRouter.prototype.route = function(conn) {
- var _5680 = conn.getStartPoint();
- var toPt = conn.getEndPoint();
- var lines = conn.getSource().getConnections();
- var _5683 = new draw2d.ArrayList();
- var index = 0;
- for ( var i = 0; i < lines.getSize(); i++) {
- var _5686 = lines.get(i);
- if (_5686.getTarget() == conn.getTarget()
- || _5686.getSource() == conn.getTarget()) {
- _5683.add(_5686);
- if (conn == _5686) {
- index = _5683.getSize();
- }
- }
- }
- if (_5683.getSize() > 1) {
- this.routeCollision(conn, index);
- } else {
- draw2d.NullConnectionRouter.prototype.route.call(this, conn);
- }
- };
- draw2d.FanConnectionRouter.prototype.routeNormal = function(conn) {
- conn.addPoint(conn.getStartPoint());
- conn.addPoint(conn.getEndPoint());
- };
- draw2d.FanConnectionRouter.prototype.routeCollision = function(conn, index) {
- var start = conn.getStartPoint();
- var end = conn.getEndPoint();
- conn.addPoint(start);
- var _568c = 10;
- var _568d = new draw2d.Point((end.x + start.x) / 2, (end.y + start.y) / 2);
- var _568e = end.getPosition(start);
- var ray;
- if (_568e == draw2d.PositionConstants.SOUTH
- || _568e == draw2d.PositionConstants.EAST) {
- ray = new draw2d.Point(end.x - start.x, end.y - start.y);
- } else {
- ray = new draw2d.Point(start.x - end.x, start.y - end.y);
- }
- var _5690 = Math.sqrt(ray.x * ray.x + ray.y * ray.y);
- var _5691 = _568c * ray.x / _5690;
- var _5692 = _568c * ray.y / _5690;
- var _5693;
- if (index % 2 === 0) {
- _5693 = new draw2d.Point(_568d.x + (index / 2) * (-1 * _5692), _568d.y
- + (index / 2) * _5691);
- } else {
- _5693 = new draw2d.Point(_568d.x + (index / 2) * _5692, _568d.y
- + (index / 2) * (-1 * _5691));
- }
- conn.addPoint(_5693);
- conn.addPoint(end);
- };
- draw2d.Graphics = function(_6019, _601a, _601b) {
- this.jsGraphics = _6019;
- this.xt = _601b.x;
- this.yt = _601b.y;
- this.radian = _601a * Math.PI / 180;
- this.sinRadian = Math.sin(this.radian);
- this.cosRadian = Math.cos(this.radian);
- };
- draw2d.Graphics.prototype.setStroke = function(x) {
- this.jsGraphics.setStroke(x);
- };
- draw2d.Graphics.prototype.drawLine = function(x1, y1, x2, y2) {
- var _x1 = this.xt + x1 * this.cosRadian - y1 * this.sinRadian;
- var _y1 = this.yt + x1 * this.sinRadian + y1 * this.cosRadian;
- var _x2 = this.xt + x2 * this.cosRadian - y2 * this.sinRadian;
- var _y2 = this.yt + x2 * this.sinRadian + y2 * this.cosRadian;
- this.jsGraphics.drawLine(_x1, _y1, _x2, _y2);
- };
- draw2d.Graphics.prototype.fillRect = function(x, y, w, h) {
- var x1 = this.xt + x * this.cosRadian - y * this.sinRadian;
- var y1 = this.yt + x * this.sinRadian + y * this.cosRadian;
- var x2 = this.xt + (x + w) * this.cosRadian - y * this.sinRadian;
- var y2 = this.yt + (x + w) * this.sinRadian + y * this.cosRadian;
- var x3 = this.xt + (x + w) * this.cosRadian - (y + h) * this.sinRadian;
- var y3 = this.yt + (x + w) * this.sinRadian + (y + h) * this.cosRadian;
- var x4 = this.xt + x * this.cosRadian - (y + h) * this.sinRadian;
- var y4 = this.yt + x * this.sinRadian + (y + h) * this.cosRadian;
- this.jsGraphics.fillPolygon( [ x1, x2, x3, x4 ], [ y1, y2, y3, y4 ]);
- };
- draw2d.Graphics.prototype.fillPolygon = function(_6031, _6032) {
- var rotX = [];
- var rotY = [];
- for ( var i = 0; i < _6031.length; i++) {
- rotX[i] = this.xt + _6031[i] * this.cosRadian - _6032[i]
- * this.sinRadian;
- rotY[i] = this.yt + _6031[i] * this.sinRadian + _6032[i]
- * this.cosRadian;
- }
- this.jsGraphics.fillPolygon(rotX, rotY);
- };
- draw2d.Graphics.prototype.setColor = function(color) {
- this.jsGraphics.setColor(color.getHTMLStyle());
- };
- draw2d.Graphics.prototype.drawPolygon = function(_6037, _6038) {
- var rotX = [];
- var rotY = [];
- for ( var i = 0; i < _6037.length; i++) {
- rotX[i] = this.xt + _6037[i] * this.cosRadian - _6038[i]
- * this.sinRadian;
- rotY[i] = this.yt + _6037[i] * this.sinRadian + _6038[i]
- * this.cosRadian;
- }
- this.jsGraphics.drawPolygon(rotX, rotY);
- };
- draw2d.Connection = function() {
- draw2d.Line.call(this);
- this.sourcePort = null;
- this.targetPort = null;
- this.canDrag = true;
- this.sourceDecorator = null;
- this.targetDecorator = null;
- this.sourceAnchor = new draw2d.ConnectionAnchor();
- this.targetAnchor = new draw2d.ConnectionAnchor();
- this.router = draw2d.Connection.defaultRouter;
- this.lineSegments = new draw2d.ArrayList();
- this.children = new draw2d.ArrayList();
- this.setColor(new draw2d.Color(0, 0, 115));
- this.setLineWidth(1);
- };
- draw2d.Connection.prototype = new draw2d.Line();
- draw2d.Connection.prototype.type = "draw2d.Connection";
- draw2d.Connection.defaultRouter = new draw2d.ManhattanConnectionRouter();
- draw2d.Connection.setDefaultRouter = function(_58bd) {
- draw2d.Connection.defaultRouter = _58bd;
- };
- draw2d.Connection.prototype.disconnect = function() {
- if (this.sourcePort !== null) {
- this.sourcePort.detachMoveListener(this);
- this.fireSourcePortRouteEvent();
- }
- if (this.targetPort !== null) {
- this.targetPort.detachMoveListener(this);
- this.fireTargetPortRouteEvent();
- }
- };
- draw2d.Connection.prototype.reconnect = function() {
- if (this.sourcePort !== null) {
- this.sourcePort.attachMoveListener(this);
- this.fireSourcePortRouteEvent();
- }
- if (this.targetPort !== null) {
- this.targetPort.attachMoveListener(this);
- this.fireTargetPortRouteEvent();
- }
- };
- draw2d.Connection.prototype.isResizeable = function() {
- return this.getCanDrag();
- };
- draw2d.Connection.prototype.setCanDrag = function(flag) {
- this.canDrag = flag;
- };
- draw2d.Connection.prototype.getCanDrag = function() {
- return this.canDrag;
- };
- draw2d.Connection.prototype.addFigure = function(_58bf, _58c0) {
- var entry = {};
- entry.figure = _58bf;
- entry.locator = _58c0;
- this.children.add(entry);
- if (this.graphics !== null) {
- this.paint();
- }
- var oThis = this;
- var _58c3 = function() {
- var _58c4 = arguments[0] || window.event;
- _58c4.returnValue = false;
- oThis.getWorkflow().setCurrentSelection(oThis);
- oThis.getWorkflow().showLineResizeHandles(oThis);
- };
- if (_58bf.getHTMLElement().addEventListener) {
- _58bf.getHTMLElement().addEventListener("mousedown", _58c3, false);
- } else {
- if (_58bf.getHTMLElement().attachEvent) {
- _58bf.getHTMLElement().attachEvent("onmousedown", _58c3);
- }
- }
- };
- draw2d.Connection.prototype.setSourceDecorator = function(_58c5) {
- this.sourceDecorator = _58c5;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.Connection.prototype.getSourceDecorator = function() {
- return this.sourceDecorator;
- };
- draw2d.Connection.prototype.setTargetDecorator = function(_58c6) {
- this.targetDecorator = _58c6;
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.Connection.prototype.getTargetDecorator = function() {
- return this.targetDecorator;
- };
- draw2d.Connection.prototype.setSourceAnchor = function(_58c7) {
- this.sourceAnchor = _58c7;
- this.sourceAnchor.setOwner(this.sourcePort);
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.Connection.prototype.setTargetAnchor = function(_58c8) {
- this.targetAnchor = _58c8;
- this.targetAnchor.setOwner(this.targetPort);
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.Connection.prototype.setRouter = function(_58c9) {
- if (_58c9 !== null) {
- this.router = _58c9;
- } else {
- this.router = new draw2d.NullConnectionRouter();
- }
- if (this.graphics !== null) {
- this.paint();
- }
- };
- draw2d.Connection.prototype.getRouter = function() {
- return this.router;
- };
- draw2d.Connection.prototype.setWorkflow = function(_58ca) {
- draw2d.Line.prototype.setWorkflow.call(this, _58ca);
- for ( var i = 0; i < this.children.getSize(); i++) {
- this.children.get(i).isAppended = false;
- }
- };
- draw2d.Connection.prototype.paint = function() {
- if (this.html === null) {
- return;
- }
- try {
- for ( var i = 0; i < this.children.getSize(); i++) {
- var entry = this.children.get(i);
- if (entry.isAppended == true) {
- this.html.removeChild(entry.figure.getHTMLElement());
- }
- entry.isAppended = false;
- }
- if (this.graphics === null) {
- this.graphics = new jsGraphics(this.html);
- } else {
- this.graphics.clear();
- }
- this.graphics.setStroke(this.stroke);
- this.graphics.setColor(this.lineColor.getHTMLStyle());
- this.startStroke();
- this.router.route(this);
- if (this.getSource().getParent().isMoving == false
- && this.getTarget().getParent().isMoving == false) {
- if (this.targetDecorator !== null) {
- this.targetDecorator.paint(new draw2d.Graphics(this.graphics,
- this.getEndAngle(), this.getEndPoint()));
- }
- if (this.sourceDecorator !== null) {
- this.sourceDecorator.paint(new draw2d.Graphics(this.graphics,
- this.getStartAngle(), this.getStartPoint()));
- }
- }
- this.finishStroke();
- for ( var i = 0; i < this.children.getSize(); i++) {
- var entry = this.children.get(i);
- this.html.appendChild(entry.figure.getHTMLElement());
- entry.isAppended = true;
- entry.locator.relocate(entry.figure);
- }
- } catch (e) {
- pushErrorStack(e, "draw2d.Connection.prototype.paint=function()");
- }
- };
- draw2d.Connection.prototype.getStartPoint = function() {
- if (this.isMoving == false) {
- return this.sourceAnchor.getLocation(this.targetAnchor
- .getReferencePoint());
- } else {
- return draw2d.Line.prototype.getStartPoint.call(this);
- }
- };
- draw2d.Connection.prototype.getEndPoint = function() {
- if (this.isMoving == false) {
- return this.targetAnchor.getLocation(this.sourceAnchor
- .getReferencePoint());
- } else {
- return draw2d.Line.prototype.getEndPoint.call(this);
- }
- };
- draw2d.Connection.prototype.startStroke = function() {
- this.oldPoint = null;
- this.lineSegments = new draw2d.ArrayList();
- };
- draw2d.Connection.prototype.finishStroke = function() {
- this.graphics.paint();
- this.oldPoint = null;
- };
- draw2d.Connection.prototype.getPoints = function() {
- var _58ce = new draw2d.ArrayList();
- var line = null;
- for ( var i = 0; i < this.lineSegments.getSize(); i++) {
- line = this.lineSegments.get(i);
- _58ce.add(line.start);
- }
- if (line !== null) {
- _58ce.add(line.end);
- }
- return _58ce;
- };
- draw2d.Connection.prototype.addPoint = function(p) {
- p = new draw2d.Point(parseInt(p.x), parseInt(p.y));
- if (this.oldPoint !== null) {
- this.graphics.drawLine(this.oldPoint.x, this.oldPoint.y, p.x, p.y);
- var line = {};
- line.start = this.oldPoint;
- line.end = p;
- this.lineSegments.add(line);
- }
- this.oldPoint = {};
- this.oldPoint.x = p.x;
- this.oldPoint.y = p.y;
- };
- draw2d.Connection.prototype.refreshSourcePort = function() {
- var model = this.getModel().getSourceModel();
- var _58d4 = this.getModel().getSourcePortName();
- var _58d5 = this.getWorkflow().getDocument().getFigures();
- var count = _58d5.getSize();
- for ( var i = 0; i < count; i++) {
- var _58d8 = _58d5.get(i);
- if (_58d8.getModel() == model) {
- var port = _58d8.getOutputPort(_58d4);
- this.setSource(port);
- }
- }
- this.setRouter(this.getRouter());
- };
- draw2d.Connection.prototype.refreshTargetPort = function() {
- var model = this.getModel().getTargetModel();
- var _58db = this.getModel().getTargetPortName();
- var _58dc = this.getWorkflow().getDocument().getFigures();
- var count = _58dc.getSize();
- for ( var i = 0; i < count; i++) {
- var _58df = _58dc.get(i);
- if (_58df.getModel() == model) {
- var port = _58df.getInputPort(_58db);
- this.setTarget(port);
- }
- }
- this.setRouter(this.getRouter());
- };
- draw2d.Connection.prototype.setSource = function(port) {
- if (this.sourcePort !== null) {
- this.sourcePort.detachMoveListener(this);
- }
- this.sourcePort = port;
- if (this.sourcePort === null) {
- return;
- }
- this.sourceAnchor.setOwner(this.sourcePort);
- this.fireSourcePortRouteEvent();
- this.sourcePort.attachMoveListener(this);
- this.setStartPoint(port.getAbsoluteX(), port.getAbsoluteY());
- };
- draw2d.Connection.prototype.getSource = function() {
- return this.sourcePort;
- };
- draw2d.Connection.prototype.setTarget = function(port) {
- if (this.targetPort !== null) {
- this.targetPort.detachMoveListener(this);
- }
- this.targetPort = port;
- if (this.targetPort === null) {
- return;
- }
- this.targetAnchor.setOwner(this.targetPort);
- this.fireTargetPortRouteEvent();
- this.targetPort.attachMoveListener(this);
- this.setEndPoint(port.getAbsoluteX(), port.getAbsoluteY());
- };
- draw2d.Connection.prototype.getTarget = function() {
- return this.targetPort;
- };
- draw2d.Connection.prototype.onOtherFigureMoved = function(_58e3) {
- if (_58e3 == this.sourcePort) {
- this.setStartPoint(this.sourcePort.getAbsoluteX(), this.sourcePort
- .getAbsoluteY());
- } else {
- this.setEndPoint(this.targetPort.getAbsoluteX(), this.targetPort
- .getAbsoluteY());
- }
- };
- draw2d.Connection.prototype.containsPoint = function(px, py) {
- for ( var i = 0; i < this.lineSegments.getSize(); i++) {
- var line = this.lineSegments.get(i);
- if (draw2d.Line.hit(this.corona, line.start.x, line.start.y,
- line.end.x, line.end.y, px, py)) {
- return true;
- }
- }
- return false;
- };
- draw2d.Connection.prototype.getStartAngle = function() {
- var p1 = this.lineSegments.get(0).start;
- var p2 = this.lineSegments.get(0).end;
- if (this.router instanceof draw2d.BezierConnectionRouter) {
- p2 = this.lineSegments.get(5).end;
- }
- var _58ea = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y)
- * (p1.y - p2.y));
- var angle = -(180 / Math.PI) * Math.asin((p1.y - p2.y) / _58ea);
- if (angle < 0) {
- if (p2.x < p1.x) {
- angle = Math.abs(angle) + 180;
- } else {
- angle = 360 - Math.abs(angle);
- }
- } else {
- if (p2.x < p1.x) {
- angle = 180 - angle;
- }
- }
- return angle;
- };
- draw2d.Connection.prototype.getEndAngle = function() {
- if (this.lineSegments.getSize() === 0) {
- return 90;
- }
- var p1 = this.lineSegments.get(this.lineSegments.getSize() - 1).end;
- var p2 = this.lineSegments.get(this.lineSegments.getSize() - 1).start;
- if (this.router instanceof draw2d.BezierConnectionRouter) {
- p2 = this.lineSegments.get(this.lineSegments.getSize() - 5).end;
- }
- var _58ee = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y)
- * (p1.y - p2.y));
- var angle = -(180 / Math.PI) * Math.asin((p1.y - p2.y) / _58ee);
- if (angle < 0) {
- if (p2.x < p1.x) {
- angle = Math.abs(angle) + 180;
- } else {
- angle = 360 - Math.abs(angle);
- }
- } else {
- if (p2.x < p1.x) {
- angle = 180 - angle;
- }
- }
- return angle;
- };
- draw2d.Connection.prototype.fireSourcePortRouteEvent = function() {
- var _58f0 = this.sourcePort.getConnections();
- for ( var i = 0; i < _58f0.getSize(); i++) {
- _58f0.get(i).paint();
- }
- };
- draw2d.Connection.prototype.fireTargetPortRouteEvent = function() {
- var _58f2 = this.targetPort.getConnections();
- for ( var i = 0; i < _58f2.getSize(); i++) {
- _58f2.get(i).paint();
- }
- };
- draw2d.Connection.prototype.createCommand = function(_58f4) {
- if (_58f4.getPolicy() == draw2d.EditPolicy.MOVE) {
- return new draw2d.CommandReconnect(this);
- }
- if (_58f4.getPolicy() == draw2d.EditPolicy.DELETE) {
- if (this.isDeleteable() == true) {
- return new draw2d.CommandDelete(this);
- }
- return null;
- }
- return null;
- };
- draw2d.ConnectionAnchor = function(owner) {
- this.owner = owner;
- };
- draw2d.ConnectionAnchor.prototype.type = "draw2d.ConnectionAnchor";
- draw2d.ConnectionAnchor.prototype.getLocation = function(_5901) {
- return this.getReferencePoint();
- };
- draw2d.ConnectionAnchor.prototype.getOwner = function() {
- return this.owner;
- };
- draw2d.ConnectionAnchor.prototype.setOwner = function(owner) {
- this.owner = owner;
- };
- draw2d.ConnectionAnchor.prototype.getBox = function() {
- return this.getOwner().getAbsoluteBounds();
- };
- draw2d.ConnectionAnchor.prototype.getReferencePoint = function() {
- if (this.getOwner() === null) {
- return null;
- } else {
- return this.getOwner().getAbsolutePosition();
- }
- };
- draw2d.ChopboxConnectionAnchor = function(owner) {
- draw2d.ConnectionAnchor.call(this, owner);
- };
- draw2d.ChopboxConnectionAnchor.prototype = new draw2d.ConnectionAnchor();
- draw2d.ChopboxConnectionAnchor.prototype.type = "draw2d.ChopboxConnectionAnchor";
- draw2d.ChopboxConnectionAnchor.prototype.getLocation = function(_5009) {
- var r = new draw2d.Dimension();
- r.setBounds(this.getBox());
- r.translate(-1, -1);
- r.resize(1, 1);
- var _500b = r.x + r.w / 2;
- var _500c = r.y + r.h / 2;
- if (r.isEmpty() || (_5009.x == _500b && _5009.y == _500c)) {
- return new Point(_500b, _500c);
- }
- var dx = _5009.x - _500b;
- var dy = _5009.y - _500c;
- var scale = 0.5 / Math.max(Math.abs(dx) / r.w, Math.abs(dy) / r.h);
- dx *= scale;
- dy *= scale;
- _500b += dx;
- _500c += dy;
- return new draw2d.Point(Math.round(_500b), Math.round(_500c));
- };
- draw2d.ChopboxConnectionAnchor.prototype.getBox = function() {
- return this.getOwner().getParent().getBounds();
- };
- draw2d.ChopboxConnectionAnchor.prototype.getReferencePoint = function() {
- return this.getBox().getCenter();
- };
- draw2d.ConnectionDecorator = function() {
- this.color = new draw2d.Color(0, 0, 0);
- this.backgroundColor = new draw2d.Color(250, 250, 250);
- };
- draw2d.ConnectionDecorator.prototype.type = "draw2d.ConnectionDecorator";
- draw2d.ConnectionDecorator.prototype.paint = function(g) {
- };
- draw2d.ConnectionDecorator.prototype.setColor = function(c) {
- this.color = c;
- };
- draw2d.ConnectionDecorator.prototype.setBackgroundColor = function(c) {
- this.backgroundColor = c;
- };
- draw2d.ArrowConnectionDecorator = function(_4b3e, width) {
- draw2d.ConnectionDecorator.call(this);
- if (_4b3e === undefined || _4b3e < 1) {
- this.lenght = 15;
- }
- if (width === undefined || width < 1) {
- this.width = 10;
- }
- };
- draw2d.ArrowConnectionDecorator.prototype = new draw2d.ConnectionDecorator();
- draw2d.ArrowConnectionDecorator.prototype.type = "draw2d.ArrowConnectionDecorator";
- draw2d.ArrowConnectionDecorator.prototype.paint = function(g) {
- if (this.backgroundColor !== null) {
- g.setColor(this.backgroundColor);
- g.fillPolygon( [ 3, this.lenght, this.lenght, 3 ], [ 0,
- (this.width / 2), -(this.width / 2), 0 ]);
- }
- g.setColor(this.color);
- g.setStroke(1);
- g.drawPolygon( [ 3, this.lenght, this.lenght, 3 ], [ 0, (this.width / 2),
- -(this.width / 2), 0 ]);
- };
- draw2d.ArrowConnectionDecorator.prototype.setDimension = function(l, width) {
- this.width = w;
- this.lenght = l;
- };
- draw2d.CompartmentFigure = function() {
- draw2d.Node.call(this);
- this.children = new draw2d.ArrayList();
- this.setBorder(new draw2d.LineBorder(1));
- this.dropable = new draw2d.DropTarget(this.html);
- this.dropable.node = this;
- this.dropable.addEventListener("figureenter", function(_4b0a) {
- _4b0a.target.node.onFigureEnter(_4b0a.relatedTarget.node);
- });
- this.dropable.addEventListener("figureleave", function(_4b0b) {
- _4b0b.target.node.onFigureLeave(_4b0b.relatedTarget.node);
- });
- this.dropable.addEventListener("figuredrop", function(_4b0c) {
- _4b0c.target.node.onFigureDrop(_4b0c.relatedTarget.node);
- });
- };
- draw2d.CompartmentFigure.prototype = new draw2d.Node();
- draw2d.CompartmentFigure.prototype.type = "draw2d.CompartmentFigure";
- draw2d.CompartmentFigure.prototype.onFigureEnter = function(_4b0d) {
- };
- draw2d.CompartmentFigure.prototype.onFigureLeave = function(_4b0e) {
- };
- draw2d.CompartmentFigure.prototype.onFigureDrop = function(_4b0f) {
- };
- draw2d.CompartmentFigure.prototype.getChildren = function() {
- return this.children;
- };
- draw2d.CompartmentFigure.prototype.addChild = function(_4b10) {
- _4b10.setZOrder(this.getZOrder() + 1);
- _4b10.setParent(this);
- this.children.add(_4b10);
- };
- draw2d.CompartmentFigure.prototype.removeChild = function(_4b11) {
- _4b11.setParent(null);
- this.children.remove(_4b11);
- };
- draw2d.CompartmentFigure.prototype.setZOrder = function(index) {
- draw2d.Node.prototype.setZOrder.call(this, index);
- for ( var i = 0; i < this.children.getSize(); i++) {
- this.children.get(i).setZOrder(index + 1);
- }
- };
- draw2d.CompartmentFigure.prototype.setPosition = function(xPos, yPos) {
-
- var oldX = this.getX();
- var oldY = this.getY();
- draw2d.Node.prototype.setPosition.call(this, xPos, yPos);
- for ( var i = 0; i < this.children.getSize(); i++) {
- var child = this.children.get(i);
- child.setPosition(child.getX() + this.getX() - oldX, child.getY()
- + this.getY() - oldY);
- }
- };
- draw2d.CompartmentFigure.prototype.onDrag = function() {
- var oldX = this.getX();
- var oldY = this.getY();
- draw2d.Node.prototype.onDrag.call(this);
- for ( var i = 0; i < this.children.getSize(); i++) {
- var child = this.children.get(i);
- child.setPosition(child.getX() + this.getX() - oldX, child.getY()
- + this.getY() - oldY);
- }
- };
- draw2d.CanvasDocument = function(_56a8) {
- this.canvas = _56a8;
- };
- draw2d.CanvasDocument.prototype.type = "draw2d.CanvasDocument";
- draw2d.CanvasDocument.prototype.getFigures = function() {
- var _56a9 = new draw2d.ArrayList();
- var _56aa = this.canvas.figures;
- var _56ab = this.canvas.dialogs;
- for ( var i = 0; i < _56aa.getSize(); i++) {
- var _56ad = _56aa.get(i);
- if (_56ab.indexOf(_56ad) == -1 && _56ad.getParent() === null
- && !(_56ad instanceof draw2d.WindowFigure)) {
- _56a9.add(_56ad);
- }
- }
- return _56a9;
- };
- draw2d.CanvasDocument.prototype.getFigure = function(id) {
- return this.canvas.getFigure(id);
- };
- draw2d.CanvasDocument.prototype.getLines = function() {
- return this.canvas.getLines();
- };
- draw2d.CanvasDocument.prototype.getLine = function(id) {
- return this.canvas.getLine(id);
- };
- draw2d.Annotation = function(msg) {
- this.msg = msg;
- this.alpha = 1;
- this.color = new draw2d.Color(0, 0, 0);
- this.bgColor = new draw2d.Color(241, 241, 121);
- this.fontSize = 10;
- this.textNode = null;
- draw2d.Figure.call(this);
- };
- draw2d.Annotation.prototype = new draw2d.Figure();
- draw2d.Annotation.prototype.type = "draw2d.Annotation";
- draw2d.Annotation.prototype.createHTMLElement = function() {
- var item = draw2d.Figure.prototype.createHTMLElement.call(this);
- item.style.color = this.color.getHTMLStyle();
- item.style.backgroundColor = this.bgColor.getHTMLStyle();
- item.style.fontSize = this.fontSize + "pt";
- item.style.width = "auto";
- item.style.height = "auto";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.onselectstart = function() {
- return false;
- };
- item.unselectable = "on";
- item.style.cursor = "default";
- this.textNode = document.createTextNode(this.msg);
- item.appendChild(this.textNode);
- this.disableTextSelection(item);
- return item;
- };
- draw2d.Annotation.prototype.onDoubleClick = function() {
- var _57d0 = new draw2d.AnnotationDialog(this);
- this.workflow.showDialog(_57d0);
- };
- draw2d.Annotation.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.bgColor !== null) {
- this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
- } else {
- this.html.style.backgroundColor = "transparent";
- }
- };
- draw2d.Annotation.prototype.getBackgroundColor = function() {
- return this.bgColor;
- };
- draw2d.Annotation.prototype.setFontSize = function(size) {
- this.fontSize = size;
- this.html.style.fontSize = this.fontSize + "pt";
- };
- draw2d.Annotation.prototype.getText = function() {
- return this.msg;
- };
- draw2d.Annotation.prototype.setText = function(text) {
- this.msg = text;
- this.html.removeChild(this.textNode);
- this.textNode = document.createTextNode(this.msg);
- this.html.appendChild(this.textNode);
- };
- draw2d.Annotation.prototype.setStyledText = function(text) {
- this.msg = text;
- this.html.removeChild(this.textNode);
- this.textNode = document.createElement("div");
- this.textNode.innerHTML = text;
- this.html.appendChild(this.textNode);
- };
- draw2d.ResizeHandle = function(_57e4, type) {
- draw2d.Rectangle.call(this, 5, 5);
- this.type = type;
- var _57e6 = this.getWidth();
- var _57e7 = _57e6 / 2;
- switch (this.type) {
- case 1:
- this.setSnapToGridAnchor(new draw2d.Point(_57e6, _57e6));
- break;
- case 2:
- this.setSnapToGridAnchor(new draw2d.Point(_57e7, _57e6));
- break;
- case 3:
- this.setSnapToGridAnchor(new draw2d.Point(0, _57e6));
- break;
- case 4:
- this.setSnapToGridAnchor(new draw2d.Point(0, _57e7));
- break;
- case 5:
- this.setSnapToGridAnchor(new draw2d.Point(0, 0));
- break;
- case 6:
- this.setSnapToGridAnchor(new draw2d.Point(_57e7, 0));
- break;
- case 7:
- this.setSnapToGridAnchor(new draw2d.Point(_57e6, 0));
- break;
- case 8:
- this.setSnapToGridAnchor(new draw2d.Point(_57e6, _57e7));
- case 9:
- this.setSnapToGridAnchor(new draw2d.Point(_57e7, _57e7));
- break;
- }
- this.setBackgroundColor(new draw2d.Color(0, 255, 0));
- this.setWorkflow(_57e4);
- this.setZOrder(10000);
- };
- draw2d.ResizeHandle.prototype = new draw2d.Rectangle();
- draw2d.ResizeHandle.prototype.type = "draw2d.ResizeHandle";
- draw2d.ResizeHandle.prototype.getSnapToDirection = function() {
- switch (this.type) {
- case 1:
- return draw2d.SnapToHelper.NORTH_WEST;
- case 2:
- return draw2d.SnapToHelper.NORTH;
- case 3:
- return draw2d.SnapToHelper.NORTH_EAST;
- case 4:
- return draw2d.SnapToHelper.EAST;
- case 5:
- return draw2d.SnapToHelper.SOUTH_EAST;
- case 6:
- return draw2d.SnapToHelper.SOUTH;
- case 7:
- return draw2d.SnapToHelper.SOUTH_WEST;
- case 8:
- return draw2d.SnapToHelper.WEST;
- case 9:
- return draw2d.SnapToHelper.CENTER;
- }
- };
- draw2d.ResizeHandle.prototype.onDragend = function() {
- var _57e8 = this.workflow.currentSelection;
- if (this.commandMove !== null) {
- this.commandMove.setPosition(_57e8.getX(), _57e8.getY());
- this.workflow.getCommandStack().execute(this.commandMove);
- this.commandMove = null;
- }
- if (this.commandResize !== null) {
- this.commandResize.setDimension(_57e8.getWidth(), _57e8.getHeight());
- this.workflow.getCommandStack().execute(this.commandResize);
- this.commandResize = null;
- }
- this.workflow.hideSnapToHelperLines();
- };
- draw2d.ResizeHandle.prototype.setPosition = function(xPos, yPos) {
- this.x = xPos;
- this.y = yPos;
- if (this.html === null) {
- return;
- }
- this.html.style.left = this.x + "px";
- this.html.style.top = this.y + "px";
- };
- draw2d.ResizeHandle.prototype.onDragstart = function(x, y) {
- if (!this.canDrag) {
- return false;
- }
- var _57ed = this.workflow.currentSelection;
- this.commandMove = _57ed.createCommand(new draw2d.EditPolicy(
- draw2d.EditPolicy.MOVE));
- this.commandResize = _57ed.createCommand(new draw2d.EditPolicy(
- draw2d.EditPolicy.RESIZE));
- return true;
- };
- draw2d.ResizeHandle.prototype.onDrag = function() {
- var oldX = this.getX();
- var oldY = this.getY();
- draw2d.Rectangle.prototype.onDrag.call(this);
- var diffX = oldX - this.getX();
- var diffY = oldY - this.getY();
- var _57f2 = this.workflow.currentSelection.getX();
- var _57f3 = this.workflow.currentSelection.getY();
- var _57f4 = this.workflow.currentSelection.getWidth();
- var _57f5 = this.workflow.currentSelection.getHeight();
- switch (this.type) {
- case 1:
- this.workflow.currentSelection
- .setPosition(_57f2 - diffX, _57f3 - diffY);
- this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5
- + diffY);
- break;
- case 2:
- this.workflow.currentSelection.setPosition(_57f2, _57f3 - diffY);
- this.workflow.currentSelection.setDimension(_57f4, _57f5 + diffY);
- break;
- case 3:
- this.workflow.currentSelection.setPosition(_57f2, _57f3 - diffY);
- this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5
- + diffY);
- break;
- case 4:
- this.workflow.currentSelection.setPosition(_57f2, _57f3);
- this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5);
- break;
- case 5:
- this.workflow.currentSelection.setPosition(_57f2, _57f3);
- this.workflow.currentSelection.setDimension(_57f4 - diffX, _57f5
- - diffY);
- break;
- case 6:
- this.workflow.currentSelection.setPosition(_57f2, _57f3);
- this.workflow.currentSelection.setDimension(_57f4, _57f5 - diffY);
- break;
- case 7:
- this.workflow.currentSelection.setPosition(_57f2 - diffX, _57f3);
- this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5
- - diffY);
- break;
- case 8:
- this.workflow.currentSelection.setPosition(_57f2 - diffX, _57f3);
- this.workflow.currentSelection.setDimension(_57f4 + diffX, _57f5);
- break;
- }
- this.workflow.moveResizeHandles(this.workflow.getCurrentSelection());
- };
- draw2d.ResizeHandle.prototype.setCanDrag = function(flag) {
- draw2d.Rectangle.prototype.setCanDrag.call(this, flag);
- if (this.html === null) {
- return;
- }
- if (!flag) {
- this.html.style.cursor = "";
- return;
- }
- switch (this.type) {
- case 1:
- this.html.style.cursor = "nw-resize";
- break;
- case 2:
- this.html.style.cursor = "s-resize";
- break;
- case 3:
- this.html.style.cursor = "ne-resize";
- break;
- case 4:
- this.html.style.cursor = "w-resize";
- break;
- case 5:
- this.html.style.cursor = "se-resize";
- break;
- case 6:
- this.html.style.cursor = "n-resize";
- break;
- case 7:
- this.html.style.cursor = "sw-resize";
- break;
- case 8:
- this.html.style.cursor = "e-resize";
- break;
- case 9:
- this.html.style.cursor = "resize";
- break;
- }
- };
- draw2d.ResizeHandle.prototype.onKeyDown = function(_57f7, ctrl) {
- this.workflow.onKeyDown(_57f7, ctrl);
- };
- draw2d.ResizeHandle.prototype.fireMoveEvent = function() {
- };
- draw2d.LineStartResizeHandle = function(_5b1e) {
- draw2d.ResizeHandle.call(this, _5b1e, 9);
- this.setDimension(10, 10);
- this.setBackgroundColor(new draw2d.Color(100, 255, 0));
- this.setZOrder(10000);
- };
- draw2d.LineStartResizeHandle.prototype = new draw2d.ResizeHandle();
- draw2d.LineStartResizeHandle.prototype.type = "draw2d.LineStartResizeHandle";
- draw2d.LineStartResizeHandle.prototype.onDragend = function() {
- if (this.workflow.currentSelection instanceof draw2d.Connection) {
- if (this.command !== null) {
- this.command.cancel();
- }
- } else {
- if (this.command !== null) {
- this.getWorkflow().getCommandStack().execute(this.command);
- }
- }
- this.command = null;
- };
- draw2d.LineStartResizeHandle.prototype.onDragstart = function(x, y) {
- if (!this.canDrag) {
- return false;
- }
- this.command = this.workflow.currentSelection
- .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
- return this.command !== null;
- };
- draw2d.LineStartResizeHandle.prototype.onDrag = function() {
- var oldX = this.getX();
- var oldY = this.getY();
- draw2d.Rectangle.prototype.onDrag.call(this);
- var diffX = oldX - this.getX();
- var diffY = oldY - this.getY();
- var _5b25 = this.workflow.currentSelection.getStartPoint();
- var line = this.workflow.currentSelection;
- line.setStartPoint(_5b25.x - diffX, _5b25.y - diffY);
- line.isMoving = true;
- };
- draw2d.LineStartResizeHandle.prototype.onDrop = function(_5b27) {
- var line = this.workflow.currentSelection;
- line.isMoving = false;
- if (line instanceof draw2d.Connection) {
- this.command.setNewPorts(_5b27, line.getTarget());
- this.getWorkflow().getCommandStack().execute(this.command);
- }
- this.command = null;
- };
- draw2d.LineEndResizeHandle = function(_58f5) {
- draw2d.ResizeHandle.call(this, _58f5, 9);
- this.setDimension(10, 10);
- this.setBackgroundColor(new draw2d.Color(0, 255, 0));
- this.setZOrder(10000);
- };
- draw2d.LineEndResizeHandle.prototype = new draw2d.ResizeHandle();
- draw2d.LineEndResizeHandle.prototype.type = "draw2d.LineEndResizeHandle";
- draw2d.LineEndResizeHandle.prototype.onDragend = function() {
- if (this.workflow.currentSelection instanceof draw2d.Connection) {
- if (this.command !== null) {
- this.command.cancel();
- }
- } else {
- if (this.command !== null) {
- this.workflow.getCommandStack().execute(this.command);
- }
- }
- this.command = null;
- };
- draw2d.LineEndResizeHandle.prototype.onDragstart = function(x, y) {
- if (!this.canDrag) {
- return false;
- }
- this.command = this.workflow.currentSelection
- .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
- return this.command !== null;
- };
- draw2d.LineEndResizeHandle.prototype.onDrag = function() {
- var oldX = this.getX();
- var oldY = this.getY();
- draw2d.Rectangle.prototype.onDrag.call(this);
- var diffX = oldX - this.getX();
- var diffY = oldY - this.getY();
- var _58fc = this.workflow.currentSelection.getEndPoint();
- var line = this.workflow.currentSelection;
- line.setEndPoint(_58fc.x - diffX, _58fc.y - diffY);
- line.isMoving = true;
- };
- draw2d.LineEndResizeHandle.prototype.onDrop = function(_58fe) {
- var line = this.workflow.currentSelection;
- line.isMoving = false;
- if (line instanceof draw2d.Connection) {
- this.command.setNewPorts(line.getSource(), _58fe);
- this.getWorkflow().getCommandStack().execute(this.command);
- }
- this.command = null;
- };
- draw2d.Canvas = function(_5020) {
- try {
- if (_5020) {
- this.construct(_5020);
- }
- this.enableSmoothFigureHandling = false;
- this.canvasLines = new draw2d.ArrayList();
- } catch (e) {
- pushErrorStack(e, "draw2d.Canvas=function(/*:String*/id)");
- }
- };
- draw2d.Canvas.IMAGE_BASE_URL = "";
- draw2d.Canvas.prototype.type = "draw2d.Canvas";
- draw2d.Canvas.prototype.construct = function(_5021) {
- this.canvasId = _5021;
- this.html = document.getElementById(this.canvasId);
- this.scrollArea = document.body.parentNode;
- };
- draw2d.Canvas.prototype.setViewPort = function(divId) {
- this.scrollArea = document.getElementById(divId);
- };
- draw2d.Canvas.prototype.addFigure = function(_5023, xPos, yPos, _5026) {
- try {
- if (this.enableSmoothFigureHandling === true) {
- if (_5023.timer <= 0) {
- _5023.setAlpha(0.001);
- }
- var _5027 = _5023;
- var _5028 = function() {
- if (_5027.alpha < 1) {
- _5027.setAlpha(Math.min(1, _5027.alpha + 0.05));
- } else {
- window.clearInterval(_5027.timer);
- _5027.timer = -1;
- }
- };
- if (_5027.timer > 0) {
- window.clearInterval(_5027.timer);
- }
- _5027.timer = window.setInterval(_5028, 30);
- }
- _5023.setCanvas(this);
- if (xPos && yPos) {
- _5023.setPosition(xPos, yPos);
- }
- if (_5023 instanceof draw2d.Line) {
- this.canvasLines.add(_5023);
- this.html.appendChild(_5023.getHTMLElement());
- } else {
- var obj = this.canvasLines.getFirstElement();
- if (obj === null) {
- this.html.appendChild(_5023.getHTMLElement());
- } else {
- this.html.insertBefore(_5023.getHTMLElement(), obj
- .getHTMLElement());
- }
- }
- if (!_5026) {
- _5023.paint();
- }
- } catch (e) {
- pushErrorStack(
- e,
- "draw2d.Canvas.prototype.addFigure= function( /*:draw2d.Figure*/figure,/*:int*/ xPos,/*:int*/ yPos, /*:boolean*/ avoidPaint)");
- }
- };
- draw2d.Canvas.prototype.removeFigure = function(_502a) {
- if (this.enableSmoothFigureHandling === true) {
- var oThis = this;
- var _502c = _502a;
- var _502d = function() {
- if (_502c.alpha > 0) {
- _502c.setAlpha(Math.max(0, _502c.alpha - 0.05));
- } else {
- window.clearInterval(_502c.timer);
- _502c.timer = -1;
- oThis.html.removeChild(_502c.html);
- _502c.setCanvas(null);
- }
- };
- if (_502c.timer > 0) {
- window.clearInterval(_502c.timer);
- }
- _502c.timer = window.setInterval(_502d, 20);
- } else {
- this.html.removeChild(_502a.html);
- _502a.setCanvas(null);
- }
- if (_502a instanceof draw2d.Line) {
- this.canvasLines.remove(_502a);
- }
- };
- draw2d.Canvas.prototype.getEnableSmoothFigureHandling = function() {
- return this.enableSmoothFigureHandling;
- };
- draw2d.Canvas.prototype.setEnableSmoothFigureHandling = function(flag) {
- this.enableSmoothFigureHandling = flag;
- };
- draw2d.Canvas.prototype.getWidth = function() {
- return parseInt(this.html.style.width);
- };
- draw2d.Canvas.prototype.setWidth = function(width) {
- if (this.scrollArea !== null) {
- this.scrollArea.style.width = width + "px";
- } else {
- this.html.style.width = width + "px";
- }
- };
- draw2d.Canvas.prototype.getHeight = function() {
- return parseInt(this.html.style.height);
- };
- draw2d.Canvas.prototype.setHeight = function(_5030) {
- if (this.scrollArea !== null) {
- this.scrollArea.style.height = _5030 + "px";
- } else {
- this.html.style.height = _5030 + "px";
- }
- };
- draw2d.Canvas.prototype.setBackgroundImage = function(_5031, _5032) {
- if (_5031 !== null) {
- if (_5032) {
- this.html.style.background = "transparent url(" + _5031 + ") ";
- } else {
- this.html.style.background = "transparent url(" + _5031
- + ") no-repeat";
- }
- } else {
- this.html.style.background = "transparent";
- }
- };
- draw2d.Canvas.prototype.getY = function() {
- return this.y;
- };
- draw2d.Canvas.prototype.getX = function() {
- return this.x;
- };
- draw2d.Canvas.prototype.getAbsoluteY = function() {
- var el = this.html;
- var ot = el.offsetTop;
- while ((el = el.offsetParent) !== null) {
- ot += el.offsetTop;
- }
- return ot;
- };
- draw2d.Canvas.prototype.getAbsoluteX = function() {
- var el = this.html;
- var ol = el.offsetLeft;
- while ((el = el.offsetParent) !== null) {
- ol += el.offsetLeft;
- }
- return ol;
- };
- draw2d.Canvas.prototype.getScrollLeft = function() {
- return this.scrollArea.scrollLeft;
- };
- draw2d.Canvas.prototype.getScrollTop = function() {
- return this.scrollArea.scrollTop;
- };
- draw2d.Workflow = function(id) {
- try {
- if (!id) {
- return;
- }
- this.menu = null;
- this.gridWidthX = 10;
- this.gridWidthY = 10;
- this.snapToGridHelper = null;
- this.verticalSnapToHelperLine = null;
- this.horizontalSnapToHelperLine = null;
- this.snapToGeometryHelper = null;
- this.figures = new draw2d.ArrayList();
- this.lines = new draw2d.ArrayList();
- this.commonPorts = new draw2d.ArrayList();
- this.dropTargets = new draw2d.ArrayList();
- this.compartments = new draw2d.ArrayList();
- this.selectionListeners = new draw2d.ArrayList();
- this.dialogs = new draw2d.ArrayList();
- this.toolPalette = null;
- this.dragging = false;
- this.tooltip = null;
- this.draggingLine = null;
- this.draggingLineCommand = null;
- this.commandStack = new draw2d.CommandStack();
- this.oldScrollPosLeft = 0;
- this.oldScrollPosTop = 0;
- this.currentSelection = null;
- this.currentMenu = null;
- this.connectionLine = new draw2d.Line();
- this.resizeHandleStart = new draw2d.LineStartResizeHandle(this);
- this.resizeHandleEnd = new draw2d.LineEndResizeHandle(this);
- this.resizeHandle1 = new draw2d.ResizeHandle(this, 1);
- this.resizeHandle2 = new draw2d.ResizeHandle(this, 2);
- this.resizeHandle3 = new draw2d.ResizeHandle(this, 3);
- this.resizeHandle4 = new draw2d.ResizeHandle(this, 4);
- this.resizeHandle5 = new draw2d.ResizeHandle(this, 5);
- this.resizeHandle6 = new draw2d.ResizeHandle(this, 6);
- this.resizeHandle7 = new draw2d.ResizeHandle(this, 7);
- this.resizeHandle8 = new draw2d.ResizeHandle(this, 8);
- this.resizeHandleHalfWidth = parseInt(this.resizeHandle2.getWidth() / 2);
- draw2d.Canvas.call(this, id);
- this.setPanning(false);
- if (this.html !== null) {
- this.html.style.backgroundImage = "url(grid_10.png)";
- this.html.className = "Workflow";
- oThis = this;
- this.html.tabIndex = "0";
- var _4a24 = function() {
- var _4a25 = arguments[0] || window.event;
- _4a25.cancelBubble = true;
- _4a25.returnValue = false;
- _4a25.stopped = true;
- var diffX = _4a25.clientX;
- var diffY = _4a25.clientY;
- var _4a28 = oThis.getScrollLeft();
- var _4a29 = oThis.getScrollTop();
- var _4a2a = oThis.getAbsoluteX();
- var _4a2b = oThis.getAbsoluteY();
- var line = oThis.getBestLine(diffX + _4a28 - _4a2a, diffY
- + _4a29 - _4a2b, null);
- if (line !== null) {
- line.onContextMenu(diffX + _4a28 - _4a2a, diffY + _4a29
- - _4a2b);
- } else {
- oThis.onContextMenu(diffX + _4a28 - _4a2a, diffY + _4a29
- - _4a2b);
- }
- };
- this.html.oncontextmenu = function() {
- return false;
- };
- var oThis = this;
- var _4a2e = function(event) {
- var ctrl = event.ctrlKey;
- oThis.onKeyDown(event.keyCode, ctrl);
- };
- var _4a31 = function() {
- var _4a32 = arguments[0] || window.event;
- if (_4a32.returnValue == false) {
- return;
- }
- var diffX = _4a32.clientX;
- var diffY = _4a32.clientY;
- var _4a35 = oThis.getScrollLeft();
- var _4a36 = oThis.getScrollTop();
- var _4a37 = oThis.getAbsoluteX();
- var _4a38 = oThis.getAbsoluteY();
- oThis.onMouseDown(diffX + _4a35 - _4a37, diffY + _4a36 - _4a38);
- };
- var _4a39 = function() {
- var _4a3a = arguments[0] || window.event;
- if (oThis.currentMenu !== null) {
- oThis.removeFigure(oThis.currentMenu);
- oThis.currentMenu = null;
- }
- if (_4a3a.button == 2) {
- return;
- }
- var diffX = _4a3a.clientX;
- var diffY = _4a3a.clientY;
- var _4a3d = oThis.getScrollLeft();
- var _4a3e = oThis.getScrollTop();
- var _4a3f = oThis.getAbsoluteX();
- var _4a40 = oThis.getAbsoluteY();
- oThis.onMouseUp(diffX + _4a3d - _4a3f, diffY + _4a3e - _4a40);
- };
- var _4a41 = function() {
- var _4a42 = arguments[0] || window.event;
- var diffX = _4a42.clientX;
- var diffY = _4a42.clientY;
- var _4a45 = oThis.getScrollLeft();
- var _4a46 = oThis.getScrollTop();
- var _4a47 = oThis.getAbsoluteX();
- var _4a48 = oThis.getAbsoluteY();
- oThis.currentMouseX = diffX + _4a45 - _4a47;
- oThis.currentMouseY = diffY + _4a46 - _4a48;
- var obj = oThis.getBestFigure(oThis.currentMouseX,
- oThis.currentMouseY);
- if (draw2d.Drag.currentHover !== null && obj === null) {
- var _4a4a = new draw2d.DragDropEvent();
- _4a4a.initDragDropEvent("mouseleave", false, oThis);
- draw2d.Drag.currentHover.dispatchEvent(_4a4a);
- } else {
- var diffX = _4a42.clientX;
- var diffY = _4a42.clientY;
- var _4a45 = oThis.getScrollLeft();
- var _4a46 = oThis.getScrollTop();
- var _4a47 = oThis.getAbsoluteX();
- var _4a48 = oThis.getAbsoluteY();
- oThis.onMouseMove(diffX + _4a45 - _4a47, diffY + _4a46
- - _4a48);
- }
- if (obj === null) {
- draw2d.Drag.currentHover = null;
- }
- if (oThis.tooltip !== null) {
- if (Math.abs(oThis.currentTooltipX - oThis.currentMouseX) > 10
- || Math.abs(oThis.currentTooltipY
- - oThis.currentMouseY) > 10) {
- oThis.showTooltip(null);
- }
- }
- };
- var _4a4b = function(_4a4c) {
- var _4a4c = arguments[0] || window.event;
- var diffX = _4a4c.clientX;
- var diffY = _4a4c.clientY;
- var _4a4f = oThis.getScrollLeft();
- var _4a50 = oThis.getScrollTop();
- var _4a51 = oThis.getAbsoluteX();
- var _4a52 = oThis.getAbsoluteY();
- var line = oThis.getBestLine(diffX + _4a4f - _4a51, diffY
- + _4a50 - _4a52, null);
- if (line !== null) {
- line.onDoubleClick();
- }
- };
- if (this.html.addEventListener) {
- this.html.addEventListener("contextmenu", _4a24, false);
- this.html.addEventListener("mousemove", _4a41, false);
- this.html.addEventListener("mouseup", _4a39, false);
- this.html.addEventListener("mousedown", _4a31, false);
- this.html.addEventListener("keydown", _4a2e, false);
- this.html.addEventListener("dblclick", _4a4b, false);
- } else {
- if (this.html.attachEvent) {
- this.html.attachEvent("oncontextmenu", _4a24);
- this.html.attachEvent("onmousemove", _4a41);
- this.html.attachEvent("onmousedown", _4a31);
- this.html.attachEvent("onmouseup", _4a39);
- this.html.attachEvent("onkeydown", _4a2e);
- this.html.attachEvent("ondblclick", _4a4b);
- } else {
- throw "Open-jACOB Draw2D not supported in this browser.";
- }
- }
- }
- } catch (e) {
- pushErrorStack(e, "draw2d.Workflow=function(/*:String*/id)");
- }
- };
- draw2d.Workflow.prototype = new draw2d.Canvas();
- draw2d.Workflow.prototype.type = "draw2d.Workflow";
- draw2d.Workflow.COLOR_GREEN = new draw2d.Color(0, 255, 0);
- draw2d.Workflow.prototype.clear = function() {
- this.scrollTo(0, 0, true);
- this.gridWidthX = 10;
- this.gridWidthY = 10;
- this.snapToGridHelper = null;
- this.verticalSnapToHelperLine = null;
- this.horizontalSnapToHelperLine = null;
- var _4a54 = this.getDocument();
- var _4a55 = _4a54.getLines().clone();
- for ( var i = 0; i < _4a55.getSize(); i++) {
- (new draw2d.CommandDelete(_4a55.get(i))).execute();
- }
- var _4a57 = _4a54.getFigures().clone();
- for ( var i = 0; i < _4a57.getSize(); i++) {
- (new draw2d.CommandDelete(_4a57.get(i))).execute();
- }
- this.commonPorts.removeAllElements();
- this.dropTargets.removeAllElements();
- this.compartments.removeAllElements();
- this.selectionListeners.removeAllElements();
- this.dialogs.removeAllElements();
- this.commandStack = new draw2d.CommandStack();
- this.currentSelection = null;
- this.currentMenu = null;
- draw2d.Drag.clearCurrent();
- };
- draw2d.Workflow.prototype.onScroll = function() {
- var _4a58 = this.getScrollLeft();
- var _4a59 = this.getScrollTop();
- var _4a5a = _4a58 - this.oldScrollPosLeft;
- var _4a5b = _4a59 - this.oldScrollPosTop;
- for ( var i = 0; i < this.figures.getSize(); i++) {
- var _4a5d = this.figures.get(i);
- if (_4a5d.hasFixedPosition && _4a5d.hasFixedPosition() == true) {
- _4a5d.setPosition(_4a5d.getX() + _4a5a, _4a5d.getY() + _4a5b);
- }
- }
- this.oldScrollPosLeft = _4a58;
- this.oldScrollPosTop = _4a59;
- };
- draw2d.Workflow.prototype.setPanning = function(flag) {
- this.panning = flag;
- if (flag) {
- this.html.style.cursor = "move";
- } else {
- this.html.style.cursor = "default";
- }
- };
- draw2d.Workflow.prototype.scrollTo = function(x, y, fast) {
- if (fast) {
- this.scrollArea.scrollLeft = x;
- this.scrollArea.scrollTop = y;
- } else {
- var steps = 40;
- var xStep = (x - this.getScrollLeft()) / steps;
- var yStep = (y - this.getScrollTop()) / steps;
- var oldX = this.getScrollLeft();
- var oldY = this.getScrollTop();
- for ( var i = 0; i < steps; i++) {
- this.scrollArea.scrollLeft = oldX + (xStep * i);
- this.scrollArea.scrollTop = oldY + (yStep * i);
- }
- }
- };
- draw2d.Workflow.prototype.showTooltip = function(_4a68, _4a69) {
- if (this.tooltip !== null) {
- this.removeFigure(this.tooltip);
- this.tooltip = null;
- if (this.tooltipTimer >= 0) {
- window.clearTimeout(this.tooltipTimer);
- this.tooltipTimer = -1;
- }
- }
- this.tooltip = _4a68;
- if (this.tooltip !== null) {
- this.currentTooltipX = this.currentMouseX;
- this.currentTooltipY = this.currentMouseY;
- this.addFigure(this.tooltip, this.currentTooltipX + 10,
- this.currentTooltipY + 10);
- var oThis = this;
- var _4a6b = function() {
- oThis.tooltipTimer = -1;
- oThis.showTooltip(null);
- };
- if (_4a69 == true) {
- this.tooltipTimer = window.setTimeout(_4a6b, 5000);
- }
- }
- };
- draw2d.Workflow.prototype.showDialog = function(_4a6c, xPos, yPos) {
- if (xPos) {
- this.addFigure(_4a6c, xPos, yPos);
- } else {
- this.addFigure(_4a6c, 200, 100);
- }
- this.dialogs.add(_4a6c);
- };
- draw2d.Workflow.prototype.showMenu = function(menu, xPos, yPos) {
- if (this.menu !== null) {
- this.html.removeChild(this.menu.getHTMLElement());
- this.menu.setWorkflow();
- }
- this.menu = menu;
- if (this.menu !== null) {
- this.menu.setWorkflow(this);
- this.menu.setPosition(xPos, yPos);
- this.html.appendChild(this.menu.getHTMLElement());
- this.menu.paint();
- }
- };
- draw2d.Workflow.prototype.onContextMenu = function(x, y) {
- var menu = this.getContextMenu();
- if (menu !== null) {
- this.showMenu(menu, x, y);
- }
- };
- draw2d.Workflow.prototype.getContextMenu = function() {
- return null;
- };
- draw2d.Workflow.prototype.setToolWindow = function(_4a75, x, y) {
- this.toolPalette = _4a75;
- if (y) {
- this.addFigure(_4a75, x, y);
- } else {
- this.addFigure(_4a75, 20, 20);
- }
- this.dialogs.add(_4a75);
- };
- draw2d.Workflow.prototype.setSnapToGrid = function(flag) {
- if (flag) {
- this.snapToGridHelper = new draw2d.SnapToGrid(this);
- } else {
- this.snapToGridHelper = null;
- }
- };
- draw2d.Workflow.prototype.setSnapToGeometry = function(flag) {
- if (flag) {
- this.snapToGeometryHelper = new draw2d.SnapToGeometry(this);
- } else {
- this.snapToGeometryHelper = null;
- }
- };
- draw2d.Workflow.prototype.setGridWidth = function(dx, dy) {
- this.gridWidthX = dx;
- this.gridWidthY = dy;
- };
- draw2d.Workflow.prototype.addFigure = function(_4a7c, xPos, yPos) {
- try {
- draw2d.Canvas.prototype.addFigure.call(this, _4a7c, xPos, yPos, true);
- _4a7c.setWorkflow(this);
- var _4a7f = this;
- if (_4a7c instanceof draw2d.CompartmentFigure) {
- this.compartments.add(_4a7c);
- }
- if (_4a7c instanceof draw2d.Line) {
- this.lines.add(_4a7c);
- } else {
- this.figures.add(_4a7c);
- _4a7c.draggable.addEventListener("drag", function(_4a80) {
- var _4a81 = _4a7f.getFigure(_4a80.target.element.id);
- if (_4a81 === null) {
- return;
- }
- if (_4a81.isSelectable() == false) {
- return;
- }
- _4a7f.moveResizeHandles(_4a81);
- });
- }
- _4a7c.paint();
- this.setDocumentDirty();
- } catch (e) {
- pushErrorStack(
- e,
- "draw2d.Workflow.prototype.addFigure=function(/*:draw2d.Figure*/ figure ,/*:int*/ xPos, /*:int*/ yPos)");
- }
- };
- draw2d.Workflow.prototype.removeFigure = function(_4a82) {
- draw2d.Canvas.prototype.removeFigure.call(this, _4a82);
- this.figures.remove(_4a82);
- this.lines.remove(_4a82);
- this.dialogs.remove(_4a82);
- _4a82.setWorkflow(null);
- if (_4a82 instanceof draw2d.CompartmentFigure) {
- this.compartments.remove(_4a82);
- }
- if (_4a82 instanceof draw2d.Connection) {
- _4a82.disconnect();
- }
- if (this.currentSelection == _4a82) {
- this.setCurrentSelection(null);
- }
- this.setDocumentDirty();
- _4a82.onRemove(this);
- };
- draw2d.Workflow.prototype.moveFront = function(_4a83) {
- this.html.removeChild(_4a83.getHTMLElement());
- this.html.appendChild(_4a83.getHTMLElement());
- };
- draw2d.Workflow.prototype.moveBack = function(_4a84) {
- this.html.removeChild(_4a84.getHTMLElement());
- this.html.insertBefore(_4a84.getHTMLElement(), this.html.firstChild);
- };
- draw2d.Workflow.prototype.getBestCompartmentFigure = function(x, y, _4a87) {
- var _4a88 = null;
- for ( var i = 0; i < this.figures.getSize(); i++) {
- var _4a8a = this.figures.get(i);
- if ((_4a8a instanceof draw2d.CompartmentFigure)
- && _4a8a.isOver(x, y) == true && _4a8a != _4a87) {
- if (_4a88 === null) {
- _4a88 = _4a8a;
- } else {
- if (_4a88.getZOrder() < _4a8a.getZOrder()) {
- _4a88 = _4a8a;
- }
- }
- }
- }
- return _4a88;
- };
- draw2d.Workflow.prototype.getBestFigure = function(x, y, _4a8d) {
- var _4a8e = null;
- for ( var i = 0; i < this.figures.getSize(); i++) {
- var _4a90 = this.figures.get(i);
- if (_4a90.isOver(x, y) == true && _4a90 != _4a8d) {
- if (_4a8e === null) {
- _4a8e = _4a90;
- } else {
- if (_4a8e.getZOrder() < _4a90.getZOrder()) {
- _4a8e = _4a90;
- }
- }
- }
- }
- return _4a8e;
- };
- draw2d.Workflow.prototype.getBestLine = function(x, y, _4a93) {
- var _4a94 = null;
- var count = this.lines.getSize();
- for ( var i = 0; i < count; i++) {
- var line = this.lines.get(i);
- if (line.containsPoint(x, y) == true && line != _4a93) {
- if (_4a94 === null) {
- _4a94 = line;
- } else {
- if (_4a94.getZOrder() < line.getZOrder()) {
- _4a94 = line;
- }
- }
- }
- }
- return _4a94;
- };
- draw2d.Workflow.prototype.getFigure = function(id) {
- for ( var i = 0; i < this.figures.getSize(); i++) {
- var _4a9a = this.figures.get(i);
- if (_4a9a.id == id) {
- return _4a9a;
- }
- }
- return null;
- };
- draw2d.Workflow.prototype.getFigures = function() {
- return this.figures;
- };
- draw2d.Workflow.prototype.getDocument = function() {
- return new draw2d.CanvasDocument(this);
- };
- draw2d.Workflow.prototype.addSelectionListener = function(w) {
- if (w !== null) {
- if (w.onSelectionChanged) {
- this.selectionListeners.add(w);
- } else {
- throw "Object doesn't implement required callback method [onSelectionChanged]";
- }
- }
- };
- draw2d.Workflow.prototype.removeSelectionListener = function(w) {
- this.selectionListeners.remove(w);
- };
- draw2d.Workflow.prototype.setCurrentSelection = function(_4a9d) {
- if (_4a9d === null || this.currentSelection != _4a9d) {
- this.hideResizeHandles();
- this.hideLineResizeHandles();
- }
- this.currentSelection = _4a9d;
- for ( var i = 0; i < this.selectionListeners.getSize(); i++) {
- var w = this.selectionListeners.get(i);
- if (w.onSelectionChanged) {
- w.onSelectionChanged(this.currentSelection,
- this.currentSelection ? this.currentSelection.getModel()
- : null);
- }
- }
- if (_4a9d instanceof draw2d.Line) {
- this.showLineResizeHandles(_4a9d);
- if (!(_4a9d instanceof draw2d.Connection)) {
- this.draggingLineCommand = line
- .createCommand(new draw2d.EditPolicy(draw2d.EditPolicy.MOVE));
- if (this.draggingLineCommand !== null) {
- this.draggingLine = _4a9d;
- }
- }
- }
- };
- draw2d.Workflow.prototype.getCurrentSelection = function() {
- return this.currentSelection;
- };
- draw2d.Workflow.prototype.getLine = function(id) {
- var count = this.lines.getSize();
- for ( var i = 0; i < count; i++) {
- var line = this.lines.get(i);
- if (line.getId() == id) {
- return line;
- }
- }
- return null;
- };
- draw2d.Workflow.prototype.getLines = function() {
- return this.lines;
- };
- draw2d.Workflow.prototype.registerPort = function(port) {
- port.draggable.targets = this.dropTargets;
- this.commonPorts.add(port);
- this.dropTargets.add(port.dropable);
- };
- draw2d.Workflow.prototype.unregisterPort = function(port) {
- port.draggable.targets = null;
- this.commonPorts.remove(port);
- this.dropTargets.remove(port.dropable);
- };
- draw2d.Workflow.prototype.getCommandStack = function() {
- return this.commandStack;
- };
- draw2d.Workflow.prototype.showConnectionLine = function(x1, y1, x2, y2) {
- this.connectionLine.setStartPoint(x1, y1);
- this.connectionLine.setEndPoint(x2, y2);
- if (this.connectionLine.canvas === null) {
- draw2d.Canvas.prototype.addFigure.call(this, this.connectionLine);
- }
- };
- draw2d.Workflow.prototype.hideConnectionLine = function() {
- if (this.connectionLine.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.connectionLine);
- }
- };
- draw2d.Workflow.prototype.showLineResizeHandles = function(_4aaa) {
- var _4aab = this.resizeHandleStart.getWidth() / 2;
- var _4aac = this.resizeHandleStart.getHeight() / 2;
- var _4aad = _4aaa.getStartPoint();
- var _4aae = _4aaa.getEndPoint();
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandleStart,
- _4aad.x - _4aab, _4aad.y - _4aab);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandleEnd, _4aae.x
- - _4aab, _4aae.y - _4aab);
- this.resizeHandleStart.setCanDrag(_4aaa.isResizeable());
- this.resizeHandleEnd.setCanDrag(_4aaa.isResizeable());
- if (_4aaa.isResizeable()) {
- this.resizeHandleStart.setBackgroundColor(draw2d.Workflow.COLOR_GREEN);
- this.resizeHandleEnd.setBackgroundColor(draw2d.Workflow.COLOR_GREEN);
- this.resizeHandleStart.draggable.targets = this.dropTargets;
- this.resizeHandleEnd.draggable.targets = this.dropTargets;
- } else {
- this.resizeHandleStart.setBackgroundColor(null);
- this.resizeHandleEnd.setBackgroundColor(null);
- }
- };
- draw2d.Workflow.prototype.hideLineResizeHandles = function() {
- if (this.resizeHandleStart.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandleStart);
- }
- if (this.resizeHandleEnd.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandleEnd);
- }
- };
- draw2d.Workflow.prototype.showResizeHandles = function(_4aaf) {
- this.hideLineResizeHandles();
- this.hideResizeHandles();
- if (this.getEnableSmoothFigureHandling() == true
- && this.getCurrentSelection() != _4aaf) {
- this.resizeHandle1.setAlpha(0.01);
- this.resizeHandle2.setAlpha(0.01);
- this.resizeHandle3.setAlpha(0.01);
- this.resizeHandle4.setAlpha(0.01);
- this.resizeHandle5.setAlpha(0.01);
- this.resizeHandle6.setAlpha(0.01);
- this.resizeHandle7.setAlpha(0.01);
- this.resizeHandle8.setAlpha(0.01);
- }
- var _4ab0 = this.resizeHandle1.getWidth();
- var _4ab1 = this.resizeHandle1.getHeight();
- var _4ab2 = _4aaf.getHeight();
- var _4ab3 = _4aaf.getWidth();
- var xPos = _4aaf.getX();
- var yPos = _4aaf.getY();
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle1, xPos
- - _4ab0, yPos - _4ab1);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle3, xPos
- + _4ab3, yPos - _4ab1);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle5, xPos
- + _4ab3, yPos + _4ab2);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle7, xPos
- - _4ab0, yPos + _4ab2);
- this.moveFront(this.resizeHandle1);
- this.moveFront(this.resizeHandle3);
- this.moveFront(this.resizeHandle5);
- this.moveFront(this.resizeHandle7);
- this.resizeHandle1.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle3.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle5.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle7.setCanDrag(_4aaf.isResizeable());
- if (_4aaf.isResizeable()) {
- var green = new draw2d.Color(0, 255, 0);
- this.resizeHandle1.setBackgroundColor(green);
- this.resizeHandle3.setBackgroundColor(green);
- this.resizeHandle5.setBackgroundColor(green);
- this.resizeHandle7.setBackgroundColor(green);
- } else {
- this.resizeHandle1.setBackgroundColor(null);
- this.resizeHandle3.setBackgroundColor(null);
- this.resizeHandle5.setBackgroundColor(null);
- this.resizeHandle7.setBackgroundColor(null);
- }
- if (_4aaf.isStrechable() && _4aaf.isResizeable()) {
- this.resizeHandle2.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle4.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle6.setCanDrag(_4aaf.isResizeable());
- this.resizeHandle8.setCanDrag(_4aaf.isResizeable());
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle2, xPos
- + (_4ab3 / 2) - this.resizeHandleHalfWidth, yPos - _4ab1);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle4, xPos
- + _4ab3, yPos + (_4ab2 / 2) - (_4ab1 / 2));
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle6, xPos
- + (_4ab3 / 2) - this.resizeHandleHalfWidth, yPos + _4ab2);
- draw2d.Canvas.prototype.addFigure.call(this, this.resizeHandle8, xPos
- - _4ab0, yPos + (_4ab2 / 2) - (_4ab1 / 2));
- this.moveFront(this.resizeHandle2);
- this.moveFront(this.resizeHandle4);
- this.moveFront(this.resizeHandle6);
- this.moveFront(this.resizeHandle8);
- }
- };
- draw2d.Workflow.prototype.hideResizeHandles = function() {
- if (this.resizeHandle1.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle1);
- }
- if (this.resizeHandle2.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle2);
- }
- if (this.resizeHandle3.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle3);
- }
- if (this.resizeHandle4.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle4);
- }
- if (this.resizeHandle5.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle5);
- }
- if (this.resizeHandle6.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle6);
- }
- if (this.resizeHandle7.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle7);
- }
- if (this.resizeHandle8.canvas !== null) {
- draw2d.Canvas.prototype.removeFigure.call(this, this.resizeHandle8);
- }
- };
- draw2d.Workflow.prototype.moveResizeHandles = function(_4ab7) {
- var _4ab8 = this.resizeHandle1.getWidth();
- var _4ab9 = this.resizeHandle1.getHeight();
- var _4aba = _4ab7.getHeight();
- var _4abb = _4ab7.getWidth();
- var xPos = _4ab7.getX();
- var yPos = _4ab7.getY();
- this.resizeHandle1.setPosition(xPos - _4ab8, yPos - _4ab9);
- this.resizeHandle3.setPosition(xPos + _4abb, yPos - _4ab9);
- this.resizeHandle5.setPosition(xPos + _4abb, yPos + _4aba);
- this.resizeHandle7.setPosition(xPos - _4ab8, yPos + _4aba);
- if (_4ab7.isStrechable()) {
- this.resizeHandle2.setPosition(xPos + (_4abb / 2)
- - this.resizeHandleHalfWidth, yPos - _4ab9);
- this.resizeHandle4.setPosition(xPos + _4abb, yPos + (_4aba / 2)
- - (_4ab9 / 2));
- this.resizeHandle6.setPosition(xPos + (_4abb / 2)
- - this.resizeHandleHalfWidth, yPos + _4aba);
- this.resizeHandle8.setPosition(xPos - _4ab8, yPos + (_4aba / 2)
- - (_4ab9 / 2));
- }
- };
- draw2d.Workflow.prototype.onMouseDown = function(x, y) {
- this.dragging = true;
- this.mouseDownPosX = x;
- this.mouseDownPosY = y;
- if (this.toolPalette !== null && this.toolPalette.getActiveTool() !== null) {
- this.toolPalette.getActiveTool().execute(x, y);
- }
- this.showMenu(null);
- var line = this.getBestLine(x, y);
- if (line !== null && line.isSelectable()) {
- this.setCurrentSelection(line);
- } else {
- this.setCurrentSelection(null);
- }
- };
- draw2d.Workflow.prototype.onMouseUp = function(x, y) {
- this.dragging = false;
- if (this.draggingLineCommand !== null) {
- this.getCommandStack().execute(this.draggingLineCommand);
- this.draggingLine = null;
- this.draggingLineCommand = null;
- }
- };
- draw2d.Workflow.prototype.onMouseMove = function(x, y) {
- if (this.dragging === true && this.draggingLine !== null) {
- var diffX = x - this.mouseDownPosX;
- var diffY = y - this.mouseDownPosY;
- this.draggingLine.startX = this.draggingLine.getStartX() + diffX;
- this.draggingLine.startY = this.draggingLine.getStartY() + diffY;
- this.draggingLine.setEndPoint(this.draggingLine.getEndX() + diffX,
- this.draggingLine.getEndY() + diffY);
- this.mouseDownPosX = x;
- this.mouseDownPosY = y;
- this.showLineResizeHandles(this.currentSelection);
- } else {
- if (this.dragging === true && this.panning === true) {
- var diffX = x - this.mouseDownPosX;
- var diffY = y - this.mouseDownPosY;
- this.scrollTo(this.getScrollLeft() - diffX, this.getScrollTop()
- - diffY, true);
- this.onScroll();
- }
- }
- };
- draw2d.Workflow.prototype.onKeyDown = function(_4ac7, ctrl) {
- if (_4ac7 == 46 && this.currentSelection !== null) {
- this.commandStack
- .execute(this.currentSelection
- .createCommand(new draw2d.EditPolicy(
- draw2d.EditPolicy.DELETE)));
- } else {
- if (_4ac7 == 90 && ctrl) {
- this.commandStack.undo();
- } else {
- if (_4ac7 == 89 && ctrl) {
- this.commandStack.redo();
- }
- }
- }
- };
- draw2d.Workflow.prototype.setDocumentDirty = function() {
- try {
- for ( var i = 0; i < this.dialogs.getSize(); i++) {
- var d = this.dialogs.get(i);
- if (d !== null && d.onSetDocumentDirty) {
- d.onSetDocumentDirty();
- }
- }
- if (this.snapToGeometryHelper !== null) {
- this.snapToGeometryHelper.onSetDocumentDirty();
- }
- if (this.snapToGridHelper !== null) {
- this.snapToGridHelper.onSetDocumentDirty();
- }
- } catch (e) {
- pushErrorStack(e,
- "draw2d.Workflow.prototype.setDocumentDirty=function()");
- }
- };
- draw2d.Workflow.prototype.snapToHelper = function(_4acb, pos) {
- if (this.snapToGeometryHelper !== null) {
- if (_4acb instanceof draw2d.ResizeHandle) {
- var _4acd = _4acb.getSnapToGridAnchor();
- pos.x += _4acd.x;
- pos.y += _4acd.y;
- var _4ace = new draw2d.Point(pos.x, pos.y);
- var _4acf = _4acb.getSnapToDirection();
- var _4ad0 = this.snapToGeometryHelper.snapPoint(_4acf, pos, _4ace);
- if ((_4acf & draw2d.SnapToHelper.EAST_WEST)
- && !(_4ad0 & draw2d.SnapToHelper.EAST_WEST)) {
- this.showSnapToHelperLineVertical(_4ace.x);
- } else {
- this.hideSnapToHelperLineVertical();
- }
- if ((_4acf & draw2d.SnapToHelper.NORTH_SOUTH)
- && !(_4ad0 & draw2d.SnapToHelper.NORTH_SOUTH)) {
- this.showSnapToHelperLineHorizontal(_4ace.y);
- } else {
- this.hideSnapToHelperLineHorizontal();
- }
- _4ace.x -= _4acd.x;
- _4ace.y -= _4acd.y;
- return _4ace;
- } else {
- var _4ad1 = new draw2d.Dimension(pos.x, pos.y, _4acb.getWidth(),
- _4acb.getHeight());
- var _4ace = new draw2d.Dimension(pos.x, pos.y, _4acb.getWidth(),
- _4acb.getHeight());
- var _4acf = draw2d.SnapToHelper.NSEW;
- var _4ad0 = this.snapToGeometryHelper.snapRectangle(_4ad1, _4ace);
- if ((_4acf & draw2d.SnapToHelper.WEST)
- && !(_4ad0 & draw2d.SnapToHelper.WEST)) {
- this.showSnapToHelperLineVertical(_4ace.x);
- } else {
- if ((_4acf & draw2d.SnapToHelper.EAST)
- && !(_4ad0 & draw2d.SnapToHelper.EAST)) {
- this.showSnapToHelperLineVertical(_4ace.getX()
- + _4ace.getWidth());
- } else {
- this.hideSnapToHelperLineVertical();
- }
- }
- if ((_4acf & draw2d.SnapToHelper.NORTH)
- && !(_4ad0 & draw2d.SnapToHelper.NORTH)) {
- this.showSnapToHelperLineHorizontal(_4ace.y);
- } else {
- if ((_4acf & draw2d.SnapToHelper.SOUTH)
- && !(_4ad0 & draw2d.SnapToHelper.SOUTH)) {
- this.showSnapToHelperLineHorizontal(_4ace.getY()
- + _4ace.getHeight());
- } else {
- this.hideSnapToHelperLineHorizontal();
- }
- }
- return _4ace.getTopLeft();
- }
- } else {
- if (this.snapToGridHelper !== null) {
- var _4acd = _4acb.getSnapToGridAnchor();
- pos.x = pos.x + _4acd.x;
- pos.y = pos.y + _4acd.y;
- var _4ace = new draw2d.Point(pos.x, pos.y);
- this.snapToGridHelper.snapPoint(0, pos, _4ace);
- _4ace.x = _4ace.x - _4acd.x;
- _4ace.y = _4ace.y - _4acd.y;
- return _4ace;
- }
- }
- return pos;
- };
- draw2d.Workflow.prototype.showSnapToHelperLineHorizontal = function(_4ad2) {
- if (this.horizontalSnapToHelperLine === null) {
- this.horizontalSnapToHelperLine = new draw2d.Line();
- this.horizontalSnapToHelperLine
- .setColor(new draw2d.Color(175, 175, 255));
- this.addFigure(this.horizontalSnapToHelperLine);
- }
- this.horizontalSnapToHelperLine.setStartPoint(0, _4ad2);
- this.horizontalSnapToHelperLine.setEndPoint(this.getWidth(), _4ad2);
- };
- draw2d.Workflow.prototype.showSnapToHelperLineVertical = function(_4ad3) {
- if (this.verticalSnapToHelperLine === null) {
- this.verticalSnapToHelperLine = new draw2d.Line();
- this.verticalSnapToHelperLine.setColor(new draw2d.Color(175, 175, 255));
- this.addFigure(this.verticalSnapToHelperLine);
- }
- this.verticalSnapToHelperLine.setStartPoint(_4ad3, 0);
- this.verticalSnapToHelperLine.setEndPoint(_4ad3, this.getHeight());
- };
- draw2d.Workflow.prototype.hideSnapToHelperLines = function() {
- this.hideSnapToHelperLineHorizontal();
- this.hideSnapToHelperLineVertical();
- };
- draw2d.Workflow.prototype.hideSnapToHelperLineHorizontal = function() {
- if (this.horizontalSnapToHelperLine !== null) {
- this.removeFigure(this.horizontalSnapToHelperLine);
- this.horizontalSnapToHelperLine = null;
- }
- };
- draw2d.Workflow.prototype.hideSnapToHelperLineVertical = function() {
- if (this.verticalSnapToHelperLine !== null) {
- this.removeFigure(this.verticalSnapToHelperLine);
- this.verticalSnapToHelperLine = null;
- }
- };
- draw2d.WindowFigure = function(title) {
- this.title = title;
- this.titlebar = null;
- draw2d.Figure.call(this);
- this.setDeleteable(false);
- this.setCanSnapToHelper(false);
- this.setZOrder(draw2d.WindowFigure.ZOrderIndex);
- };
- draw2d.WindowFigure.prototype = new draw2d.Figure();
- draw2d.WindowFigure.prototype.type = ":draw2d.WindowFigure";
- draw2d.WindowFigure.ZOrderIndex = 50000;
- draw2d.WindowFigure.setZOrderBaseIndex = function(index) {
- draw2d.WindowFigure.ZOrderBaseIndex = index;
- };
- draw2d.WindowFigure.prototype.hasFixedPosition = function() {
- return true;
- };
- draw2d.WindowFigure.prototype.hasTitleBar = function() {
- return true;
- };
- draw2d.WindowFigure.prototype.createHTMLElement = function() {
- var item = draw2d.Figure.prototype.createHTMLElement.call(this);
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.border = "1px solid black";
- item.style.backgroundImage = "url(window_bg.png)";
- item.style.zIndex = draw2d.WindowFigure.ZOrderIndex;
- item.style.cursor = null;
- item.className = "WindowFigure";
- if (this.hasTitleBar()) {
- this.titlebar = document.createElement("div");
- this.titlebar.style.position = "absolute";
- this.titlebar.style.left = "0px";
- this.titlebar.style.top = "0px";
- this.titlebar.style.width = this.getWidth() + "px";
- this.titlebar.style.height = "15px";
- this.titlebar.style.margin = "0px";
- this.titlebar.style.padding = "0px";
- this.titlebar.style.font = "normal 10px verdana";
- this.titlebar.style.backgroundColor = "blue";
- this.titlebar.style.borderBottom = "2px solid gray";
- this.titlebar.style.whiteSpace = "nowrap";
- this.titlebar.style.textAlign = "center";
- this.titlebar.style.backgroundImage = "url(window_toolbar.png)";
- this.titlebar.className = "WindowFigure_titlebar";
- this.textNode = document.createTextNode(this.title);
- this.titlebar.appendChild(this.textNode);
- this.disableTextSelection(this.titlebar);
- item.appendChild(this.titlebar);
- }
- return item;
- };
- draw2d.WindowFigure.prototype.setDocumentDirty = function(_566d) {
- };
- draw2d.WindowFigure.prototype.onDragend = function() {
- };
- draw2d.WindowFigure.prototype.onDragstart = function(x, y) {
- if (this.titlebar === null) {
- return false;
- }
- if (this.canDrag === true && x < parseInt(this.titlebar.style.width)
- && y < parseInt(this.titlebar.style.height)) {
- return true;
- }
- return false;
- };
- draw2d.WindowFigure.prototype.isSelectable = function() {
- return false;
- };
- draw2d.WindowFigure.prototype.setCanDrag = function(flag) {
- draw2d.Figure.prototype.setCanDrag.call(this, flag);
- this.html.style.cursor = "";
- if (this.titlebar === null) {
- return;
- }
- if (flag) {
- this.titlebar.style.cursor = "move";
- } else {
- this.titlebar.style.cursor = "";
- }
- };
- draw2d.WindowFigure.prototype.setWorkflow = function(_5671) {
- var _5672 = this.workflow;
- draw2d.Figure.prototype.setWorkflow.call(this, _5671);
- if (_5672 !== null) {
- _5672.removeSelectionListener(this);
- }
- if (this.workflow !== null) {
- this.workflow.addSelectionListener(this);
- }
- };
- draw2d.WindowFigure.prototype.setDimension = function(w, h) {
- draw2d.Figure.prototype.setDimension.call(this, w, h);
- if (this.titlebar !== null) {
- this.titlebar.style.width = this.getWidth() + "px";
- }
- };
- draw2d.WindowFigure.prototype.setTitle = function(title) {
- this.title = title;
- };
- draw2d.WindowFigure.prototype.getMinWidth = function() {
- return 50;
- };
- draw2d.WindowFigure.prototype.getMinHeight = function() {
- return 50;
- };
- draw2d.WindowFigure.prototype.isResizeable = function() {
- return false;
- };
- draw2d.WindowFigure.prototype.setAlpha = function(_5676) {
- };
- draw2d.WindowFigure.prototype.setBackgroundColor = function(color) {
- this.bgColor = color;
- if (this.bgColor !== null) {
- this.html.style.backgroundColor = this.bgColor.getHTMLStyle();
- } else {
- this.html.style.backgroundColor = "transparent";
- this.html.style.backgroundImage = "";
- }
- };
- draw2d.WindowFigure.prototype.setColor = function(color) {
- this.lineColor = color;
- if (this.lineColor !== null) {
- this.html.style.border = this.lineStroke + "px solid "
- + this.lineColor.getHTMLStyle();
- } else {
- this.html.style.border = "0px";
- }
- };
- draw2d.WindowFigure.prototype.setLineWidth = function(w) {
- this.lineStroke = w;
- this.html.style.border = this.lineStroke + "px solid black";
- };
- draw2d.WindowFigure.prototype.onSelectionChanged = function(_567a, model) {
- };
- draw2d.Button = function(_5544, width, _5546) {
- this.x = 0;
- this.y = 0;
- this.width = 24;
- this.height = 24;
- this.id = draw2d.UUID.create();
- this.enabled = true;
- this.active = false;
- this.palette = _5544;
- this.html = this.createHTMLElement();
- if (width !== undefined && _5546 !== undefined) {
- this.setDimension(width, _5546);
- } else {
- this.setDimension(24, 24);
- }
- };
- draw2d.Button.prototype.type = "draw2d.Button";
- draw2d.Button.prototype.dispose = function() {
- };
- draw2d.Button.prototype.getImageUrl = function() {
- return this.type + ".png";
- };
- draw2d.Button.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.height = this.width + "px";
- item.style.width = this.height + "px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.outline = "none";
- if (this.getImageUrl() !== null) {
- item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
- } else {
- item.style.backgroundImage = "";
- }
- var oThis = this;
- this.omousedown = function(event) {
- if (oThis.enabled) {
- oThis.setActive(true);
- }
- event.cancelBubble = true;
- event.returnValue = false;
- };
- this.omouseup = function(event) {
- if (oThis.enabled) {
- oThis.setActive(false);
- oThis.execute();
- oThis.palette.setActiveTool(null);
- }
- event.cancelBubble = true;
- event.returnValue = false;
- };
- if (item.addEventListener) {
- item.addEventListener("mousedown", this.omousedown, false);
- item.addEventListener("mouseup", this.omouseup, false);
- } else {
- if (item.attachEvent) {
- item.attachEvent("onmousedown", this.omousedown);
- item.attachEvent("onmouseup", this.omouseup);
- }
- }
- return item;
- };
- draw2d.Button.prototype.getHTMLElement = function() {
- if (this.html === null) {
- this.html = this.createHTMLElement();
- }
- return this.html;
- };
- draw2d.Button.prototype.execute = function() {
- };
- draw2d.Button.prototype.setTooltip = function(_554b) {
- this.tooltip = _554b;
- if (this.tooltip !== null) {
- this.html.title = this.tooltip;
- } else {
- this.html.title = "";
- }
- };
- draw2d.Button.prototype.getWorkflow = function() {
- return this.getToolPalette().getWorkflow();
- };
- draw2d.Button.prototype.getToolPalette = function() {
- return this.palette;
- };
- draw2d.Button.prototype.setActive = function(flag) {
- if (!this.enabled) {
- return;
- }
- this.active = flag;
- if (flag === true) {
- this.html.style.border = "1px inset";
- } else {
- this.html.style.border = "0px";
- }
- };
- draw2d.Button.prototype.isActive = function() {
- return this.active;
- };
- draw2d.Button.prototype.setEnabled = function(flag) {
- this.enabled = flag;
- if (flag) {
- this.html.style.filter = "alpha(opacity=100)";
- this.html.style.opacity = "1.0";
- } else {
- this.html.style.filter = "alpha(opacity=30)";
- this.html.style.opacity = "0.3";
- }
- };
- draw2d.Button.prototype.setDimension = function(w, h) {
- this.width = w;
- this.height = h;
- if (this.html === null) {
- return;
- }
- this.html.style.width = this.width + "px";
- this.html.style.height = this.height + "px";
- };
- draw2d.Button.prototype.setPosition = function(xPos, yPos) {
- this.x = Math.max(0, xPos);
- this.y = Math.max(0, yPos);
- if (this.html === null) {
- return;
- }
- this.html.style.left = this.x + "px";
- this.html.style.top = this.y + "px";
- };
- draw2d.Button.prototype.getWidth = function() {
- return this.width;
- };
- draw2d.Button.prototype.getHeight = function() {
- return this.height;
- };
- draw2d.Button.prototype.getY = function() {
- return this.y;
- };
- draw2d.Button.prototype.getX = function() {
- return this.x;
- };
- draw2d.Button.prototype.getPosition = function() {
- return new draw2d.Point(this.x, this.y);
- };
- draw2d.ToggleButton = function(_58b2) {
- draw2d.Button.call(this, _58b2);
- this.isDownFlag = false;
- };
- draw2d.ToggleButton.prototype = new draw2d.Button();
- draw2d.ToggleButton.prototype.type = "draw2d.ToggleButton";
- draw2d.ToggleButton.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.height = "24px";
- item.style.width = "24px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- if (this.getImageUrl() !== null) {
- item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
- } else {
- item.style.backgroundImage = "";
- }
- var oThis = this;
- this.omousedown = function(event) {
- if (oThis.enabled) {
- if (!oThis.isDown()) {
- draw2d.Button.prototype.setActive.call(oThis, true);
- }
- }
- event.cancelBubble = true;
- event.returnValue = false;
- };
- this.omouseup = function(event) {
- if (oThis.enabled) {
- if (oThis.isDown()) {
- draw2d.Button.prototype.setActive.call(oThis, false);
- }
- oThis.isDownFlag = !oThis.isDownFlag;
- oThis.execute();
- }
- event.cancelBubble = true;
- event.returnValue = false;
- };
- if (item.addEventListener) {
- item.addEventListener("mousedown", this.omousedown, false);
- item.addEventListener("mouseup", this.omouseup, false);
- } else {
- if (item.attachEvent) {
- item.attachEvent("onmousedown", this.omousedown);
- item.attachEvent("onmouseup", this.omouseup);
- }
- }
- return item;
- };
- draw2d.ToggleButton.prototype.isDown = function() {
- return this.isDownFlag;
- };
- draw2d.ToggleButton.prototype.setActive = function(flag) {
- draw2d.Button.prototype.setActive.call(this, flag);
- this.isDownFlag = flag;
- };
- draw2d.ToggleButton.prototype.execute = function() {
- };
- draw2d.ToolGeneric = function(_58a4) {
- this.x = 0;
- this.y = 0;
- this.enabled = true;
- this.tooltip = null;
- this.palette = _58a4;
- this.html = this.createHTMLElement();
- this.setDimension(10, 10);
- };
- draw2d.ToolGeneric.prototype.type = "draw2d.ToolGeneric";
- draw2d.ToolGeneric.prototype.dispose = function() {
- };
- draw2d.ToolGeneric.prototype.getImageUrl = function() {
- return this.type + ".png";
- };
- draw2d.ToolGeneric.prototype.getWorkflow = function() {
- return this.getToolPalette().getWorkflow();
- };
- draw2d.ToolGeneric.prototype.getToolPalette = function() {
- return this.palette;
- };
- draw2d.ToolGeneric.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.height = "24px";
- item.style.width = "24px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- if (this.getImageUrl() !== null) {
- item.style.backgroundImage = "url(" + this.getImageUrl() + ")";
- } else {
- item.style.backgroundImage = "";
- }
- var oThis = this;
- this.click = function(event) {
- if (oThis.enabled) {
- oThis.palette.setActiveTool(oThis);
- }
- event.cancelBubble = true;
- event.returnValue = false;
- };
- if (item.addEventListener) {
- item.addEventListener("click", this.click, false);
- } else {
- if (item.attachEvent) {
- item.attachEvent("onclick", this.click);
- }
- }
- if (this.tooltip !== null) {
- item.title = this.tooltip;
- } else {
- item.title = "";
- }
- return item;
- };
- draw2d.ToolGeneric.prototype.getHTMLElement = function() {
- if (this.html === null) {
- this.html = this.createHTMLElement();
- }
- return this.html;
- };
- draw2d.ToolGeneric.prototype.execute = function(x, y) {
- if (this.enabled) {
- this.palette.setActiveTool(null);
- }
- };
- draw2d.ToolGeneric.prototype.setTooltip = function(_58aa) {
- this.tooltip = _58aa;
- if (this.tooltip !== null) {
- this.html.title = this.tooltip;
- } else {
- this.html.title = "";
- }
- };
- draw2d.ToolGeneric.prototype.setActive = function(flag) {
- if (!this.enabled) {
- return;
- }
- if (flag === true) {
- this.html.style.border = "1px inset";
- } else {
- this.html.style.border = "0px";
- }
- };
- draw2d.ToolGeneric.prototype.setEnabled = function(flag) {
- this.enabled = flag;
- if (flag) {
- this.html.style.filter = "alpha(opacity=100)";
- this.html.style.opacity = "1.0";
- } else {
- this.html.style.filter = "alpha(opacity=30)";
- this.html.style.opacity = "0.3";
- }
- };
- draw2d.ToolGeneric.prototype.setDimension = function(w, h) {
- this.width = w;
- this.height = h;
- if (this.html === null) {
- return;
- }
- this.html.style.width = this.width + "px";
- this.html.style.height = this.height + "px";
- };
- draw2d.ToolGeneric.prototype.setPosition = function(xPos, yPos) {
- this.x = Math.max(0, xPos);
- this.y = Math.max(0, yPos);
- if (this.html === null) {
- return;
- }
- this.html.style.left = this.x + "px";
- this.html.style.top = this.y + "px";
- };
- draw2d.ToolGeneric.prototype.getWidth = function() {
- return this.width;
- };
- draw2d.ToolGeneric.prototype.getHeight = function() {
- return this.height;
- };
- draw2d.ToolGeneric.prototype.getY = function() {
- return this.y;
- };
- draw2d.ToolGeneric.prototype.getX = function() {
- return this.x;
- };
- draw2d.ToolGeneric.prototype.getPosition = function() {
- return new draw2d.Point(this.x, this.y);
- };
- draw2d.ToolPalette = function(title) {
- draw2d.WindowFigure.call(this, title);
- this.setDimension(75, 400);
- this.activeTool = null;
- this.children = {};
- };
- draw2d.ToolPalette.prototype = new draw2d.WindowFigure();
- draw2d.ToolPalette.prototype.type = "draw2d.ToolPalette";
- draw2d.ToolPalette.prototype.dispose = function() {
- draw2d.WindowFigure.prototype.dispose.call(this);
- };
- draw2d.ToolPalette.prototype.createHTMLElement = function() {
- var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
- this.scrollarea = document.createElement("div");
- this.scrollarea.style.position = "absolute";
- this.scrollarea.style.left = "0px";
- if (this.hasTitleBar()) {
- this.scrollarea.style.top = "15px";
- } else {
- this.scrollarea.style.top = "0px";
- }
- this.scrollarea.style.width = this.getWidth() + "px";
- this.scrollarea.style.height = "15px";
- this.scrollarea.style.margin = "0px";
- this.scrollarea.style.padding = "0px";
- this.scrollarea.style.font = "normal 10px verdana";
- this.scrollarea.style.borderBottom = "2px solid gray";
- this.scrollarea.style.whiteSpace = "nowrap";
- this.scrollarea.style.textAlign = "center";
- this.scrollarea.style.overflowX = "auto";
- this.scrollarea.style.overflowY = "auto";
- this.scrollarea.style.overflow = "auto";
- item.appendChild(this.scrollarea);
- return item;
- };
- draw2d.ToolPalette.prototype.setDimension = function(w, h) {
- draw2d.WindowFigure.prototype.setDimension.call(this, w, h);
- if (this.scrollarea !== null) {
- this.scrollarea.style.width = this.getWidth() + "px";
- if (this.hasTitleBar()) {
- this.scrollarea.style.height = (this.getHeight() - 15) + "px";
- } else {
- this.scrollarea.style.height = this.getHeight() + "px";
- }
- }
- };
- draw2d.ToolPalette.prototype.addChild = function(item) {
- this.children[item.id] = item;
- this.scrollarea.appendChild(item.getHTMLElement());
- };
- draw2d.ToolPalette.prototype.getChild = function(id) {
- return this.children[id];
- };
- draw2d.ToolPalette.prototype.getActiveTool = function() {
- return this.activeTool;
- };
- draw2d.ToolPalette.prototype.setActiveTool = function(tool) {
- if (this.activeTool != tool && this.activeTool !== null) {
- this.activeTool.setActive(false);
- }
- if (tool !== null) {
- tool.setActive(true);
- }
- this.activeTool = tool;
- };
- draw2d.Dialog = function(title) {
- this.buttonbar = null;
- if (title) {
- draw2d.WindowFigure.call(this, title);
- } else {
- draw2d.WindowFigure.call(this, "Dialog");
- }
- this.setDimension(400, 300);
- };
- draw2d.Dialog.prototype = new draw2d.WindowFigure();
- draw2d.Dialog.prototype.type = "draw2d.Dialog";
- draw2d.Dialog.prototype.createHTMLElement = function() {
- var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
- var oThis = this;
- this.buttonbar = document.createElement("div");
- this.buttonbar.style.position = "absolute";
- this.buttonbar.style.left = "0px";
- this.buttonbar.style.bottom = "0px";
- this.buttonbar.style.width = this.getWidth() + "px";
- this.buttonbar.style.height = "30px";
- this.buttonbar.style.margin = "0px";
- this.buttonbar.style.padding = "0px";
- this.buttonbar.style.font = "normal 10px verdana";
- this.buttonbar.style.backgroundColor = "#c0c0c0";
- this.buttonbar.style.borderBottom = "2px solid gray";
- this.buttonbar.style.whiteSpace = "nowrap";
- this.buttonbar.style.textAlign = "center";
- this.buttonbar.className = "Dialog_buttonbar";
- this.okbutton = document.createElement("button");
- this.okbutton.style.border = "1px solid gray";
- this.okbutton.style.font = "normal 10px verdana";
- this.okbutton.style.width = "80px";
- this.okbutton.style.margin = "5px";
- this.okbutton.className = "Dialog_okbutton";
- this.okbutton.innerHTML = "Ok";
- this.okbutton.onclick = function() {
- var error = null;
- try {
- oThis.onOk();
- } catch (e) {
- error = e;
- }
- oThis.workflow.removeFigure(oThis);
- if (error !== null) {
- throw error;
- }
- };
- this.buttonbar.appendChild(this.okbutton);
- this.cancelbutton = document.createElement("button");
- this.cancelbutton.innerHTML = "Cancel";
- this.cancelbutton.style.font = "normal 10px verdana";
- this.cancelbutton.style.border = "1px solid gray";
- this.cancelbutton.style.width = "80px";
- this.cancelbutton.style.margin = "5px";
- this.cancelbutton.className = "Dialog_cancelbutton";
- this.cancelbutton.onclick = function() {
- var error = null;
- try {
- oThis.onCancel();
- } catch (e) {
- error = e;
- }
- oThis.workflow.removeFigure(oThis);
- if (error !== null) {
- throw error;
- }
- };
- this.buttonbar.appendChild(this.cancelbutton);
- item.appendChild(this.buttonbar);
- return item;
- };
- draw2d.Dialog.prototype.onOk = function() {
- };
- draw2d.Dialog.prototype.onCancel = function() {
- };
- draw2d.Dialog.prototype.setDimension = function(w, h) {
- draw2d.WindowFigure.prototype.setDimension.call(this, w, h);
- if (this.buttonbar !== null) {
- this.buttonbar.style.width = this.getWidth() + "px";
- }
- };
- draw2d.Dialog.prototype.setWorkflow = function(_5af6) {
- draw2d.WindowFigure.prototype.setWorkflow.call(this, _5af6);
- this.setFocus();
- };
- draw2d.Dialog.prototype.setFocus = function() {
- };
- draw2d.Dialog.prototype.onSetDocumentDirty = function() {
- };
- draw2d.InputDialog = function() {
- draw2d.Dialog.call(this);
- this.setDimension(400, 100);
- };
- draw2d.InputDialog.prototype = new draw2d.Dialog();
- draw2d.InputDialog.prototype.type = "draw2d.InputDialog";
- draw2d.InputDialog.prototype.createHTMLElement = function() {
- var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
- return item;
- };
- draw2d.InputDialog.prototype.onOk = function() {
- this.workflow.removeFigure(this);
- };
- draw2d.InputDialog.prototype.onCancel = function() {
- this.workflow.removeFigure(this);
- };
- draw2d.PropertyDialog = function(_4b4f, _4b50, label) {
- this.figure = _4b4f;
- this.propertyName = _4b50;
- this.label = label;
- draw2d.Dialog.call(this);
- this.setDimension(400, 120);
- };
- draw2d.PropertyDialog.prototype = new draw2d.Dialog();
- draw2d.PropertyDialog.prototype.type = "draw2d.PropertyDialog";
- draw2d.PropertyDialog.prototype.createHTMLElement = function() {
- var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
- var _4b53 = document.createElement("form");
- _4b53.style.position = "absolute";
- _4b53.style.left = "10px";
- _4b53.style.top = "30px";
- _4b53.style.width = "375px";
- _4b53.style.font = "normal 10px verdana";
- item.appendChild(_4b53);
- this.labelDiv = document.createElement("div");
- this.labelDiv.innerHTML = this.label;
- this.disableTextSelection(this.labelDiv);
- _4b53.appendChild(this.labelDiv);
- this.input = document.createElement("input");
- this.input.style.border = "1px solid gray";
- this.input.style.font = "normal 10px verdana";
- this.input.type = "text";
- var value = this.figure.getProperty(this.propertyName);
- if (value) {
- this.input.value = value;
- } else {
- this.input.value = "";
- }
- this.input.style.width = "100%";
- _4b53.appendChild(this.input);
- this.input.focus();
- return item;
- };
- draw2d.PropertyDialog.prototype.onOk = function() {
- draw2d.Dialog.prototype.onOk.call(this);
- this.figure.setProperty(this.propertyName, this.input.value);
- };
- draw2d.AnnotationDialog = function(_57df) {
- this.figure = _57df;
- draw2d.Dialog.call(this);
- this.setDimension(400, 100);
- };
- draw2d.AnnotationDialog.prototype = new draw2d.Dialog();
- draw2d.AnnotationDialog.prototype.type = "draw2d.AnnotationDialog";
- draw2d.AnnotationDialog.prototype.createHTMLElement = function() {
- var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
- var _57e1 = document.createElement("form");
- _57e1.style.position = "absolute";
- _57e1.style.left = "10px";
- _57e1.style.top = "30px";
- _57e1.style.width = "375px";
- _57e1.style.font = "normal 10px verdana";
- item.appendChild(_57e1);
- this.label = document.createTextNode("Text");
- _57e1.appendChild(this.label);
- this.input = document.createElement("input");
- this.input.style.border = "1px solid gray";
- this.input.style.font = "normal 10px verdana";
- this.input.type = "text";
- var value = this.figure.getText();
- if (value) {
- this.input.value = value;
- } else {
- this.input.value = "";
- }
- this.input.style.width = "100%";
- _57e1.appendChild(this.input);
- this.input.focus();
- return item;
- };
- draw2d.AnnotationDialog.prototype.onOk = function() {
- this.workflow.getCommandStack().execute(
- new draw2d.CommandSetText(this.figure, this.input.value));
- this.workflow.removeFigure(this);
- };
- draw2d.PropertyWindow = function() {
- this.currentSelection = null;
- draw2d.WindowFigure.call(this, "Property Window");
- this.setDimension(200, 100);
- };
- draw2d.PropertyWindow.prototype = new draw2d.WindowFigure();
- draw2d.PropertyWindow.prototype.type = "draw2d.PropertyWindow";
- draw2d.PropertyWindow.prototype.dispose = function() {
- draw2d.WindowFigure.prototype.dispose.call(this);
- };
- draw2d.PropertyWindow.prototype.createHTMLElement = function() {
- var item = draw2d.WindowFigure.prototype.createHTMLElement.call(this);
- item.appendChild(this.createLabel("Type:", 15, 25));
- item.appendChild(this.createLabel("X :", 15, 50));
- item.appendChild(this.createLabel("Y :", 15, 70));
- item.appendChild(this.createLabel("Width :", 85, 50));
- item.appendChild(this.createLabel("Height :", 85, 70));
- this.labelType = this.createLabel("", 50, 25);
- this.labelX = this.createLabel("", 40, 50);
- this.labelY = this.createLabel("", 40, 70);
- this.labelWidth = this.createLabel("", 135, 50);
- this.labelHeight = this.createLabel("", 135, 70);
- this.labelType.style.fontWeight = "normal";
- this.labelX.style.fontWeight = "normal";
- this.labelY.style.fontWeight = "normal";
- this.labelWidth.style.fontWeight = "normal";
- this.labelHeight.style.fontWeight = "normal";
- item.appendChild(this.labelType);
- item.appendChild(this.labelX);
- item.appendChild(this.labelY);
- item.appendChild(this.labelWidth);
- item.appendChild(this.labelHeight);
- return item;
- };
- draw2d.PropertyWindow.prototype.onSelectionChanged = function(_4b56) {
- draw2d.WindowFigure.prototype.onSelectionChanged.call(this, _4b56);
- if (this.currentSelection !== null) {
- this.currentSelection.detachMoveListener(this);
- }
- this.currentSelection = _4b56;
- if (_4b56 !== null && _4b56 != this) {
- this.labelType.innerHTML = _4b56.type;
- if (_4b56.getX) {
- this.labelX.innerHTML = _4b56.getX();
- this.labelY.innerHTML = _4b56.getY();
- this.labelWidth.innerHTML = _4b56.getWidth();
- this.labelHeight.innerHTML = _4b56.getHeight();
- this.currentSelection = _4b56;
- this.currentSelection.attachMoveListener(this);
- } else {
- this.labelX.innerHTML = "";
- this.labelY.innerHTML = "";
- this.labelWidth.innerHTML = "";
- this.labelHeight.innerHTML = "";
- }
- } else {
- this.labelType.innerHTML = "<none>";
- this.labelX.innerHTML = "";
- this.labelY.innerHTML = "";
- this.labelWidth.innerHTML = "";
- this.labelHeight.innerHTML = "";
- }
- };
- draw2d.PropertyWindow.prototype.getCurrentSelection = function() {
- return this.currentSelection;
- };
- draw2d.PropertyWindow.prototype.onOtherFigureMoved = function(_4b57) {
- if (_4b57 == this.currentSelection) {
- this.onSelectionChanged(_4b57);
- }
- };
- draw2d.PropertyWindow.prototype.createLabel = function(text, x, y) {
- var l = document.createElement("div");
- l.style.position = "absolute";
- l.style.left = x + "px";
- l.style.top = y + "px";
- l.style.font = "normal 10px verdana";
- l.style.whiteSpace = "nowrap";
- l.style.fontWeight = "bold";
- l.innerHTML = text;
- return l;
- };
- draw2d.ColorDialog = function() {
- this.maxValue = {
- "h" : "359",
- "s" : "100",
- "v" : "100"
- };
- this.HSV = {
- 0 : 359,
- 1 : 100,
- 2 : 100
- };
- this.slideHSV = {
- 0 : 359,
- 1 : 100,
- 2 : 100
- };
- this.SVHeight = 165;
- this.wSV = 162;
- this.wH = 162;
- draw2d.Dialog.call(this, "Color Chooser");
- this.loadSV();
- this.setColor(new draw2d.Color(255, 0, 0));
- this.setDimension(219, 244);
- };
- draw2d.ColorDialog.prototype = new draw2d.Dialog();
- draw2d.ColorDialog.prototype.type = "draw2d.ColorDialog";
- draw2d.ColorDialog.prototype.createHTMLElement = function() {
- var oThis = this;
- var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
- this.outerDiv = document.createElement("div");
- this.outerDiv.id = "plugin";
- this.outerDiv.style.top = "15px";
- this.outerDiv.style.left = "0px";
- this.outerDiv.style.width = "201px";
- this.outerDiv.style.position = "absolute";
- this.outerDiv.style.padding = "9px";
- this.outerDiv.display = "block";
- this.outerDiv.style.background = "#0d0d0d";
- this.plugHEX = document.createElement("div");
- this.plugHEX.id = "plugHEX";
- this.plugHEX.innerHTML = "F1FFCC";
- this.plugHEX.style.color = "white";
- this.plugHEX.style.font = "normal 10px verdana";
- this.outerDiv.appendChild(this.plugHEX);
- this.SV = document.createElement("div");
- this.SV.onmousedown = function(event) {
- oThis.mouseDownSV(oThis.SVslide, event);
- };
- this.SV.id = "SV";
- this.SV.style.cursor = "crosshair";
- this.SV.style.background = "#FF0000 url(SatVal.png)";
- this.SV.style.position = "absolute";
- this.SV.style.height = "166px";
- this.SV.style.width = "167px";
- this.SV.style.marginRight = "10px";
- this.SV.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='SatVal.png', sizingMethod='scale')";
- this.SV.style["float"] = "left";
- this.outerDiv.appendChild(this.SV);
- this.SVslide = document.createElement("div");
- this.SVslide.onmousedown = function(event) {
- oThis.mouseDownSV(event);
- };
- this.SVslide.style.top = "40px";
- this.SVslide.style.left = "40px";
- this.SVslide.style.position = "absolute";
- this.SVslide.style.cursor = "crosshair";
- this.SVslide.style.background = "url(slide.gif)";
- this.SVslide.style.height = "9px";
- this.SVslide.style.width = "9px";
- this.SVslide.style.lineHeight = "1px";
- this.outerDiv.appendChild(this.SVslide);
- this.H = document.createElement("form");
- this.H.id = "H";
- this.H.onmousedown = function(event) {
- oThis.mouseDownH(event);
- };
- this.H.style.border = "1px solid #000000";
- this.H.style.cursor = "crosshair";
- this.H.style.position = "absolute";
- this.H.style.width = "19px";
- this.H.style.top = "28px";
- this.H.style.left = "191px";
- this.outerDiv.appendChild(this.H);
- this.Hslide = document.createElement("div");
- this.Hslide.style.top = "-7px";
- this.Hslide.style.left = "-8px";
- this.Hslide.style.background = "url(slideHue.gif)";
- this.Hslide.style.height = "5px";
- this.Hslide.style.width = "33px";
- this.Hslide.style.position = "absolute";
- this.Hslide.style.lineHeight = "1px";
- this.H.appendChild(this.Hslide);
- this.Hmodel = document.createElement("div");
- this.Hmodel.style.height = "1px";
- this.Hmodel.style.width = "19px";
- this.Hmodel.style.lineHeight = "1px";
- this.Hmodel.style.margin = "0px";
- this.Hmodel.style.padding = "0px";
- this.Hmodel.style.fontSize = "1px";
- this.H.appendChild(this.Hmodel);
- item.appendChild(this.outerDiv);
- return item;
- };
- draw2d.ColorDialog.prototype.onOk = function() {
- draw2d.Dialog.prototype.onOk.call(this);
- };
- draw2d.browser = function(v) {
- return (Math.max(navigator.userAgent.toLowerCase().indexOf(v), 0));
- };
- draw2d.ColorDialog.prototype.showColor = function(c) {
- this.plugHEX.style.background = "#" + c;
- this.plugHEX.innerHTML = c;
- };
- draw2d.ColorDialog.prototype.getSelectedColor = function() {
- var rgb = this.hex2rgb(this.plugHEX.innerHTML);
- return new draw2d.Color(rgb[0], rgb[1], rgb[2]);
- };
- draw2d.ColorDialog.prototype.setColor = function(color) {
- if (color === null) {
- color = new draw2d.Color(100, 100, 100);
- }
- var hex = this.rgb2hex(Array(color.getRed(), color.getGreen(), color
- .getBlue()));
- this.updateH(hex);
- };
- draw2d.ColorDialog.prototype.XY = function(e, v) {
- var z = draw2d.browser("msie") ? Array(event.clientX
- + document.body.scrollLeft, event.clientY + document.body.scrollTop)
- : Array(e.pageX, e.pageY);
- return z[v];
- };
- draw2d.ColorDialog.prototype.mkHSV = function(a, b, c) {
- return (Math.min(a, Math.max(0, Math.ceil((parseInt(c) / b) * a))));
- };
- draw2d.ColorDialog.prototype.ckHSV = function(a, b) {
- if (a >= 0 && a <= b) {
- return (a);
- } else {
- if (a > b) {
- return (b);
- } else {
- if (a < 0) {
- return ("-" + oo);
- }
- }
- }
- };
- draw2d.ColorDialog.prototype.mouseDownH = function(e) {
- this.slideHSV[0] = this.HSV[0];
- var oThis = this;
- this.H.onmousemove = function(e) {
- oThis.dragH(e);
- };
- this.H.onmouseup = function(e) {
- oThis.H.onmousemove = "";
- oThis.H.onmouseup = "";
- };
- this.dragH(e);
- };
- draw2d.ColorDialog.prototype.dragH = function(e) {
- var y = this.XY(e, 1) - this.getY() - 40;
- this.Hslide.style.top = (this.ckHSV(y, this.wH) - 5) + "px";
- this.slideHSV[0] = this.mkHSV(359, this.wH, this.Hslide.style.top);
- this.updateSV();
- this.showColor(this.commit());
- this.SV.style.backgroundColor = "#"
- + this.hsv2hex(Array(this.HSV[0], 100, 100));
- };
- draw2d.ColorDialog.prototype.mouseDownSV = function(o, e) {
- this.slideHSV[0] = this.HSV[0];
- var oThis = this;
- function reset() {
- oThis.SV.onmousemove = "";
- oThis.SV.onmouseup = "";
- oThis.SVslide.onmousemove = "";
- oThis.SVslide.onmouseup = "";
- }
- this.SV.onmousemove = function(e) {
- oThis.dragSV(e);
- };
- this.SV.onmouseup = reset;
- this.SVslide.onmousemove = function(e) {
- oThis.dragSV(e);
- };
- this.SVslide.onmouseup = reset;
- this.dragSV(e);
- };
- draw2d.ColorDialog.prototype.dragSV = function(e) {
- var x = this.XY(e, 0) - this.getX() - 1;
- var y = this.XY(e, 1) - this.getY() - 20;
- this.SVslide.style.left = this.ckHSV(x, this.wSV) + "px";
- this.SVslide.style.top = this.ckHSV(y, this.wSV) + "px";
- this.slideHSV[1] = this.mkHSV(100, this.wSV, this.SVslide.style.left);
- this.slideHSV[2] = 100 - this.mkHSV(100, this.wSV, this.SVslide.style.top);
- this.updateSV();
- };
- draw2d.ColorDialog.prototype.commit = function() {
- var r = "hsv";
- var z = {};
- var j = "";
- for ( var i = 0; i <= r.length - 1; i++) {
- j = r.substr(i, 1);
- z[i] = (j == "h") ? this.maxValue[j]
- - this.mkHSV(this.maxValue[j], this.wH, this.Hslide.style.top)
- : this.HSV[i];
- }
- return (this.updateSV(this.hsv2hex(z)));
- };
- draw2d.ColorDialog.prototype.updateSV = function(v) {
- this.HSV = v ? this.hex2hsv(v) : Array(this.slideHSV[0], this.slideHSV[1],
- this.slideHSV[2]);
- if (!v) {
- v = this.hsv2hex(Array(this.slideHSV[0], this.slideHSV[1],
- this.slideHSV[2]));
- }
- this.showColor(v);
- return v;
- };
- draw2d.ColorDialog.prototype.loadSV = function() {
- var z = "";
- for ( var i = this.SVHeight; i >= 0; i--) {
- z += "<div style=\"background:#"
- + this.hsv2hex(Array(Math.round((359 / this.SVHeight) * i),
- 100, 100)) + ";\"><br/></div>";
- }
- this.Hmodel.innerHTML = z;
- };
- draw2d.ColorDialog.prototype.updateH = function(v) {
- this.plugHEX.innerHTML = v;
- this.HSV = this.hex2hsv(v);
- this.SV.style.backgroundColor = "#"
- + this.hsv2hex(Array(this.HSV[0], 100, 100));
- this.SVslide.style.top = (parseInt(this.wSV - this.wSV
- * (this.HSV[1] / 100)) + 20)
- + "px";
- this.SVslide.style.left = (parseInt(this.wSV * (this.HSV[1] / 100)) + 5)
- + "px";
- this.Hslide.style.top = (parseInt(this.wH
- * ((this.maxValue["h"] - this.HSV[0]) / this.maxValue["h"])) - 7)
- + "px";
- };
- draw2d.ColorDialog.prototype.toHex = function(v) {
- v = Math.round(Math.min(Math.max(0, v), 255));
- return ("0123456789ABCDEF".charAt((v - v % 16) / 16) + "0123456789ABCDEF"
- .charAt(v % 16));
- };
- draw2d.ColorDialog.prototype.hex2rgb = function(r) {
- return ( {
- 0 : parseInt(r.substr(0, 2), 16),
- 1 : parseInt(r.substr(2, 2), 16),
- 2 : parseInt(r.substr(4, 2), 16)
- });
- };
- draw2d.ColorDialog.prototype.rgb2hex = function(r) {
- return (this.toHex(r[0]) + this.toHex(r[1]) + this.toHex(r[2]));
- };
- draw2d.ColorDialog.prototype.hsv2hex = function(h) {
- return (this.rgb2hex(this.hsv2rgb(h)));
- };
- draw2d.ColorDialog.prototype.hex2hsv = function(v) {
- return (this.rgb2hsv(this.hex2rgb(v)));
- };
- draw2d.ColorDialog.prototype.rgb2hsv = function(r) {
- var max = Math.max(r[0], r[1], r[2]);
- var delta = max - Math.min(r[0], r[1], r[2]);
- var H;
- var S;
- var V;
- if (max != 0) {
- S = Math.round(delta / max * 100);
- if (r[0] == max) {
- H = (r[1] - r[2]) / delta;
- } else {
- if (r[1] == max) {
- H = 2 + (r[2] - r[0]) / delta;
- } else {
- if (r[2] == max) {
- H = 4 + (r[0] - r[1]) / delta;
- }
- }
- }
- var H = Math.min(Math.round(H * 60), 360);
- if (H < 0) {
- H += 360;
- }
- }
- return ( {
- 0 : H ? H : 0,
- 1 : S ? S : 0,
- 2 : Math.round((max / 255) * 100)
- });
- };
- draw2d.ColorDialog.prototype.hsv2rgb = function(r) {
- var R;
- var B;
- var G;
- var S = r[1] / 100;
- var V = r[2] / 100;
- var H = r[0] / 360;
- if (S > 0) {
- if (H >= 1) {
- H = 0;
- }
- H = 6 * H;
- F = H - Math.floor(H);
- A = Math.round(255 * V * (1 - S));
- B = Math.round(255 * V * (1 - (S * F)));
- C = Math.round(255 * V * (1 - (S * (1 - F))));
- V = Math.round(255 * V);
- switch (Math.floor(H)) {
- case 0:
- R = V;
- G = C;
- B = A;
- break;
- case 1:
- R = B;
- G = V;
- B = A;
- break;
- case 2:
- R = A;
- G = V;
- B = C;
- break;
- case 3:
- R = A;
- G = B;
- B = V;
- break;
- case 4:
- R = C;
- G = A;
- B = V;
- break;
- case 5:
- R = V;
- G = A;
- B = B;
- break;
- }
- return ( {
- 0 : R ? R : 0,
- 1 : G ? G : 0,
- 2 : B ? B : 0
- });
- } else {
- return ( {
- 0 : (V = Math.round(V * 255)),
- 1 : V,
- 2 : V
- });
- }
- };
- draw2d.LineColorDialog = function(_5a31) {
- draw2d.ColorDialog.call(this);
- this.figure = _5a31;
- var color = _5a31.getColor();
- this.updateH(this
- .rgb2hex(color.getRed(), color.getGreen(), color.getBlue()));
- };
- draw2d.LineColorDialog.prototype = new draw2d.ColorDialog();
- draw2d.LineColorDialog.prototype.type = "draw2d.LineColorDialog";
- draw2d.LineColorDialog.prototype.onOk = function() {
- var _5a33 = this.workflow;
- draw2d.ColorDialog.prototype.onOk.call(this);
- if (typeof this.figure.setColor == "function") {
- _5a33.getCommandStack()
- .execute(
- new draw2d.CommandSetColor(this.figure, this
- .getSelectedColor()));
- if (_5a33.getCurrentSelection() == this.figure) {
- _5a33.setCurrentSelection(this.figure);
- }
- }
- };
- draw2d.BackgroundColorDialog = function(_5b1b) {
- draw2d.ColorDialog.call(this);
- this.figure = _5b1b;
- var color = _5b1b.getBackgroundColor();
- if (color !== null) {
- this.updateH(this.rgb2hex(color.getRed(), color.getGreen(), color
- .getBlue()));
- }
- };
- draw2d.BackgroundColorDialog.prototype = new draw2d.ColorDialog();
- draw2d.BackgroundColorDialog.prototype.type = "draw2d.BackgroundColorDialog";
- draw2d.BackgroundColorDialog.prototype.onOk = function() {
- var _5b1d = this.workflow;
- draw2d.ColorDialog.prototype.onOk.call(this);
- if (typeof this.figure.setBackgroundColor == "function") {
- _5b1d.getCommandStack().execute(
- new draw2d.CommandSetBackgroundColor(this.figure, this
- .getSelectedColor()));
- if (_5b1d.getCurrentSelection() == this.figure) {
- _5b1d.setCurrentSelection(this.figure);
- }
- }
- };
- draw2d.AnnotationDialog = function(_57df) {
- this.figure = _57df;
- draw2d.Dialog.call(this);
- this.setDimension(400, 100);
- };
- draw2d.AnnotationDialog.prototype = new draw2d.Dialog();
- draw2d.AnnotationDialog.prototype.type = "draw2d.AnnotationDialog";
- draw2d.AnnotationDialog.prototype.createHTMLElement = function() {
- var item = draw2d.Dialog.prototype.createHTMLElement.call(this);
- var _57e1 = document.createElement("form");
- _57e1.style.position = "absolute";
- _57e1.style.left = "10px";
- _57e1.style.top = "30px";
- _57e1.style.width = "375px";
- _57e1.style.font = "normal 10px verdana";
- item.appendChild(_57e1);
- this.label = document.createTextNode("Text");
- _57e1.appendChild(this.label);
- this.input = document.createElement("input");
- this.input.style.border = "1px solid gray";
- this.input.style.font = "normal 10px verdana";
- this.input.type = "text";
- var value = this.figure.getText();
- if (value) {
- this.input.value = value;
- } else {
- this.input.value = "";
- }
- this.input.style.width = "100%";
- _57e1.appendChild(this.input);
- this.input.focus();
- return item;
- };
- draw2d.AnnotationDialog.prototype.onOk = function() {
- this.workflow.getCommandStack().execute(
- new draw2d.CommandSetText(this.figure, this.input.value));
- this.workflow.removeFigure(this);
- };
- draw2d.Command = function(label) {
- this.label = label;
- };
- draw2d.Command.prototype.type = "draw2d.Command";
- draw2d.Command.prototype.getLabel = function() {
- return this.label;
- };
- draw2d.Command.prototype.canExecute = function() {
- return true;
- };
- draw2d.Command.prototype.execute = function() {
- };
- draw2d.Command.prototype.cancel = function() {
- };
- draw2d.Command.prototype.undo = function() {
- };
- draw2d.Command.prototype.redo = function() {
- };
- draw2d.CommandStack = function() {
- this.undostack = [];
- this.redostack = [];
- this.maxundo = 50;
- this.eventListeners = new draw2d.ArrayList();
- };
- draw2d.CommandStack.PRE_EXECUTE = 1;
- draw2d.CommandStack.PRE_REDO = 2;
- draw2d.CommandStack.PRE_UNDO = 4;
- draw2d.CommandStack.POST_EXECUTE = 8;
- draw2d.CommandStack.POST_REDO = 16;
- draw2d.CommandStack.POST_UNDO = 32;
- draw2d.CommandStack.POST_MASK = draw2d.CommandStack.POST_EXECUTE
- | draw2d.CommandStack.POST_UNDO | draw2d.CommandStack.POST_REDO;
- draw2d.CommandStack.PRE_MASK = draw2d.CommandStack.PRE_EXECUTE
- | draw2d.CommandStack.PRE_UNDO | draw2d.CommandStack.PRE_REDO;
- draw2d.CommandStack.prototype.type = "draw2d.CommandStack";
- draw2d.CommandStack.prototype.setUndoLimit = function(count) {
- this.maxundo = count;
- };
- draw2d.CommandStack.prototype.markSaveLocation = function() {
- this.undostack = [];
- this.redostack = [];
- };
- draw2d.CommandStack.prototype.execute = function(_5577) {
- if (_5577 === null) {
- return;
- }
- if (_5577.canExecute() == false) {
- return;
- }
- this.notifyListeners(_5577, draw2d.CommandStack.PRE_EXECUTE);
- this.undostack.push(_5577);
- _5577.execute();
- this.redostack = [];
- if (this.undostack.length > this.maxundo) {
- this.undostack = this.undostack.slice(this.undostack.length
- - this.maxundo);
- }
- this.notifyListeners(_5577, draw2d.CommandStack.POST_EXECUTE);
- };
- draw2d.CommandStack.prototype.undo = function() {
- var _5578 = this.undostack.pop();
- if (_5578) {
- this.notifyListeners(_5578, draw2d.CommandStack.PRE_UNDO);
- this.redostack.push(_5578);
- _5578.undo();
- this.notifyListeners(_5578, draw2d.CommandStack.POST_UNDO);
- }
- };
- draw2d.CommandStack.prototype.redo = function() {
- var _5579 = this.redostack.pop();
- if (_5579) {
- this.notifyListeners(_5579, draw2d.CommandStack.PRE_REDO);
- this.undostack.push(_5579);
- _5579.redo();
- this.notifyListeners(_5579, draw2d.CommandStack.POST_REDO);
- }
- };
- draw2d.CommandStack.prototype.canRedo = function() {
- return this.redostack.length > 0;
- };
- draw2d.CommandStack.prototype.canUndo = function() {
- return this.undostack.length > 0;
- };
- draw2d.CommandStack.prototype.addCommandStackEventListener = function(_557a) {
- this.eventListeners.add(_557a);
- };
- draw2d.CommandStack.prototype.removeCommandStackEventListener = function(_557b) {
- this.eventListeners.remove(_557b);
- };
- draw2d.CommandStack.prototype.notifyListeners = function(_557c, state) {
- var event = new draw2d.CommandStackEvent(_557c, state);
- var size = this.eventListeners.getSize();
- for ( var i = 0; i < size; i++) {
- this.eventListeners.get(i).stackChanged(event);
- }
- };
- draw2d.CommandStackEvent = function(_507a, _507b) {
- this.command = _507a;
- this.details = _507b;
- };
- draw2d.CommandStackEvent.prototype.type = "draw2d.CommandStackEvent";
- draw2d.CommandStackEvent.prototype.getCommand = function() {
- return this.command;
- };
- draw2d.CommandStackEvent.prototype.getDetails = function() {
- return this.details;
- };
- draw2d.CommandStackEvent.prototype.isPostChangeEvent = function() {
- return 0 != (this.getDetails() & draw2d.CommandStack.POST_MASK);
- };
- draw2d.CommandStackEvent.prototype.isPreChangeEvent = function() {
- return 0 != (this.getDetails() & draw2d.CommandStack.PRE_MASK);
- };
- draw2d.CommandStackEventListener = function() {
- };
- draw2d.CommandStackEventListener.prototype.type = "draw2d.CommandStackEventListener";
- draw2d.CommandStackEventListener.prototype.stackChanged = function(event) {
- };
- draw2d.CommandAdd = function(_58b8, _58b9, x, y, _58bc) {
- draw2d.Command.call(this, "add figure");
- if (_58bc === undefined) {
- _58bc = null;
- }
- this.parent = _58bc;
- this.figure = _58b9;
- this.x = x;
- this.y = y;
- this.workflow = _58b8;
- };
- draw2d.CommandAdd.prototype = new draw2d.Command();
- draw2d.CommandAdd.prototype.type = "draw2d.CommandAdd";
- draw2d.CommandAdd.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandAdd.prototype.redo = function() {
- if (this.x && this.y) {
- this.workflow.addFigure(this.figure, this.x, this.y);
- } else {
- this.workflow.addFigure(this.figure);
- }
- this.workflow.setCurrentSelection(this.figure);
- if (this.parent !== null) {
- this.parent.addChild(this.figure);
- }
- };
- draw2d.CommandAdd.prototype.undo = function() {
- this.workflow.removeFigure(this.figure);
- this.workflow.setCurrentSelection(null);
- if (this.parent !== null) {
- this.parent.removeChild(this.figure);
- }
- };
- draw2d.CommandDelete = function(_553a) {
- draw2d.Command.call(this, "delete figure");
- this.parent = _553a.parent;
- this.figure = _553a;
- this.workflow = _553a.workflow;
- this.connections = null;
- this.compartmentDeleteCommands = null;
- };
- draw2d.CommandDelete.prototype = new draw2d.Command();
- draw2d.CommandDelete.prototype.type = "draw2d.CommandDelete";
- draw2d.CommandDelete.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandDelete.prototype.undo = function() {
- if (this.figure instanceof draw2d.CompartmentFigure) {
- for ( var i = 0; i < this.compartmentDeleteCommands.getSize(); i++) {
- var _553c = this.compartmentDeleteCommands.get(i);
- this.figure.addChild(_553c.figure);
- this.workflow.getCommandStack().undo();
- }
- }
- this.workflow.addFigure(this.figure);
- if (this.figure instanceof draw2d.Connection) {
- this.figure.reconnect();
- }
- this.workflow.setCurrentSelection(this.figure);
- if (this.parent !== null) {
- this.parent.addChild(this.figure);
- }
- for ( var i = 0; i < this.connections.getSize(); ++i) {
- this.workflow.addFigure(this.connections.get(i));
- this.connections.get(i).reconnect();
- }
- };
- draw2d.CommandDelete.prototype.redo = function() {
- if (this.figure instanceof draw2d.CompartmentFigure) {
- if (this.compartmentDeleteCommands === null) {
- this.compartmentDeleteCommands = new draw2d.ArrayList();
- var _553d = this.figure.getChildren().clone();
- for ( var i = 0; i < _553d.getSize(); i++) {
- var child = _553d.get(i);
- this.figure.removeChild(child);
- var _5540 = new draw2d.CommandDelete(child);
- this.compartmentDeleteCommands.add(_5540);
- this.workflow.getCommandStack().execute(_5540);
- }
- } else {
- for ( var i = 0; i < this.compartmentDeleteCommands.getSize(); i++) {
- this.workflow.redo();
- }
- }
- }
- this.workflow.removeFigure(this.figure);
- this.workflow.setCurrentSelection(null);
- if (this.figure instanceof draw2d.Node && this.connections === null) {
- this.connections = new draw2d.ArrayList();
- var ports = this.figure.getPorts();
- for ( var i = 0; i < ports.getSize(); i++) {
- var port = ports.get(i);
- for ( var c = 0, c_size = port.getConnections().getSize(); c < c_size; c++) {
- if (!this.connections.contains(port.getConnections().get(c))) {
- this.connections.add(port.getConnections().get(c));
- }
- }
- }
- }
- if (this.connections === null) {
- this.connections = new draw2d.ArrayList();
- }
- if (this.parent !== null) {
- this.parent.removeChild(this.figure);
- }
- for ( var i = 0; i < this.connections.getSize(); ++i) {
- this.workflow.removeFigure(this.connections.get(i));
- }
- };
- draw2d.CommandMove = function(_4fff, x, y) {
- draw2d.Command.call(this, "move figure");
- this.figure = _4fff;
- if (x == undefined) {
- this.oldX = _4fff.getX();
- this.oldY = _4fff.getY();
- } else {
- this.oldX = x;
- this.oldY = y;
- }
- this.oldCompartment = _4fff.getParent();
- };
- draw2d.CommandMove.prototype = new draw2d.Command();
- draw2d.CommandMove.prototype.type = "draw2d.CommandMove";
- draw2d.CommandMove.prototype.setStartPosition = function(x, y) {
- this.oldX = x;
- this.oldY = y;
- };
- draw2d.CommandMove.prototype.setPosition = function(x, y) {
- this.newX = x;
- this.newY = y;
- this.newCompartment = this.figure.workflow.getBestCompartmentFigure(x, y,
- this.figure);
- };
- draw2d.CommandMove.prototype.canExecute = function() {
- return this.newX != this.oldX || this.newY != this.oldY;
- };
- draw2d.CommandMove.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandMove.prototype.undo = function() {
- this.figure.setPosition(this.oldX, this.oldY);
- if (this.newCompartment !== null) {
- this.newCompartment.removeChild(this.figure);
- }
- if (this.oldCompartment !== null) {
- this.oldCompartment.addChild(this.figure);
- }
- this.figure.workflow.moveResizeHandles(this.figure);
- };
- draw2d.CommandMove.prototype.redo = function() {
- this.figure.setPosition(this.newX, this.newY);
- if (this.oldCompartment !== null) {
- this.oldCompartment.removeChild(this.figure);
- }
- if (this.newCompartment !== null) {
- this.newCompartment.addChild(this.figure);
- }
- this.figure.workflow.moveResizeHandles(this.figure);
- };
- draw2d.CommandResize = function(_5570, width, _5572) {
- draw2d.Command.call(this, "resize figure");
- this.figure = _5570;
- if (width === undefined) {
- this.oldWidth = _5570.getWidth();
- this.oldHeight = _5570.getHeight();
- } else {
- this.oldWidth = width;
- this.oldHeight = _5572;
- }
- };
- draw2d.CommandResize.prototype = new draw2d.Command();
- draw2d.CommandResize.prototype.type = "draw2d.CommandResize";
- draw2d.CommandResize.prototype.setDimension = function(width, _5574) {
- this.newWidth = width;
- this.newHeight = _5574;
- };
- draw2d.CommandResize.prototype.canExecute = function() {
- return this.newWidth != this.oldWidth || this.newHeight != this.oldHeight;
- };
- draw2d.CommandResize.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandResize.prototype.undo = function() {
- this.figure.setDimension(this.oldWidth, this.oldHeight);
- this.figure.workflow.moveResizeHandles(this.figure);
- };
- draw2d.CommandResize.prototype.redo = function() {
- this.figure.setDimension(this.newWidth, this.newHeight);
- this.figure.workflow.moveResizeHandles(this.figure);
- };
- draw2d.CommandSetText = function(_5771, text) {
- draw2d.Command.call(this, "set text");
- this.figure = _5771;
- this.newText = text;
- this.oldText = _5771.getText();
- };
- draw2d.CommandSetText.prototype = new draw2d.Command();
- draw2d.CommandSetText.prototype.type = "draw2d.CommandSetText";
- draw2d.CommandSetText.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandSetText.prototype.redo = function() {
- this.figure.setText(this.newText);
- };
- draw2d.CommandSetText.prototype.undo = function() {
- this.figure.setText(this.oldText);
- };
- draw2d.CommandSetColor = function(_5581, color) {
- draw2d.Command.call(this, "set color");
- this.figure = _5581;
- this.newColor = color;
- this.oldColor = _5581.getColor();
- };
- draw2d.CommandSetColor.prototype = new draw2d.Command();
- draw2d.CommandSetColor.prototype.type = "draw2d.CommandSetColor";
- draw2d.CommandSetColor.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandSetColor.prototype.undo = function() {
- this.figure.setColor(this.oldColor);
- };
- draw2d.CommandSetColor.prototype.redo = function() {
- this.figure.setColor(this.newColor);
- };
- draw2d.CommandSetBackgroundColor = function(_572e, color) {
- draw2d.Command.call(this, "set background color");
- this.figure = _572e;
- this.newColor = color;
- this.oldColor = _572e.getBackgroundColor();
- };
- draw2d.CommandSetBackgroundColor.prototype = new draw2d.Command();
- draw2d.CommandSetBackgroundColor.prototype.type = "draw2d.CommandSetBackgroundColor";
- draw2d.CommandSetBackgroundColor.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandSetBackgroundColor.prototype.undo = function() {
- this.figure.setBackgroundColor(this.oldColor);
- };
- draw2d.CommandSetBackgroundColor.prototype.redo = function() {
- this.figure.setBackgroundColor(this.newColor);
- };
- draw2d.CommandConnect = function(_5951, _5952, _5953) {
- draw2d.Command.call(this, "create connection");
- this.workflow = _5951;
- this.source = _5952;
- this.target = _5953;
- this.connection = null;
- };
- draw2d.CommandConnect.prototype = new draw2d.Command();
- draw2d.CommandConnect.prototype.type = "draw2d.CommandConnect";
- draw2d.CommandConnect.prototype.setConnection = function(_5954) {
- this.connection = _5954;
- };
- draw2d.CommandConnect.prototype.execute = function() {
- if (this.connection === null) {
- this.connection = new draw2d.Connection();
- }
- this.connection.setSource(this.source);
- this.connection.setTarget(this.target);
- this.workflow.addFigure(this.connection);
- };
- draw2d.CommandConnect.prototype.redo = function() {
- this.workflow.addFigure(this.connection);
- this.connection.reconnect();
- };
- draw2d.CommandConnect.prototype.undo = function() {
- this.workflow.removeFigure(this.connection);
- };
- draw2d.CommandReconnect = function(con) {
- draw2d.Command.call(this, "reconnect connection");
- this.con = con;
- this.oldSourcePort = con.getSource();
- this.oldTargetPort = con.getTarget();
- this.oldRouter = con.getRouter();
- this.con.setRouter(new draw2d.NullConnectionRouter());
- };
- draw2d.CommandReconnect.prototype = new draw2d.Command();
- draw2d.CommandReconnect.prototype.type = "draw2d.CommandReconnect";
- draw2d.CommandReconnect.prototype.canExecute = function() {
- return true;
- };
- draw2d.CommandReconnect.prototype.setNewPorts = function(_5584, _5585) {
- this.newSourcePort = _5584;
- this.newTargetPort = _5585;
- };
- draw2d.CommandReconnect.prototype.execute = function() {
- this.redo();
- };
- draw2d.CommandReconnect.prototype.cancel = function() {
- var start = this.con.sourceAnchor.getLocation(this.con.targetAnchor
- .getReferencePoint());
- var end = this.con.targetAnchor.getLocation(this.con.sourceAnchor
- .getReferencePoint());
- this.con.setStartPoint(start.x, start.y);
- this.con.setEndPoint(end.x, end.y);
- this.con.getWorkflow().showLineResizeHandles(this.con);
- this.con.setRouter(this.oldRouter);
- };
- draw2d.CommandReconnect.prototype.undo = function() {
- this.con.setSource(this.oldSourcePort);
- this.con.setTarget(this.oldTargetPort);
- this.con.setRouter(this.oldRouter);
- if (this.con.getWorkflow().getCurrentSelection() == this.con) {
- this.con.getWorkflow().showLineResizeHandles(this.con);
- }
- };
- draw2d.CommandReconnect.prototype.redo = function() {
- this.con.setSource(this.newSourcePort);
- this.con.setTarget(this.newTargetPort);
- this.con.setRouter(this.oldRouter);
- if (this.con.getWorkflow().getCurrentSelection() == this.con) {
- this.con.getWorkflow().showLineResizeHandles(this.con);
- }
- };
- draw2d.CommandMoveLine = function(line, _57a3, _57a4, endX, endY) {
- draw2d.Command.call(this, "move line");
- this.line = line;
- this.startX1 = _57a3;
- this.startY1 = _57a4;
- this.endX1 = endX;
- this.endY1 = endY;
- };
- draw2d.CommandMoveLine.prototype = new draw2d.Command();
- draw2d.CommandMoveLine.prototype.type = "draw2d.CommandMoveLine";
- draw2d.CommandMoveLine.prototype.canExecute = function() {
- return this.startX1 != this.startX2 || this.startY1 != this.startY2
- || this.endX1 != this.endX2 || this.endY1 != this.endY2;
- };
- draw2d.CommandMoveLine.prototype.execute = function() {
- this.startX2 = this.line.getStartX();
- this.startY2 = this.line.getStartY();
- this.endX2 = this.line.getEndX();
- this.endY2 = this.line.getEndY();
- this.redo();
- };
- draw2d.CommandMoveLine.prototype.undo = function() {
- this.line.setStartPoint(this.startX1, this.startY1);
- this.line.setEndPoint(this.endX1, this.endY1);
- if (this.line.workflow.getCurrentSelection() == this.line) {
- this.line.workflow.showLineResizeHandles(this.line);
- }
- };
- draw2d.CommandMoveLine.prototype.redo = function() {
- this.line.setStartPoint(this.startX2, this.startY2);
- this.line.setEndPoint(this.endX2, this.endY2);
- if (this.line.workflow.getCurrentSelection() == this.line) {
- this.line.workflow.showLineResizeHandles(this.line);
- }
- };
- draw2d.CommandMovePort = function(port) {
- draw2d.Command.call(this, "move port");
- this.port = port;
- };
- draw2d.CommandMovePort.prototype = new draw2d.Command();
- draw2d.CommandMovePort.prototype.type = "draw2d.CommandMovePort";
- draw2d.CommandMovePort.prototype.execute = function() {
- this.port.setAlpha(1);
- this.port.setPosition(this.port.originX, this.port.originY);
- this.port.parentNode.workflow.hideConnectionLine();
- };
- draw2d.CommandMovePort.prototype.undo = function() {
- };
- draw2d.CommandMovePort.prototype.redo = function() {
- };
- draw2d.CommandMovePort.prototype.setPosition = function(x, y) {
- };
- draw2d.Menu = function() {
- this.menuItems = new draw2d.ArrayList();
- draw2d.Figure.call(this);
- this.setSelectable(false);
- this.setDeleteable(false);
- this.setCanDrag(false);
- this.setResizeable(false);
- this.setSelectable(false);
- this.setZOrder(10000);
- this.dirty = false;
- };
- draw2d.Menu.prototype = new draw2d.Figure();
- draw2d.Menu.prototype.type = "draw2d.Menu";
- draw2d.Menu.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.style.position = "absolute";
- item.style.left = this.x + "px";
- item.style.top = this.y + "px";
- item.style.margin = "0px";
- item.style.padding = "0px";
- item.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
- item.style.border = "1px solid gray";
- item.style.background = "lavender";
- item.style.cursor = "pointer";
- item.style.width = "auto";
- item.style.height = "auto";
- item.className = "Menu";
- return item;
- };
- draw2d.Menu.prototype.setWorkflow = function(_5085) {
- this.workflow = _5085;
- };
- draw2d.Menu.prototype.setDimension = function(w, h) {
- };
- draw2d.Menu.prototype.appendMenuItem = function(item) {
- this.menuItems.add(item);
- item.parentMenu = this;
- this.dirty = true;
- };
- draw2d.Menu.prototype.getHTMLElement = function() {
- var html = draw2d.Figure.prototype.getHTMLElement.call(this);
- if (this.dirty) {
- this.createList();
- }
- return html;
- };
- draw2d.Menu.prototype.createList = function() {
- this.dirty = false;
- this.html.innerHTML = "";
- var oThis = this;
- for ( var i = 0; i < this.menuItems.getSize(); i++) {
- var item = this.menuItems.get(i);
- var li = document.createElement("a");
- li.innerHTML = item.getLabel();
- li.style.display = "block";
- li.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif";
- li.style.fontSize = "9pt";
- li.style.color = "dimgray";
- li.style.borderBottom = "1px solid silver";
- li.style.paddingLeft = "5px";
- li.style.paddingRight = "5px";
- li.style.whiteSpace = "nowrap";
- li.style.cursor = "pointer";
- li.className = "MenuItem";
- this.html.appendChild(li);
- li.menuItem = item;
- if (li.addEventListener) {
- li.addEventListener("click", function(event) {
- var _508f = arguments[0] || window.event;
- _508f.cancelBubble = true;
- _508f.returnValue = false;
- var diffX = _508f.clientX;
- var diffY = _508f.clientY;
- var _5092 = document.body.parentNode.scrollLeft;
- var _5093 = document.body.parentNode.scrollTop;
- this.menuItem.execute(diffX + _5092, diffY + _5093);
- }, false);
- li.addEventListener("mouseup", function(event) {
- event.cancelBubble = true;
- event.returnValue = false;
- }, false);
- li.addEventListener("mousedown", function(event) {
- event.cancelBubble = true;
- event.returnValue = false;
- }, false);
- li.addEventListener("mouseover", function(event) {
- this.style.backgroundColor = "silver";
- }, false);
- li.addEventListener("mouseout", function(event) {
- this.style.backgroundColor = "transparent";
- }, false);
- } else {
- if (li.attachEvent) {
- li.attachEvent("onclick", function(event) {
- var _5099 = arguments[0] || window.event;
- _5099.cancelBubble = true;
- _5099.returnValue = false;
- var diffX = _5099.clientX;
- var diffY = _5099.clientY;
- var _509c = document.body.parentNode.scrollLeft;
- var _509d = document.body.parentNode.scrollTop;
- event.srcElement.menuItem.execute(diffX + _509c, diffY
- + _509d);
- });
- li.attachEvent("onmousedown", function(event) {
- event.cancelBubble = true;
- event.returnValue = false;
- });
- li.attachEvent("onmouseup", function(event) {
- event.cancelBubble = true;
- event.returnValue = false;
- });
- li.attachEvent("onmouseover", function(event) {
- event.srcElement.style.backgroundColor = "silver";
- });
- li.attachEvent("onmouseout", function(event) {
- event.srcElement.style.backgroundColor = "transparent";
- });
- }
- }
- }
- };
- draw2d.MenuItem = function(label, _4f03, _4f04) {
- this.label = label;
- this.iconUrl = _4f03;
- this.parentMenu = null;
- this.action = _4f04;
- };
- draw2d.MenuItem.prototype.type = "draw2d.MenuItem";
- draw2d.MenuItem.prototype.isEnabled = function() {
- return true;
- };
- draw2d.MenuItem.prototype.getLabel = function() {
- return this.label;
- };
- draw2d.MenuItem.prototype.execute = function(x, y) {
- this.parentMenu.workflow.showMenu(null);
- this.action(x, y);
- };
- draw2d.Locator = function() {
- };
- draw2d.Locator.prototype.type = "draw2d.Locator";
- draw2d.Locator.prototype.relocate = function(_5077) {
- };
- draw2d.ConnectionLocator = function(_57d5) {
- draw2d.Locator.call(this);
- this.connection = _57d5;
- };
- draw2d.ConnectionLocator.prototype = new draw2d.Locator;
- draw2d.ConnectionLocator.prototype.type = "draw2d.ConnectionLocator";
- draw2d.ConnectionLocator.prototype.getConnection = function() {
- return this.connection;
- };
- draw2d.ManhattanMidpointLocator = function(_603c) {
- draw2d.ConnectionLocator.call(this, _603c);
- };
- draw2d.ManhattanMidpointLocator.prototype = new draw2d.ConnectionLocator;
- draw2d.ManhattanMidpointLocator.prototype.type = "draw2d.ManhattanMidpointLocator";
- draw2d.ManhattanMidpointLocator.prototype.relocate = function(_603d) {
- var conn = this.getConnection();
- var p = new draw2d.Point();
- var _6040 = conn.getPoints();
- var index = Math.floor((_6040.getSize() - 2) / 2);
- if (_6040.getSize() <= index + 1) {
- return;
- }
- var p1 = _6040.get(index);
- var p2 = _6040.get(index + 1);
- p.x = (p2.x - p1.x) / 2 + p1.x + 5;
- p.y = (p2.y - p1.y) / 2 + p1.y + 5;
- _603d.setPosition(p.x, p.y);
- };
- draw2d.EditPartFactory = function() {
- };
- draw2d.EditPartFactory.prototype.type = "draw2d.EditPartFactory";
- draw2d.EditPartFactory.prototype.createEditPart = function(model) {
- };
- draw2d.AbstractObjectModel = function() {
- this.listeners = new draw2d.ArrayList();
- this.id = draw2d.UUID.create();
- };
- draw2d.AbstractObjectModel.EVENT_ELEMENT_ADDED = "element added";
- draw2d.AbstractObjectModel.EVENT_ELEMENT_REMOVED = "element removed";
- draw2d.AbstractObjectModel.EVENT_CONNECTION_ADDED = "connection addedx";
- draw2d.AbstractObjectModel.EVENT_CONNECTION_REMOVED = "connection removed";
- draw2d.AbstractObjectModel.prototype.type = "draw2d.AbstractObjectModel";
- draw2d.AbstractObjectModel.prototype.getModelChildren = function() {
- return new draw2d.ArrayList();
- };
- draw2d.AbstractObjectModel.prototype.getModelParent = function() {
- return this.modelParent;
- };
- draw2d.AbstractObjectModel.prototype.setModelParent = function(_555f) {
- this.modelParent = _555f;
- };
- draw2d.AbstractObjectModel.prototype.getId = function() {
- return this.id;
- };
- draw2d.AbstractObjectModel.prototype.firePropertyChange = function(_5560,
- _5561, _5562) {
- var count = this.listeners.getSize();
- if (count === 0) {
- return;
- }
- var event = new draw2d.PropertyChangeEvent(this, _5560, _5561, _5562);
- for ( var i = 0; i < count; i++) {
- try {
- this.listeners.get(i).propertyChange(event);
- } catch (e) {
- alert("Method: draw2d.AbstractObjectModel.prototype.firePropertyChange\n"
- + e
- + "\nProperty: "
- + _5560
- + "\nListener Class:"
- + this.listeners.get(i).type);
- }
- }
- };
- draw2d.AbstractObjectModel.prototype.addPropertyChangeListener = function(_5566) {
- if (_5566 !== null) {
- this.listeners.add(_5566);
- }
- };
- draw2d.AbstractObjectModel.prototype.removePropertyChangeListener = function(
- _5567) {
- if (_5567 !== null) {
- this.listeners.remove(_5567);
- }
- };
- draw2d.AbstractObjectModel.prototype.getPersistentAttributes = function() {
- return {
- id : this.id
- };
- };
- draw2d.AbstractConnectionModel = function() {
- draw2d.AbstractObjectModel.call(this);
- };
- draw2d.AbstractConnectionModel.prototype = new draw2d.AbstractObjectModel();
- draw2d.AbstractConnectionModel.prototype.type = "draw2d.AbstractConnectionModel";
- draw2d.AbstractConnectionModel.prototype.getSourceModel = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getSourceModel]";
- };
- draw2d.AbstractConnectionModel.prototype.getTargetModel = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getTargetModel]";
- };
- draw2d.AbstractConnectionModel.prototype.getSourcePortName = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getSourcePortName]";
- };
- draw2d.AbstractConnectionModel.prototype.getTargetPortName = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getTargetPortName]";
- };
- draw2d.AbstractConnectionModel.prototype.getSourcePortModel = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getSourcePortModel]";
- };
- draw2d.AbstractConnectionModel.prototype.getTargetPortModel = function() {
- throw "you must override the method [AbstractConnectionModel.prototype.getTargetPortModel]";
- };
- draw2d.PropertyChangeEvent = function(model, _5919, _591a, _591b) {
- this.model = model;
- this.property = _5919;
- this.oldValue = _591a;
- this.newValue = _591b;
- };
- draw2d.PropertyChangeEvent.prototype.type = "draw2d.PropertyChangeEvent";
- draw2d.GraphicalViewer = function(id) {
- try {
- draw2d.Workflow.call(this, id);
- this.factory = null;
- this.model = null;
- this.initDone = false;
- } catch (e) {
- pushErrorStack(e, "draw2d.GraphicalViewer=function(/*:String*/ id)");
- }
- };
- draw2d.GraphicalViewer.prototype = new draw2d.Workflow();
- draw2d.GraphicalViewer.prototype.type = "draw2d.GraphicalViewer";
- draw2d.GraphicalViewer.prototype.setEditPartFactory = function(_56c3) {
- this.factory = _56c3;
- this.checkInit();
- };
- draw2d.GraphicalViewer.prototype.setModel = function(model) {
- try {
- if (model instanceof draw2d.AbstractObjectModel) {
- this.model = model;
- this.checkInit();
- this.model.addPropertyChangeListener(this);
- } else {
- alert("Invalid model class type:" + model.type);
- }
- } catch (e) {
- pushErrorStack(
- e,
- "draw2d.GraphicalViewer.prototype.setModel=function(/*:draw2d.AbstractObjectModel*/ model )");
- }
- };
- draw2d.GraphicalViewer.prototype.propertyChange = function(event) {
- switch (event.property) {
- case draw2d.AbstractObjectModel.EVENT_ELEMENT_REMOVED:
- var _56c6 = this.getFigure(event.oldValue.getId());
- this.removeFigure(_56c6);
- break;
- case draw2d.AbstractObjectModel.EVENT_ELEMENT_ADDED:
- var _56c6 = this.factory.createEditPart(event.newValue);
- _56c6.setId(event.newValue.getId());
- this.addFigure(_56c6);
- this.setCurrentSelection(_56c6);
- break;
- }
- };
- draw2d.GraphicalViewer.prototype.checkInit = function() {
- if (this.factory !== null && this.model !== null && this.initDone == false) {
- try {
- var _56c7 = this.model.getModelChildren();
- var count = _56c7.getSize();
- for ( var i = 0; i < count; i++) {
- var child = _56c7.get(i);
- var _56cb = this.factory.createEditPart(child);
- _56cb.setId(child.getId());
- this.addFigure(_56cb);
- }
- } catch (e) {
- pushErrorStack(e,
- "draw2d.GraphicalViewer.prototype.checkInit=function()[addFigures]");
- }
- try {
- var _56cc = this.getDocument().getFigures();
- var count = _56cc.getSize();
- for ( var i = 0; i < count; i++) {
- var _56cb = _56cc.get(i);
- if (_56cb instanceof draw2d.Node) {
- this.refreshConnections(_56cb);
- }
- }
- } catch (e) {
- pushErrorStack(e,
- "draw2d.GraphicalViewer.prototype.checkInit=function()[refreshConnections]");
- }
- }
- };
- draw2d.GraphicalViewer.prototype.refreshConnections = function(node) {
- try {
- var _56ce = new draw2d.ArrayList();
- var _56cf = node.getModelSourceConnections();
- var count = _56cf.getSize();
- for ( var i = 0; i < count; i++) {
- var _56d2 = _56cf.get(i);
- _56ce.add(_56d2.getId());
- var _56d3 = this.getLine(_56d2.getId());
- if (_56d3 === null) {
- _56d3 = this.factory.createEditPart(_56d2);
- var _56d4 = _56d2.getSourceModel();
- var _56d5 = _56d2.getTargetModel();
- var _56d6 = this.getFigure(_56d4.getId());
- var _56d7 = this.getFigure(_56d5.getId());
- var _56d8 = _56d6.getOutputPort(_56d2.getSourcePortName());
- var _56d9 = _56d7.getInputPort(_56d2.getTargetPortName());
- _56d3.setTarget(_56d9);
- _56d3.setSource(_56d8);
- _56d3.setId(_56d2.getId());
- this.addFigure(_56d3);
- this.setCurrentSelection(_56d3);
- }
- }
- var ports = node.getOutputPorts();
- count = ports.getSize();
- for ( var i = 0; i < count; i++) {
- var _56db = ports.get(i).getConnections();
- var _56dc = _56db.getSize();
- for ( var ii = 0; ii < _56dc; ii++) {
- var _56de = _56db.get(ii);
- if (!_56ce.contains(_56de.getId())) {
- this.removeFigure(_56de);
- _56ce.add(_56de.getId());
- }
- }
- }
- } catch (e) {
- pushErrorStack(
- e,
- "draw2d.GraphicalViewer.prototype.refreshConnections=function(/*:draw2d.Node*/ node )");
- }
- };
- draw2d.GraphicalEditor = function(id) {
- try {
- this.view = new draw2d.GraphicalViewer(id);
- this.initializeGraphicalViewer();
- } catch (e) {
- pushErrorStack(e, "draw2d.GraphicalEditor=function(/*:String*/ id)");
- }
- };
- draw2d.GraphicalEditor.prototype.type = "draw2d.GraphicalEditor";
- draw2d.GraphicalEditor.prototype.initializeGraphicalViewer = function() {
- };
- draw2d.GraphicalEditor.prototype.getGraphicalViewer = function() {
- return this.view;
- };
- var whitespace = "\n\r\t ";
- XMLP = function(_595d) {
- _595d = SAXStrings.replace(_595d, null, null, "\r\n", "\n");
- _595d = SAXStrings.replace(_595d, null, null, "\r", "\n");
- this.m_xml = _595d;
- this.m_iP = 0;
- this.m_iState = XMLP._STATE_PROLOG;
- this.m_stack = new Stack();
- this._clearAttributes();
- };
- XMLP._NONE = 0;
- XMLP._ELM_B = 1;
- XMLP._ELM_E = 2;
- XMLP._ELM_EMP = 3;
- XMLP._ATT = 4;
- XMLP._TEXT = 5;
- XMLP._ENTITY = 6;
- XMLP._PI = 7;
- XMLP._CDATA = 8;
- XMLP._COMMENT = 9;
- XMLP._DTD = 10;
- XMLP._ERROR = 11;
- XMLP._CONT_XML = 0;
- XMLP._CONT_ALT = 1;
- XMLP._ATT_NAME = 0;
- XMLP._ATT_VAL = 1;
- XMLP._STATE_PROLOG = 1;
- XMLP._STATE_DOCUMENT = 2;
- XMLP._STATE_MISC = 3;
- XMLP._errs = [];
- XMLP._errs[XMLP.ERR_CLOSE_PI = 0] = "PI: missing closing sequence";
- XMLP._errs[XMLP.ERR_CLOSE_DTD = 1] = "DTD: missing closing sequence";
- XMLP._errs[XMLP.ERR_CLOSE_COMMENT = 2] = "Comment: missing closing sequence";
- XMLP._errs[XMLP.ERR_CLOSE_CDATA = 3] = "CDATA: missing closing sequence";
- XMLP._errs[XMLP.ERR_CLOSE_ELM = 4] = "Element: missing closing sequence";
- XMLP._errs[XMLP.ERR_CLOSE_ENTITY = 5] = "Entity: missing closing sequence";
- XMLP._errs[XMLP.ERR_PI_TARGET = 6] = "PI: target is required";
- XMLP._errs[XMLP.ERR_ELM_EMPTY = 7] = "Element: cannot be both empty and closing";
- XMLP._errs[XMLP.ERR_ELM_NAME = 8] = "Element: name must immediatly follow \"<\"";
- XMLP._errs[XMLP.ERR_ELM_LT_NAME = 9] = "Element: \"<\" not allowed in element names";
- XMLP._errs[XMLP.ERR_ATT_VALUES = 10] = "Attribute: values are required and must be in quotes";
- XMLP._errs[XMLP.ERR_ATT_LT_NAME = 11] = "Element: \"<\" not allowed in attribute names";
- XMLP._errs[XMLP.ERR_ATT_LT_VALUE = 12] = "Attribute: \"<\" not allowed in attribute values";
- XMLP._errs[XMLP.ERR_ATT_DUP = 13] = "Attribute: duplicate attributes not allowed";
- XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN = 14] = "Entity: unknown entity";
- XMLP._errs[XMLP.ERR_INFINITELOOP = 15] = "Infininte loop";
- XMLP._errs[XMLP.ERR_DOC_STRUCTURE = 16] = "Document: only comments, processing instructions, or whitespace allowed outside of document element";
- XMLP._errs[XMLP.ERR_ELM_NESTING = 17] = "Element: must be nested correctly";
- XMLP.prototype._addAttribute = function(name, value) {
- this.m_atts[this.m_atts.length] = new Array(name, value);
- };
- XMLP.prototype._checkStructure = function(_5960) {
- if (XMLP._STATE_PROLOG == this.m_iState) {
- if ((XMLP._TEXT == _5960) || (XMLP._ENTITY == _5960)) {
- if (SAXStrings.indexOfNonWhitespace(this.getContent(), this
- .getContentBegin(), this.getContentEnd()) != -1) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
- }
- if ((XMLP._ELM_B == _5960) || (XMLP._ELM_EMP == _5960)) {
- this.m_iState = XMLP._STATE_DOCUMENT;
- }
- }
- if (XMLP._STATE_DOCUMENT == this.m_iState) {
- if ((XMLP._ELM_B == _5960) || (XMLP._ELM_EMP == _5960)) {
- this.m_stack.push(this.getName());
- }
- if ((XMLP._ELM_E == _5960) || (XMLP._ELM_EMP == _5960)) {
- var _5961 = this.m_stack.pop();
- if ((_5961 === null) || (_5961 != this.getName())) {
- return this._setErr(XMLP.ERR_ELM_NESTING);
- }
- }
- if (this.m_stack.count() === 0) {
- this.m_iState = XMLP._STATE_MISC;
- return _5960;
- }
- }
- if (XMLP._STATE_MISC == this.m_iState) {
- if ((XMLP._ELM_B == _5960) || (XMLP._ELM_E == _5960)
- || (XMLP._ELM_EMP == _5960) || (XMLP.EVT_DTD == _5960)) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
- if ((XMLP._TEXT == _5960) || (XMLP._ENTITY == _5960)) {
- if (SAXStrings.indexOfNonWhitespace(this.getContent(), this
- .getContentBegin(), this.getContentEnd()) != -1) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
- }
- }
- return _5960;
- };
- XMLP.prototype._clearAttributes = function() {
- this.m_atts = [];
- };
- XMLP.prototype._findAttributeIndex = function(name) {
- for ( var i = 0; i < this.m_atts.length; i++) {
- if (this.m_atts[i][XMLP._ATT_NAME] == name) {
- return i;
- }
- }
- return -1;
- };
- XMLP.prototype.getAttributeCount = function() {
- return this.m_atts ? this.m_atts.length : 0;
- };
- XMLP.prototype.getAttributeName = function(index) {
- return ((index < 0) || (index >= this.m_atts.length)) ? null
- : this.m_atts[index][XMLP._ATT_NAME];
- };
- XMLP.prototype.getAttributeValue = function(index) {
- return ((index < 0) || (index >= this.m_atts.length)) ? null
- : __unescapeString(this.m_atts[index][XMLP._ATT_VAL]);
- };
- XMLP.prototype.getAttributeValueByName = function(name) {
- return this.getAttributeValue(this._findAttributeIndex(name));
- };
- XMLP.prototype.getColumnNumber = function() {
- return SAXStrings.getColumnNumber(this.m_xml, this.m_iP);
- };
- XMLP.prototype.getContent = function() {
- return (this.m_cSrc == XMLP._CONT_XML) ? this.m_xml : this.m_cAlt;
- };
- XMLP.prototype.getContentBegin = function() {
- return this.m_cB;
- };
- XMLP.prototype.getContentEnd = function() {
- return this.m_cE;
- };
- XMLP.prototype.getLineNumber = function() {
- return SAXStrings.getLineNumber(this.m_xml, this.m_iP);
- };
- XMLP.prototype.getName = function() {
- return this.m_name;
- };
- XMLP.prototype.next = function() {
- return this._checkStructure(this._parse());
- };
- XMLP.prototype._parse = function() {
- if (this.m_iP == this.m_xml.length) {
- return XMLP._NONE;
- }
- if (this.m_iP == this.m_xml.indexOf("<?", this.m_iP)) {
- return this._parsePI(this.m_iP + 2);
- } else {
- if (this.m_iP == this.m_xml.indexOf("<!DOCTYPE", this.m_iP)) {
- return this._parseDTD(this.m_iP + 9);
- } else {
- if (this.m_iP == this.m_xml.indexOf("<!--", this.m_iP)) {
- return this._parseComment(this.m_iP + 4);
- } else {
- if (this.m_iP == this.m_xml.indexOf("<![CDATA[", this.m_iP)) {
- return this._parseCDATA(this.m_iP + 9);
- } else {
- if (this.m_iP == this.m_xml.indexOf("<", this.m_iP)) {
- return this._parseElement(this.m_iP + 1);
- } else {
- if (this.m_iP == this.m_xml.indexOf("&", this.m_iP)) {
- return this._parseEntity(this.m_iP + 1);
- } else {
- return this._parseText(this.m_iP);
- }
- }
- }
- }
- }
- }
- };
- XMLP.prototype._parseAttribute = function(iB, iE) {
- var iNB, iNE, iEq, iVB, iVE;
- var _596a, strN, strV;
- this.m_cAlt = "";
- iNB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
- if ((iNB == -1) || (iNB >= iE)) {
- return iNB;
- }
- iEq = this.m_xml.indexOf("=", iNB);
- if ((iEq == -1) || (iEq > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
- iNE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iNB, iEq);
- iVB = SAXStrings.indexOfNonWhitespace(this.m_xml, iEq + 1, iE);
- if ((iVB == -1) || (iVB > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
- _596a = this.m_xml.charAt(iVB);
- if (SAXStrings.QUOTES.indexOf(_596a) == -1) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
- iVE = this.m_xml.indexOf(_596a, iVB + 1);
- if ((iVE == -1) || (iVE > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
- strN = this.m_xml.substring(iNB, iNE + 1);
- strV = this.m_xml.substring(iVB + 1, iVE);
- if (strN.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ATT_LT_NAME);
- }
- if (strV.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ATT_LT_VALUE);
- }
- strV = SAXStrings.replace(strV, null, null, "\n", " ");
- strV = SAXStrings.replace(strV, null, null, "\t", " ");
- iRet = this._replaceEntities(strV);
- if (iRet == XMLP._ERROR) {
- return iRet;
- }
- strV = this.m_cAlt;
- if (this._findAttributeIndex(strN) == -1) {
- this._addAttribute(strN, strV);
- } else {
- return this._setErr(XMLP.ERR_ATT_DUP);
- }
- this.m_iP = iVE + 2;
- return XMLP._ATT;
- };
- XMLP.prototype._parseCDATA = function(iB) {
- var iE = this.m_xml.indexOf("]]>", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_CDATA);
- }
- this._setContent(XMLP._CONT_XML, iB, iE);
- this.m_iP = iE + 3;
- return XMLP._CDATA;
- };
- XMLP.prototype._parseComment = function(iB) {
- var iE = this.m_xml.indexOf("-" + "->", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_COMMENT);
- }
- this._setContent(XMLP._CONT_XML, iB, iE);
- this.m_iP = iE + 3;
- return XMLP._COMMENT;
- };
- XMLP.prototype._parseDTD = function(iB) {
- var iE, strClose, iInt, iLast;
- iE = this.m_xml.indexOf(">", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_DTD);
- }
- iInt = this.m_xml.indexOf("[", iB);
- strClose = ((iInt != -1) && (iInt < iE)) ? "]>" : ">";
- while (true) {
- if (iE == iLast) {
- return this._setErr(XMLP.ERR_INFINITELOOP);
- }
- iLast = iE;
- iE = this.m_xml.indexOf(strClose, iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_DTD);
- }
- if (this.m_xml.substring(iE - 1, iE + 2) != "]]>") {
- break;
- }
- }
- this.m_iP = iE + strClose.length;
- return XMLP._DTD;
- };
- XMLP.prototype._parseElement = function(iB) {
- var iE, iDE, iNE, iRet;
- var iType, strN, iLast;
- iDE = iE = this.m_xml.indexOf(">", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_ELM);
- }
- if (this.m_xml.charAt(iB) == "/") {
- iType = XMLP._ELM_E;
- iB++;
- } else {
- iType = XMLP._ELM_B;
- }
- if (this.m_xml.charAt(iE - 1) == "/") {
- if (iType == XMLP._ELM_E) {
- return this._setErr(XMLP.ERR_ELM_EMPTY);
- }
- iType = XMLP._ELM_EMP;
- iDE--;
- }
- iDE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iB, iDE);
- if (iE - iB != 1) {
- if (SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB) {
- return this._setErr(XMLP.ERR_ELM_NAME);
- }
- }
- this._clearAttributes();
- iNE = SAXStrings.indexOfWhitespace(this.m_xml, iB, iDE);
- if (iNE == -1) {
- iNE = iDE + 1;
- } else {
- this.m_iP = iNE;
- while (this.m_iP < iDE) {
- if (this.m_iP == iLast) {
- return this._setErr(XMLP.ERR_INFINITELOOP);
- }
- iLast = this.m_iP;
- iRet = this._parseAttribute(this.m_iP, iDE);
- if (iRet == XMLP._ERROR) {
- return iRet;
- }
- }
- }
- strN = this.m_xml.substring(iB, iNE);
- if (strN.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ELM_LT_NAME);
- }
- this.m_name = strN;
- this.m_iP = iE + 1;
- return iType;
- };
- XMLP.prototype._parseEntity = function(iB) {
- var iE = this.m_xml.indexOf(";", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_ENTITY);
- }
- this.m_iP = iE + 1;
- return this._replaceEntity(this.m_xml, iB, iE);
- };
- XMLP.prototype._parsePI = function(iB) {
- var iE, iTB, iTE, iCB, iCE;
- iE = this.m_xml.indexOf("?>", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_PI);
- }
- iTB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
- if (iTB == -1) {
- return this._setErr(XMLP.ERR_PI_TARGET);
- }
- iTE = SAXStrings.indexOfWhitespace(this.m_xml, iTB, iE);
- if (iTE == -1) {
- iTE = iE;
- }
- iCB = SAXStrings.indexOfNonWhitespace(this.m_xml, iTE, iE);
- if (iCB == -1) {
- iCB = iE;
- }
- iCE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iCB, iE);
- if (iCE == -1) {
- iCE = iE - 1;
- }
- this.m_name = this.m_xml.substring(iTB, iTE);
- this._setContent(XMLP._CONT_XML, iCB, iCE + 1);
- this.m_iP = iE + 2;
- return XMLP._PI;
- };
- XMLP.prototype._parseText = function(iB) {
- var iE, iEE;
- iE = this.m_xml.indexOf("<", iB);
- if (iE == -1) {
- iE = this.m_xml.length;
- }
- iEE = this.m_xml.indexOf("&", iB);
- if ((iEE != -1) && (iEE <= iE)) {
- iE = iEE;
- }
- this._setContent(XMLP._CONT_XML, iB, iE);
- this.m_iP = iE;
- return XMLP._TEXT;
- };
- XMLP.prototype._replaceEntities = function(strD, iB, iE) {
- if (SAXStrings.isEmpty(strD)) {
- return "";
- }
- iB = iB || 0;
- iE = iE || strD.length;
- var iEB, iEE, strRet = "";
- iEB = strD.indexOf("&", iB);
- iEE = iB;
- while ((iEB > 0) && (iEB < iE)) {
- strRet += strD.substring(iEE, iEB);
- iEE = strD.indexOf(";", iEB) + 1;
- if ((iEE === 0) || (iEE > iE)) {
- return this._setErr(XMLP.ERR_CLOSE_ENTITY);
- }
- iRet = this._replaceEntity(strD, iEB + 1, iEE - 1);
- if (iRet == XMLP._ERROR) {
- return iRet;
- }
- strRet += this.m_cAlt;
- iEB = strD.indexOf("&", iEE);
- }
- if (iEE != iE) {
- strRet += strD.substring(iEE, iE);
- }
- this._setContent(XMLP._CONT_ALT, strRet);
- return XMLP._ENTITY;
- };
- XMLP.prototype._replaceEntity = function(strD, iB, iE) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- switch (strD.substring(iB, iE)) {
- case "amp":
- strEnt = "&";
- break;
- case "lt":
- strEnt = "<";
- break;
- case "gt":
- strEnt = ">";
- break;
- case "apos":
- strEnt = "'";
- break;
- case "quot":
- strEnt = "\"";
- break;
- default:
- if (strD.charAt(iB) == "#") {
- strEnt = String.fromCharCode(parseInt(strD.substring(iB + 1, iE)));
- } else {
- return this._setErr(XMLP.ERR_ENTITY_UNKNOWN);
- }
- break;
- }
- this._setContent(XMLP._CONT_ALT, strEnt);
- return XMLP._ENTITY;
- };
- XMLP.prototype._setContent = function(iSrc) {
- var args = arguments;
- if (XMLP._CONT_XML == iSrc) {
- this.m_cAlt = null;
- this.m_cB = args[1];
- this.m_cE = args[2];
- } else {
- this.m_cAlt = args[1];
- this.m_cB = 0;
- this.m_cE = args[1].length;
- }
- this.m_cSrc = iSrc;
- };
- XMLP.prototype._setErr = function(iErr) {
- var _5984 = XMLP._errs[iErr];
- this.m_cAlt = _5984;
- this.m_cB = 0;
- this.m_cE = _5984.length;
- this.m_cSrc = XMLP._CONT_ALT;
- return XMLP._ERROR;
- };
- SAXDriver = function() {
- this.m_hndDoc = null;
- this.m_hndErr = null;
- this.m_hndLex = null;
- };
- SAXDriver.DOC_B = 1;
- SAXDriver.DOC_E = 2;
- SAXDriver.ELM_B = 3;
- SAXDriver.ELM_E = 4;
- SAXDriver.CHARS = 5;
- SAXDriver.PI = 6;
- SAXDriver.CD_B = 7;
- SAXDriver.CD_E = 8;
- SAXDriver.CMNT = 9;
- SAXDriver.DTD_B = 10;
- SAXDriver.DTD_E = 11;
- SAXDriver.prototype.parse = function(strD) {
- var _5986 = new XMLP(strD);
- if (this.m_hndDoc && this.m_hndDoc.setDocumentLocator) {
- this.m_hndDoc.setDocumentLocator(this);
- }
- this.m_parser = _5986;
- this.m_bErr = false;
- if (!this.m_bErr) {
- this._fireEvent(SAXDriver.DOC_B);
- }
- this._parseLoop();
- if (!this.m_bErr) {
- this._fireEvent(SAXDriver.DOC_E);
- }
- this.m_xml = null;
- this.m_iP = 0;
- };
- SAXDriver.prototype.setDocumentHandler = function(hnd) {
- this.m_hndDoc = hnd;
- };
- SAXDriver.prototype.setErrorHandler = function(hnd) {
- this.m_hndErr = hnd;
- };
- SAXDriver.prototype.setLexicalHandler = function(hnd) {
- this.m_hndLex = hnd;
- };
- SAXDriver.prototype.getColumnNumber = function() {
- return this.m_parser.getColumnNumber();
- };
- SAXDriver.prototype.getLineNumber = function() {
- return this.m_parser.getLineNumber();
- };
- SAXDriver.prototype.getMessage = function() {
- return this.m_strErrMsg;
- };
- SAXDriver.prototype.getPublicId = function() {
- return null;
- };
- SAXDriver.prototype.getSystemId = function() {
- return null;
- };
- SAXDriver.prototype.getLength = function() {
- return this.m_parser.getAttributeCount();
- };
- SAXDriver.prototype.getName = function(index) {
- return this.m_parser.getAttributeName(index);
- };
- SAXDriver.prototype.getValue = function(index) {
- return this.m_parser.getAttributeValue(index);
- };
- SAXDriver.prototype.getValueByName = function(name) {
- return this.m_parser.getAttributeValueByName(name);
- };
- SAXDriver.prototype._fireError = function(_598d) {
- this.m_strErrMsg = _598d;
- this.m_bErr = true;
- if (this.m_hndErr && this.m_hndErr.fatalError) {
- this.m_hndErr.fatalError(this);
- }
- };
- SAXDriver.prototype._fireEvent = function(iEvt) {
- var hnd, func, args = arguments, iLen = args.length - 1;
- if (this.m_bErr) {
- return;
- }
- if (SAXDriver.DOC_B == iEvt) {
- func = "startDocument";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.DOC_E == iEvt) {
- func = "endDocument";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.ELM_B == iEvt) {
- func = "startElement";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.ELM_E == iEvt) {
- func = "endElement";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.CHARS == iEvt) {
- func = "characters";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.PI == iEvt) {
- func = "processingInstruction";
- hnd = this.m_hndDoc;
- } else {
- if (SAXDriver.CD_B == iEvt) {
- func = "startCDATA";
- hnd = this.m_hndLex;
- } else {
- if (SAXDriver.CD_E == iEvt) {
- func = "endCDATA";
- hnd = this.m_hndLex;
- } else {
- if (SAXDriver.CMNT == iEvt) {
- func = "comment";
- hnd = this.m_hndLex;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (hnd && hnd[func]) {
- if (0 == iLen) {
- hnd[func]();
- } else {
- if (1 == iLen) {
- hnd[func](args[1]);
- } else {
- if (2 == iLen) {
- hnd[func](args[1], args[2]);
- } else {
- if (3 == iLen) {
- hnd[func](args[1], args[2], args[3]);
- }
- }
- }
- }
- }
- };
- SAXDriver.prototype._parseLoop = function(_5990) {
- var _5991, _5990;
- _5990 = this.m_parser;
- while (!this.m_bErr) {
- _5991 = _5990.next();
- if (_5991 == XMLP._ELM_B) {
- this._fireEvent(SAXDriver.ELM_B, _5990.getName(), this);
- } else {
- if (_5991 == XMLP._ELM_E) {
- this._fireEvent(SAXDriver.ELM_E, _5990.getName());
- } else {
- if (_5991 == XMLP._ELM_EMP) {
- this._fireEvent(SAXDriver.ELM_B, _5990.getName(), this);
- this._fireEvent(SAXDriver.ELM_E, _5990.getName());
- } else {
- if (_5991 == XMLP._TEXT) {
- this._fireEvent(SAXDriver.CHARS, _5990.getContent(),
- _5990.getContentBegin(), _5990.getContentEnd()
- - _5990.getContentBegin());
- } else {
- if (_5991 == XMLP._ENTITY) {
- this._fireEvent(SAXDriver.CHARS,
- _5990.getContent(),
- _5990.getContentBegin(), _5990
- .getContentEnd()
- - _5990.getContentBegin());
- } else {
- if (_5991 == XMLP._PI) {
- this._fireEvent(SAXDriver.PI, _5990.getName(),
- _5990.getContent().substring(
- _5990.getContentBegin(),
- _5990.getContentEnd()));
- } else {
- if (_5991 == XMLP._CDATA) {
- this._fireEvent(SAXDriver.CD_B);
- this._fireEvent(SAXDriver.CHARS, _5990
- .getContent(), _5990
- .getContentBegin(), _5990
- .getContentEnd()
- - _5990.getContentBegin());
- this._fireEvent(SAXDriver.CD_E);
- } else {
- if (_5991 == XMLP._COMMENT) {
- this._fireEvent(SAXDriver.CMNT, _5990
- .getContent(), _5990
- .getContentBegin(), _5990
- .getContentEnd()
- - _5990.getContentBegin());
- } else {
- if (_5991 == XMLP._DTD) {
- } else {
- if (_5991 == XMLP._ERROR) {
- this._fireError(_5990
- .getContent());
- } else {
- if (_5991 == XMLP._NONE) {
- return;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- };
- SAXStrings = function() {
- };
- SAXStrings.WHITESPACE = " \t\n\r";
- SAXStrings.QUOTES = "\"'";
- SAXStrings.getColumnNumber = function(strD, iP) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iP = iP || strD.length;
- var arrD = strD.substring(0, iP).split("\n");
- var _5995 = arrD[arrD.length - 1];
- arrD.length--;
- var _5996 = arrD.join("\n").length;
- return iP - _5996;
- };
- SAXStrings.getLineNumber = function(strD, iP) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iP = iP || strD.length;
- return strD.substring(0, iP).split("\n").length;
- };
- SAXStrings.indexOfNonWhitespace = function(strD, iB, iE) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iB; i < iE; i++) {
- if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
- return i;
- }
- }
- return -1;
- };
- SAXStrings.indexOfWhitespace = function(strD, iB, iE) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iB; i < iE; i++) {
- if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
- return i;
- }
- }
- return -1;
- };
- SAXStrings.isEmpty = function(strD) {
- return (strD === null) || (strD.length === 0);
- };
- SAXStrings.lastIndexOfNonWhitespace = function(strD, iB, iE) {
- if (SAXStrings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iE - 1; i >= iB; i--) {
- if (SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
- return i;
- }
- }
- return -1;
- };
- SAXStrings.replace = function(strD, iB, iE, strF, strR) {
- if (SAXStrings.isEmpty(strD)) {
- return "";
- }
- iB = iB || 0;
- iE = iE || strD.length;
- return strD.substring(iB, iE).split(strF).join(strR);
- };
- Stack = function() {
- this.m_arr = [];
- };
- Stack.prototype.clear = function() {
- this.m_arr = [];
- };
- Stack.prototype.count = function() {
- return this.m_arr.length;
- };
- Stack.prototype.destroy = function() {
- this.m_arr = null;
- };
- Stack.prototype.peek = function() {
- if (this.m_arr.length === 0) {
- return null;
- }
- return this.m_arr[this.m_arr.length - 1];
- };
- Stack.prototype.pop = function() {
- if (this.m_arr.length === 0) {
- return null;
- }
- var o = this.m_arr[this.m_arr.length - 1];
- this.m_arr.length--;
- return o;
- };
- Stack.prototype.push = function(o) {
- this.m_arr[this.m_arr.length] = o;
- };
- function isEmpty(str) {
- return (str === null) || (str.length == 0);
- }
- function trim(_59ae, _59af, _59b0) {
- if (isEmpty(_59ae)) {
- return "";
- }
- if (_59af === null) {
- _59af = true;
- }
- if (_59b0 === null) {
- _59b0 = true;
- }
- var left = 0;
- var right = 0;
- var i = 0;
- var k = 0;
- if (_59af == true) {
- while ((i < _59ae.length)
- && (whitespace.indexOf(_59ae.charAt(i++)) != -1)) {
- left++;
- }
- }
- if (_59b0 == true) {
- k = _59ae.length - 1;
- while ((k >= left) && (whitespace.indexOf(_59ae.charAt(k--)) != -1)) {
- right++;
- }
- }
- return _59ae.substring(left, _59ae.length - right);
- }
- function __escapeString(str) {
- var _59b6 = /&/g;
- var _59b7 = /</g;
- var _59b8 = />/g;
- var _59b9 = /"/g;
- var _59ba = /'/g;
- str = str.replace(_59b6, "&");
- str = str.replace(_59b7, "<");
- str = str.replace(_59b8, ">");
- str = str.replace(_59b9, """);
- str = str.replace(_59ba, "'");
- return str;
- }
- function __unescapeString(str) {
- var _59bc = /&/g;
- var _59bd = /</g;
- var _59be = />/g;
- var _59bf = /"/g;
- var _59c0 = /'/g;
- str = str.replace(_59bc, "&");
- str = str.replace(_59bd, "<");
- str = str.replace(_59be, ">");
- str = str.replace(_59bf, "\"");
- str = str.replace(_59c0, "'");
- return str;
- }
- function addClass(_619a, _619b) {
- if (_619a) {
- if (_619a.indexOf("|" + _619b + "|") < 0) {
- _619a += _619b + "|";
- }
- } else {
- _619a = "|" + _619b + "|";
- }
- return _619a;
- }
- DOMException = function(code) {
- this._class = addClass(this._class, "DOMException");
- this.code = code;
- };
- DOMException.INDEX_SIZE_ERR = 1;
- DOMException.DOMSTRING_SIZE_ERR = 2;
- DOMException.HIERARCHY_REQUEST_ERR = 3;
- DOMException.WRONG_DOCUMENT_ERR = 4;
- DOMException.INVALID_CHARACTER_ERR = 5;
- DOMException.NO_DATA_ALLOWED_ERR = 6;
- DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
- DOMException.NOT_FOUND_ERR = 8;
- DOMException.NOT_SUPPORTED_ERR = 9;
- DOMException.INUSE_ATTRIBUTE_ERR = 10;
- DOMException.INVALID_STATE_ERR = 11;
- DOMException.SYNTAX_ERR = 12;
- DOMException.INVALID_MODIFICATION_ERR = 13;
- DOMException.NAMESPACE_ERR = 14;
- DOMException.INVALID_ACCESS_ERR = 15;
- DOMImplementation = function() {
- this._class = addClass(this._class, "DOMImplementation");
- this._p = null;
- this.preserveWhiteSpace = false;
- this.namespaceAware = true;
- this.errorChecking = true;
- };
- DOMImplementation.prototype.escapeString = function DOMNode__escapeString(str) {
- return __escapeString(str);
- };
- DOMImplementation.prototype.unescapeString = function DOMNode__unescapeString(
- str) {
- return __unescapeString(str);
- };
- DOMImplementation.prototype.hasFeature = function DOMImplementation_hasFeature(
- _619f, _61a0) {
- var ret = false;
- if (_619f.toLowerCase() == "xml") {
- ret = (!_61a0 || (_61a0 == "1.0") || (_61a0 == "2.0"));
- } else {
- if (_619f.toLowerCase() == "core") {
- ret = (!_61a0 || (_61a0 == "2.0"));
- }
- }
- return ret;
- };
- DOMImplementation.prototype.loadXML = function DOMImplementation_loadXML(_61a2) {
- var _61a3;
- try {
- _61a3 = new XMLP(_61a2);
- } catch (e) {
- 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.");
- }
- var doc = new DOMDocument(this);
- this._parseLoop(doc, _61a3);
- doc._parseComplete = true;
- return doc;
- };
- DOMImplementation.prototype.translateErrCode = function DOMImplementation_translateErrCode(
- code) {
- var msg = "";
- switch (code) {
- case DOMException.INDEX_SIZE_ERR:
- msg = "INDEX_SIZE_ERR: Index out of bounds";
- break;
- case DOMException.DOMSTRING_SIZE_ERR:
- msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString";
- break;
- case DOMException.HIERARCHY_REQUEST_ERR:
- msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location";
- break;
- case DOMException.WRONG_DOCUMENT_ERR:
- msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same";
- break;
- case DOMException.INVALID_CHARACTER_ERR:
- msg = "INVALID_CHARACTER_ERR: The string contains an invalid character";
- break;
- case DOMException.NO_DATA_ALLOWED_ERR:
- msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data";
- break;
- case DOMException.NO_MODIFICATION_ALLOWED_ERR:
- msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified";
- break;
- case DOMException.NOT_FOUND_ERR:
- msg = "NOT_FOUND_ERR: The item cannot be found";
- break;
- case DOMException.NOT_SUPPORTED_ERR:
- msg = "NOT_SUPPORTED_ERR: This implementation does not support function";
- break;
- case DOMException.INUSE_ATTRIBUTE_ERR:
- msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element";
- break;
- case DOMException.INVALID_STATE_ERR:
- msg = "INVALID_STATE_ERR: The object is no longer usable";
- break;
- case DOMException.SYNTAX_ERR:
- msg = "SYNTAX_ERR: Syntax error";
- break;
- case DOMException.INVALID_MODIFICATION_ERR:
- msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object";
- break;
- case DOMException.NAMESPACE_ERR:
- msg = "NAMESPACE_ERR: The namespace declaration is incorrect";
- break;
- case DOMException.INVALID_ACCESS_ERR:
- msg = "INVALID_ACCESS_ERR: The object does not support this function";
- break;
- default:
- msg = "UNKNOWN: Unknown Exception Code (" + code + ")";
- }
- return msg;
- };
- DOMImplementation.prototype._parseLoop = function DOMImplementation__parseLoop(
- doc, p) {
- var iEvt, iNode, iAttr, strName;
- iNodeParent = doc;
- var _61aa = 0;
- var _61ab = [];
- var _61ac = [];
- if (this.namespaceAware) {
- var iNS = doc.createNamespace("");
- iNS.setValue("http://www.w3.org/2000/xmlns/");
- doc._namespaces.setNamedItem(iNS);
- }
- while (true) {
- iEvt = p.next();
- if (iEvt == XMLP._ELM_B) {
- var pName = p.getName();
- pName = trim(pName, true, true);
- if (!this.namespaceAware) {
- iNode = doc.createElement(p.getName());
- for ( var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i);
- iAttr = iNode.getAttributeNode(strName);
- if (!iAttr) {
- iAttr = doc.createAttribute(strName);
- }
- iAttr.setValue(p.getAttributeValue(i));
- iNode.setAttributeNode(iAttr);
- }
- } else {
- iNode = doc.createElementNS("", p.getName());
- iNode._namespaces = iNodeParent._namespaces._cloneNodes(iNode);
- for ( var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i);
- if (this._isNamespaceDeclaration(strName)) {
- var _61b0 = this._parseNSName(strName);
- if (strName != "xmlns") {
- iNS = doc.createNamespace(strName);
- } else {
- iNS = doc.createNamespace("");
- }
- iNS.setValue(p.getAttributeValue(i));
- iNode._namespaces.setNamedItem(iNS);
- } else {
- iAttr = iNode.getAttributeNode(strName);
- if (!iAttr) {
- iAttr = doc.createAttributeNS("", strName);
- }
- iAttr.setValue(p.getAttributeValue(i));
- iNode.setAttributeNodeNS(iAttr);
- if (this._isIdDeclaration(strName)) {
- iNode.id = p.getAttributeValue(i);
- }
- }
- }
- if (iNode._namespaces.getNamedItem(iNode.prefix)) {
- iNode.namespaceURI = iNode._namespaces
- .getNamedItem(iNode.prefix).value;
- }
- for ( var i = 0; i < iNode.attributes.length; i++) {
- if (iNode.attributes.item(i).prefix != "") {
- if (iNode._namespaces.getNamedItem(iNode.attributes
- .item(i).prefix)) {
- iNode.attributes.item(i).namespaceURI = iNode._namespaces
- .getNamedItem(iNode.attributes.item(i).prefix).value;
- }
- }
- }
- }
- if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
- iNodeParent.documentElement = iNode;
- }
- iNodeParent.appendChild(iNode);
- iNodeParent = iNode;
- } else {
- if (iEvt == XMLP._ELM_E) {
- iNodeParent = iNodeParent.parentNode;
- } else {
- if (iEvt == XMLP._ELM_EMP) {
- pName = p.getName();
- pName = trim(pName, true, true);
- if (!this.namespaceAware) {
- iNode = doc.createElement(pName);
- for ( var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i);
- iAttr = iNode.getAttributeNode(strName);
- if (!iAttr) {
- iAttr = doc.createAttribute(strName);
- }
- iAttr.setValue(p.getAttributeValue(i));
- iNode.setAttributeNode(iAttr);
- }
- } else {
- iNode = doc.createElementNS("", p.getName());
- iNode._namespaces = iNodeParent._namespaces
- ._cloneNodes(iNode);
- for ( var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i);
- if (this._isNamespaceDeclaration(strName)) {
- var _61b0 = this._parseNSName(strName);
- if (strName != "xmlns") {
- iNS = doc.createNamespace(strName);
- } else {
- iNS = doc.createNamespace("");
- }
- iNS.setValue(p.getAttributeValue(i));
- iNode._namespaces.setNamedItem(iNS);
- } else {
- iAttr = iNode.getAttributeNode(strName);
- if (!iAttr) {
- iAttr = doc.createAttributeNS("", strName);
- }
- iAttr.setValue(p.getAttributeValue(i));
- iNode.setAttributeNodeNS(iAttr);
- if (this._isIdDeclaration(strName)) {
- iNode.id = p.getAttributeValue(i);
- }
- }
- }
- if (iNode._namespaces.getNamedItem(iNode.prefix)) {
- iNode.namespaceURI = iNode._namespaces
- .getNamedItem(iNode.prefix).value;
- }
- for ( var i = 0; i < iNode.attributes.length; i++) {
- if (iNode.attributes.item(i).prefix != "") {
- if (iNode._namespaces
- .getNamedItem(iNode.attributes.item(i).prefix)) {
- iNode.attributes.item(i).namespaceURI = iNode._namespaces
- .getNamedItem(iNode.attributes
- .item(i).prefix).value;
- }
- }
- }
- }
- if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
- iNodeParent.documentElement = iNode;
- }
- iNodeParent.appendChild(iNode);
- } else {
- if (iEvt == XMLP._TEXT || iEvt == XMLP._ENTITY) {
- var _61b1 = p.getContent().substring(
- p.getContentBegin(), p.getContentEnd());
- if (!this.preserveWhiteSpace) {
- if (trim(_61b1, true, true) == "") {
- _61b1 = "";
- }
- }
- if (_61b1.length > 0) {
- var _61b2 = doc.createTextNode(_61b1);
- iNodeParent.appendChild(_61b2);
- if (iEvt == XMLP._ENTITY) {
- _61ab[_61ab.length] = _61b2;
- } else {
- _61ac[_61ac.length] = _61b2;
- }
- }
- } else {
- if (iEvt == XMLP._PI) {
- iNodeParent.appendChild(doc
- .createProcessingInstruction(p.getName(), p
- .getContent().substring(
- p.getContentBegin(),
- p.getContentEnd())));
- } else {
- if (iEvt == XMLP._CDATA) {
- _61b1 = p.getContent().substring(
- p.getContentBegin(), p.getContentEnd());
- if (!this.preserveWhiteSpace) {
- _61b1 = trim(_61b1, true, true);
- _61b1.replace(/ +/g, " ");
- }
- if (_61b1.length > 0) {
- iNodeParent.appendChild(doc
- .createCDATASection(_61b1));
- }
- } else {
- if (iEvt == XMLP._COMMENT) {
- var _61b1 = p.getContent().substring(
- p.getContentBegin(),
- p.getContentEnd());
- if (!this.preserveWhiteSpace) {
- _61b1 = trim(_61b1, true, true);
- _61b1.replace(/ +/g, " ");
- }
- if (_61b1.length > 0) {
- iNodeParent.appendChild(doc
- .createComment(_61b1));
- }
- } else {
- if (iEvt == XMLP._DTD) {
- } else {
- if (iEvt == XMLP._ERROR) {
- throw (new DOMException(
- DOMException.SYNTAX_ERR));
- } else {
- if (iEvt == XMLP._NONE) {
- if (iNodeParent == doc) {
- break;
- } else {
- throw (new DOMException(
- DOMException.SYNTAX_ERR));
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- var _61b3 = _61ab.length;
- for (intLoop = 0; intLoop < _61b3; intLoop++) {
- var _61b4 = _61ab[intLoop];
- var _61b5 = _61b4.getParentNode();
- if (_61b5) {
- _61b5.normalize();
- if (!this.preserveWhiteSpace) {
- var _61b6 = _61b5.getChildNodes();
- var _61b7 = _61b6.getLength();
- for (intLoop2 = 0; intLoop2 < _61b7; intLoop2++) {
- var child = _61b6.item(intLoop2);
- if (child.getNodeType() == DOMNode.TEXT_NODE) {
- var _61b9 = child.getData();
- _61b9 = trim(_61b9, true, true);
- _61b9.replace(/ +/g, " ");
- child.setData(_61b9);
- }
- }
- }
- }
- }
- if (!this.preserveWhiteSpace) {
- var _61b3 = _61ac.length;
- for (intLoop = 0; intLoop < _61b3; intLoop++) {
- var node = _61ac[intLoop];
- if (node.getParentNode() !== null) {
- var _61bb = node.getData();
- _61bb = trim(_61bb, true, true);
- _61bb.replace(/ +/g, " ");
- node.setData(_61bb);
- }
- }
- }
- };
- DOMImplementation.prototype._isNamespaceDeclaration = function DOMImplementation__isNamespaceDeclaration(
- _61bc) {
- return (_61bc.indexOf("xmlns") > -1);
- };
- DOMImplementation.prototype._isIdDeclaration = function DOMImplementation__isIdDeclaration(
- _61bd) {
- return (_61bd.toLowerCase() == "id");
- };
- DOMImplementation.prototype._isValidName = function DOMImplementation__isValidName(
- name) {
- return name.match(re_validName);
- };
- re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/;
- DOMImplementation.prototype._isValidString = function DOMImplementation__isValidString(
- name) {
- return (name.search(re_invalidStringChars) < 0);
- };
- 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/;
- DOMImplementation.prototype._parseNSName = function DOMImplementation__parseNSName(
- _61c0) {
- var _61c1 = {};
- _61c1.prefix = _61c0;
- _61c1.namespaceName = "";
- delimPos = _61c0.indexOf(":");
- if (delimPos > -1) {
- _61c1.prefix = _61c0.substring(0, delimPos);
- _61c1.namespaceName = _61c0.substring(delimPos + 1, _61c0.length);
- }
- return _61c1;
- };
- DOMImplementation.prototype._parseQName = function DOMImplementation__parseQName(
- _61c2) {
- var _61c3 = {};
- _61c3.localName = _61c2;
- _61c3.prefix = "";
- delimPos = _61c2.indexOf(":");
- if (delimPos > -1) {
- _61c3.prefix = _61c2.substring(0, delimPos);
- _61c3.localName = _61c2.substring(delimPos + 1, _61c2.length);
- }
- return _61c3;
- };
- DOMNodeList = function(_61c4, _61c5) {
- this._class = addClass(this._class, "DOMNodeList");
- this._nodes = [];
- this.length = 0;
- this.parentNode = _61c5;
- this.ownerDocument = _61c4;
- this._readonly = false;
- };
- DOMNodeList.prototype.getLength = function DOMNodeList_getLength() {
- return this.length;
- };
- DOMNodeList.prototype.item = function DOMNodeList_item(index) {
- var ret = null;
- if ((index >= 0) && (index < this._nodes.length)) {
- ret = this._nodes[index];
- }
- return ret;
- };
- DOMNodeList.prototype._findItemIndex = function DOMNodeList__findItemIndex(id) {
- var ret = -1;
- if (id > -1) {
- for ( var i = 0; i < this._nodes.length; i++) {
- if (this._nodes[i]._id == id) {
- ret = i;
- break;
- }
- }
- }
- return ret;
- };
- DOMNodeList.prototype._insertBefore = function DOMNodeList__insertBefore(_61cb,
- _61cc) {
- if ((_61cc >= 0) && (_61cc < this._nodes.length)) {
- var _61cd = [];
- _61cd = this._nodes.slice(0, _61cc);
- if (_61cb.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- _61cd = _61cd.concat(_61cb.childNodes._nodes);
- } else {
- _61cd[_61cd.length] = _61cb;
- }
- this._nodes = _61cd.concat(this._nodes.slice(_61cc));
- this.length = this._nodes.length;
- }
- };
- DOMNodeList.prototype._replaceChild = function DOMNodeList__replaceChild(_61ce,
- _61cf) {
- var ret = null;
- if ((_61cf >= 0) && (_61cf < this._nodes.length)) {
- ret = this._nodes[_61cf];
- if (_61ce.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- var _61d1 = [];
- _61d1 = this._nodes.slice(0, _61cf);
- _61d1 = _61d1.concat(_61ce.childNodes._nodes);
- this._nodes = _61d1.concat(this._nodes.slice(_61cf + 1));
- } else {
- this._nodes[_61cf] = _61ce;
- }
- }
- return ret;
- };
- DOMNodeList.prototype._removeChild = function DOMNodeList__removeChild(_61d2) {
- var ret = null;
- if (_61d2 > -1) {
- ret = this._nodes[_61d2];
- var _61d4 = [];
- _61d4 = this._nodes.slice(0, _61d2);
- this._nodes = _61d4.concat(this._nodes.slice(_61d2 + 1));
- this.length = this._nodes.length;
- }
- return ret;
- };
- DOMNodeList.prototype._appendChild = function DOMNodeList__appendChild(_61d5) {
- if (_61d5.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- this._nodes = this._nodes.concat(_61d5.childNodes._nodes);
- } else {
- this._nodes[this._nodes.length] = _61d5;
- }
- this.length = this._nodes.length;
- };
- DOMNodeList.prototype._cloneNodes = function DOMNodeList__cloneNodes(deep,
- _61d7) {
- var _61d8 = new DOMNodeList(this.ownerDocument, _61d7);
- for ( var i = 0; i < this._nodes.length; i++) {
- _61d8._appendChild(this._nodes[i].cloneNode(deep));
- }
- return _61d8;
- };
- DOMNodeList.prototype.toString = function DOMNodeList_toString() {
- var ret = "";
- for ( var i = 0; i < this.length; i++) {
- ret += this._nodes[i].toString();
- }
- return ret;
- };
- DOMNamedNodeMap = function(_61dc, _61dd) {
- this._class = addClass(this._class, "DOMNamedNodeMap");
- this.DOMNodeList = DOMNodeList;
- this.DOMNodeList(_61dc, _61dd);
- };
- DOMNamedNodeMap.prototype = new DOMNodeList;
- DOMNamedNodeMap.prototype.getNamedItem = function DOMNamedNodeMap_getNamedItem(
- name) {
- var ret = null;
- var _61e0 = this._findNamedItemIndex(name);
- if (_61e0 > -1) {
- ret = this._nodes[_61e0];
- }
- return ret;
- };
- DOMNamedNodeMap.prototype.setNamedItem = function DOMNamedNodeMap_setNamedItem(
- arg) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (this.ownerDocument != arg.ownerDocument) {
- throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
- if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
- throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
- }
- }
- var _61e2 = this._findNamedItemIndex(arg.name);
- var ret = null;
- if (_61e2 > -1) {
- ret = this._nodes[_61e2];
- if (this.ownerDocument.implementation.errorChecking && ret._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- } else {
- this._nodes[_61e2] = arg;
- }
- } else {
- this._nodes[this.length] = arg;
- }
- this.length = this._nodes.length;
- arg.ownerElement = this.parentNode;
- return ret;
- };
- DOMNamedNodeMap.prototype.removeNamedItem = function DOMNamedNodeMap_removeNamedItem(
- name) {
- var ret = null;
- if (this.ownerDocument.implementation.errorChecking
- && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- var _61e6 = this._findNamedItemIndex(name);
- if (this.ownerDocument.implementation.errorChecking && (_61e6 < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- var _61e7 = this._nodes[_61e6];
- if (this.ownerDocument.implementation.errorChecking && _61e7._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- return this._removeChild(_61e6);
- };
- DOMNamedNodeMap.prototype.getNamedItemNS = function DOMNamedNodeMap_getNamedItemNS(
- _61e8, _61e9) {
- var ret = null;
- var _61eb = this._findNamedItemNSIndex(_61e8, _61e9);
- if (_61eb > -1) {
- ret = this._nodes[_61eb];
- }
- return ret;
- };
- DOMNamedNodeMap.prototype.setNamedItemNS = function DOMNamedNodeMap_setNamedItemNS(
- arg) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.ownerDocument != arg.ownerDocument) {
- throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
- if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
- throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
- }
- }
- var _61ed = this._findNamedItemNSIndex(arg.namespaceURI, arg.localName);
- var ret = null;
- if (_61ed > -1) {
- ret = this._nodes[_61ed];
- if (this.ownerDocument.implementation.errorChecking && ret._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- } else {
- this._nodes[_61ed] = arg;
- }
- } else {
- this._nodes[this.length] = arg;
- }
- this.length = this._nodes.length;
- arg.ownerElement = this.parentNode;
- return ret;
- };
- DOMNamedNodeMap.prototype.removeNamedItemNS = function DOMNamedNodeMap_removeNamedItemNS(
- _61ef, _61f0) {
- var ret = null;
- if (this.ownerDocument.implementation.errorChecking
- && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- var _61f2 = this._findNamedItemNSIndex(_61ef, _61f0);
- if (this.ownerDocument.implementation.errorChecking && (_61f2 < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- var _61f3 = this._nodes[_61f2];
- if (this.ownerDocument.implementation.errorChecking && _61f3._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- return this._removeChild(_61f2);
- };
- DOMNamedNodeMap.prototype._findNamedItemIndex = function DOMNamedNodeMap__findNamedItemIndex(
- name) {
- var ret = -1;
- for ( var i = 0; i < this._nodes.length; i++) {
- if (this._nodes[i].name == name) {
- ret = i;
- break;
- }
- }
- return ret;
- };
- DOMNamedNodeMap.prototype._findNamedItemNSIndex = function DOMNamedNodeMap__findNamedItemNSIndex(
- _61f7, _61f8) {
- var ret = -1;
- if (_61f8) {
- for ( var i = 0; i < this._nodes.length; i++) {
- if ((this._nodes[i].namespaceURI == _61f7)
- && (this._nodes[i].localName == _61f8)) {
- ret = i;
- break;
- }
- }
- }
- return ret;
- };
- DOMNamedNodeMap.prototype._hasAttribute = function DOMNamedNodeMap__hasAttribute(
- name) {
- var ret = false;
- var _61fd = this._findNamedItemIndex(name);
- if (_61fd > -1) {
- ret = true;
- }
- return ret;
- };
- DOMNamedNodeMap.prototype._hasAttributeNS = function DOMNamedNodeMap__hasAttributeNS(
- _61fe, _61ff) {
- var ret = false;
- var _6201 = this._findNamedItemNSIndex(_61fe, _61ff);
- if (_6201 > -1) {
- ret = true;
- }
- return ret;
- };
- DOMNamedNodeMap.prototype._cloneNodes = function DOMNamedNodeMap__cloneNodes(
- _6202) {
- var _6203 = new DOMNamedNodeMap(this.ownerDocument, _6202);
- for ( var i = 0; i < this._nodes.length; i++) {
- _6203._appendChild(this._nodes[i].cloneNode(false));
- }
- return _6203;
- };
- DOMNamedNodeMap.prototype.toString = function DOMNamedNodeMap_toString() {
- var ret = "";
- for ( var i = 0; i < this.length - 1; i++) {
- ret += this._nodes[i].toString() + " ";
- }
- if (this.length > 0) {
- ret += this._nodes[this.length - 1].toString();
- }
- return ret;
- };
- DOMNamespaceNodeMap = function(_6207, _6208) {
- this._class = addClass(this._class, "DOMNamespaceNodeMap");
- this.DOMNamedNodeMap = DOMNamedNodeMap;
- this.DOMNamedNodeMap(_6207, _6208);
- };
- DOMNamespaceNodeMap.prototype = new DOMNamedNodeMap;
- DOMNamespaceNodeMap.prototype._findNamedItemIndex = function DOMNamespaceNodeMap__findNamedItemIndex(
- _6209) {
- var ret = -1;
- for ( var i = 0; i < this._nodes.length; i++) {
- if (this._nodes[i].localName == _6209) {
- ret = i;
- break;
- }
- }
- return ret;
- };
- DOMNamespaceNodeMap.prototype._cloneNodes = function DOMNamespaceNodeMap__cloneNodes(
- _620c) {
- var _620d = new DOMNamespaceNodeMap(this.ownerDocument, _620c);
- for ( var i = 0; i < this._nodes.length; i++) {
- _620d._appendChild(this._nodes[i].cloneNode(false));
- }
- return _620d;
- };
- DOMNamespaceNodeMap.prototype.toString = function DOMNamespaceNodeMap_toString() {
- var ret = "";
- for ( var ind = 0; ind < this._nodes.length; ind++) {
- var ns = null;
- try {
- var ns = this.parentNode.parentNode._namespaces
- .getNamedItem(this._nodes[ind].localName);
- } catch (e) {
- break;
- }
- if (!(ns && ("" + ns.nodeValue == "" + this._nodes[ind].nodeValue))) {
- ret += this._nodes[ind].toString() + " ";
- }
- }
- return ret;
- };
- DOMNode = function(_6212) {
- this._class = addClass(this._class, "DOMNode");
- if (_6212) {
- this._id = _6212._genId();
- }
- this.namespaceURI = "";
- this.prefix = "";
- this.localName = "";
- this.nodeName = "";
- this.nodeValue = "";
- this.nodeType = 0;
- this.parentNode = null;
- this.childNodes = new DOMNodeList(_6212, this);
- this.firstChild = null;
- this.lastChild = null;
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributes = new DOMNamedNodeMap(_6212, this);
- this.ownerDocument = _6212;
- this._namespaces = new DOMNamespaceNodeMap(_6212, this);
- this._readonly = false;
- };
- DOMNode.ELEMENT_NODE = 1;
- DOMNode.ATTRIBUTE_NODE = 2;
- DOMNode.TEXT_NODE = 3;
- DOMNode.CDATA_SECTION_NODE = 4;
- DOMNode.ENTITY_REFERENCE_NODE = 5;
- DOMNode.ENTITY_NODE = 6;
- DOMNode.PROCESSING_INSTRUCTION_NODE = 7;
- DOMNode.COMMENT_NODE = 8;
- DOMNode.DOCUMENT_NODE = 9;
- DOMNode.DOCUMENT_TYPE_NODE = 10;
- DOMNode.DOCUMENT_FRAGMENT_NODE = 11;
- DOMNode.NOTATION_NODE = 12;
- DOMNode.NAMESPACE_NODE = 13;
- DOMNode.prototype.hasAttributes = function DOMNode_hasAttributes() {
- if (this.attributes.length === 0) {
- return false;
- } else {
- return true;
- }
- };
- DOMNode.prototype.getNodeName = function DOMNode_getNodeName() {
- return this.nodeName;
- };
- DOMNode.prototype.getNodeValue = function DOMNode_getNodeValue() {
- return this.nodeValue;
- };
- DOMNode.prototype.setNodeValue = function DOMNode_setNodeValue(_6213) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.nodeValue = _6213;
- };
- DOMNode.prototype.getNodeType = function DOMNode_getNodeType() {
- return this.nodeType;
- };
- DOMNode.prototype.getParentNode = function DOMNode_getParentNode() {
- return this.parentNode;
- };
- DOMNode.prototype.getChildNodes = function DOMNode_getChildNodes() {
- return this.childNodes;
- };
- DOMNode.prototype.getFirstChild = function DOMNode_getFirstChild() {
- return this.firstChild;
- };
- DOMNode.prototype.getLastChild = function DOMNode_getLastChild() {
- return this.lastChild;
- };
- DOMNode.prototype.getPreviousSibling = function DOMNode_getPreviousSibling() {
- return this.previousSibling;
- };
- DOMNode.prototype.getNextSibling = function DOMNode_getNextSibling() {
- return this.nextSibling;
- };
- DOMNode.prototype.getAttributes = function DOMNode_getAttributes() {
- return this.attributes;
- };
- DOMNode.prototype.getOwnerDocument = function DOMNode_getOwnerDocument() {
- return this.ownerDocument;
- };
- DOMNode.prototype.getNamespaceURI = function DOMNode_getNamespaceURI() {
- return this.namespaceURI;
- };
- DOMNode.prototype.getPrefix = function DOMNode_getPrefix() {
- return this.prefix;
- };
- DOMNode.prototype.setPrefix = function DOMNode_setPrefix(_6214) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (!this.ownerDocument.implementation._isValidName(_6214)) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- if (!this.ownerDocument._isValidNamespace(this.namespaceURI, _6214
- + ":" + this.localName)) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- if ((_6214 == "xmlns")
- && (this.namespaceURI != "http://www.w3.org/2000/xmlns/")) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- if ((_6214 == "") && (this.localName == "xmlns")) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- }
- this.prefix = _6214;
- if (this.prefix != "") {
- this.nodeName = this.prefix + ":" + this.localName;
- } else {
- this.nodeName = this.localName;
- }
- };
- DOMNode.prototype.getLocalName = function DOMNode_getLocalName() {
- return this.localName;
- };
- DOMNode.prototype.insertBefore = function DOMNode_insertBefore(_6215, _6216) {
- var _6217;
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.ownerDocument != _6215.ownerDocument) {
- throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
- if (this._isAncestor(_6215)) {
- throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
- if (_6216) {
- var _6218 = this.childNodes._findItemIndex(_6216._id);
- if (this.ownerDocument.implementation.errorChecking && (_6218 < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- var _6219 = _6215.parentNode;
- if (_6219) {
- _6219.removeChild(_6215);
- }
- this.childNodes._insertBefore(_6215, this.childNodes
- ._findItemIndex(_6216._id));
- _6217 = _6216.previousSibling;
- if (_6215.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- if (_6215.childNodes._nodes.length > 0) {
- for ( var ind = 0; ind < _6215.childNodes._nodes.length; ind++) {
- _6215.childNodes._nodes[ind].parentNode = this;
- }
- _6216.previousSibling = _6215.childNodes._nodes[_6215.childNodes._nodes.length - 1];
- }
- } else {
- _6215.parentNode = this;
- _6216.previousSibling = _6215;
- }
- } else {
- _6217 = this.lastChild;
- this.appendChild(_6215);
- }
- if (_6215.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- if (_6215.childNodes._nodes.length > 0) {
- if (_6217) {
- _6217.nextSibling = _6215.childNodes._nodes[0];
- } else {
- this.firstChild = _6215.childNodes._nodes[0];
- }
- _6215.childNodes._nodes[0].previousSibling = _6217;
- _6215.childNodes._nodes[_6215.childNodes._nodes.length - 1].nextSibling = _6216;
- }
- } else {
- if (_6217) {
- _6217.nextSibling = _6215;
- } else {
- this.firstChild = _6215;
- }
- _6215.previousSibling = _6217;
- _6215.nextSibling = _6216;
- }
- return _6215;
- };
- DOMNode.prototype.replaceChild = function DOMNode_replaceChild(_621b, _621c) {
- var ret = null;
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.ownerDocument != _621b.ownerDocument) {
- throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
- if (this._isAncestor(_621b)) {
- throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
- var index = this.childNodes._findItemIndex(_621c._id);
- if (this.ownerDocument.implementation.errorChecking && (index < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- var _621f = _621b.parentNode;
- if (_621f) {
- _621f.removeChild(_621b);
- }
- ret = this.childNodes._replaceChild(_621b, index);
- if (_621b.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- if (_621b.childNodes._nodes.length > 0) {
- for ( var ind = 0; ind < _621b.childNodes._nodes.length; ind++) {
- _621b.childNodes._nodes[ind].parentNode = this;
- }
- if (_621c.previousSibling) {
- _621c.previousSibling.nextSibling = _621b.childNodes._nodes[0];
- } else {
- this.firstChild = _621b.childNodes._nodes[0];
- }
- if (_621c.nextSibling) {
- _621c.nextSibling.previousSibling = _621b;
- } else {
- this.lastChild = _621b.childNodes._nodes[_621b.childNodes._nodes.length - 1];
- }
- _621b.childNodes._nodes[0].previousSibling = _621c.previousSibling;
- _621b.childNodes._nodes[_621b.childNodes._nodes.length - 1].nextSibling = _621c.nextSibling;
- }
- } else {
- _621b.parentNode = this;
- if (_621c.previousSibling) {
- _621c.previousSibling.nextSibling = _621b;
- } else {
- this.firstChild = _621b;
- }
- if (_621c.nextSibling) {
- _621c.nextSibling.previousSibling = _621b;
- } else {
- this.lastChild = _621b;
- }
- _621b.previousSibling = _621c.previousSibling;
- _621b.nextSibling = _621c.nextSibling;
- }
- return ret;
- };
- DOMNode.prototype.removeChild = function DOMNode_removeChild(_6221) {
- if (this.ownerDocument.implementation.errorChecking
- && (this._readonly || _6221._readonly)) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- var _6222 = this.childNodes._findItemIndex(_6221._id);
- if (this.ownerDocument.implementation.errorChecking && (_6222 < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- this.childNodes._removeChild(_6222);
- _6221.parentNode = null;
- if (_6221.previousSibling) {
- _6221.previousSibling.nextSibling = _6221.nextSibling;
- } else {
- this.firstChild = _6221.nextSibling;
- }
- if (_6221.nextSibling) {
- _6221.nextSibling.previousSibling = _6221.previousSibling;
- } else {
- this.lastChild = _6221.previousSibling;
- }
- _6221.previousSibling = null;
- _6221.nextSibling = null;
- return _6221;
- };
- DOMNode.prototype.appendChild = function DOMNode_appendChild(_6223) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.ownerDocument != _6223.ownerDocument) {
- throw (new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
- if (this._isAncestor(_6223)) {
- throw (new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
- var _6224 = _6223.parentNode;
- if (_6224) {
- _6224.removeChild(_6223);
- }
- this.childNodes._appendChild(_6223);
- if (_6223.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- if (_6223.childNodes._nodes.length > 0) {
- for ( var ind = 0; ind < _6223.childNodes._nodes.length; ind++) {
- _6223.childNodes._nodes[ind].parentNode = this;
- }
- if (this.lastChild) {
- this.lastChild.nextSibling = _6223.childNodes._nodes[0];
- _6223.childNodes._nodes[0].previousSibling = this.lastChild;
- this.lastChild = _6223.childNodes._nodes[_6223.childNodes._nodes.length - 1];
- } else {
- this.lastChild = _6223.childNodes._nodes[_6223.childNodes._nodes.length - 1];
- this.firstChild = _6223.childNodes._nodes[0];
- }
- }
- } else {
- _6223.parentNode = this;
- if (this.lastChild) {
- this.lastChild.nextSibling = _6223;
- _6223.previousSibling = this.lastChild;
- this.lastChild = _6223;
- } else {
- this.lastChild = _6223;
- this.firstChild = _6223;
- }
- }
- return _6223;
- };
- DOMNode.prototype.hasChildNodes = function DOMNode_hasChildNodes() {
- return (this.childNodes.length > 0);
- };
- DOMNode.prototype.cloneNode = function DOMNode_cloneNode(deep) {
- try {
- return this.ownerDocument.importNode(this, deep);
- } catch (e) {
- return null;
- }
- };
- DOMNode.prototype.normalize = function DOMNode_normalize() {
- var inode;
- var _6228 = new DOMNodeList();
- if (this.nodeType == DOMNode.ELEMENT_NODE
- || this.nodeType == DOMNode.DOCUMENT_NODE) {
- var _6229 = null;
- for ( var i = 0; i < this.childNodes.length; i++) {
- inode = this.childNodes.item(i);
- if (inode.nodeType == DOMNode.TEXT_NODE) {
- if (inode.length < 1) {
- _6228._appendChild(inode);
- } else {
- if (_6229) {
- _6229.appendData(inode.data);
- _6228._appendChild(inode);
- } else {
- _6229 = inode;
- }
- }
- } else {
- _6229 = null;
- inode.normalize();
- }
- }
- for ( var i = 0; i < _6228.length; i++) {
- inode = _6228.item(i);
- inode.parentNode.removeChild(inode);
- }
- }
- };
- DOMNode.prototype.isSupported = function DOMNode_isSupported(_622b, _622c) {
- return this.ownerDocument.implementation.hasFeature(_622b, _622c);
- };
- DOMNode.prototype.getElementsByTagName = function DOMNode_getElementsByTagName(
- _622d) {
- return this._getElementsByTagNameRecursive(_622d, new DOMNodeList(
- this.ownerDocument));
- };
- DOMNode.prototype._getElementsByTagNameRecursive = function DOMNode__getElementsByTagNameRecursive(
- _622e, _622f) {
- if (this.nodeType == DOMNode.ELEMENT_NODE
- || this.nodeType == DOMNode.DOCUMENT_NODE) {
- if ((this.nodeName == _622e) || (_622e == "*")) {
- _622f._appendChild(this);
- }
- for ( var i = 0; i < this.childNodes.length; i++) {
- _622f = this.childNodes.item(i)._getElementsByTagNameRecursive(
- _622e, _622f);
- }
- }
- return _622f;
- };
- DOMNode.prototype.getXML = function DOMNode_getXML() {
- return this.toString();
- };
- DOMNode.prototype.getElementsByTagNameNS = function DOMNode_getElementsByTagNameNS(
- _6231, _6232) {
- return this._getElementsByTagNameNSRecursive(_6231, _6232, new DOMNodeList(
- this.ownerDocument));
- };
- DOMNode.prototype._getElementsByTagNameNSRecursive = function DOMNode__getElementsByTagNameNSRecursive(
- _6233, _6234, _6235) {
- if (this.nodeType == DOMNode.ELEMENT_NODE
- || this.nodeType == DOMNode.DOCUMENT_NODE) {
- if (((this.namespaceURI == _6233) || (_6233 == "*"))
- && ((this.localName == _6234) || (_6234 == "*"))) {
- _6235._appendChild(this);
- }
- for ( var i = 0; i < this.childNodes.length; i++) {
- _6235 = this.childNodes.item(i)._getElementsByTagNameNSRecursive(
- _6233, _6234, _6235);
- }
- }
- return _6235;
- };
- DOMNode.prototype._isAncestor = function DOMNode__isAncestor(node) {
- return ((this == node) || ((this.parentNode) && (this.parentNode
- ._isAncestor(node))));
- };
- DOMNode.prototype.importNode = function DOMNode_importNode(_6238, deep) {
- var _623a;
- this.getOwnerDocument()._performingImportNodeOperation = true;
- try {
- if (_6238.nodeType == DOMNode.ELEMENT_NODE) {
- if (!this.ownerDocument.implementation.namespaceAware) {
- _623a = this.ownerDocument.createElement(_6238.tagName);
- for ( var i = 0; i < _6238.attributes.length; i++) {
- _623a.setAttribute(_6238.attributes.item(i).name,
- _6238.attributes.item(i).value);
- }
- } else {
- _623a = this.ownerDocument.createElementNS(_6238.namespaceURI,
- _6238.nodeName);
- for ( var i = 0; i < _6238.attributes.length; i++) {
- _623a.setAttributeNS(_6238.attributes.item(i).namespaceURI,
- _6238.attributes.item(i).name, _6238.attributes
- .item(i).value);
- }
- for ( var i = 0; i < _6238._namespaces.length; i++) {
- _623a._namespaces._nodes[i] = this.ownerDocument
- .createNamespace(_6238._namespaces.item(i).localName);
- _623a._namespaces._nodes[i].setValue(_6238._namespaces
- .item(i).value);
- }
- }
- } else {
- if (_6238.nodeType == DOMNode.ATTRIBUTE_NODE) {
- if (!this.ownerDocument.implementation.namespaceAware) {
- _623a = this.ownerDocument.createAttribute(_6238.name);
- } else {
- _623a = this.ownerDocument.createAttributeNS(
- _6238.namespaceURI, _6238.nodeName);
- for ( var i = 0; i < _6238._namespaces.length; i++) {
- _623a._namespaces._nodes[i] = this.ownerDocument
- .createNamespace(_6238._namespaces.item(i).localName);
- _623a._namespaces._nodes[i].setValue(_6238._namespaces
- .item(i).value);
- }
- }
- _623a.setValue(_6238.value);
- } else {
- if (_6238.nodeType == DOMNode.DOCUMENT_FRAGMENT) {
- _623a = this.ownerDocument.createDocumentFragment();
- } else {
- if (_6238.nodeType == DOMNode.NAMESPACE_NODE) {
- _623a = this.ownerDocument
- .createNamespace(_6238.nodeName);
- _623a.setValue(_6238.value);
- } else {
- if (_6238.nodeType == DOMNode.TEXT_NODE) {
- _623a = this.ownerDocument
- .createTextNode(_6238.data);
- } else {
- if (_6238.nodeType == DOMNode.CDATA_SECTION_NODE) {
- _623a = this.ownerDocument
- .createCDATASection(_6238.data);
- } else {
- if (_6238.nodeType == DOMNode.PROCESSING_INSTRUCTION_NODE) {
- _623a = this.ownerDocument
- .createProcessingInstruction(
- _6238.target, _6238.data);
- } else {
- if (_6238.nodeType == DOMNode.COMMENT_NODE) {
- _623a = this.ownerDocument
- .createComment(_6238.data);
- } else {
- throw (new DOMException(
- DOMException.NOT_SUPPORTED_ERR));
- }
- }
- }
- }
- }
- }
- }
- }
- if (deep) {
- for ( var i = 0; i < _6238.childNodes.length; i++) {
- _623a.appendChild(this.ownerDocument.importNode(
- _6238.childNodes.item(i), true));
- }
- }
- this.getOwnerDocument()._performingImportNodeOperation = false;
- return _623a;
- } catch (eAny) {
- this.getOwnerDocument()._performingImportNodeOperation = false;
- throw eAny;
- }
- };
- DOMNode.prototype.__escapeString = function DOMNode__escapeString(str) {
- return __escapeString(str);
- };
- DOMNode.prototype.__unescapeString = function DOMNode__unescapeString(str) {
- return __unescapeString(str);
- };
- DOMDocument = function(_623e) {
- this._class = addClass(this._class, "DOMDocument");
- this.DOMNode = DOMNode;
- this.DOMNode(this);
- this.doctype = null;
- this.implementation = _623e;
- this.documentElement = null;
- this.all = [];
- this.nodeName = "#document";
- this.nodeType = DOMNode.DOCUMENT_NODE;
- this._id = 0;
- this._lastId = 0;
- this._parseComplete = false;
- this.ownerDocument = this;
- this._performingImportNodeOperation = false;
- };
- DOMDocument.prototype = new DOMNode;
- DOMDocument.prototype.getDoctype = function DOMDocument_getDoctype() {
- return this.doctype;
- };
- DOMDocument.prototype.getImplementation = function DOMDocument_implementation() {
- return this.implementation;
- };
- DOMDocument.prototype.getDocumentElement = function DOMDocument_getDocumentElement() {
- return this.documentElement;
- };
- DOMDocument.prototype.createElement = function DOMDocument_createElement(_623f) {
- if (this.ownerDocument.implementation.errorChecking
- && (!this.ownerDocument.implementation._isValidName(_623f))) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- var node = new DOMElement(this);
- node.tagName = _623f;
- node.nodeName = _623f;
- this.all[this.all.length] = node;
- return node;
- };
- DOMDocument.prototype.createDocumentFragment = function DOMDocument_createDocumentFragment() {
- var node = new DOMDocumentFragment(this);
- return node;
- };
- DOMDocument.prototype.createTextNode = function DOMDocument_createTextNode(data) {
- var node = new DOMText(this);
- node.data = data;
- node.nodeValue = data;
- node.length = data.length;
- return node;
- };
- DOMDocument.prototype.createComment = function DOMDocument_createComment(data) {
- var node = new DOMComment(this);
- node.data = data;
- node.nodeValue = data;
- node.length = data.length;
- return node;
- };
- DOMDocument.prototype.createCDATASection = function DOMDocument_createCDATASection(
- data) {
- var node = new DOMCDATASection(this);
- node.data = data;
- node.nodeValue = data;
- node.length = data.length;
- return node;
- };
- DOMDocument.prototype.createProcessingInstruction = function DOMDocument_createProcessingInstruction(
- _6248, data) {
- if (this.ownerDocument.implementation.errorChecking
- && (!this.implementation._isValidName(_6248))) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- var node = new DOMProcessingInstruction(this);
- node.target = _6248;
- node.nodeName = _6248;
- node.data = data;
- node.nodeValue = data;
- node.length = data.length;
- return node;
- };
- DOMDocument.prototype.createAttribute = function DOMDocument_createAttribute(
- name) {
- if (this.ownerDocument.implementation.errorChecking
- && (!this.ownerDocument.implementation._isValidName(name))) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- var node = new DOMAttr(this);
- node.name = name;
- node.nodeName = name;
- return node;
- };
- DOMDocument.prototype.createElementNS = function DOMDocument_createElementNS(
- _624d, _624e) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (!this.ownerDocument._isValidNamespace(_624d, _624e)) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- if (!this.ownerDocument.implementation._isValidName(_624e)) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
- var node = new DOMElement(this);
- var qname = this.implementation._parseQName(_624e);
- node.nodeName = _624e;
- node.namespaceURI = _624d;
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.tagName = _624e;
- this.all[this.all.length] = node;
- return node;
- };
- DOMDocument.prototype.createAttributeNS = function DOMDocument_createAttributeNS(
- _6251, _6252) {
- if (this.ownerDocument.implementation.errorChecking) {
- if (!this.ownerDocument._isValidNamespace(_6251, _6252, true)) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- if (!this.ownerDocument.implementation._isValidName(_6252)) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
- var node = new DOMAttr(this);
- var qname = this.implementation._parseQName(_6252);
- node.nodeName = _6252;
- node.namespaceURI = _6251;
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.name = _6252;
- node.nodeValue = "";
- return node;
- };
- DOMDocument.prototype.createNamespace = function DOMDocument_createNamespace(
- _6255) {
- var node = new DOMNamespace(this);
- var qname = this.implementation._parseQName(_6255);
- node.nodeName = _6255;
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.name = _6255;
- node.nodeValue = "";
- return node;
- };
- DOMDocument.prototype.getElementById = function DOMDocument_getElementById(
- _6258) {
- retNode = null;
- for ( var i = 0; i < this.all.length; i++) {
- var node = this.all[i];
- if ((node.id == _6258)
- && (node._isAncestor(node.ownerDocument.documentElement))) {
- retNode = node;
- break;
- }
- }
- return retNode;
- };
- DOMDocument.prototype._genId = function DOMDocument__genId() {
- this._lastId += 1;
- return this._lastId;
- };
- DOMDocument.prototype._isValidNamespace = function DOMDocument__isValidNamespace(
- _625b, _625c, _625d) {
- if (this._performingImportNodeOperation == true) {
- return true;
- }
- var valid = true;
- var qName = this.implementation._parseQName(_625c);
- if (this._parseComplete == true) {
- if (qName.localName.indexOf(":") > -1) {
- valid = false;
- }
- if ((valid) && (!_625d)) {
- if (!_625b) {
- valid = false;
- }
- }
- if ((valid) && (qName.prefix == "")) {
- valid = false;
- }
- }
- if ((valid) && (qName.prefix == "xml")
- && (_625b != "http://www.w3.org/XML/1998/namespace")) {
- valid = false;
- }
- return valid;
- };
- DOMDocument.prototype.toString = function DOMDocument_toString() {
- return "" + this.childNodes;
- };
- DOMElement = function(_6260) {
- this._class = addClass(this._class, "DOMElement");
- this.DOMNode = DOMNode;
- this.DOMNode(_6260);
- this.tagName = "";
- this.id = "";
- this.nodeType = DOMNode.ELEMENT_NODE;
- };
- DOMElement.prototype = new DOMNode;
- DOMElement.prototype.getTagName = function DOMElement_getTagName() {
- return this.tagName;
- };
- DOMElement.prototype.getAttribute = function DOMElement_getAttribute(name) {
- var ret = "";
- var attr = this.attributes.getNamedItem(name);
- if (attr) {
- ret = attr.value;
- }
- return ret;
- };
- DOMElement.prototype.setAttribute = function DOMElement_setAttribute(name,
- value) {
- var attr = this.attributes.getNamedItem(name);
- if (!attr) {
- attr = this.ownerDocument.createAttribute(name);
- }
- var value = new String(value);
- if (this.ownerDocument.implementation.errorChecking) {
- if (attr._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (!this.ownerDocument.implementation._isValidString(value)) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
- if (this.ownerDocument.implementation._isIdDeclaration(name)) {
- this.id = value;
- }
- attr.value = value;
- attr.nodeValue = value;
- if (value.length > 0) {
- attr.specified = true;
- } else {
- attr.specified = false;
- }
- this.attributes.setNamedItem(attr);
- };
- DOMElement.prototype.removeAttribute = function DOMElement_removeAttribute(name) {
- return this.attributes.removeNamedItem(name);
- };
- DOMElement.prototype.getAttributeNode = function DOMElement_getAttributeNode(
- name) {
- return this.attributes.getNamedItem(name);
- };
- DOMElement.prototype.setAttributeNode = function DOMElement_setAttributeNode(
- _6269) {
- if (this.ownerDocument.implementation._isIdDeclaration(_6269.name)) {
- this.id = _6269.value;
- }
- return this.attributes.setNamedItem(_6269);
- };
- DOMElement.prototype.removeAttributeNode = function DOMElement_removeAttributeNode(
- _626a) {
- if (this.ownerDocument.implementation.errorChecking && _626a._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- var _626b = this.attributes._findItemIndex(_626a._id);
- if (this.ownerDocument.implementation.errorChecking && (_626b < 0)) {
- throw (new DOMException(DOMException.NOT_FOUND_ERR));
- }
- return this.attributes._removeChild(_626b);
- };
- DOMElement.prototype.getAttributeNS = function DOMElement_getAttributeNS(_626c,
- _626d) {
- var ret = "";
- var attr = this.attributes.getNamedItemNS(_626c, _626d);
- if (attr) {
- ret = attr.value;
- }
- return ret;
- };
- DOMElement.prototype.setAttributeNS = function DOMElement_setAttributeNS(_6270,
- _6271, value) {
- var attr = this.attributes.getNamedItem(_6270, _6271);
- if (!attr) {
- attr = this.ownerDocument.createAttributeNS(_6270, _6271);
- }
- var value = new String(value);
- if (this.ownerDocument.implementation.errorChecking) {
- if (attr._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (!this.ownerDocument._isValidNamespace(_6270, _6271)) {
- throw (new DOMException(DOMException.NAMESPACE_ERR));
- }
- if (!this.ownerDocument.implementation._isValidString(value)) {
- throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
- if (this.ownerDocument.implementation._isIdDeclaration(name)) {
- this.id = value;
- }
- attr.value = value;
- attr.nodeValue = value;
- if (value.length > 0) {
- attr.specified = true;
- } else {
- attr.specified = false;
- }
- this.attributes.setNamedItemNS(attr);
- };
- DOMElement.prototype.removeAttributeNS = function DOMElement_removeAttributeNS(
- _6274, _6275) {
- return this.attributes.removeNamedItemNS(_6274, _6275);
- };
- DOMElement.prototype.getAttributeNodeNS = function DOMElement_getAttributeNodeNS(
- _6276, _6277) {
- return this.attributes.getNamedItemNS(_6276, _6277);
- };
- DOMElement.prototype.setAttributeNodeNS = function DOMElement_setAttributeNodeNS(
- _6278) {
- if ((_6278.prefix == "")
- && this.ownerDocument.implementation._isIdDeclaration(_6278.name)) {
- this.id = _6278.value;
- }
- return this.attributes.setNamedItemNS(_6278);
- };
- DOMElement.prototype.hasAttribute = function DOMElement_hasAttribute(name) {
- return this.attributes._hasAttribute(name);
- };
- DOMElement.prototype.hasAttributeNS = function DOMElement_hasAttributeNS(_627a,
- _627b) {
- return this.attributes._hasAttributeNS(_627a, _627b);
- };
- DOMElement.prototype.toString = function DOMElement_toString() {
- var ret = "";
- var ns = this._namespaces.toString();
- if (ns.length > 0) {
- ns = " " + ns;
- }
- var attrs = this.attributes.toString();
- if (attrs.length > 0) {
- attrs = " " + attrs;
- }
- ret += "<" + this.nodeName + ns + attrs + ">";
- ret += this.childNodes.toString();
- ret += "</" + this.nodeName + ">";
- return ret;
- };
- DOMAttr = function(_627f) {
- this._class = addClass(this._class, "DOMAttr");
- this.DOMNode = DOMNode;
- this.DOMNode(_627f);
- this.name = "";
- this.specified = false;
- this.value = "";
- this.nodeType = DOMNode.ATTRIBUTE_NODE;
- this.ownerElement = null;
- this.childNodes = null;
- this.attributes = null;
- };
- DOMAttr.prototype = new DOMNode;
- DOMAttr.prototype.getName = function DOMAttr_getName() {
- return this.nodeName;
- };
- DOMAttr.prototype.getSpecified = function DOMAttr_getSpecified() {
- return this.specified;
- };
- DOMAttr.prototype.getValue = function DOMAttr_getValue() {
- return this.nodeValue;
- };
- DOMAttr.prototype.setValue = function DOMAttr_setValue(value) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.setNodeValue(value);
- };
- DOMAttr.prototype.setNodeValue = function DOMAttr_setNodeValue(value) {
- this.nodeValue = new String(value);
- this.value = this.nodeValue;
- this.specified = (this.value.length > 0);
- };
- DOMAttr.prototype.toString = function DOMAttr_toString() {
- var ret = "";
- ret += this.nodeName + "=\"" + this.__escapeString(this.nodeValue) + "\"";
- return ret;
- };
- DOMAttr.prototype.getOwnerElement = function() {
- return this.ownerElement;
- };
- DOMNamespace = function(_6283) {
- this._class = addClass(this._class, "DOMNamespace");
- this.DOMNode = DOMNode;
- this.DOMNode(_6283);
- this.name = "";
- this.specified = false;
- this.value = "";
- this.nodeType = DOMNode.NAMESPACE_NODE;
- };
- DOMNamespace.prototype = new DOMNode;
- DOMNamespace.prototype.getValue = function DOMNamespace_getValue() {
- return this.nodeValue;
- };
- DOMNamespace.prototype.setValue = function DOMNamespace_setValue(value) {
- this.nodeValue = new String(value);
- this.value = this.nodeValue;
- };
- DOMNamespace.prototype.toString = function DOMNamespace_toString() {
- var ret = "";
- if (this.nodeName != "") {
- ret += this.nodeName + "=\"" + this.__escapeString(this.nodeValue)
- + "\"";
- } else {
- ret += "xmlns=\"" + this.__escapeString(this.nodeValue) + "\"";
- }
- return ret;
- };
- DOMCharacterData = function(_6286) {
- this._class = addClass(this._class, "DOMCharacterData");
- this.DOMNode = DOMNode;
- this.DOMNode(_6286);
- this.data = "";
- this.length = 0;
- };
- DOMCharacterData.prototype = new DOMNode;
- DOMCharacterData.prototype.getData = function DOMCharacterData_getData() {
- return this.nodeValue;
- };
- DOMCharacterData.prototype.setData = function DOMCharacterData_setData(data) {
- this.setNodeValue(data);
- };
- DOMCharacterData.prototype.setNodeValue = function DOMCharacterData_setNodeValue(
- data) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.nodeValue = new String(data);
- this.data = this.nodeValue;
- this.length = this.nodeValue.length;
- };
- DOMCharacterData.prototype.getLength = function DOMCharacterData_getLength() {
- return this.nodeValue.length;
- };
- DOMCharacterData.prototype.substringData = function DOMCharacterData_substringData(
- _6289, count) {
- var ret = null;
- if (this.data) {
- if (this.ownerDocument.implementation.errorChecking
- && ((_6289 < 0) || (_6289 > this.data.length) || (count < 0))) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- if (!count) {
- ret = this.data.substring(_6289);
- } else {
- ret = this.data.substring(_6289, _6289 + count);
- }
- }
- return ret;
- };
- DOMCharacterData.prototype.appendData = function DOMCharacterData_appendData(
- arg) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.setData("" + this.data + arg);
- };
- DOMCharacterData.prototype.insertData = function DOMCharacterData_insertData(
- _628d, arg) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.data) {
- if (this.ownerDocument.implementation.errorChecking
- && ((_628d < 0) || (_628d > this.data.length))) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- this.setData(this.data.substring(0, _628d).concat(arg,
- this.data.substring(_628d)));
- } else {
- if (this.ownerDocument.implementation.errorChecking && (_628d != 0)) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- this.setData(arg);
- }
- };
- DOMCharacterData.prototype.deleteData = function DOMCharacterData_deleteData(
- _628f, count) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.data) {
- if (this.ownerDocument.implementation.errorChecking
- && ((_628f < 0) || (_628f > this.data.length) || (count < 0))) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- if (!count || (_628f + count) > this.data.length) {
- this.setData(this.data.substring(0, _628f));
- } else {
- this.setData(this.data.substring(0, _628f).concat(
- this.data.substring(_628f + count)));
- }
- }
- };
- DOMCharacterData.prototype.replaceData = function DOMCharacterData_replaceData(
- _6291, count, arg) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.data) {
- if (this.ownerDocument.implementation.errorChecking
- && ((_6291 < 0) || (_6291 > this.data.length) || (count < 0))) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- this.setData(this.data.substring(0, _6291).concat(arg,
- this.data.substring(_6291 + count)));
- } else {
- this.setData(arg);
- }
- };
- DOMText = function(_6294) {
- this._class = addClass(this._class, "DOMText");
- this.DOMCharacterData = DOMCharacterData;
- this.DOMCharacterData(_6294);
- this.nodeName = "#text";
- this.nodeType = DOMNode.TEXT_NODE;
- };
- DOMText.prototype = new DOMCharacterData;
- DOMText.prototype.splitText = function DOMText_splitText(_6295) {
- var data, inode;
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if ((_6295 < 0) || (_6295 > this.data.length)) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- }
- if (this.parentNode) {
- data = this.substringData(_6295);
- inode = this.ownerDocument.createTextNode(data);
- if (this.nextSibling) {
- this.parentNode.insertBefore(inode, this.nextSibling);
- } else {
- this.parentNode.appendChild(inode);
- }
- this.deleteData(_6295);
- }
- return inode;
- };
- DOMText.prototype.toString = function DOMText_toString() {
- return this.__escapeString("" + this.nodeValue);
- };
- DOMCDATASection = function(_6297) {
- this._class = addClass(this._class, "DOMCDATASection");
- this.DOMCharacterData = DOMCharacterData;
- this.DOMCharacterData(_6297);
- this.nodeName = "#cdata-section";
- this.nodeType = DOMNode.CDATA_SECTION_NODE;
- };
- DOMCDATASection.prototype = new DOMCharacterData;
- DOMCDATASection.prototype.splitText = function DOMCDATASection_splitText(_6298) {
- var data, inode;
- if (this.ownerDocument.implementation.errorChecking) {
- if (this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if ((_6298 < 0) || (_6298 > this.data.length)) {
- throw (new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- }
- if (this.parentNode) {
- data = this.substringData(_6298);
- inode = this.ownerDocument.createCDATASection(data);
- if (this.nextSibling) {
- this.parentNode.insertBefore(inode, this.nextSibling);
- } else {
- this.parentNode.appendChild(inode);
- }
- this.deleteData(_6298);
- }
- return inode;
- };
- DOMCDATASection.prototype.toString = function DOMCDATASection_toString() {
- var ret = "";
- ret += "<![CDATA[" + this.nodeValue + "]]>";
- return ret;
- };
- DOMComment = function(_629b) {
- this._class = addClass(this._class, "DOMComment");
- this.DOMCharacterData = DOMCharacterData;
- this.DOMCharacterData(_629b);
- this.nodeName = "#comment";
- this.nodeType = DOMNode.COMMENT_NODE;
- };
- DOMComment.prototype = new DOMCharacterData;
- DOMComment.prototype.toString = function DOMComment_toString() {
- var ret = "";
- ret += "<!--" + this.nodeValue + "-->";
- return ret;
- };
- DOMProcessingInstruction = function(_629d) {
- this._class = addClass(this._class, "DOMProcessingInstruction");
- this.DOMNode = DOMNode;
- this.DOMNode(_629d);
- this.target = "";
- this.data = "";
- this.nodeType = DOMNode.PROCESSING_INSTRUCTION_NODE;
- };
- DOMProcessingInstruction.prototype = new DOMNode;
- DOMProcessingInstruction.prototype.getTarget = function DOMProcessingInstruction_getTarget() {
- return this.nodeName;
- };
- DOMProcessingInstruction.prototype.getData = function DOMProcessingInstruction_getData() {
- return this.nodeValue;
- };
- DOMProcessingInstruction.prototype.setData = function DOMProcessingInstruction_setData(
- data) {
- this.setNodeValue(data);
- };
- DOMProcessingInstruction.prototype.setNodeValue = function DOMProcessingInstruction_setNodeValue(
- data) {
- if (this.ownerDocument.implementation.errorChecking && this._readonly) {
- throw (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.nodeValue = new String(data);
- this.data = this.nodeValue;
- };
- DOMProcessingInstruction.prototype.toString = function DOMProcessingInstruction_toString() {
- var ret = "";
- ret += "<?" + this.nodeName + " " + this.nodeValue + " ?>";
- return ret;
- };
- DOMDocumentFragment = function(_62a1) {
- this._class = addClass(this._class, "DOMDocumentFragment");
- this.DOMNode = DOMNode;
- this.DOMNode(_62a1);
- this.nodeName = "#document-fragment";
- this.nodeType = DOMNode.DOCUMENT_FRAGMENT_NODE;
- };
- DOMDocumentFragment.prototype = new DOMNode;
- DOMDocumentFragment.prototype.toString = function DOMDocumentFragment_toString() {
- var xml = "";
- var _62a3 = this.getChildNodes().getLength();
- for (intLoop = 0; intLoop < _62a3; intLoop++) {
- xml += this.getChildNodes().item(intLoop).toString();
- }
- return xml;
- };
- DOMDocumentType = function() {
- alert("DOMDocumentType.constructor(): Not Implemented");
- };
- DOMEntity = function() {
- alert("DOMEntity.constructor(): Not Implemented");
- };
- DOMEntityReference = function() {
- alert("DOMEntityReference.constructor(): Not Implemented");
- };
- DOMNotation = function() {
- alert("DOMNotation.constructor(): Not Implemented");
- };
- Strings = new Object();
- Strings.WHITESPACE = " \t\n\r";
- Strings.QUOTES = "\"'";
- Strings.isEmpty = function Strings_isEmpty(strD) {
- return (strD === null) || (strD.length === 0);
- };
- Strings.indexOfNonWhitespace = function Strings_indexOfNonWhitespace(strD, iB,
- iE) {
- if (Strings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iB; i < iE; i++) {
- if (Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
- return i;
- }
- }
- return -1;
- };
- Strings.lastIndexOfNonWhitespace = function Strings_lastIndexOfNonWhitespace(
- strD, iB, iE) {
- if (Strings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iE - 1; i >= iB; i--) {
- if (Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
- return i;
- }
- }
- return -1;
- };
- Strings.indexOfWhitespace = function Strings_indexOfWhitespace(strD, iB, iE) {
- if (Strings.isEmpty(strD)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
- for ( var i = iB; i < iE; i++) {
- if (Strings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
- return i;
- }
- }
- return -1;
- };
- Strings.replace = function Strings_replace(strD, iB, iE, strF, strR) {
- if (Strings.isEmpty(strD)) {
- return "";
- }
- iB = iB || 0;
- iE = iE || strD.length;
- return strD.substring(iB, iE).split(strF).join(strR);
- };
- Strings.getLineNumber = function Strings_getLineNumber(strD, iP) {
- if (Strings.isEmpty(strD)) {
- return -1;
- }
- iP = iP || strD.length;
- return strD.substring(0, iP).split("\n").length;
- };
- Strings.getColumnNumber = function Strings_getColumnNumber(strD, iP) {
- if (Strings.isEmpty(strD)) {
- return -1;
- }
- iP = iP || strD.length;
- var arrD = strD.substring(0, iP).split("\n");
- var _62bb = arrD[arrD.length - 1];
- arrD.length--;
- var _62bc = arrD.join("\n").length;
- return iP - _62bc;
- };
- StringBuffer = function() {
- this._a = [];
- };
- StringBuffer.prototype.append = function StringBuffer_append(d) {
- this._a[this._a.length] = d;
- };
- StringBuffer.prototype.toString = function StringBuffer_toString() {
- return this._a.join("");
- };
- draw2d.XMLSerializer = function() {
- alert("do not init this class. Use the static methods instead");
- };
- draw2d.XMLSerializer.toXML = function(obj, _5717, _5718) {
- if (_5717 == undefined) {
- _5717 = "model";
- }
- _5718 = _5718 ? _5718 : "";
- var t = draw2d.XMLSerializer.getTypeName(obj);
- var s = _5718 + "<" + _5717 + " type=\"" + t + "\">";
- switch (t) {
- case "int":
- case "number":
- case "boolean":
- s += obj;
- break;
- case "string":
- s += draw2d.XMLSerializer.xmlEncode(obj);
- break;
- case "date":
- s += obj.toLocaleString();
- break;
- case "Array":
- case "array":
- s += "\n";
- var _571b = _5718 + " ";
- for ( var i = 0; i < obj.length; i++) {
- s += draw2d.XMLSerializer.toXML(obj[i], ("element"), _571b);
- }
- s += _5718;
- break;
- default:
- if (obj !== null) {
- s += "\n";
- if (obj instanceof draw2d.ArrayList) {
- obj.trimToSize();
- }
- var _571d = obj.getPersistentAttributes();
- var _571b = _5718 + " ";
- for ( var name in _571d) {
- s += draw2d.XMLSerializer.toXML(_571d[name], name, _571b);
- }
- s += _5718;
- }
- break;
- }
- s += "</" + _5717 + ">\n";
- return s;
- };
- draw2d.XMLSerializer.isSimpleVar = function(t) {
- switch (t) {
- case "int":
- case "string":
- case "String":
- case "Number":
- case "number":
- case "Boolean":
- case "boolean":
- case "bool":
- case "dateTime":
- case "Date":
- case "date":
- case "float":
- return true;
- }
- return false;
- };
- draw2d.XMLSerializer.getTypeName = function(obj) {
- if (obj === null) {
- return "undefined";
- }
- if (obj instanceof Array) {
- return "Array";
- }
- if (obj instanceof Date) {
- return "Date";
- }
- var t = typeof (obj);
- if (t == "number") {
- return (parseInt(obj).toString() == obj) ? "int" : "number";
- }
- if (draw2d.XMLSerializer.isSimpleVar(t)) {
- return t;
- }
- return obj.type.replace("@NAMESPACE" + "@", "");
- };
- draw2d.XMLSerializer.xmlEncode = function(_5722) {
- var _5723 = _5722;
- var amp = /&/gi;
- var gt = />/gi;
- var lt = /</gi;
- var quot = /"/gi;
- var apos = /'/gi;
- var _5729 = ">";
- var _572a = "&#60;";
- var _572b = "&#38;";
- var _572c = """;
- var _572d = "'";
- _5723 = _5723.replace(amp, _572b);
- _5723 = _5723.replace(quot, _572c);
- _5723 = _5723.replace(lt, _572a);
- _5723 = _5723.replace(gt, _5729);
- _5723 = _5723.replace(apos, _572d);
- return _5723;
- };
- draw2d.XMLDeserializer = function() {
- alert("do not init this class. Use the static methods instead");
- };
- draw2d.XMLDeserializer.fromXML = function(node, _4fe9) {
- var _4fea = "" + node.getAttributes().getNamedItem("type").getNodeValue();
- var value = node.getNodeValue();
- switch (_4fea) {
- case "int":
- try {
- return parseInt("" + node.getChildNodes().item(0).getNodeValue());
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- case "string":
- case "String":
- try {
- if (node.getChildNodes().getLength() > 0) {
- return "" + node.getChildNodes().item(0).getNodeValue();
- }
- return "";
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- case "Number":
- case "number":
- try {
- return parseFloat("" + node.getChildNodes().item(0).getNodeValue());
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- case "Boolean":
- case "boolean":
- case "bool":
- try {
- return "true" == ("" + node.getChildNodes().item(0).getNodeValue())
- .toLowerCase();
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- case "dateTime":
- case "Date":
- case "date":
- try {
- return new Date("" + node.getChildNodes().item(0).getNodeValue());
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- case "float":
- try {
- return parseFloat("" + node.getChildNodes().item(0).getNodeValue());
- } catch (e) {
- alert("Error:" + e + "\nDataType:" + _4fea + "\nXML Node:" + node);
- }
- break;
- }
- _4fea = _4fea.replace("@NAMESPACE" + "@", "");
- var obj = eval("new " + _4fea + "()");
- if (_4fe9 != undefined && obj.setModelParent != undefined) {
- obj.setModelParent(_4fe9);
- }
- var _4fed = node.getChildNodes();
- for ( var i = 0; i < _4fed.length; i++) {
- var child = _4fed.item(i);
- var _4ff0 = child.getNodeName();
- if (obj instanceof Array) {
- _4ff0 = i;
- }
- obj[_4ff0] = draw2d.XMLDeserializer.fromXML(child,
- obj instanceof draw2d.AbstractObjectModel ? obj : _4fe9);
- }
- return obj;
- };
- draw2d.EditPolicy = function(_5cb1) {
- this.policy = _5cb1;
- };
- draw2d.EditPolicy.DELETE = "DELETE";
- draw2d.EditPolicy.MOVE = "MOVE";
- draw2d.EditPolicy.CONNECT = "CONNECT";
- draw2d.EditPolicy.RESIZE = "RESIZE";
- draw2d.EditPolicy.prototype.type = "draw2d.EditPolicy";
- draw2d.EditPolicy.prototype.getPolicy = function() {
- return this.policy;
- };
- draw2d.AbstractPalettePart = function() {
- this.x = 0;
- this.y = 0;
- this.html = null;
- };
- draw2d.AbstractPalettePart.prototype.type = "draw2d.AbstractPalettePart";
- draw2d.AbstractPalettePart.prototype = new draw2d.Draggable();
- draw2d.AbstractPalettePart.prototype.createHTMLElement = function() {
- var item = document.createElement("div");
- item.id = this.id;
- item.style.position = "absolute";
- item.style.height = "24px";
- item.style.width = "24px";
- return item;
- };
- draw2d.AbstractPalettePart.prototype.setEnviroment = function(_6008, _6009) {
- this.palette = _6009;
- this.workflow = _6008;
- };
- draw2d.AbstractPalettePart.prototype.getHTMLElement = function() {
- if (this.html === null) {
- this.html = this.createHTMLElement();
- draw2d.Draggable.call(this, this.html);
- }
- return this.html;
- };
- draw2d.AbstractPalettePart.prototype.onDrop = function(_600a, _600b) {
- var _600c = this.workflow.getScrollLeft();
- var _600d = this.workflow.getScrollTop();
- var _600e = this.workflow.getAbsoluteX();
- var _600f = this.workflow.getAbsoluteY();
- this.setPosition(this.x, this.y);
- this.execute(_600a + _600c - _600e, _600b + _600d - _600f);
- };
- draw2d.AbstractPalettePart.prototype.execute = function(x, y) {
- alert("inerited class should override the method 'draw2d.AbstractPalettePart.prototype.execute'");
- };
- draw2d.AbstractPalettePart.prototype.setTooltip = function(_6012) {
- this.tooltip = _6012;
- if (this.tooltip !== null) {
- this.html.title = this.tooltip;
- } else {
- this.html.title = "";
- }
- };
- draw2d.AbstractPalettePart.prototype.setDimension = function(w, h) {
- this.width = w;
- this.height = h;
- if (this.html === null) {
- return;
- }
- this.html.style.width = this.width + "px";
- this.html.style.height = this.height + "px";
- };
- draw2d.AbstractPalettePart.prototype.setPosition = function(xPos, yPos) {
- this.x = Math.max(0, xPos);
- this.y = Math.max(0, yPos);
- if (this.html === null) {
- return;
- }
- this.html.style.left = this.x + "px";
- this.html.style.top = this.y + "px";
- this.html.style.cursor = "move";
- };
- draw2d.AbstractPalettePart.prototype.getWidth = function() {
- return this.width;
- };
- draw2d.AbstractPalettePart.prototype.getHeight = function() {
- return this.height;
- };
- draw2d.AbstractPalettePart.prototype.getY = function() {
- return this.y;
- };
- draw2d.AbstractPalettePart.prototype.getX = function() {
- return this.x;
- };
- draw2d.AbstractPalettePart.prototype.getPosition = function() {
- return new draw2d.Point(this.x, this.y);
- };
- draw2d.AbstractPalettePart.prototype.disableTextSelection = function(e) {
- if (typeof e.onselectstart != "undefined") {
- e.onselectstart = function() {
- return false;
- };
- } else {
- if (typeof e.style.MozUserSelect != "undefined") {
- e.style.MozUserSelect = "none";
- }
- }
- };
- draw2d.ExternalPalette = function(_5b29, divId) {
- this.html = document.getElementById(divId);
- this.workflow = _5b29;
- this.parts = new draw2d.ArrayList();
- };
- draw2d.ExternalPalette.prototype.type = "draw2d.ExternalPalette";
- draw2d.ExternalPalette.prototype.getHTMLElement = function() {
- return this.html;
- };
- draw2d.ExternalPalette.prototype.addPalettePart = function(part) {
- if (!(part instanceof draw2d.AbstractPalettePart)) {
- throw "parameter is not instanceof [draw2d.AbstractPalettePart]";
- }
- this.parts.add(part);
- this.html.appendChild(part.getHTMLElement());
- part.setEnviroment(this.workflow, this);
- };
|