/**
* Copyright (c) 2006
*
* Philipp Berger, Martin Czuchra, Gero Decker, Ole Eckermann, Lutz Gericke,
* Alexander Hold, Alexander Koglin, Oliver Kopp, Stefan Krumnow,
* Matthias Kunze, Philipp Maschke, Falko Menge, Christoph Neijenhuis,
* Hagen Overdick, Zhen Peng, Nicolas Peters, Kerstin Pfitzner, Daniel Polak,
* Steffen Ryll, Kai Schlichting, Jan-Felix Schwarz, Daniel Taschik,
* Willi Tscheschner, Björn Wagner, Sven Wagner-Boysen, Matthias Weidlich
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*
*
* Ext JS (http://extjs.com/) is used under the terms of the Open Source LGPL 3.0
* license.
* The license and the source files can be found in our SVN repository at:
* http://oryx-editor.googlecode.com/.
**/ORYX.Utils={getParamFromUrl:function(b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+b+"=([^]*)";var d=new RegExp(a);var c=d.exec(window.location.href);if(c==null){return null}else{return c[1]}},adjustLightness:function(){return arguments[0]},adjustGradient:function(c,a){if(ORYX.CONFIG.DISABLE_GRADIENT&&c){var b=a.getAttributeNS(null,"stop-color")||"#ffffff";$A(c.getElementsByTagName("stop")).each(function(d){if(d==a){return}d.setAttributeNS(null,"stop-color",b)})}}};XMLNS={ATOM:"http://www.w3.org/2005/Atom",XHTML:"http://www.w3.org/1999/xhtml",ERDF:"http://purl.org/NET/erdf/profile",RDFS:"http://www.w3.org/2000/01/rdf-schema#",RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RAZIEL:"http://b3mn.org/Raziel",SCHEMA:""};var Kickstart={started:false,callbacks:[],alreadyLoaded:[],PATH:"",load:function(){Kickstart.kick()},kick:function(){if(!Kickstart.started){Kickstart.started=true;Kickstart.callbacks.each(function(a){window.setTimeout(a,1)})}},register:function(callback){with(Kickstart){if(started){window.setTimeout(callback,1)}else{Kickstart.callbacks.push(callback)}}},require:function(a){if(Kickstart.alreadyLoaded.member(a)){return false}return Kickstart.include(a)},include:function(a){var b=document.getElementsByTagNameNS(XMLNS.XHTML,"head")[0];var c=document.createElementNS(XMLNS.XHTML,"script");c.setAttributeNS(XMLNS.XHTML,"type","text/javascript");c.src=Kickstart.PATH+a;b.appendChild(c);Kickstart.alreadyLoaded.push(a);return true}};Event.observe(window,"load",Kickstart.load);var ERDF={LITERAL:1,RESOURCE:2,DELIMITERS:[".","-"],HASH:"#",HYPHEN:"-",schemas:[],callback:undefined,log:undefined,init:function(a){ERDF.callback=a;ERDF.registerSchema("schema",XMLNS.SCHEMA);ERDF.registerSchema("rdfs",XMLNS.RDFS)},run:function(){return ERDF._checkProfile()&&ERDF.parse()},parse:function(){ERDF.__startTime=new Date();var b=document.getElementsByTagNameNS(XMLNS.XHTML,"body");var c={type:ERDF.RESOURCE,value:""};var a=ERDF._parseDocumentMetadata()&&ERDF._parseFromTag(b[0],c);ERDF.__stopTime=new Date();var d=(ERDF.__stopTime-ERDF.__startTime)/1000;return a},_parseDocumentMetadata:function(){var b=document.getElementsByTagNameNS(XMLNS.XHTML,"head");var a=b[0].getElementsByTagNameNS(XMLNS.XHTML,"link");var c=b[0].getElementsByTagNameNS(XMLNS.XHTML,"meta");$A(a).each(function(e){var d=e.getAttribute("rel");var g=e.getAttribute("rev");var f=e.getAttribute("href");ERDF._parseTriplesFrom(ERDF.RESOURCE,"",d,ERDF.RESOURCE,f);ERDF._parseTriplesFrom(ERDF.RESOURCE,f,g,ERDF.RESOURCE,"")});$A(c).each(function(f){var e=f.getAttribute("name");var d=f.getAttribute("content");ERDF._parseTriplesFrom(ERDF.RESOURCE,"",e,ERDF.LITERAL,d)});return true},_parseFromTag:function(c,k,d){if(c.namespaceURI!=XMLNS.XHTML){return}if(!d){d=0}var a=c.getAttribute("id");if(c.nodeName.endsWith(":a")||c.nodeName=="a"){var h=c.getAttribute("rel");var e=c.getAttribute("rev");var n=c.getAttribute("href");var m=c.getAttribute("title");var g=c.textContent;ERDF._parseTriplesFrom(k.type,k.value,h,ERDF.RESOURCE,n,function(p){var o=m?m:g;ERDF._parseTriplesFrom(p.object.type,p.object.value,"rdfs.label",ERDF.LITERAL,o)});ERDF._parseTriplesFrom(k.type,k.value,e,ERDF.RESOURCE,"");ERDF._parseTypeTriplesFrom(k.type,k.value,h)}else{if(c.nodeName.endsWith(":img")||c.nodeName=="img"){var h=c.getAttribute("class");var n=c.getAttribute("src");var f=c.getAttribute("alt");ERDF._parseTriplesFrom(k.type,k.value,h,ERDF.RESOURCE,n,function(p){var o=f;ERDF._parseTriplesFrom(p.object.type,p.object.value,"rdfs.label",ERDF.LITERAL,o)})}}var h=c.getAttribute("class");var m=c.getAttribute("title");var g=c.textContent;var l=m?m:g;ERDF._parseTriplesFrom(k.type,k.value,h,ERDF.LITERAL,l);if(a){k={type:ERDF.RESOURCE,value:ERDF.HASH+a}}ERDF._parseTypeTriplesFrom(k.type,k.value,h);var b=c.childNodes;if(b){$A(b).each(function(o){if(o.nodeType==o.ELEMENT_NODE){ERDF._parseFromTag(o,k,d+1)}})}},_parseTriplesFrom:function(c,e,d,a,b,f){if(!d){return}d.toLowerCase().split(" ").each(function(h){var g=ERDF.schemas.find(function(l){return false||ERDF.DELIMITERS.find(function(m){return h.startsWith(l.prefix+m)})});if(g&&b){h=h.substring(g.prefix.length+1,h.length);var k=ERDF.registerTriple(new ERDF.Resource(e),{prefix:g.prefix,name:h},(a==ERDF.RESOURCE)?new ERDF.Resource(b):new ERDF.Literal(b));if(f){f(k)}}})},_parseTypeTriplesFrom:function(a,c,b,d){if(!b){return}b.toLowerCase().split(" ").each(function(f){var e=ERDF.schemas.find(function(h){return false||ERDF.DELIMITERS.find(function(k){return f.startsWith(ERDF.HYPHEN+h.prefix+k)})});if(e&&c){f=f.substring(e.prefix.length+2,f.length);var g=ERDF.registerTriple((a==ERDF.RESOURCE)?new ERDF.Resource(c):new ERDF.Literal(c),{prefix:"rdf",name:"type"},new ERDF.Resource(e.namespace+f));if(d){d(g)}}})},_checkProfile:function(){var b=document.getElementsByTagNameNS(XMLNS.XHTML,"head");var a=b[0].getAttribute("profile");var c=false;if(a&&a.split(" ").member(XMLNS.ERDF)){return true}else{return false}},__stripHashes:function(a){return(a&&a.substring(0,1)=="#")?a.substring(1,a.length):a},registerSchema:function(b,a){ERDF.schemas.push({prefix:b,namespace:a})},registerTriple:function(c,a,b){if(a.prefix.toLowerCase()=="schema"){this.registerSchema(a.name,b.value)}var d=new ERDF.Triple(c,a,b);ERDF.callback(d);return d},__enhanceObject:function(){this.isResource=function(){return this.type==ERDF.RESOURCE};this.isLocal=function(){return this.isResource()&&this.value.startsWith("#")};this.isCurrentDocument=function(){return this.isResource()&&(this.value=="")};this.getId=function(){return this.isLocal()?ERDF.__stripHashes(this.value):false};this.isLiteral=function(){return this.type==ERDF.LIITERAL}},serialize:function(a){if(!a){return""}else{if(a.constructor==String){return a}else{if(a.constructor==Boolean){return a?"true":"false"}else{return a.toString()}}}}};ERDF.Triple=function(c,a,b){this.subject=c;this.predicate=a;this.object=b;this.toString=function(){return"[ERDF.Triple] "+this.subject.toString()+" "+this.predicate.prefix+":"+this.predicate.name+" "+this.object.toString()}};ERDF.Resource=function(a){this.type=ERDF.RESOURCE;this.value=a;ERDF.__enhanceObject.apply(this);this.toString=function(){return"<"+this.value+">"}};ERDF.Literal=function(a){this.type=ERDF.LITERAL;this.value=ERDF.serialize(a);ERDF.__enhanceObject.apply(this);this.toString=function(){return'"'+this.value+'"'}};var USE_ASYNCHRONOUS_REQUESTS=true;var DISCARD_UNUSED_TRIPLES=true;var PREFER_SPANS_OVER_DIVS=true;var PREFER_TITLE_OVER_TEXTNODE=false;var RESOURCE_ID_PREFIX="resource";var SHOW_DEBUG_ALERTS_WHEN_SAVING=false;var SHOW_EXTENDED_DEBUG_INFORMATION=false;var USE_ARESS_WORKAROUNDS=true;var RESOURCE_CREATED=1;var RESOURCE_REMOVED=2;var RESOURCE_SAVED=4;var RESOURCE_RELOADED=8;var RESOURCE_SYNCHRONIZED=16;var TRIPLE_REMOVE=1;var TRIPLE_ADD=2;var TRIPLE_RELOAD=4;var TRIPLE_SAVE=8;var PROCESSDATA_REF="processdata";var DataManager={init:function(){ERDF.init(DataManager._registerTriple);DataManager.__synclocal()},_triples:[],_registerTriple:function(a){DataManager._triples.push(a)},__synclocal:function(){DataManager._triples=[];ERDF.run()},__synchronizeShape:function(a){var c=ResourceManager.getResource(a.resourceId);var b=a.serialize();b.each(function(d){var f=(d.type=="resource");var e=new ERDF.Triple(new ERDF.Resource(a.resourceId),{prefix:d.prefix,name:d.name},f?new ERDF.Resource(d.value):new ERDF.Literal(d.value));DataManager.setObject(e)});return c},__storeShape:function(a){var b=DataManager.__synchronizeShape(a);b.save()},__forceExistance:function(a){if(!$(a.resourceId)){if(!$$("."+PROCESSDATA_REF)[0]){DataManager.graft(XMLNS.XHTML,document.getElementsByTagNameNS(XMLNS.XHTML,"body").item(0),["div",{"class":PROCESSDATA_REF,style:"display:none;"}])}DataManager.graft(XMLNS.XHTML,$$("."+PROCESSDATA_REF)[0],["div",{id:a.resourceId,"class":(a instanceof ORYX.Core.Canvas)?"-oryx-canvas":undefined}])}else{var c=$(a.resourceId);var b=$A(c.childNodes);b.each(function(d){c.removeChild(d)})}},__persistShape:function(b){var d=b.serialize();var a=[];var c=new ERDF.Resource(b.resourceId);DataManager.removeTriples(DataManager.query(c,undefined,undefined));d.each(function(f){var e=(f.type=="resource")?new ERDF.Resource(f.value):new ERDF.Literal(f.value);DataManager.addTriple(new ERDF.Triple(c,{prefix:f.prefix,name:f.name},e))})},__persistDOM:function(d){var c=d.getCanvas();var b=c.getChildShapes(true);var a="";b.each(function(e){DataManager.__forceExistance(e)});DataManager.__renderCanvas(d);a+=DataManager.serialize($(ERDF.__stripHashes(d.getCanvas().resourceId)),true);b.each(function(e){DataManager.__persistShape(e);a+=DataManager.serialize($(ERDF.__stripHashes(e.resourceId)),true)});return a},__renderCanvas:function(e){var b=e.getCanvas();var d=e.getStencilSets();var a=b.getChildShapes(true);DataManager.__forceExistance(b);DataManager.__persistShape(b);var c=new ERDF.Resource(b.resourceId);DataManager.removeTriples(DataManager.query(c,undefined,undefined));DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"mode"},new ERDF.Literal("writable")));DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"mode"},new ERDF.Literal("fullscreen")));d.values().each(function(f){DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"stencilset"},new ERDF.Resource(f.source().replace(/&/g,"%26"))));DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"ssnamespace"},new ERDF.Resource(f.namespace())));f.extensions().keys().each(function(g){DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"ssextension"},new ERDF.Literal(g)))})});a.each(function(f){DataManager.addTriple(new ERDF.Triple(c,{prefix:"oryx",name:"render"},new ERDF.Resource("#"+f.resourceId)))})},__counter:0,__provideId:function(){while($(RESOURCE_ID_PREFIX+DataManager.__counter)){DataManager.__counter++}return RESOURCE_ID_PREFIX+DataManager.__counter},serializeDOM:function(a){return DataManager.__persistDOM(a)},syncGlobal:function(a){return DataManager.__syncglobal(a)},__syncglobal:function(c){var b=c.getCanvas();var a=b.getChildShapes(true);a.select(function(d){return !($(d.resourceId))}).each(function(d){if(USE_ARESS_WORKAROUNDS){var e=d.properties["raziel-type"];var g='
'+e+"
";var f=ResourceManager.__createResource(g);d.resourceId=f.id()}else{var f=ResourceManager.__createResource();d.resourceId=f.id()}});a.each(function(d){DataManager.__storeShape(d)})},serialize:function(f,b){if(f.nodeType==f.ELEMENT_NODE){var e=$A(f.childNodes);var c=$A(f.attributes);var d=new String(f.getAttribute("class"));var g=d.split(" ").member("transient");if(g){return""}var a="<"+f.nodeName;if(!b){a+=' xmlns="'+(f.namespaceURI?f.namespaceURI:XMLNS.XHTML)+'" xmlns:oryx="http://oryx-editor.org"'}c.each(function(h){a+=" "+h.nodeName+'="'+h.nodeValue+'"'});if(e.length==0){a+="/>"}else{a+=">";e.each(function(h){a+=DataManager.serialize(h,true)});a+=""+f.nodeName+">"}return a}else{if(f.nodeType==f.TEXT_NODE){return f.nodeValue}}},addTriple:function(c){if(!c.subject.type==ERDF.LITERAL){throw"Cannot add the triple "+c.toString()+" because the subject is not a resource."}var a=ERDF.__stripHashes(c.subject.value);var b=$(a);if(!b){throw"Cannot add the triple "+c.toString()+' because the subject "'+a+'" is not in the document.'}if(c.object.type==ERDF.LITERAL){DataManager.graft(XMLNS.XHTML,b,["span",{"class":(c.predicate.prefix+"-"+c.predicate.name)},c.object.value.escapeHTML()])}else{DataManager.graft(XMLNS.XHTML,b,["a",{rel:(c.predicate.prefix+"-"+c.predicate.name),href:c.object.value}])}return true},removeTriples:function(b){var a=b.select(function(c){return DataManager.__removeTriple(c)});return a},removeTriple:function(b){var a=DataManager.__removeTriple(b);return a},__removeTriple:function(d){if(!d.subject.type==ERDF.LITERAL){throw"Cannot remove the triple "+d.toString()+" because the subject is not a resource."}var b=ERDF.__stripHashes(d.subject.value);var c=$(b);if(!c){throw"Cannot remove the triple "+d.toString()+" because the subject is not in the document."}if(d.object.type==ERDF.LITERAL){var a=DataManager.__removeTripleRecursively(d,c);return a}},__removeTripleRecursively:function(e,d){if(d.nodeType!=d.ELEMENT_NODE){return false}var b=new String(d.getAttribute("class"));var a=$A(d.childNodes);if(b.include(e.predicate.prefix+"-"+e.predicate.name)){var c=d.textContent;if((e.object.type==ERDF.LITERAL)&&(e.object.value==c)){d.parentNode.removeChild(d)}return true}else{a.each(function(f){DataManager.__removeTripleRecursively(e,f)});return false}},graft:function(g,f,d,l){l=(l||(f&&f.ownerDocument)||document);var h;if(d===undefined){echo("Can't graft an undefined value")}else{if(d.constructor==String){h=l.createTextNode(d)}else{for(var c=0;c1)?" There is more than one raziel:entry URL.":" There is no raziel:entry URL."));return false},__createResource:function(e){var d=DataManager.query(new ERDF.Resource(""),{prefix:"raziel",name:"collection"},undefined);if((d.length==1)&&(d[0].object.isResource())){var b=d[0].object.value;var c=undefined;var a=e?e:'';ResourceManager.__request("POST",b,a,function(){var f=(this.responseXML);var h=f.childNodes[0];var g=h.getAttribute("id");if(!$$("."+PROCESSDATA_REF)[0]){DataManager.graft(XMLNS.XHTML,document.getElementsByTagNameNS(XMLNS.XHTML,"body").item(0),["div",{"class":PROCESSDATA_REF,style:"display:none;"}])}$$("."+PROCESSDATA_REF)[0].appendChild(h.cloneNode(true));DataManager.__synclocal();c=new ResourceManager.getResource(g);ResourceManager.__resourceActionSucceeded(this,RESOURCE_CREATED,undefined)},function(){ResourceManager.__resourceActionFailed(this,RESOURCE_CREATED,undefined)},false);return c}throw"Could not create resource! raziel:collection URL is missing!";return false},__Resource:function(b,a){this.__id=b;this.__url=a;this.id=function(){return this.__id};this.url=function(){return this.__url};this.reload=function(){var d=this.__url;var c=this.__id;ResourceManager.__request("GET",d,null,function(){ResourceManager.__resourceActionSucceeded(this,RESOURCE_RELOADED,c)},function(){ResourceManager.__resourceActionFailed(this,RESURCE_RELOADED,c)},USE_ASYNCHRONOUS_REQUESTS)};this.save=function(e){var d=this.__url;var c=this.__id;data=DataManager.serialize($(c));ResourceManager.__request("PUT",d,data,function(){ResourceManager.__resourceActionSucceeded(this,e?RESOURCE_SAVED|RESOURCE_SYNCHRONIZED:RESOURCE_SAVED,c)},function(){ResourceManager.__resourceActionFailed(this,e?RESOURCE_SAVED|RESOURCE_SYNCHRONIZED:RESOURCE.SAVED,c)},USE_ASYNCHRONOUS_REQUESTS)};this.remove=function(){var d=this.__url;var c=this.__id;ResourceManager.__request("DELETE",d,null,function(){ResourceManager.__resourceActionSucceeded(this,RESOURCE_REMOVED,c)},function(){ResourceManager.__resourceActionFailed(this,RESOURCE_REMOVED,c)},USE_ASYNCHRONOUS_REQUESTS)}},request:function(c,a){var b={method:"get",asynchronous:true,parameters:{}};Object.extend(b,a||{});var d=Hash.toQueryString(b.parameters);if(d){c+=(c.include("?")?"&":"?")+d}return ResourceManager.__request(b.method,c,b.data,(b.onSuccess instanceof Function?function(){b.onSuccess(this)}:undefined),(b.onFailure instanceof Function?function(){b.onFailure(this)}:undefined),b.asynchronous&&USE_ASYNCHRONOUS_REQUESTS,b.headers)},__request:function(a,b,f,n,m,d,c){var g=Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")});if(!g){if(!this.__corrupt){throw"This browser does not provide any AJAX functionality. You will not be able to use the software provided with the page you are viewing. Please consider installing appropriate extensions."}this.__corrupt=true;return false}if(n instanceof Function){g.onload=n}if(m instanceof Function){g.onerror=m}var k=$H(c);k.keys().each(function(e){g.setRequestHeader(e,k[e])});try{if(SHOW_DEBUG_ALERTS_WHEN_SAVING){alert(a+" "+b+"\n"+SHOW_EXTENDED_DEBUG_INFORMATION?f:"")}g.open(a,b,!d?false:true);g.send(f)}catch(l){return false}return true},__resourceActionSucceeded:function(g,c,f){var a=g.status;var b=g.responseText;if(SHOW_DEBUG_ALERTS_WHEN_SAVING){alert(a+" "+url+"\n"+SHOW_EXTENDED_DEBUG_INFORMATION?data:"")}if(a>=300){throw"The server responded with an error: "+a+"\n"+(SHOW_EXTENDED_DEBUG_INFORMATION?+data:"If you need additional information here, including the data sent by the server, consider setting SHOW_EXTENDED_DEBUG_INFORMATION to true.")}switch(c){case RESOURCE_REMOVED:var b=(g.responseXML);var e=b.childNodes[0];var f=e.getAttribute("id");var d=document.getElementById(f);d.parentNode.removeChild(d);break;case RESOURCE_CREATED:break;case RESOURCE_SAVED|RESOURCE_SYNCHRONIZED:DataManager.__synclocal();case RESOURCE_SAVED:break;case RESOURCE_RELOADED:var b=(g.responseXML);var e=b.childNodes[0];var f=e.getAttribute("id");var d=document.getElementById(f);d.parentNode.removeChild(d);if(!$$(PROCESSDATA_REF)[0]){DataManager.graft(XMLNS.XHTML,document.getElementsByTagNameNS(XMLNS.XHTML,"body").item(0),["div",{"class":PROCESSDATA_REF,style:"display:none;"}])}$$(PROCESSDATA_REF)[0].appendChild(e.cloneNode(true));DataManager.__synclocal();break;default:DataManager.__synclocal()}ResourceManager.__dispatchEvent(new ResourceManager.__Event(c,f))},__resourceActionFailed:function(c,a,b){throw"Fatal: Resource action failed. There is something horribly wrong with either the server, the transport protocol or your online status. Sure you're online?"}};var Clazz=function(){};Clazz.prototype.construct=function(){};Clazz.extend=function(e){var a=function(){if(arguments[0]!==Clazz){this.construct.apply(this,arguments)}};var d=new this(Clazz);var b=this.prototype;for(var f in e){var c=e[f];if(c instanceof Function){c.$=b}d[f]=c}a.prototype=d;a.extend=this.extend;return a};if(!ORYX){var ORYX={}}if(!ORYX.CONFIG){ORYX.CONFIG={}}ORYX.CONFIG.ROOT_PATH="../editor/";ORYX.CONFIG.EXPLORER_PATH="../explorer";ORYX.CONFIG.LIBS_PATH="../libs";ORYX.CONFIG.SERVER_HANDLER_ROOT="../service";ORYX.CONFIG.SERVER_EDITOR_HANDLER=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/editor";ORYX.CONFIG.SERVER_MODEL_HANDLER=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/model";ORYX.CONFIG.STENCILSET_HANDLER=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/editor_stencilset?embedsvg=true&url=true&namespace=";ORYX.CONFIG.STENCIL_SETS_URL=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/editor_stencilset";ORYX.CONFIG.PLUGINS_CONFIG=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/editor/plugins";ORYX.CONFIG.SYNTAXCHECKER_URL=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/syntaxchecker";ORYX.CONFIG.DEPLOY_URL=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/model/deploy";ORYX.CONFIG.MODEL_LIST_URL=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/models";ORYX.CONFIG.SS_EXTENSIONS_FOLDER=ORYX.CONFIG.ROOT_PATH+"stencilsets/extensions/";ORYX.CONFIG.SS_EXTENSIONS_CONFIG=ORYX.CONFIG.SERVER_HANDLER_ROOT+"/editor_ssextensions";ORYX.CONFIG.ORYX_NEW_URL="/new";ORYX.CONFIG.BPMN_LAYOUTER=ORYX.CONFIG.ROOT_PATH+"bpmnlayouter";if(!ORYX){var ORYX={}}if(!ORYX.CONFIG){ORYX.CONFIG={}}ORYX.CONFIG.BACKEND_SWITCH=true;ORYX.CONFIG.PANEL_LEFT_WIDTH=250;ORYX.CONFIG.PANEL_RIGHT_COLLAPSED=true;ORYX.CONFIG.PANEL_RIGHT_WIDTH=300;ORYX.CONFIG.APPNAME="Activiti BPM suite";ORYX.CONFIG.WEB_URL="../";ORYX.CONFIG.BLANK_IMAGE=ORYX.CONFIG.LIBS_PATH+"/ext-2.0.2/resources/images/default/s.gif";ORYX.CONFIG.SHOW_GRIDLINE=true;ORYX.CONFIG.MODE_READONLY="readonly";ORYX.CONFIG.MODE_FULLSCREEN="fullscreen";ORYX.CONFIG.WINDOW_HEIGHT=400;ORYX.CONFIG.PREVENT_LOADINGMASK_AT_READY=false;ORYX.CONFIG.PLUGINS_ENABLED=true;ORYX.CONFIG.PLUGINS_FOLDER="Plugins/";ORYX.CONFIG.BPMN20_SCHEMA_VALIDATION_ON=true;ORYX.CONFIG.NAMESPACE_ORYX="http://www.b3mn.org/oryx";ORYX.CONFIG.NAMESPACE_SVG="http://www.w3.org/2000/svg";ORYX.CONFIG.CANVAS_WIDTH=1485;ORYX.CONFIG.CANVAS_HEIGHT=1050;ORYX.CONFIG.CANVAS_RESIZE_INTERVAL=300;ORYX.CONFIG.SELECTED_AREA_PADDING=4;ORYX.CONFIG.CANVAS_BACKGROUND_COLOR="none";ORYX.CONFIG.GRID_DISTANCE=30;ORYX.CONFIG.GRID_ENABLED=true;ORYX.CONFIG.ZOOM_OFFSET=0.1;ORYX.CONFIG.DEFAULT_SHAPE_MARGIN=60;ORYX.CONFIG.SCALERS_SIZE=7;ORYX.CONFIG.MINIMUM_SIZE=20;ORYX.CONFIG.MAXIMUM_SIZE=10000;ORYX.CONFIG.OFFSET_MAGNET=15;ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP=8;ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM=8;ORYX.CONFIG.OFFSET_EDGE_BOUNDS=5;ORYX.CONFIG.COPY_MOVE_OFFSET=30;ORYX.CONFIG.BORDER_OFFSET=14;ORYX.CONFIG.MAX_NUM_SHAPES_NO_GROUP=12;ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET_CORNER=30;ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET=45;ORYX.CONFIG.SHAPEMENU_RIGHT="Oryx_Right";ORYX.CONFIG.SHAPEMENU_BOTTOM="Oryx_Bottom";ORYX.CONFIG.SHAPEMENU_LEFT="Oryx_Left";ORYX.CONFIG.SHAPEMENU_TOP="Oryx_Top";ORYX.CONFIG.MORPHITEM_DISABLED="Oryx_MorphItem_disabled";ORYX.CONFIG.TYPE_STRING="string";ORYX.CONFIG.TYPE_BOOLEAN="boolean";ORYX.CONFIG.TYPE_INTEGER="integer";ORYX.CONFIG.TYPE_FLOAT="float";ORYX.CONFIG.TYPE_COLOR="color";ORYX.CONFIG.TYPE_DATE="date";ORYX.CONFIG.TYPE_CHOICE="choice";ORYX.CONFIG.TYPE_URL="url";ORYX.CONFIG.TYPE_DIAGRAM_LINK="diagramlink";ORYX.CONFIG.TYPE_COMPLEX="complex";ORYX.CONFIG.TYPE_MULTIPLECOMPLEX="multiplecomplex";ORYX.CONFIG.TYPE_TEXT="text";ORYX.CONFIG.TYPE_MODEL_LINK="modellink";ORYX.CONFIG.TYPE_LISTENER="listener";ORYX.CONFIG.TYPE_EPC_FREQ="epcfrequency";ORYX.CONFIG.TYPE_GLOSSARY_LINK="glossarylink";ORYX.CONFIG.LABEL_LINE_DISTANCE=2;ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT=12;ORYX.CONFIG.ENABLE_MORPHMENU_BY_HOVER=false;ORYX.CONFIG.EDITOR_ALIGN_BOTTOM=1;ORYX.CONFIG.EDITOR_ALIGN_MIDDLE=2;ORYX.CONFIG.EDITOR_ALIGN_TOP=4;ORYX.CONFIG.EDITOR_ALIGN_LEFT=8;ORYX.CONFIG.EDITOR_ALIGN_CENTER=16;ORYX.CONFIG.EDITOR_ALIGN_RIGHT=32;ORYX.CONFIG.EDITOR_ALIGN_SIZE=48;ORYX.CONFIG.EVENT_MOUSEDOWN="mousedown";ORYX.CONFIG.EVENT_MOUSEUP="mouseup";ORYX.CONFIG.EVENT_MOUSEOVER="mouseover";ORYX.CONFIG.EVENT_MOUSEOUT="mouseout";ORYX.CONFIG.EVENT_MOUSEMOVE="mousemove";ORYX.CONFIG.EVENT_DBLCLICK="dblclick";ORYX.CONFIG.EVENT_KEYDOWN="keydown";ORYX.CONFIG.EVENT_KEYUP="keyup";ORYX.CONFIG.EVENT_LOADED="editorloaded";ORYX.CONFIG.EVENT_EXECUTE_COMMANDS="executeCommands";ORYX.CONFIG.EVENT_STENCIL_SET_LOADED="stencilSetLoaded";ORYX.CONFIG.EVENT_SELECTION_CHANGED="selectionchanged";ORYX.CONFIG.EVENT_SHAPEADDED="shapeadded";ORYX.CONFIG.EVENT_SHAPEREMOVED="shaperemoved";ORYX.CONFIG.EVENT_PROPERTY_CHANGED="propertyChanged";ORYX.CONFIG.EVENT_DRAGDROP_START="dragdrop.start";ORYX.CONFIG.EVENT_SHAPE_MENU_CLOSE="shape.menu.close";ORYX.CONFIG.EVENT_DRAGDROP_END="dragdrop.end";ORYX.CONFIG.EVENT_RESIZE_START="resize.start";ORYX.CONFIG.EVENT_RESIZE_END="resize.end";ORYX.CONFIG.EVENT_DRAGDOCKER_DOCKED="dragDocker.docked";ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW="highlight.showHighlight";ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE="highlight.hideHighlight";ORYX.CONFIG.EVENT_LOADING_ENABLE="loading.enable";ORYX.CONFIG.EVENT_LOADING_DISABLE="loading.disable";ORYX.CONFIG.EVENT_LOADING_STATUS="loading.status";ORYX.CONFIG.EVENT_OVERLAY_SHOW="overlay.show";ORYX.CONFIG.EVENT_OVERLAY_HIDE="overlay.hide";ORYX.CONFIG.EVENT_ARRANGEMENT_TOP="arrangement.setToTop";ORYX.CONFIG.EVENT_ARRANGEMENT_BACK="arrangement.setToBack";ORYX.CONFIG.EVENT_ARRANGEMENT_FORWARD="arrangement.setForward";ORYX.CONFIG.EVENT_ARRANGEMENT_BACKWARD="arrangement.setBackward";ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED="propertyWindow.propertyChanged";ORYX.CONFIG.EVENT_LAYOUT_ROWS="layout.rows";ORYX.CONFIG.EVENT_LAYOUT_BPEL="layout.BPEL";ORYX.CONFIG.EVENT_LAYOUT_BPEL_VERTICAL="layout.BPEL.vertical";ORYX.CONFIG.EVENT_LAYOUT_BPEL_HORIZONTAL="layout.BPEL.horizontal";ORYX.CONFIG.EVENT_LAYOUT_BPEL_SINGLECHILD="layout.BPEL.singlechild";ORYX.CONFIG.EVENT_LAYOUT_BPEL_AUTORESIZE="layout.BPEL.autoresize";ORYX.CONFIG.EVENT_AUTOLAYOUT_LAYOUT="autolayout.layout";ORYX.CONFIG.EVENT_UNDO_EXECUTE="undo.execute";ORYX.CONFIG.EVENT_UNDO_ROLLBACK="undo.rollback";ORYX.CONFIG.EVENT_BUTTON_UPDATE="toolbar.button.update";ORYX.CONFIG.EVENT_LAYOUT="layout.dolayout";ORYX.CONFIG.EVENT_GLOSSARY_LINK_EDIT="glossary.link.edit";ORYX.CONFIG.EVENT_GLOSSARY_SHOW="glossary.show.info";ORYX.CONFIG.EVENT_GLOSSARY_NEW="glossary.show.new";ORYX.CONFIG.EVENT_DOCKERDRAG="dragTheDocker";ORYX.CONFIG.EVENT_SHOW_PROPERTYWINDOW="propertywindow.show";ORYX.CONFIG.EVENT_ABOUT_TO_SAVE="file.aboutToSave";ORYX.CONFIG.SELECTION_HIGHLIGHT_SIZE=5;ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR="#4444FF";ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR2="#9999FF";ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_CORNER="corner";ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_RECTANGLE="rectangle";ORYX.CONFIG.SELECTION_VALID_COLOR="#00FF00";ORYX.CONFIG.SELECTION_INVALID_COLOR="#FF0000";ORYX.CONFIG.DOCKER_DOCKED_COLOR="#00FF00";ORYX.CONFIG.DOCKER_UNDOCKED_COLOR="#FF0000";ORYX.CONFIG.DOCKER_SNAP_OFFSET=10;ORYX.CONFIG.EDIT_OFFSET_PASTE=10;ORYX.CONFIG.KEY_CODE_X=88;ORYX.CONFIG.KEY_CODE_C=67;ORYX.CONFIG.KEY_CODE_V=86;ORYX.CONFIG.KEY_CODE_DELETE=46;ORYX.CONFIG.KEY_CODE_META=224;ORYX.CONFIG.KEY_CODE_BACKSPACE=8;ORYX.CONFIG.KEY_CODE_LEFT=37;ORYX.CONFIG.KEY_CODE_RIGHT=39;ORYX.CONFIG.KEY_CODE_UP=38;ORYX.CONFIG.KEY_CODE_DOWN=40;ORYX.CONFIG.KEY_Code_enter=12;ORYX.CONFIG.KEY_Code_left=37;ORYX.CONFIG.KEY_Code_right=39;ORYX.CONFIG.KEY_Code_top=38;ORYX.CONFIG.KEY_Code_bottom=40;ORYX.CONFIG.META_KEY_META_CTRL="metactrl";ORYX.CONFIG.META_KEY_ALT="alt";ORYX.CONFIG.META_KEY_SHIFT="shift";ORYX.CONFIG.KEY_ACTION_DOWN="down";ORYX.CONFIG.KEY_ACTION_UP="up";function printf(){var a=arguments[0];for(var b=1;b=ORYX_LOGLEVEL_TRACE){ORYX.Log.__log("TRACE",arguments)}},debug:function(){if(ORYX_LOGLEVEL>=ORYX_LOGLEVEL_DEBUG){ORYX.Log.__log("DEBUG",arguments)}},info:function(){if(ORYX_LOGLEVEL>=ORYX_LOGLEVEL_INFO){ORYX.Log.__log("INFO",arguments)}},warn:function(){if(ORYX_LOGLEVEL>=ORYX_LOGLEVEL_WARN){ORYX.Log.__log("WARN",arguments)}},error:function(){if(ORYX_LOGLEVEL>=ORYX_LOGLEVEL_ERROR){ORYX.Log.__log("ERROR",arguments)}},fatal:function(){if(ORYX_LOGLEVEL>=ORYX_LOGLEVEL_FATAL){ORYX.Log.__log("FATAL",arguments)}},__log:function(c,a){a[0]=(new Date()).getTime()+" "+c+" "+a[0];var b=printf.apply(null,a);ORYX.Log.__appenders.each(function(d){d.append(b)})},addAppender:function(a){ORYX.Log.__appenders.push(a)}},load:function(){if(ORYX.CONFIG.PREVENT_LOADINGMASK_AT_READY!==true){var a=new Ext.Window({renderTo:Ext.getBody(),id:"oryx-loading-panel",bodyStyle:"padding: 8px;background:white",title:ORYX.I18N.Oryx.title,width:"auto",height:"auto",modal:true,resizable:false,closable:false,html:''+ORYX.I18N.Oryx.pleaseWait+""});a.show()}ORYX.Log.debug("Oryx begins loading procedure.");if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])<1.5){throw ("Application requires the Prototype JavaScript framework >= 1.5.3")}ORYX.Log.debug("Prototype > 1.5 found.");ORYX._load()},_load:function(){ORYX.loadPlugins()},loadPlugins:function(){if(ORYX.CONFIG.PLUGINS_ENABLED){ORYX._loadPlugins()}else{ORYX.Log.warn("Ignoring plugins, loading Core only.")}init()},_loadPlugins:function(){var a=ORYX.CONFIG.PLUGINS_CONFIG;ORYX.Log.debug("Loading plugin configuration from '%0'.",a);new Ajax.Request(a,{asynchronous:false,method:"get",onSuccess:function(c){ORYX.Log.info("Plugin configuration file loaded.");var f=c.responseXML;var b=[];var d=$A(f.getElementsByTagName("properties"));d.each(function(h){var g=$A(h.childNodes);g.each(function(m){var l=new Hash();var k=$A(m.attributes);k.each(function(n){l[n.nodeName]=n.nodeValue});if(k.length>0){b.push(l)}})});var e=f.getElementsByTagName("plugin");$A(e).each(function(k){var p=new Hash();$A(k.attributes).each(function(r){p[r.nodeName]=r.nodeValue});if(!p.name){ORYX.Log.error("A plugin is not providing a name. Ingnoring this plugin.");return}if(!p.source){ORYX.Log.error("Plugin with name '%0' doesn't provide a source attribute.",p.name);return}var n=k.getElementsByTagName("property");var o=[];$A(n).each(function(t){var s=new Hash();var r=$A(t.attributes);r.each(function(u){s[u.nodeName]=u.nodeValue});if(r.length>0){o.push(s)}});o=o.concat(b);p.properties=o;var l=k.getElementsByTagName("requires");var q;$A(l).each(function(s){var r=$A(s.attributes).find(function(t){return t.name=="namespace"});if(r&&r.nodeValue){if(!q){q={namespaces:[]}}q.namespaces.push(r.nodeValue)}});if(q){p.requires=q}var m=k.getElementsByTagName("notUsesIn");var h;$A(m).each(function(s){var r=$A(s.attributes).find(function(t){return t.name=="namespace"});if(r&&r.nodeValue){if(!h){h={namespaces:[]}}h.namespaces.push(r.nodeValue)}});if(h){p.notUsesIn=h}var g=ORYX.PATH+ORYX.CONFIG.PLUGINS_FOLDER+p.source;ORYX.Log.debug("Requireing '%0'",g);ORYX.Log.info("Plugin '%0' successfully loaded.",p.name);ORYX.availablePlugins.push(p)})},onFailure:this._loadPluginsOnFails})},_loadPluginsOnFails:function(a){ORYX.Log.error("Plugin configuration file not available.")}});ORYX.Log.debug("Registering Oryx with Kickstart");Kickstart.register(ORYX.load);if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.SVG){ORYX.Core.SVG={}}ORYX.Core.SVG.EditPathHandler=Clazz.extend({construct:function(){arguments.callee.$.construct.apply(this,arguments);this.x=0;this.y=0;this.oldX=0;this.oldY=0;this.deltaWidth=1;this.deltaHeight=1;this.d=""},init:function(a,f,d,b,c,e){this.x=a;this.y=f;this.oldX=d;this.oldY=b;this.deltaWidth=c;this.deltaHeight=e;this.d=""},editPointsAbs:function(c){if(c instanceof Array){var d=[];var a,e;for(var b=0;b1){var G=parseFloat(n[0]);var F=parseFloat(n[1]);var E=parseFloat(n[0]);var D=parseFloat(n[1]);for(var z=0;z1){var g=(this.oldWidth===0)?0:this.width/this.oldWidth;var e=(this.oldHeight===0)?0:this.height/this.oldHeight;var b="";for(var c=0;c=this.x&&d<=this.x+this.width&&b>=this.y&&b<=this.y+this.height);break;case"Circle":return ORYX.Core.Math.isPointInEllipse(d,b,this.x+this.width/2,this.y+this.height/2,this.radiusX,this.radiusX);break;case"Ellipse":return ORYX.Core.Math.isPointInEllipse(d,b,this.x+this.radiusX,this.y+this.radiusY,this.radiusX,this.radiusY);break;case"Line":return ORYX.Core.Math.isPointInLine(d,b,this.x,this.y,this.x+this.width,this.y+this.height);break;case"Polyline":var a=this.element.getAttributeNS(null,"points");if(a){a=a.replace(/,/g," ").split(" ").without("");a=a.collect(function(e){return parseFloat(e)});return ORYX.Core.Math.isPointInPolygone(d,b,a)}else{return false}break;case"Path":if(!this.handler){var c=new PathParser();this.handler=new ORYX.Core.SVG.PointsPathHandler();c.setHandler(this.handler);c.parsePath(this.element)}return ORYX.Core.Math.isPointInPolygone(d,b,this.handler.points);break;default:return false}},isVisible:function(c){if(this.visible!==undefined){return this.visible}if(!c){c=this.element}var b=false;try{b=!!c.ownerSVGElement}catch(g){}if(b){if(ORYX.Editor.checkClassType(c,SVGGElement)){if(c.className&&c.className.baseVal=="me"){this.visible=true;return this.visible}}var f=c.getAttributeNS(null,"fill");var d=c.getAttributeNS(null,"stroke");if(f&&f=="none"&&d&&d=="none"){this.visible=false}else{var a=c.getAttributeNS(null,"display");if(!a){this.visible=this.isVisible(c.parentNode)}else{if(a=="none"){this.visible=false}else{this.visible=true}}}}else{this.visible=true}return this.visible},toString:function(){return(this.element)?"SVGShape "+this.element.id:"SVGShape "+this.element}});if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.SVG){ORYX.Core.SVG={}}ORYX.Core.SVG.Label=Clazz.extend({_characterSets:["%W","@","m","wDGMOQÖ#+=<>~^","ABCHKNRSUVXZÜÄ&","bdghnopquxöüETY1234567890ß_§${}*´`µ€","aeksvyzäFLP?°²³","c-",'rtJ"/()[]:;!|\\',"fjI., ","'","il"],_characterSetValues:[15,14,13,11,10,9,8,7,6,5,4,3],construct:function(m){arguments.callee.$.construct.apply(this,arguments);if(!m.textElement){throw"Label: No parameter textElement."}else{if(!ORYX.Editor.checkClassType(m.textElement,SVGTextElement)){throw"Label: Parameter textElement is not an SVGTextElement."}}this.invisibleRenderPoint=-5000;this.node=m.textElement;this.node.setAttributeNS(null,"stroke-width","0pt");this.node.setAttributeNS(null,"letter-spacing","-0.01px");this.shapeId=m.shapeId;this.id;this.fitToElemId;this.edgePosition;this.x;this.y;this.oldX;this.oldY;this.isVisible=true;this._text;this._verticalAlign;this._horizontalAlign;this._rotate;this._rotationPoint;this.anchorLeft;this.anchorRight;this.anchorTop;this.anchorBottom;this._isChanged=true;var k=this.node.getAttributeNS(null,"id");if(k){this.id=k}this.fitToElemId=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"fittoelem");if(this.fitToElemId){this.fitToElemId=this.shapeId+this.fitToElemId}var f=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"align");if(f){f=f.replace(/,/g," ");f=f.split(" ");f=f.without("");f.each((function(e){switch(e){case"top":case"middle":case"bottom":if(!this._verticalAlign){this._originVerticalAlign=this._verticalAlign=e}break;case"left":case"center":case"right":if(!this._horizontalAlign){this._originHorizontalAlign=this._horizontalAlign=e}break}}).bind(this))}this.edgePosition=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"edgePosition");if(this.edgePosition){this.originEdgePosition=this.edgePosition=this.edgePosition.toLowerCase()}this.offsetTop=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"offsetTop")||ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP;if(this.offsetTop){this.offsetTop=parseInt(this.offsetTop)}this.offsetBottom=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"offsetBottom")||ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM;if(this.offsetBottom){this.offsetBottom=parseInt(this.offsetBottom)}var l=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"rotate");if(l){try{this._rotate=parseFloat(l)}catch(g){this._rotate=0}}else{this._rotate=0}var b=this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX,"anchors");if(b){b=b.replace("/,/g"," ");var a=b.split(" ").without("");for(var d=0;dh){var q=0;var n=0;var o=this.getTrimmedTextLength(p.textContent);for(var g=0;gh-2){var c=this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG,"tspan");if(n<=q){n=(g==0)?g:g-1;c.textContent=p.textContent.slice(q,n).trim()}else{c.textContent=p.textContent.slice(q,++n).trim()}c.setAttributeNS(null,"x",this.invisibleRenderPoint);c.setAttributeNS(null,"y",this.invisibleRenderPoint);d.push(c);q=n}else{var a=p.textContent.charAt(g);if(a==" "||a=="-"||a=="."||a==","||a==";"||a==":"){n=g}}}p.textContent=p.textContent.slice(q).trim()}d.push(p)}while(this.node.hasChildNodes()){this.node.removeChild(this.node.childNodes[0])}while(d.length>0){this.node.appendChild(d.shift())}}}catch(m){ORYX.Log.fatal("Error "+m)}window.setTimeout(this._positionText.bind(this),0)},_positionText:function(){try{var d=this.node.childNodes;var m=this.getFontSize(this.node);var b=[];var l=this.x,k=this.y;if(this.position){l=this.position.x;k=this.position.y}l=Math.floor(l);k=Math.floor(k);var f=0,a=[];var g=(this.indices||$R(0,d.length-1).toArray());var c=g.length;g.each((function(n){if("undefined"==typeof n){return}var o=d[f++];if(o.textContent.trim()===""){b.push(o)}else{var e=0;switch(this._verticalAlign){case"bottom":e=-(c-n-1)*(m);break;case"middle":e=-(c/2-n-1)*(m);e-=ORYX.CONFIG.LABEL_LINE_DISTANCE/2;break;case"top":e=n*(m);e+=m;break}o.setAttributeNS(null,"dy",Math.floor(e));o.setAttributeNS(null,"x",l);o.setAttributeNS(null,"y",k);a.push(n)}}).bind(this));a.length=d.length;this.indices=this.indices||a;b.each(function(e){this.node.removeChild(e)}.bind(this));switch(this._horizontalAlign){case"left":this.node.setAttributeNS(null,"text-anchor","start");break;case"center":this.node.setAttributeNS(null,"text-anchor","middle");break;case"right":this.node.setAttributeNS(null,"text-anchor","end");break}}catch(h){this._isChanged=true}if(this.isVisible){this.node.removeAttributeNS(null,"visibility")}delete this._isUpdating;(this.changeCallbacks||[]).each(function(e){e.apply(e)})},_getRenderedTextLength:function(c,d,b,a){if(d===undefined){return c.getComputedTextLength()}else{return c.getSubStringLength(d,b)}},_estimateTextWidth:function(d,c){var b=0;for(var a=0;a=0){return this._characterSetValues[a]}}return 9},getReferencedElementWidth:function(){var a=this.node.ownerDocument.getElementById(this.fitToElemId);if(a){var b=a.getBBox();if(b){return(this._rotate!=0&&this._rotate%180!=0&&this._rotate%90==0?b.height:b.width)}}return undefined},text:function(){switch(arguments.length){case 0:return this._text;break;case 1:var a=this._text;if(arguments[0]){this._text=arguments[0].toString()}else{this._text=""}if(a!==this._text){this._isChanged=true;this._textHasChanged=true}break;default:break}},getOriginVerticalAlign:function(){return this._originVerticalAlign},verticalAlign:function(){switch(arguments.length){case 0:return this._verticalAlign;case 1:if(["top","middle","bottom"].member(arguments[0])){var a=this._verticalAlign;this._verticalAlign=arguments[0];if(this._verticalAlign!==a){this._isChanged=true}}break;default:break}},getOriginHorizontalAlign:function(){return this._originHorizontalAlign},horizontalAlign:function(){switch(arguments.length){case 0:return this._horizontalAlign;case 1:if(["left","center","right"].member(arguments[0])){var a=this._horizontalAlign;this._horizontalAlign=arguments[0];if(this._horizontalAlign!==a){this._isChanged=true}}break;default:break}},rotate:function(){switch(arguments.length){case 0:return this._rotate;case 1:if(this._rotate!=arguments[0]){this._rotate=arguments[0];this._rotationPoint=undefined;this._isChanged=true}case 2:if(this._rotate!=arguments[0]||!this._rotationPoint||this._rotationPoint.x!=arguments[1].x||this._rotationPoint.y!=arguments[1].y){this._rotate=arguments[0];this._rotationPoint=arguments[1];this._isChanged=true}}},hide:function(){if(this.isVisible){this.isVisible=false;this._isChanged=true}},show:function(){if(!this.isVisible){this.isVisible=true;this._isChanged=true}},getInheritedFontSize:function(b){if(!b||!b.getAttributeNS){return}var a=b.getAttributeNS(null,"font-size");if(a){return parseFloat(a)}else{if(!ORYX.Editor.checkClassType(b,SVGSVGElement)){return this.getInheritedFontSize(b.parentNode)}}},getFontSize:function(b){var a=this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG,"tspan");var c=this.getInheritedFontSize(this.node);if(!c){if(a[0]&&/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)&&new Number(RegExp.$1)>=3){c=a[0].getExtentOfChar(0).height}else{c=ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT}if(c<=0){c=ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT}}if(c){this.node.setAttribute("oryx:fontSize",c)}return c},getTrimmedTextLength:function(b){b=b.strip().gsub(" "," ");var a;do{a=b.length;b=b.gsub(" "," ")}while(a>b.length);return b.length},getOffsetBottom:function(){return this.offsetBottom},getOffsetTop:function(){return this.offsetTop},deserialize:function(b,a){if(b&&"undefined"!=typeof b.x&&"undefined"!=typeof b.y){this.setPosition({x:b.x,y:b.y});if("undefined"!=typeof b.distance){var d=a.dockers[b.from];var c=a.dockers[b.to];if(d&&c){this.setReferencePoint({dirty:true,distance:b.distance,intersection:{x:b.x,y:b.y},orientation:b.orientation,segment:{from:d,fromIndex:b.from,fromPosition:d.bounds.center(),to:c,toIndex:b.to,toPosition:c.bounds.center()}})}}if(b.left){this.anchorLeft=true}if(b.right){this.anchorRight=true}if(b.top){this.anchorTop=true}if(b.bottom){this.anchorBottom=true}if(b.valign){this.verticalAlign(b.valign)}if(b.align){this.horizontalAlign(b.align)}}else{if(b&&"undefined"!=typeof b.edge){this.setEdgePosition(b.edge)}}},serialize:function(){if(this.getEdgePosition()){if(this.getOriginEdgePosition()!==this.getEdgePosition()){return{edge:this.getEdgePosition()}}else{return null}}if(this.position){var b={x:this.position.x,y:this.position.y};if(this.isAnchorLeft()&&this.isAnchorLeft()!==this.isOriginAnchorLeft()){b.left=true}if(this.isAnchorRight()&&this.isAnchorRight()!==this.isOriginAnchorRight()){b.right=true}if(this.isAnchorTop()&&this.isAnchorTop()!==this.isOriginAnchorTop()){b.top=true}if(this.isAnchorBottom()&&this.isAnchorBottom()!==this.isOriginAnchorBottom()){b.bottom=true}if(this.getOriginVerticalAlign()!==this.verticalAlign()){b.valign=this.verticalAlign()}if(this.getOriginHorizontalAlign()!==this.horizontalAlign()){b.align=this.horizontalAlign()}return b}if(this.getReferencePoint()){var a=this.getReferencePoint();return{distance:a.distance,x:a.intersection.x,y:a.intersection.y,from:a.segment.fromIndex,to:a.segment.toIndex,orientation:a.orientation,valign:this.verticalAlign(),align:this.horizontalAlign()}}return null},toString:function(){return"Label "+this.id}});if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.Math){ORYX.Core.Math={}}ORYX.Core.Math.midPoint=function(b,a){return{x:(b.x+a.x)/2,y:(b.y+a.y)/2}};ORYX.Core.Math.isPointInLine=function(h,f,g,e,b,a,d){d=d?Math.abs(d):1;if(Math.abs(g-b)<=d&&Math.abs(h-g)<=d&&f-Math.max(e,a)<=d&&Math.min(e,a)-f<=d){return true}if(Math.abs(e-a)<=d&&Math.abs(f-e)<=d&&h-Math.max(g,b)<=d&&Math.min(g,b)-h<=d){return true}if(h>Math.max(g,b)||hMath.max(e,a)||f=n)!=(l>=n)){h+=l-m>=0?k>=0:k<=0}if(!k&&Math.min(c,b)<=a&&a<=Math.max(c,b)&&Math.min(m,l)<=n&&n<=Math.max(m,l)){return true}}return(h%2)?true:false};ORYX.Core.Math.distancePointLinie=function(e,d,a,b){var c=ORYX.Core.Math.getPointOfIntersectionPointLine(e,d,a,b);if(!c){return null}return ORYX.Core.Math.getDistancePointToPoint(a,c)};ORYX.Core.Math.getDistancePointToPoint=function(b,a){return Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2))};ORYX.Core.Math.getDistanceBetweenTwoPoints=function(c,b,a){return ORYX.Core.Math.getDistancePointToPoint(a,c)/ORYX.Core.Math.getDistancePointToPoint(c,b)};ORYX.Core.Math.pointIsLeftOfLine=function(e,d,a){var c=ORYX.Core.Math.getVector(e,d);var b=ORYX.Core.Math.getVector(e,a);return((c.x*b.y)-(b.x*c.y))>0};ORYX.Core.Math.getPointBetweenTwoPoints=function(b,a,c){c=Math.max(Math.min(c||0,1),0);if(c===0){return b}else{if(c===1){return a}}return{x:b.x+((a.x-b.x)*c),y:b.y+((a.y-b.y)*c)}};ORYX.Core.Math.getVector=function(b,a){return{x:a.x-b.x,y:a.y-b.y}};ORYX.Core.Math.getIdentityVector=function(a){if(arguments.length==2){a=ORYX.Core.Math.getVector(arguments[0],arguments[1])}var b=Math.sqrt((a.x*a.x)+(a.y*a.y));return{x:a.x/(b||1),y:a.y/(b||1)}};ORYX.Core.Math.getOrthogonalIdentityVector=function(c,b){var a=arguments.length==1?c:ORYX.Core.Math.getIdentityVector(c,b);return{x:a.y,y:-a.x}};ORYX.Core.Math.getPointOfIntersectionPointLine=function(f,c,a,e){var d=Math.pow(c.x-f.x,2)+Math.pow(c.y-f.y,2);if(d==0){return undefined}var b=((a.x-f.x)*(c.x-f.x)+(a.y-f.y)*(c.y-f.y))/d;if(e){if(!(0<=b&&b<=1)){return undefined}}pointOfIntersection=new Object();pointOfIntersection.x=f.x+b*(c.x-f.x);pointOfIntersection.y=f.y+b*(c.y-f.y);return pointOfIntersection};ORYX.Core.Math.getTranslatedPoint=function(b,c){var a=c.a*b.x+c.c*b.y+c.e*1;var d=c.b*b.x+c.d*b.y+c.f*1;return{x:a,y:d}};ORYX.Core.Math.getInverseMatrix=function(b){var c=ORYX.Core.Math.getDeterminant(b),a=b;return{a:c*((a.d*1)-(a.f*0)),b:c*((a.f*0)-(a.b*1)),c:c*((a.e*0)-(a.c*1)),d:c*((a.a*1)-(a.e*0)),e:c*((a.c*a.f)-(a.e*a.d)),f:c*((a.e*a.b)-(a.a*a.f))}};ORYX.Core.Math.getDeterminant=function(a){return(a.a*a.d*1)+(a.c*a.f*0)+(a.e*a.b*0)-(a.e*a.d*0)-(a.c*a.b*1)-(a.a*a.f*0)};ORYX.Core.Math.getTranslatedBoundingBox=function(a){var h=a.getCTM();var f=a.getBBox();var e=ORYX.Core.Math.getTranslatedPoint({x:f.x,y:f.y},h);var g=ORYX.Core.Math.getTranslatedPoint({x:f.x,y:f.y+f.height},h);var b=ORYX.Core.Math.getTranslatedPoint({x:f.x+f.width,y:f.y},h);var c=ORYX.Core.Math.getTranslatedPoint({x:f.x+f.width,y:f.y+f.height},h);var k={x:Math.min(e.x,g.x,b.x,c.x),y:Math.min(e.y,g.y,b.y,c.y)};var d={x:Math.max(e.x,g.x,b.x,c.x),y:Math.max(e.y,g.y,b.y,c.y)};return{x:k.x,y:k.y,width:d.x-k.x,height:d.y-k.y}};ORYX.Core.Math.getAngle=function(c,a){if(c.x==a.x&&c.y==a.y){return 0}var b=Math.asin(Math.sqrt(Math.pow(c.y-a.y,2))/(Math.sqrt(Math.pow(a.x-c.x,2)+Math.pow(c.y-a.y,2))))*180/Math.PI;if(a.x>=c.x&&a.y<=c.y){return b}else{if(a.xc.y){return 180+b}else{return 360-b}}}};new function(){var b=2,c=8,e=4,a=1;function d(g,n,m,k,h,f){var l=0;if(n>f){l|=c}else{if(nh){l|=b}else{if(g0){o=true}else{var t=0,r=0;p=m!=0?m:k;if((p&c)>0){t=h+(g-h)*(l-u)/(s-u);r=l}else{if((p&e)>0){t=h+(g-h)*(v-u)/(s-u);r=v}else{if((p&b)>0){r=u+(s-u)*(q-h)/(g-h);t=q}else{if((p&a)>0){r=u+(s-u)*(f-h)/(g-h);t=f}}}}if(p==m){h=t;u=r;m=d(h,u,f,v,q,l)}else{g=t;s=r;k=d(g,s,f,v,q,l)}}}w++}while(o!=true&&w<5000);if(n){return{a:{x:h,y:u},b:{x:g,y:s}}}return null}}();if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.Stencil={construct:function(d,e,a,l,k,h){arguments.callee.$.construct.apply(this,arguments);if(!d){throw"Stencilset seems corrupt."}if(!e){throw"Stencil does not provide namespace."}if(!a){throw"Stencil does not provide SVG source."}if(!l){throw"Fatal internal error loading stencilset."}this._source=a;this._jsonStencil=d;this._stencilSet=l;this._namespace=e;this._propertyPackages=k;if(h&&!this._jsonStencil.position){this._jsonStencil.position=h}this._view;this._properties=new Hash();if(!this._jsonStencil.type||!(this._jsonStencil.type==="edge"||this._jsonStencil.type==="node")){throw"ORYX.Core.StencilSet.Stencil(construct): Type is not defined."}if(!this._jsonStencil.id||this._jsonStencil.id===""){throw"ORYX.Core.StencilSet.Stencil(construct): Id is not defined."}if(!this._jsonStencil.title||this._jsonStencil.title===""){throw"ORYX.Core.StencilSet.Stencil(construct): Title is not defined."}if(!this._jsonStencil.description){this._jsonStencil.description=""}if(!this._jsonStencil.groups){this._jsonStencil.groups=[]}if(!this._jsonStencil.roles){this._jsonStencil.roles=[]}this._jsonStencil.roles.push(this._jsonStencil.id);this._jsonStencil.roles.each((function(n,m){this._jsonStencil.roles[m]=e+n}).bind(this));this._jsonStencil.roles=this._jsonStencil.roles.uniq();this._jsonStencil.id=e+this._jsonStencil.id;this.postProcessProperties();if(!this._jsonStencil.serialize){this._jsonStencil.serialize={}}if(!this._jsonStencil.deserialize){this._jsonStencil.deserialize={}}if(!this._jsonStencil.layout){this._jsonStencil.layout=[]}var c=a+"view/"+d.view;if(this._jsonStencil.view.trim().match(/)){var b=new DOMParser();var f=b.parseFromString(this._jsonStencil.view,"text/xml");if(ORYX.Editor.checkClassType(f.documentElement,SVGSVGElement)){this._view=f.documentElement;var g=this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg","image");$A(g).each((function(n){var m=n.getAttributeNodeNS("http://www.w3.org/1999/xlink","href");if(m&&m.value.indexOf("://")==-1){m.textContent=this._source+"view/"+m.value}}).bind(this))}else{throw"ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document."}}else{new Ajax.Request(c,{asynchronous:false,method:"get",onSuccess:this._loadSVGOnSuccess.bind(this),onFailure:this._loadSVGOnFailure.bind(this)})}},postProcessProperties:function(){if(this._jsonStencil.icon&&this._jsonStencil.icon.indexOf("://")===-1){this._jsonStencil.icon=this._source+"icons/"+this._jsonStencil.icon}else{this._jsonStencil.icon=""}if(this._jsonStencil.propertyPackages&&this._jsonStencil.propertyPackages instanceof Array){this._jsonStencil.propertyPackages.each((function(b){var a=this._propertyPackages[b];if(a){a.each((function(d){var c=new ORYX.Core.StencilSet.Property(d,this._namespace,this);this._properties[c.prefix()+"-"+c.id()]=c}).bind(this))}}).bind(this))}if(this._jsonStencil.properties&&this._jsonStencil.properties instanceof Array){this._jsonStencil.properties.each((function(b){var a=new ORYX.Core.StencilSet.Property(b,this._namespace,this);this._properties[a.prefix()+"-"+a.id()]=a}).bind(this))}},equals:function(a){return(this.id()===a.id())},stencilSet:function(){return this._stencilSet},type:function(){return this._jsonStencil.type},namespace:function(){return this._namespace},id:function(){return this._jsonStencil.id},idWithoutNs:function(){return this.id().replace(this.namespace(),"")},title:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonStencil,"title")},description:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonStencil,"description")},groups:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonStencil,"groups")},position:function(){return(isNaN(this._jsonStencil.position)?0:this._jsonStencil.position)},view:function(){return this._view.cloneNode(true)||this._view},icon:function(){return this._jsonStencil.icon},fixedAspectRatio:function(){return this._jsonStencil.fixedAspectRatio===true},hasMultipleRepositoryEntries:function(){return(this.getRepositoryEntries().length>0)},getRepositoryEntries:function(){return(this._jsonStencil.repositoryEntries)?$A(this._jsonStencil.repositoryEntries):$A([])},properties:function(){return this._properties.values()},property:function(a){return this._properties[a]},roles:function(){return this._jsonStencil.roles},defaultAlign:function(){if(!this._jsonStencil.defaultAlign){return"east"}return this._jsonStencil.defaultAlign},serialize:function(a,b){return this._jsonStencil.serialize},deserialize:function(a,b){return this._jsonStencil.deserialize},layout:function(a){return this._jsonStencil.layout},addProperty:function(c,b){if(c&&b){var a=new ORYX.Core.StencilSet.Property(c,b,this);this._properties[a.prefix()+"-"+a.id()]=a}},removeProperty:function(b){if(b){var a=this._properties.values().find(function(c){return(b==c.id())});if(a){delete this._properties[a.prefix()+"-"+a.id()]}}},_loadSVGOnSuccess:function(a){var b=null;b=a.responseXML;if(ORYX.Editor.checkClassType(b.documentElement,SVGSVGElement)){this._view=b.documentElement;var c=this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg","image");$A(c).each((function(e){var d=e.getAttributeNodeNS("http://www.w3.org/1999/xlink","href");if(d&&d.value.indexOf("://")==-1){d.textContent=this._source+"view/"+d.value}}).bind(this))}else{throw"ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document."}},_loadSVGOnFailure:function(a){throw"ORYX.Core.StencilSet.Stencil(_loadSVGOnFailure): Loading SVG document failed."},toString:function(){return"Stencil "+this.title()+" ("+this.id()+")"}};ORYX.Core.StencilSet.Stencil=Clazz.extend(ORYX.Core.StencilSet.Stencil);function _evenMoreEvilHack(c,e){if(window.ActiveXObject){var b=new ActiveXObject("MSXML.DomDocument");b.loadXML(c);return b}else{if(window.XMLHttpRequest){var a=new XMLHttpRequest;a.open("GET","data:"+(e||"application/xml")+";charset=utf-8,"+encodeURIComponent(c),false);if(a.overrideMimeType){a.overrideMimeType(e)}a.send(null);return a.responseXML}}}function _evilSafariHack(d){var b=d;var a="data:text/xml;charset=utf-8,"+encodeURIComponent(b);var e=null;var c=new XMLHttpRequest();c.open("GET",a);c.onload=function(){e=c.responseXML};c.send(null);return e}if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.Property=Clazz.extend({construct:function(d,b,c){arguments.callee.$.construct.apply(this,arguments);this._jsonProp=d||ORYX.Log.error("Parameter jsonProp is not defined.");this._namespace=b||ORYX.Log.error("Parameter namespace is not defined.");this._stencil=c||ORYX.Log.error("Parameter stencil is not defined.");this._items={};this._complexItems={};d.id=d.id||ORYX.Log.error("ORYX.Core.StencilSet.Property(construct): Id is not defined.");d.id=d.id.toLowerCase();if(!d.type){ORYX.Log.info("Type is not defined for stencil '%0', id '%1'. Falling back to 'String'.",c,d.id);d.type="string"}else{d.type=d.type.toLowerCase()}d.prefix=d.prefix||"oryx";d.title=d.title||"";d.value=d.value||"";d.description=d.description||"";d.readonly=d.readonly||false;d.optional=d.optional!==false;if(this._jsonProp.refToView){if(!(this._jsonProp.refToView instanceof Array)){this._jsonProp.refToView=[this._jsonProp.refToView]}}else{this._jsonProp.refToView=[]}var a=this.getMinForType(d.type);if(d.min===undefined||d.min===null){d.min=a}else{if(d.mine){d.min=e}}if(!d.fillOpacity){d.fillOpacity=false}if("number"!=typeof d.lightness){d.lightness=1}else{d.lightness=Math.max(0,Math.min(1,d.lightness))}if(!d.strokeOpacity){d.strokeOpacity=false}if(d.length===undefined||d.length===null){d.length=Number.MAX_VALUE}if(!d.wrapLines){d.wrapLines=false}if(!d.dateFormat){d.dateFormat=ORYX.I18N.PropertyWindow.dateFormat||"m/d/y"}if(!d.fill){d.fill=false}if(!d.stroke){d.stroke=false}if(!d.inverseBoolean){d.inverseBoolean=false}if(!d.directlyEditable&&d.directlyEditable!=false){d.directlyEditable=true}if(d.visible!==false){d.visible=true}if(d.isList!==true){d.isList=false;if(!d.list||!(d.list instanceof Array)){d.list=[]}}if(!d.category){if(d.popular){d.category="popular"}else{d.category="others"}}if(!d.alwaysAppearInMultiselect){d.alwaysAppearInMultiselect=false}if(d.type===ORYX.CONFIG.TYPE_CHOICE){if(d.items&&d.items instanceof Array){d.items.each((function(f){this._items[f.value.toLowerCase()]=new ORYX.Core.StencilSet.PropertyItem(f,b,this)}).bind(this))}else{throw"ORYX.Core.StencilSet.Property(construct): No property items defined."}}else{if(d.type===ORYX.CONFIG.TYPE_COMPLEX||d.type==ORYX.CONFIG.TYPE_MULTIPLECOMPLEX){if(d.complexItems&&d.complexItems instanceof Array){d.complexItems.each((function(f){this._complexItems[f.id.toLowerCase()]=new ORYX.Core.StencilSet.ComplexPropertyItem(f,b,this)}).bind(this))}else{throw"ORYX.Core.StencilSet.Property(construct): No complex property items defined."}}}},getMinForType:function(a){if(a.toLowerCase()==ORYX.CONFIG.TYPE_INTEGER){return -Math.pow(2,31)}else{return -Number.MAX_VALUE+1}},getMaxForType:function(a){if(a.toLowerCase()==ORYX.CONFIG.TYPE_INTEGER){return Math.pow(2,31)-1}else{return Number.MAX_VALUE}},equals:function(a){return(this._namespace===a.namespace()&&this.id()===a.id())?true:false},namespace:function(){return this._namespace},stencil:function(){return this._stencil},id:function(){return this._jsonProp.id},prefix:function(){return this._jsonProp.prefix},type:function(){return this._jsonProp.type},inverseBoolean:function(){return this._jsonProp.inverseBoolean},category:function(){return this._jsonProp.category},setCategory:function(a){this._jsonProp.category=a},directlyEditable:function(){return this._jsonProp.directlyEditable},visible:function(){return this._jsonProp.visible},title:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonProp,"title")},value:function(){return this._jsonProp.value},readonly:function(){return this._jsonProp.readonly},optional:function(){return this._jsonProp.optional},description:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonProp,"description")},refToView:function(){return this._jsonProp.refToView},min:function(){return this._jsonProp.min},max:function(){return this._jsonProp.max},fillOpacity:function(){return this._jsonProp.fillOpacity},strokeOpacity:function(){return this._jsonProp.strokeOpacity},length:function(){return this._jsonProp.length?this._jsonProp.length:Number.MAX_VALUE},wrapLines:function(){return this._jsonProp.wrapLines},dateFormat:function(){return this._jsonProp.dateFormat},fill:function(){return this._jsonProp.fill},lightness:function(){return this._jsonProp.lightness},stroke:function(){return this._jsonProp.stroke},items:function(){return $H(this._items).values()},item:function(a){if(a){return this._items[a.toLowerCase()]}else{return null}},toString:function(){return"Property "+this.title()+" ("+this.id()+")"},complexItems:function(){return $H(this._complexItems).values()},complexItem:function(a){if(a){return this._complexItems[a.toLowerCase()]}else{return null}},complexAttributeToView:function(){return this._jsonProp.complexAttributeToView||""},isList:function(){return !!this._jsonProp.isList},getListItems:function(){return this._jsonProp.list},linkableType:function(){return this._jsonProp.linkableType||""},alwaysAppearInMultiselect:function(){return this._jsonProp.alwaysAppearInMultiselect},popular:function(){return this._jsonProp.popular||false},setPopular:function(){this._jsonProp.popular=true}});if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.PropertyItem=Clazz.extend({construct:function(a,b,c){arguments.callee.$.construct.apply(this,arguments);if(!a){throw"ORYX.Core.StencilSet.PropertyItem(construct): Parameter jsonItem is not defined."}if(!b){throw"ORYX.Core.StencilSet.PropertyItem(construct): Parameter namespace is not defined."}if(!c){throw"ORYX.Core.StencilSet.PropertyItem(construct): Parameter property is not defined."}this._jsonItem=a;this._namespace=b;this._property=c;if(!a.value){throw"ORYX.Core.StencilSet.PropertyItem(construct): Value is not defined."}if(this._jsonItem.refToView){if(!(this._jsonItem.refToView instanceof Array)){this._jsonItem.refToView=[this._jsonItem.refToView]}}else{this._jsonItem.refToView=[]}},equals:function(a){return(this.property().equals(a.property())&&this.value()===a.value())},namespace:function(){return this._namespace},property:function(){return this._property},value:function(){return this._jsonItem.value},title:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonItem,"title")},refToView:function(){return this._jsonItem.refToView},icon:function(){return(this._jsonItem.icon)?this.property().stencil()._source+"icons/"+this._jsonItem.icon:""},toString:function(){return"PropertyItem "+this.property()+" ("+this.value()+")"}});if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.ComplexPropertyItem=Clazz.extend({construct:function(a,b,c){arguments.callee.$.construct.apply(this,arguments);if(!a){throw"ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter jsonItem is not defined."}if(!b){throw"ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter namespace is not defined."}if(!c){throw"ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter property is not defined."}this._jsonItem=a;this._namespace=b;this._property=c;this._items=new Hash();this._complexItems=new Hash();if(!a.name){throw"ORYX.Core.StencilSet.ComplexPropertyItem(construct): Name is not defined."}if(!a.type){throw"ORYX.Core.StencilSet.ComplexPropertyItem(construct): Type is not defined."}else{a.type=a.type.toLowerCase()}if(a.type===ORYX.CONFIG.TYPE_CHOICE){if(a.items&&a.items instanceof Array){a.items.each((function(d){this._items[d.value]=new ORYX.Core.StencilSet.PropertyItem(d,b,this)}).bind(this))}else{throw"ORYX.Core.StencilSet.Property(construct): No property items defined."}}else{if(a.type===ORYX.CONFIG.TYPE_COMPLEX){if(a.complexItems&&a.complexItems instanceof Array){a.complexItems.each((function(d){this._complexItems[d.id]=new ORYX.Core.StencilSet.ComplexPropertyItem(d,b,this)}).bind(this))}else{throw"ORYX.Core.StencilSet.Property(construct): No property items defined."}}}},equals:function(a){return(this.property().equals(a.property())&&this.name()===a.name())},namespace:function(){return this._namespace},property:function(){return this._property},name:function(){return ORYX.Core.StencilSet.getTranslation(this._jsonItem,"name")},id:function(){return this._jsonItem.id},type:function(){return this._jsonItem.type},optional:function(){return this._jsonItem.optional},width:function(){return this._jsonItem.width},value:function(){return this._jsonItem.value},items:function(){return this._items.values()},complexItems:function(){return this._complexItems.values()},disable:function(){return this._jsonItem.disable}});if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.Rules={construct:function(){arguments.callee.$.construct.apply(this,arguments);this._stencilSets=[];this._stencils=[];this._containerStencils=[];this._cachedConnectSET=new Hash();this._cachedConnectSE=new Hash();this._cachedConnectTE=new Hash();this._cachedCardSE=new Hash();this._cachedCardTE=new Hash();this._cachedContainPC=new Hash();this._cachedMorphRS=new Hash();this._connectionRules=new Hash();this._cardinalityRules=new Hash();this._containmentRules=new Hash();this._morphingRules=new Hash();this._layoutRules=new Hash()},initializeRules:function(l){var k=this._stencilSets.find(function(o){return(o.namespace()==l.namespace())});if(k){var f=this._stencilSets.clone();f=f.without(k);f.push(l);this._stencilSets=[];this._stencils=[];this._containerStencils=[];this._cachedConnectSET=new Hash();this._cachedConnectSE=new Hash();this._cachedConnectTE=new Hash();this._cachedCardSE=new Hash();this._cachedCardTE=new Hash();this._cachedContainPC=new Hash();this._cachedMorphRS=new Hash();this._connectionRules=new Hash();this._cardinalityRules=new Hash();this._containmentRules=new Hash();this._morphingRules=new Hash();this._layoutRules=new Hash();f.each(function(o){this.initializeRules(o)}.bind(this));return}else{this._stencilSets.push(l);var m=new Hash(l.jsonRules());var e=l.namespace();var b=l.stencils();l.extensions().values().each(function(o){if(o.rules){if(o.rules.connectionRules){m.connectionRules=m.connectionRules.concat(o.rules.connectionRules)}if(o.rules.cardinalityRules){m.cardinalityRules=m.cardinalityRules.concat(o.rules.cardinalityRules)}if(o.rules.containmentRules){m.containmentRules=m.containmentRules.concat(o.rules.containmentRules)}if(o.rules.morphingRules){m.morphingRules=m.morphingRules.concat(o.rules.morphingRules)}}if(o.stencils){b=b.concat(o.stencils)}});this._stencils=this._stencils.concat(l.stencils());var g=this._connectionRules;if(m.connectionRules){m.connectionRules.each((function(o){if(this._isRoleOfOtherNamespace(o.role)){if(!g[o.role]){g[o.role]=new Hash()}}else{if(!g[e+o.role]){g[e+o.role]=new Hash()}}o.connects.each((function(p){var s=[];if(p.to){if(!(p.to instanceof Array)){p.to=[p.to]}p.to.each((function(t){if(this._isRoleOfOtherNamespace(t)){s.push(t)}else{s.push(e+t)}}).bind(this))}var r,q;if(this._isRoleOfOtherNamespace(o.role)){r=o.role}else{r=e+o.role}if(this._isRoleOfOtherNamespace(p.from)){q=p.from}else{q=e+p.from}if(!g[r][q]){g[r][q]=s}else{g[r][q]=g[r][q].concat(s)}}).bind(this))}).bind(this))}var c=this._cardinalityRules;if(m.cardinalityRules){m.cardinalityRules.each((function(q){var o;if(this._isRoleOfOtherNamespace(q.role)){o=q.role}else{o=e+q.role}if(!c[o]){c[o]={};for(i in q){c[o][i]=q[i]}}var r=new Hash();if(q.outgoingEdges){q.outgoingEdges.each((function(s){if(this._isRoleOfOtherNamespace(s.role)){r[s.role]=s}else{r[e+s.role]=s}}).bind(this))}c[o].outgoingEdges=r;var p=new Hash();if(q.incomingEdges){q.incomingEdges.each((function(s){if(this._isRoleOfOtherNamespace(s.role)){p[s.role]=s}else{p[e+s.role]=s}}).bind(this))}c[o].incomingEdges=p}).bind(this))}var a=this._containmentRules;if(m.containmentRules){m.containmentRules.each((function(p){var o;if(this._isRoleOfOtherNamespace(p.role)){o=p.role}else{this._containerStencils.push(e+p.role);o=e+p.role}if(!a[o]){a[o]=[]}(p.contains||[]).each((function(q){if(this._isRoleOfOtherNamespace(q)){a[o].push(q)}else{a[o].push(e+q)}}).bind(this))}).bind(this))}var d=this._morphingRules;if(m.morphingRules){m.morphingRules.each((function(p){var o;if(this._isRoleOfOtherNamespace(p.role)){o=p.role}else{o=e+p.role}if(!d[o]){d[o]=[]}if(!p.preserveBounds){p.preserveBounds=false}p.baseMorphs.each((function(r){var q=this._getStencilById(e+r);if(q){d[o].push(q)}}).bind(this))}).bind(this))}var h=this._layoutRules;if(m.layoutRules){var n=function(p){return{edgeRole:p.edgeRole||undefined,t:p.t||1,r:p.r||1,b:p.b||1,l:p.l||1}};m.layoutRules.each(function(p){var o;if(this._isRoleOfOtherNamespace(p.role)){o=p.role}else{o=e+p.role}if(!h[o]){h[o]={}}if(p["in"]){h[o]["in"]=n(p["in"])}if(p.ins){h[o]["ins"]=(p.ins||[]).map(function(q){return n(q)})}if(p.out){h[o]["out"]=n(p.out)}if(p.outs){h[o]["outs"]=(p.outs||[]).map(function(q){return n(q)})}}.bind(this))}}},_getStencilById:function(a){return this._stencils.find(function(b){return b.id()==a})},_cacheConnect:function(a){result=this._canConnect(a);if(a.sourceStencil&&a.targetStencil){var c=this._cachedConnectSET[a.sourceStencil.id()];if(!c){c=new Hash();this._cachedConnectSET[a.sourceStencil.id()]=c}var b=c[a.edgeStencil.id()];if(!b){b=new Hash();c[a.edgeStencil.id()]=b}b[a.targetStencil.id()]=result}else{if(a.sourceStencil){var c=this._cachedConnectSE[a.sourceStencil.id()];if(!c){c=new Hash();this._cachedConnectSE[a.sourceStencil.id()]=c}c[a.edgeStencil.id()]=result}else{var d=this._cachedConnectTE[a.targetStencil.id()];if(!d){d=new Hash();this._cachedConnectTE[a.targetStencil.id()]=d}d[a.edgeStencil.id()]=result}}return result},_cacheCard:function(b){if(b.sourceStencil){var c=this._cachedCardSE[b.sourceStencil.id()];if(!c){c=new Hash();this._cachedCardSE[b.sourceStencil.id()]=c}var a=this._getMaximumNumberOfOutgoingEdge(b);if(a==undefined){a=-1}c[b.edgeStencil.id()]=a}if(b.targetStencil){var d=this._cachedCardTE[b.targetStencil.id()];if(!d){d=new Hash();this._cachedCardTE[b.targetStencil.id()]=d}var a=this._getMaximumNumberOfIncomingEdge(b);if(a==undefined){a=-1}d[b.edgeStencil.id()]=a}},_cacheContain:function(b){var a=[this._canContain(b),this._getMaximumOccurrence(b.containingStencil,b.containedStencil)];if(a[1]==undefined){a[1]=-1}var c=this._cachedContainPC[b.containingStencil.id()];if(!c){c=new Hash();this._cachedContainPC[b.containingStencil.id()]=c}c[b.containedStencil.id()]=a;return a},_cacheMorph:function(b){var a=this._cachedMorphRS[b];if(!a){a=[];if(this._morphingRules.keys().include(b)){a=this._stencils.select(function(c){return c.roles().include(b)})}this._cachedMorphRS[b]=a}return a},outgoingEdgeStencils:function(a){if(!a.sourceShape&&!a.sourceStencil){return[]}if(a.sourceShape){a.sourceStencil=a.sourceShape.getStencil()}var b=[];this._stencils.each((function(d){if(d.type()==="edge"){var c=Object.clone(a);c.edgeStencil=d;if(this.canConnect(c)){b.push(d)}}}).bind(this));return b},incomingEdgeStencils:function(a){if(!a.targetShape&&!a.targetStencil){return[]}if(a.targetShape){a.targetStencil=a.targetShape.getStencil()}var b=[];this._stencils.each((function(d){if(d.type()==="edge"){var c=Object.clone(a);c.edgeStencil=d;if(this.canConnect(c)){b.push(d)}}}).bind(this));return b},sourceStencils:function(b){if(!b||!b.edgeShape&&!b.edgeStencil){return[]}if(b.targetShape){b.targetStencil=b.targetShape.getStencil()}if(b.edgeShape){b.edgeStencil=b.edgeShape.getStencil()}var a=[];this._stencils.each((function(d){var c=Object.clone(b);c.sourceStencil=d;if(this.canConnect(c)){a.push(d)}}).bind(this));return a},targetStencils:function(a){if(!a||!a.edgeShape&&!a.edgeStencil){return[]}if(a.sourceShape){a.sourceStencil=a.sourceShape.getStencil()}if(a.edgeShape){a.edgeStencil=a.edgeShape.getStencil()}var b=[];this._stencils.each((function(d){var c=Object.clone(a);c.targetStencil=d;if(this.canConnect(c)){b.push(d)}}).bind(this));return b},canConnect:function(c){if(!c||(!c.sourceShape&&!c.sourceStencil&&!c.targetShape&&!c.targetStencil)||!c.edgeShape&&!c.edgeStencil){return false}if(c.sourceShape){c.sourceStencil=c.sourceShape.getStencil()}if(c.targetShape){c.targetStencil=c.targetShape.getStencil()}if(c.edgeShape){c.edgeStencil=c.edgeShape.getStencil()}var b;if(c.sourceStencil&&c.targetStencil){var e=this._cachedConnectSET[c.sourceStencil.id()];if(!e){b=this._cacheConnect(c)}else{var d=e[c.edgeStencil.id()];if(!d){b=this._cacheConnect(c)}else{var f=d[c.targetStencil.id()];if(f==undefined){b=this._cacheConnect(c)}else{b=f}}}}else{if(c.sourceStencil){var e=this._cachedConnectSE[c.sourceStencil.id()];if(!e){b=this._cacheConnect(c)}else{var d=e[c.edgeStencil.id()];if(d==undefined){b=this._cacheConnect(c)}else{b=d}}}else{var f=this._cachedConnectTE[c.targetStencil.id()];if(!f){b=this._cacheConnect(c)}else{var d=f[c.edgeStencil.id()];if(d==undefined){b=this._cacheConnect(c)}else{b=d}}}}if(b){if(c.sourceShape){var e=this._cachedCardSE[c.sourceStencil.id()];if(!e){this._cacheCard(c);e=this._cachedCardSE[c.sourceStencil.id()]}var a=e[c.edgeStencil.id()];if(a==undefined){this._cacheCard(c)}a=e[c.edgeStencil.id()];if(a!=-1){b=c.sourceShape.getOutgoingShapes().all(function(g){if((g.getStencil().id()===c.edgeStencil.id())&&((c.edgeShape)?g!==c.edgeShape:true)){a--;return(a>0)?true:false}else{return true}})}}if(c.targetShape){var f=this._cachedCardTE[c.targetStencil.id()];if(!f){this._cacheCard(c);f=this._cachedCardTE[c.targetStencil.id()]}var a=f[c.edgeStencil.id()];if(a==undefined){this._cacheCard(c)}a=f[c.edgeStencil.id()];if(a!=-1){b=c.targetShape.getIncomingShapes().all(function(g){if((g.getStencil().id()===c.edgeStencil.id())&&((c.edgeShape)?g!==c.edgeShape:true)){a--;return(a>0)?true:false}else{return true}})}}}return b},_canConnect:function(b){if(!b||(!b.sourceShape&&!b.sourceStencil&&!b.targetShape&&!b.targetStencil)||!b.edgeShape&&!b.edgeStencil){return false}if(b.sourceShape){b.sourceStencil=b.sourceShape.getStencil()}if(b.targetShape){b.targetStencil=b.targetShape.getStencil()}if(b.edgeShape){b.edgeStencil=b.edgeShape.getStencil()}var c;var a=this._getConnectionRulesOfEdgeStencil(b.edgeStencil);if(a.keys().length===0){c=false}else{if(b.sourceStencil){c=b.sourceStencil.roles().any(function(e){var d=a[e];if(!d){return false}if(b.targetStencil){return(d.any(function(f){return b.targetStencil.roles().member(f)}))}else{return true}})}else{c=a.values().any(function(d){return b.targetStencil.roles().any(function(e){return d.member(e)})})}}return c},isContainer:function(a){return this._containerStencils.member(a.getStencil().id())},canContain:function(c){if(!c||!c.containingStencil&&!c.containingShape||!c.containedStencil&&!c.containedShape){return false}if(c.containedShape){c.containedStencil=c.containedShape.getStencil()}if(c.containingShape){c.containingStencil=c.containingShape.getStencil()}if(c.containedStencil.type()=="edge"){return false}var b;var d=this._cachedContainPC[c.containingStencil.id()];if(!d){b=this._cacheContain(c)}else{b=d[c.containedStencil.id()];if(!b){b=this._cacheContain(c)}}if(!b[0]){return false}else{if(b[1]==-1){return true}else{if(c.containingShape){var a=b[1];return c.containingShape.getChildShapes(false).all(function(e){if(e.getStencil().id()===c.containedStencil.id()){a--;return(a>0)?true:false}else{return true}})}else{return true}}}},_canContain:function(b){if(!b||!b.containingStencil&&!b.containingShape||!b.containedStencil&&!b.containedShape){return false}if(b.containedShape){b.containedStencil=b.containedShape.getStencil()}if(b.containingShape){b.containingStencil=b.containingShape.getStencil()}var a;a=b.containingStencil.roles().any((function(d){var c=this._containmentRules[d];if(c){return c.any(function(e){return b.containedStencil.roles().member(e)})}else{return false}}).bind(this));return a},morphStencils:function(b){if(!b.stencil&&!b.shape){return[]}if(b.shape){b.stencil=b.shape.getStencil()}var a=[];b.stencil.roles().each(function(d){this._cacheMorph(d).each(function(e){a.push(e)})}.bind(this));var c=this.baseMorphs();a=a.uniq().sort(function(e,d){return c.include(e)&&!c.include(d)?-1:(c.include(d)&&!c.include(e)?1:0)});return a},baseMorphs:function(){var a=[];this._morphingRules.each(function(b){b.value.each(function(c){a.push(c)})});return a},containsMorphingRules:function(){return this._stencilSets.any(function(a){return !!a.jsonRules().morphingRules})},connectMorph:function(e){if(!e||(!e.sourceShape&&!e.sourceStencil&&!e.targetShape&&!e.targetStencil)){return false}if(e.sourceShape){e.sourceStencil=e.sourceShape.getStencil()}if(e.targetShape){e.targetStencil=e.targetShape.getStencil()}var a=this.incomingEdgeStencils(e);var d=this.outgoingEdgeStencils(e);var c=a.select(function(f){return d.member(f)});var b=this.baseMorphs().select(function(f){return c.member(f)});if(b.size()>0){return b[0]}else{if(c.size()>0){return c[0]}}return null},showInShapeMenu:function(a){return this._stencilSets.any(function(b){return b.jsonRules().morphingRules.any(function(c){return a.roles().include(b.namespace()+c.role)&&c.showInShapeMenu!==false})})},preserveBounds:function(a){return this._stencilSets.any(function(b){return b.jsonRules().morphingRules.any(function(c){return a.roles().include(b.namespace()+c.role)&&c.preserveBounds})})},getLayoutingRules:function(b,d){if(!b||!(b instanceof ORYX.Core.Shape)){return}var c={"in":{},out:{}};var a=function(f,e){if(f&&f[e]){["t","r","b","l"].each(function(g){c[e][g]=Math.max(f[e][g],c[e][g]||0)})}if(f&&f[e+"s"] instanceof Array){["t","r","b","l"].each(function(k){var g=f[e+"s"].find(function(l){return !l.edgeRole});var h;if(d instanceof ORYX.Core.Edge){h=f[e+"s"].find(function(l){return this._hasRole(d,l.edgeRole)}.bind(this))}c[e][k]=Math.max(h?h[k]:g[k],c[e][k]||0)}.bind(this))}}.bind(this);b.getStencil().roles().each(function(e){if(this._layoutRules[e]){a(this._layoutRules[e],"in");a(this._layoutRules[e],"out")}}.bind(this));["in","out"].each(function(e){["t","r","b","l"].each(function(f){c[e][f]=c[e][f]!==undefined?c[e][f]:1})});return c},_hasRole:function(b,c){if(!(b instanceof ORYX.Core.Shape)||!c){return}var a=b.getStencil().roles().any(function(d){return d==c});return a||b.getStencil().id()==(b.getStencil().namespace()+c)},_stencilsWithRole:function(a){return this._stencils.findAll(function(b){return(b.roles().member(a))?true:false})},_edgesWithRole:function(a){return this._stencils.findAll(function(b){return(b.roles().member(a)&&b.type()==="edge")?true:false})},_nodesWithRole:function(a){return this._stencils.findAll(function(b){return(b.roles().member(a)&&b.type()==="node")?true:false})},_getMaximumOccurrence:function(b,c){var a;c.roles().each((function(e){var d=this._cardinalityRules[e];if(d&&d.maximumOccurrence){if(a){a=Math.min(a,d.maximumOccurrence)}else{a=d.maximumOccurrence}}}).bind(this));return a},_getMaximumNumberOfOutgoingEdge:function(b){if(!b||!b.sourceStencil||!b.edgeStencil){return false}var a;b.sourceStencil.roles().each((function(d){var c=this._cardinalityRules[d];if(c&&c.outgoingEdges){b.edgeStencil.roles().each(function(e){var f=c.outgoingEdges[e];if(f&&f.maximum){if(a){a=Math.min(a,f.maximum)}else{a=f.maximum}}})}}).bind(this));return a},_getMaximumNumberOfIncomingEdge:function(b){if(!b||!b.targetStencil||!b.edgeStencil){return false}var a;b.targetStencil.roles().each((function(d){var c=this._cardinalityRules[d];if(c&&c.incomingEdges){b.edgeStencil.roles().each(function(e){var f=c.incomingEdges[e];if(f&&f.maximum){if(a){a=Math.min(a,f.maximum)}else{a=f.maximum}}})}}).bind(this));return a},_getConnectionRulesOfEdgeStencil:function(b){var a=new Hash();b.roles().each((function(c){if(this._connectionRules[c]){this._connectionRules[c].each(function(d){if(a[d.key]){a[d.key]=a[d.key].concat(d.value)}else{a[d.key]=d.value}})}}).bind(this));return a},_isRoleOfOtherNamespace:function(a){return(a.indexOf("#")>0)},toString:function(){return"Rules"}};ORYX.Core.StencilSet.Rules=Clazz.extend(ORYX.Core.StencilSet.Rules);if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}if(!ORYX.Core.StencilSet){ORYX.Core.StencilSet={}}ORYX.Core.StencilSet.StencilSet=Clazz.extend({construct:function(a){arguments.callee.$.construct.apply(this,arguments);if(!a){throw"ORYX.Core.StencilSet.StencilSet(construct): Parameter 'source' is not defined."}if(a.endsWith("/")){a=a.substr(0,a.length-1)}this._extensions=new Hash();this._source=a;this._baseUrl=a.substring(0,a.lastIndexOf("/")+1);this._jsonObject={};this._stencils=new Hash();this._availableStencils=new Hash();if(ORYX.CONFIG.BACKEND_SWITCH){this._baseUrl="../editor/stencilsets/bpmn2.0/";this._source="../stencilsets/bpmn2.0/bpmn2.0.json";new Ajax.Request("../service/editor/stencilset",{asynchronous:false,method:"get",onSuccess:this._init.bind(this),onFailure:this._cancelInit.bind(this)})}else{new Ajax.Request(a,{asynchronous:false,method:"get",onSuccess:this._init.bind(this),onFailure:this._cancelInit.bind(this)})}if(this.errornous){throw"Loading stencil set "+a+" failed."}},findRootStencilName:function(){var a=this._stencils.values().find(function(b){return b._jsonStencil.mayBeRoot});if(!a){ORYX.Log.warn("Did not find any stencil that may be root. Taking a guess.");a=this._stencils.values()[0]}return a.id()},equals:function(a){return(this.namespace()===a.namespace())},stencils:function(k,l,h){if(k&&l){var a=this._availableStencils.values();var e=[k];var d=[];var m=[];while(e.size()>0){var b=e.pop();d.push(b);var c=a.findAll(function(o){var n={containingStencil:b,containedStencil:o};return l.canContain(n)});for(var g=0;g=c.x-e&&f<=b.x+e&&d>=c.y-e&&d<=b.y+e){return true}else{return false}},clone:function(){return new ORYX.Core.Bounds(this)},toString:function(){return"( "+this.a.x+" | "+this.a.y+" )/( "+this.b.x+" | "+this.b.y+" )"},serializeForERDF:function(){return this.a.x+","+this.a.y+","+this.b.x+","+this.b.y}};ORYX.Core.Bounds=Clazz.extend(ORYX.Core.Bounds);if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}ORYX.Core.UIObject={construct:function(a){this.isChanged=true;this.isResized=true;this.isVisible=true;this.isSelectable=false;this.isResizable=false;this.isMovable=false;this.id=ORYX.Editor.provideId();this.parent=undefined;this.node=undefined;this.children=[];this.bounds=new ORYX.Core.Bounds();this._changedCallback=this._changed.bind(this);this.bounds.registerCallback(this._changedCallback);if(a&&a.eventHandlerCallback){this.eventHandlerCallback=a.eventHandlerCallback}},_changed:function(b,a){this.isChanged=true;if(this.bounds==b){this.isResized=a||this.isResized}},update:function(){if(this.isChanged){this.refresh();this.isChanged=false;this.children.each(function(a){a.update()})}},refresh:function(){},getChildren:function(){return this.children.clone()},getParents:function(){var a=[];var b=this.parent;while(b){a.push(b);b=b.parent}return a},isParent:function(a){var b=this;while(b){if(b===a){return true}b=b.parent}return false},getId:function(){return this.id},getChildById:function(b,a){return this.children.find(function(c){if(c.getId()===b){return c}else{if(a){var d=c.getChildById(b,a);if(d){return d}}}})},add:function(a){if(!(this.children.member(a))){if(a.parent){a.remove(a)}this.children.push(a);a.parent=this;a.node=this.node.appendChild(a.node);a.bounds.registerCallback(this._changedCallback)}else{ORYX.Log.info("add: ORYX.Core.UIObject is already a child of this object.")}},remove:function(a){if(this.children.member(a)){this.children=this._uiObjects.without(a);a.parent=undefined;a.node=this.node.removeChild(a.node);a.bounds.unregisterCallback(this._changedCallback)}else{ORYX.Log.info("remove: ORYX.Core.UIObject is not a child of this object.")}},absoluteBounds:function(){if(this.parent){var a=this.absoluteXY();return new ORYX.Core.Bounds(a.x,a.y,a.x+this.bounds.width(),a.y+this.bounds.height())}else{return this.bounds.clone()}},absoluteXY:function(){if(this.parent){var a=this.parent.absoluteXY();return{x:a.x+this.bounds.upperLeft().x,y:a.y+this.bounds.upperLeft().y}}else{return{x:this.bounds.upperLeft().x,y:this.bounds.upperLeft().y}}},absoluteCenterXY:function(){if(this.parent){var a=this.parent.absoluteXY();return{x:a.x+this.bounds.center().x,y:a.y+this.bounds.center().y}}else{return{x:this.bounds.center().x,y:this.bounds.center().y}}},hide:function(){this.node.setAttributeNS(null,"display","none");this.isVisible=false;this.children.each(function(a){a.hide()})},show:function(){this.node.setAttributeNS(null,"display","inherit");this.isVisible=true;this.children.each(function(a){a.show()})},addEventHandlers:function(a){a.addEventListener(ORYX.CONFIG.EVENT_MOUSEDOWN,this._delegateEvent.bind(this),false);a.addEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE,this._delegateEvent.bind(this),false);a.addEventListener(ORYX.CONFIG.EVENT_MOUSEUP,this._delegateEvent.bind(this),false);a.addEventListener(ORYX.CONFIG.EVENT_MOUSEOVER,this._delegateEvent.bind(this),false);a.addEventListener(ORYX.CONFIG.EVENT_MOUSEOUT,this._delegateEvent.bind(this),false);a.addEventListener("click",this._delegateEvent.bind(this),false);a.addEventListener(ORYX.CONFIG.EVENT_DBLCLICK,this._delegateEvent.bind(this),false)},_delegateEvent:function(a){if(this.eventHandlerCallback){this.eventHandlerCallback(a,this)}},toString:function(){return"UIObject "+this.id}};ORYX.Core.UIObject=Clazz.extend(ORYX.Core.UIObject);if(!ORYX){var ORYX={}}if(!ORYX.Core){ORYX.Core={}}ORYX.Core.AbstractShape=ORYX.Core.UIObject.extend({construct:function(a,b){arguments.callee.$.construct.apply(this,arguments);this.resourceId=ORYX.Editor.provideId();this._stencil=b;if(this._stencil._jsonStencil.superId){stencilId=this._stencil.id();superStencilId=stencilId.substring(0,stencilId.indexOf("#")+1)+b._jsonStencil.superId;stencilSet=this._stencil.stencilSet();this._stencil=stencilSet.stencil(superStencilId)}this.properties=new Hash();this.propertiesChanged=new Hash();this.hiddenProperties=new Hash();this._stencil.properties().each((function(d){var c=d.prefix()+"-"+d.id();this.properties[c]=d.value();this.propertiesChanged[c]=true}).bind(this));if(b._jsonStencil.superId){b.properties().each((function(f){var d=f.prefix()+"-"+f.id();var e=f.value();var c=this.properties[d];this.properties[d]=e;this.propertiesChanged[d]=true;this._delegateEvent({type:ORYX.CONFIG.EVENT_PROPERTY_CHANGED,name:d,value:e,oldValue:c})}).bind(this))}},layout:function(){},getStencil:function(){return this._stencil},getChildShapeByResourceId:function(a){a=ERDF.__stripHashes(a);return this.getChildShapes(true).find(function(b){return b.resourceId==a})},getChildShapes:function(b,c){var a=[];this.children.each(function(d){if(d instanceof ORYX.Core.Shape&&d.isVisible){if(c){c(d)}a.push(d);if(b){a=a.concat(d.getChildShapes(b,c))}}});return a},hasChildShape:function(a){return this.getChildShapes().any(function(b){return(b===a)||b.hasChildShape(a)})},getChildNodes:function(b,c){var a=[];this.children.each(function(d){if(d instanceof ORYX.Core.Node&&d.isVisible){if(c){c(d)}a.push(d)}if(d instanceof ORYX.Core.Shape){if(b){a=a.concat(d.getChildNodes(b,c))}}});return a},getChildEdges:function(b,c){var a=[];this.children.each(function(d){if(d instanceof ORYX.Core.Edge&&d.isVisible){if(c){c(d)}a.push(d)}if(d instanceof ORYX.Core.Shape){if(b){a=a.concat(d.getChildEdges(b,c))}}});return a},getAbstractShapesAtPosition:function(){var b,e;switch(arguments.length){case 1:b=arguments[0].x;e=arguments[0].y;break;case 2:b=arguments[0];e=arguments[1];break;default:throw"getAbstractShapesAtPosition needs 1 or 2 arguments!"}if(this.isPointIncluded(b,e)){var a=[];a.push(this);var d=this.getChildNodes();var c=this.getChildEdges();[d,c].each(function(f){var g=new Hash();f.each(function(h){if(!h.isVisible){return}var l=h.getAbstractShapesAtPosition(b,e);if(l.length>0){var k=$A(h.node.parentNode.childNodes);var m=k.indexOf(h.node);g[m]=l}});g.keys().sort().each(function(h){a=a.concat(g[h])})});return a}else{return[]}},setProperty:function(b,d,c){var a=this.properties[b];if(a!==d||c===true){this.properties[b]=d;this.propertiesChanged[b]=true;this._changed();if(!this._isInSetProperty){this._isInSetProperty=true;this._delegateEvent({type:ORYX.CONFIG.EVENT_PROPERTY_CHANGED,elements:[this],name:b,value:d,oldValue:a});delete this._isInSetProperty}}},isPropertyChanged:function(){return this.propertiesChanged.any(function(a){return a.value})},setHiddenProperty:function(b,c){if(c===undefined){delete this.hiddenProperties[b];return}var a=this.hiddenProperties[b];if(a!==c){this.hiddenProperties[b]=c}},isPointIncluded:function(d,c,b){var a=b?b:this.absoluteBounds();return a.isIncluded(d,c)},serialize:function(){var a=[];a.push({name:"type",prefix:"oryx",value:this.getStencil().id(),type:"literal"});this.hiddenProperties.each(function(b){a.push({name:b.key.replace("oryx-",""),prefix:"oryx",value:b.value,type:"literal"})}.bind(this));this.getStencil().properties().each((function(d){var c=d.prefix();var b=d.id();a.push({name:b,prefix:c,value:this.properties[c+"-"+b],type:"literal"})}).bind(this));return a},deserialize:function(b){var a=0;b=b.sort(function(d,c){d=Number(this.properties.keys().member(d.prefix+"-"+d.name));c=Number(this.properties.keys().member(c.prefix+"-"+c.name));return d>c?1:(d