From 7077fa86bfaa7ffbecea7e36a4aad21970a178fe Mon Sep 17 00:00:00 2001 From: Jonathan Mak Date: Fri, 16 May 2014 18:53:36 -0700 Subject: [PATCH] AUI-1326 - Build --- build/aui-diagram-builder/aui-diagram-builder-debug.js | 3 ++- build/aui-diagram-builder/aui-diagram-builder-impl-debug.js | 3 ++- build/aui-diagram-builder/aui-diagram-builder-impl-min.js | 2 +- build/aui-diagram-builder/aui-diagram-builder-impl.js | 3 ++- build/aui-diagram-builder/aui-diagram-builder-min.js | 2 +- build/aui-diagram-builder/aui-diagram-builder.js | 3 ++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build/aui-diagram-builder/aui-diagram-builder-debug.js b/build/aui-diagram-builder/aui-diagram-builder-debug.js index 889efa5559e..4c035e74a92 100644 --- a/build/aui-diagram-builder/aui-diagram-builder-debug.js +++ b/build/aui-diagram-builder/aui-diagram-builder-debug.js @@ -1583,9 +1583,10 @@ var DiagramBuilder = A.Component.create({ _renderGraphic: function() { var instance = this; + var canvas = instance.get(CANVAS); var graphic = instance.get(GRAPHIC); - graphic.render(instance.get(CANVAS)); + graphic.render(canvas); A.one(canvas).on(MOUSEDOWN, A.bind(instance._onCanvasMouseDown, instance)); }, diff --git a/build/aui-diagram-builder/aui-diagram-builder-impl-debug.js b/build/aui-diagram-builder/aui-diagram-builder-impl-debug.js index 69a694e43af..65b30f01979 100644 --- a/build/aui-diagram-builder/aui-diagram-builder-impl-debug.js +++ b/build/aui-diagram-builder/aui-diagram-builder-impl-debug.js @@ -785,9 +785,10 @@ var DiagramBuilder = A.Component.create({ _renderGraphic: function() { var instance = this; + var canvas = instance.get(CANVAS); var graphic = instance.get(GRAPHIC); - graphic.render(instance.get(CANVAS)); + graphic.render(canvas); A.one(canvas).on(MOUSEDOWN, A.bind(instance._onCanvasMouseDown, instance)); }, diff --git a/build/aui-diagram-builder/aui-diagram-builder-impl-min.js b/build/aui-diagram-builder/aui-diagram-builder-impl-min.js index 7099ba9210b..7600cd15161 100644 --- a/build/aui-diagram-builder/aui-diagram-builder-impl-min.js +++ b/build/aui-diagram-builder/aui-diagram-builder-impl-min.js @@ -1,5 +1,5 @@ AUI.add("aui-diagram-builder-impl",function(aD){var at=aD.Lang,d=at.isArray,a2=at.isBoolean,O=at.isObject,a6=at.isString,ay=aD.WidgetStdMod,bg=aD.Array,aq="activeElement",ac="availableField",af="availableFields",F="backspace",an="boolean",z="boundary",t="boundingBox",bc="builder",ax="cancel",az="canvas",aS="click",a7="closeEvent",L="closeMessage",a9="condition",T="connector",m="connectors",aB="content",W="controls",aP="controlsToolbar",U="createDocumentFragment",aN="data",ah="delete",aL="deleteConnectorsMessage",r="deleteNodesMessage",aV="description",M="diagram",aA="diagram-builder",aH="diagramNode",ba="diagram-node-manager",H="diagram-node",aZ="dragNode",ae="dragging",I="editEvent",R="editMessage",X="editing",aU="end",a="esc",a1="field",u="fields",aF="fieldsDragConfig",aC="fork",al="graphic",a0="height",aJ="highlightBoundaryStroke",S="highlightDropZones",c="highlighted",aR="id",w="join",Z="keydown",aE="label",C="lock",ao="mousedown",v="mouseenter",ap="mouseleave",q="name",s="node",aK="p1",aI="p2",f="parentNode",o="pencil",aO="radius",av="records",n="recordset",k="region",bd="rendered",Q="required",a5="selected",aY="shape",ag="shapeBoundary",j="shapeInvite",P="showSuggestConnector",Y="source",aM="start",am="state",y="stroke",aX="suggest",aQ="suggestConnectorOverlay",l="target",K="task",p="transition",ab="transitions",g="type",au="visible",V="width",E="xy",D="zIndex",bf="-",i=".",aa="",h="#",N="_",B=aD.getClassName,x=B(M,bc,W),a4=B(M,bc,a1),ar=B(M,s),b=B(M,s,aB),aT=B(M,s,X),ad=B(M,s,aE),be=B(M,s,a5),aW=B(M,s,aY,z),e=B(M,s,aX,T),aw=function(bj,A){var bi=d(bj)?bj:bj.get(t).getXY();return[bi[0]+A[0],bi[1]+A[1]];},bb=function(bk,bj){var bi=bj[0]-bk[0],A=bj[1]-bk[1];return Math.sqrt(bi*bi+A*A);},ak=function(bs,bq){var bo=bs.hotPoints,bn=bq.hotPoints,bv=bs.get(t).getXY(),bt=bq.get(t).getXY(),bk,bi,bl,bj,bu=Infinity,bm=[[0,0],[0,0]];for(bl=0,bk=bo.length;bl{label}',boundary:null,hotPoints:[[0,0]],CONTROLS_TEMPLATE:'
',SERIALIZABLE_ATTRS:[aV,q,Q,g,V,a0,D,E],initializer:function(){var A=this;A.after({"dataset:remove":aD.bind(A._afterDataSetRemove,A),render:A._afterRender});A.on({nameChange:A._onNameChange});A.publish({connectDrop:{defaultFn:A.connectDrop},connectEnd:{defaultFn:A.connectEnd},connectMove:{defaultFn:A.connectMove},connectOutTarget:{defaultFn:A.connectOutTarget},connectOverTarget:{defaultFn:A.connectOverTarget},connectStart:{defaultFn:A.connectStart},boundaryMouseEnter:{},boundaryMouseLeave:{}});A.get(t).addClass(ar+bf+A.get(g));},destructor:function(){var A=this;A.eachConnector(function(bi,bj,bk){bk.removeTransition(bi.get(p));});A.invite.destroy();A.get(al).destroy();A.get(bc).removeField(A);},addTransition:function(bj){var A=this;var bi=A.get(ab);bj=A.prepareTransition(bj);if(!bi.containsKey(bj.uid)){bj.uid=aD.guid();bi.add(bj.uid,bj);}return bj;},alignTransition:function(bj){var A=this;var bk=aD.DiagramNode.getNodeByName(bj.target);if(bk){var bi=ak(A,bk);bj=aD.merge(bj,{sourceXY:bi[0],targetXY:bi[1]});A.getConnector(bj).setAttrs({p1:aw(A,bj.sourceXY),p2:aw(bk,bj.targetXY)});}},alignTransitions:function(){var A=this;A.get(ab).each(aD.bind(A.alignTransition,A));},close:function(){var A=this;return A.destroy();},connect:function(bm,bk){var A=this;bm=A.addTransition(bm);var bi=null;var bn=aD.DiagramNode.getNodeByName(bm.target);if(bn){if(!A.isTransitionConnected(bm)){var bj=A.get(bc);var bl=ak(A,bn);aD.mix(bm,{sourceXY:bl[0],targetXY:bl[1]});bi=new aD.Connector(aD.merge({builder:bj,graphic:bj.get(al),transition:bm},bk));A.get(m).add(bm.uid,bi);}}A.alignTransition(bm);return bi;},connectDrop:function(bi){var A=this;A.connectNode(bi.publishedTarget);},connectEnd:function(bl){var A=this;var bk=bl.target;var bi=A.get(bc);var bj=bi.publishedSource;if(!bi.isAbleToConnect()&&bi.get(P)&&bi.connector.get(au)){bi.showSuggestConnetorOverlay();}else{bi.connector.hide();bj.invite.set(au,false);}if(bi.get(S)){bi.get(u).each(function(bm){bm.set(c,false);});}},connectMove:function(bk){var A=this;var bj=A.get(bc);var bl=bk.mouseXY;bj.connector.set(aI,bl);if(bj.publishedTarget){var bi=A.invite;var bm=bi.get(aO)||0;if(!bi.get(au)){bi.set(au,true);}bi.setXY([bl[0]-bm,bl[1]-bm]);}},connectNode:function(bj){var bi=this;var A=bi.boundaryDragDelegate.dd;bi.connect(bi.prepareTransition({sourceXY:aG(A.startXY,bi.get(t)),target:bj.get(q),targetXY:aG(A.mouseXY,bj.get(t))}));},connectOutTarget:function(bj){var A=this;var bi=A.get(bc);bi.publishedTarget=null;bi.publishedSource.invite.set(au,false);},connectOverTarget:function(bj){var A=this;var bi=A.get(bc);if(bi.publishedSource!==A){bi.publishedTarget=A;}},connectStart:function(bk){var A=this;var bi=A.get(bc);var bj=bi.get(az);bi.connector.show().set(aK,bk.startXY);if(bi.get(S)){bi.get(u).each(function(bl){bl.set(c,true);});}aD.DiagramNodeManager.fire("publishedSource",{publishedSource:A});},disconnect:function(bi){var A=this;if(A.isTransitionConnected(bi)){A.removeTransition(bi);}},eachConnector:function(bk){var A=this;var bl=[],bi=[].concat(A.get(m).values),bj=bi.length;bg.each(A.get(bc).getSourceNodes(A),function(bm){bm.get(m).each(function(bn){if(A.get(q)===bn.get(p).target){bl.push(bm);bi.push(bn);}});});bg.each(bi,function(bm,bn){bk.call(A,bm,bn,(bn'+''+'
'+"",initializer:function(){var A=this;var aM=A.get(u);A.after({draggableChange:A._afterDraggableChange,idChange:A._afterIdChange,labelChange:A._afterLabelChange});A.labelNode=aM.one(i+ae);A._uiSetDraggable(A.get(r));A._uiSetId(A.get(ar));A._uiSetLabel(A.get(am));},_afterDraggableChange:function(aM){var A=this;A._uiSetDraggable(aM.newVal);},_afterIdChange:function(aM){var A=this;A._uiSetId(aM.newVal);},_afterLabelChange:function(aM){var A=this;A._uiSetLabel(aM.newVal);},_setId:function(A){return ai.AvailableField.buildNodeId(A);},_uiSetDraggable:function(aM){var A=this;A.get(u).toggleClass(l,aM);},_uiSetId:function(aM){var A=this;A.get(u).set(ar,aM);},_uiSetLabel:function(aM){var A=this;A.get(u).attr(an,aM);A.labelNode.setContent(aM);}}});ai.AvailableField=k;var W=function(){};W.ATTRS={fields:{value:[],setter:"_setFields",validator:function(A){return d(A)||M(A);}},maxFields:{value:Infinity,validator:O}};ai.mix(W.prototype,{_setFields:function(aM){var A=this;if(M(aM)){return aM;}else{return A.createFields(aM);}},_updateFields:function(aM){var A=this;A.set(w,aM);},addField:function(aN,aM){var A=this;if(A.get(w).size()',DROP_CONTAINER_TEMPLATE:'
',TOOLBAR_CONTAINER_TEMPLATE:'
',FIELDS_CONTAINER_TEMPLATE:'
    ',CANVAS_TEMPLATE:'
    ',fieldsNode:null,propertyList:null,settingsNode:null,tabView:null,toolbar:null,initializer:function(){var A=this;A.publish({cancel:{defaultFn:A._defCancelFn}});A.after({render:A._afterRender,"recordset:update":A._afterRecordsetUpdate});A.after(A._afterUiSetHeight,A,"_uiSetHeight");A.canvas=A.get(af);A.contentContainer=A.get(e);A.dropContainer=A.get(ab);A.fieldsContainer=A.get(q);A.toolbarContainer=A.get(m);},isAvailableFieldsDrag:function(aN){var A=this;var aM=A.availableFieldsDrag;return(aN===aM.dd);},plotFields:function(){var aM=this;var A=aM.get(w);A.each(function(aN){aM.plotField(aN);});},renderUI:function(){var A=this;A._renderTabs();A._renderCanvas();A._uiSetAvailableFields(A.get(T));},syncUI:function(){var A=this;var aM=A.get(y);A._setupDrop();A._setupAvailableFieldsDrag();aM.addClass(J);},_afterActiveTabChange:function(aN){var A=this;var aM=aN.newVal.get(S);if(A.get(aF)&&(aM===A.settingsNode)){A._renderSettings(); }},_afterRecordsetUpdate:function(aM){var A=this;A._handleSaveEvent();},_afterRender:function(aM){var A=this;A.plotFields();},_afterUiSetHeight:function(aM){var A=this;A.contentContainer.setStyle(aw,O(aM)?aM+A.DEF_UNIT:aM);A.dropContainer.setStyle(aw,O(aM)?aM+A.DEF_UNIT:aM);},_defCancelFn:function(aM){var A=this;A.tabView.selectTab(0);},_handleCancelEvent:function(){var A=this;A.fire(ac);},_handleSaveEvent:function(){var A=this;A.fire(au);},_renderCanvas:function(){var A=this;var aM=A.get(y);var aN=A.canvas;var aO=A.contentContainer;var aP=A.dropContainer;if(!aN.inDoc()){aO.appendChild(aN);}if(!aP.inDoc()){aN.appendChild(aP);}if(aO.inDoc()){aO.get(g).append(aO);}else{aM.appendChild(aO);}},_renderPropertyList:function(){var A=this;if(!A.propertyList){A.propertyList=new ai.PropertyList(A.get(ah)).render(A.settingsNode);A.propertyList.get(v).unselectable();}},_renderSettings:function(){var A=this;A._renderPropertyList();A._renderToolbar();},_renderTabs:function(){var A=this;if(!A.tabView){var aM=new ai.TabView(A.get(K));aM.get(v);A.tabView=aM;A.fieldsNode=aM.getTab(0).get(S);A.settingsNode=aM.getTab(1).get(S);}},_renderToolbar:function(){var A=this;if(!A.toolbar){A.toolbar=new ai.Toolbar(A.get(N)).render(A.settingsNode);}},_setupDrop:function(){var A=this;A.drop=new ai.DD.Drop(A.get(at));},_setupAvailableFieldsDrag:function(){var A=this;A.availableFieldsDrag=new ai.DD.Delegate(A.get(aH));},_setAvailableFields:function(aN){var aM=this;var A=[];aL.each(aN,function(aP,aO){A.push(H(aP)?aP:new ai.AvailableField(aP));});return A;},_setDropConfig:function(aM){var A=this;return ai.merge({bubbleTargets:A,groups:[T],node:A.dropContainer},aM||{});},_setAvailableFieldsDragConfig:function(aM){var A=this;return ai.merge({bubbleTargets:A,container:A.get(v),dragConfig:{groups:[T],plugins:[{cfg:{moveOnEnd:false},fn:ai.Plugin.DDProxy}]},nodes:i+l},aM||{});},_setPropertyList:function(aM){var A=this;return ai.merge({bubbleTargets:A,width:250,scroll:{height:400,width:aK}},aM);},_setTabView:function(aP){var aM=this;var aO=aM.get(v);var aQ=aO.one(i+aI);var aN={after:{activeTabChange:ai.bind(aM._afterActiveTabChange,aM)},boundingBox:aO.one(i+av),contentBox:aO.one(i+U),bubbleTargets:aM,contentNode:aO.one(i+aD),cssClass:av,listNode:aQ,render:aM.get(y)};if(!aQ){var A=aM.getStrings();aN.items=[{cssClass:ak,label:A[o]},{cssClass:L,label:A[t]}];}return ai.merge(aN,aP);},_setToolbar:function(aN){var aM=this;var A=aM.getStrings();return ai.merge({activeState:false,bubbleTargets:aM,children:[{handler:ai.bind(aM._handleCancelEvent,aM),label:A[ac]}]},aN);},_uiSetAvailableFields:function(aO){var A=this;var aN=A.fieldsNode;if(aN){var aM=ai.getDoc().invoke(I);aL.each(aO,function(aP){aM.appendChild(aP.get(u));});aN.setContent(A.fieldsContainer.setContent(aM));}},_uiSetFields:function(aM){var A=this;if(A.get(aF)){A.plotFields();}}}});ai.DiagramBuilderBase=aB;},"@VERSION@",{requires:["aui-tabs","aui-property-list","collection","dd"],skinnable:true});AUI.add("aui-diagram-builder-impl",function(aD){var at=aD.Lang,d=at.isArray,a2=at.isBoolean,O=at.isObject,a6=at.isString,ay=aD.WidgetStdMod,bg=aD.Array,aq="activeElement",ac="availableField",af="availableFields",F="backspace",an="boolean",z="boundary",t="boundingBox",bc="builder",ax="cancel",az="canvas",aS="click",a7="closeEvent",L="closeMessage",a9="condition",T="connector",m="connectors",aB="content",W="controls",aP="controlsToolbar",U="createDocumentFragment",aN="data",ah="delete",aL="deleteConnectorsMessage",r="deleteNodesMessage",aV="description",M="diagram",aA="diagram-builder",aH="diagramNode",ba="diagram-node-manager",H="diagram-node",aZ="dragNode",ae="dragging",I="editEvent",R="editMessage",X="editing",aU="end",a="esc",a1="field",u="fields",aF="fieldsDragConfig",aC="fork",al="graphic",a0="height",aJ="highlightBoundaryStroke",S="highlightDropZones",c="highlighted",aR="id",w="join",Z="keydown",aE="label",C="lock",ao="mousedown",v="mouseenter",ap="mouseleave",q="name",s="node",aK="p1",aI="p2",f="parentNode",o="pencil",aO="radius",av="records",n="recordset",k="region",bd="rendered",Q="required",a5="selected",aY="shape",ag="shapeBoundary",j="shapeInvite",P="showSuggestConnector",Y="source",aM="start",am="state",y="stroke",aX="suggest",aQ="suggestConnectorOverlay",l="target",K="task",p="transition",ab="transitions",g="type",au="visible",V="width",E="xy",D="zIndex",bf="-",i=".",aa="",h="#",N="_",B=aD.getClassName,x=B(M,bc,W),a4=B(M,bc,a1),ar=B(M,s),b=B(M,s,aB),aT=B(M,s,X),ad=B(M,s,aE),be=B(M,s,a5),aW=B(M,s,aY,z),e=B(M,s,aX,T),aw=function(bj,A){var bi=d(bj)?bj:bj.get(t).getXY();return[bi[0]+A[0],bi[1]+A[1]];},bb=function(bk,bj){var bi=bj[0]-bk[0],A=bj[1]-bk[1];return Math.sqrt(bi*bi+A*A);},ak=function(bs,bq){var bo=bs.hotPoints,bn=bq.hotPoints,bv=bs.get(t).getXY(),bt=bq.get(t).getXY(),bk,bi,bl,bj,bu=Infinity,bm=[[0,0],[0,0]];for(bl=0,bk=bo.length;bl{label}',boundary:null,hotPoints:[[0,0]],CONTROLS_TEMPLATE:'
    ',SERIALIZABLE_ATTRS:[aV,q,Q,g,V,a0,D,E],initializer:function(){var A=this;A.after({"dataset:remove":aD.bind(A._afterDataSetRemove,A),render:A._afterRender});A.on({nameChange:A._onNameChange});A.publish({connectDrop:{defaultFn:A.connectDrop},connectEnd:{defaultFn:A.connectEnd},connectMove:{defaultFn:A.connectMove},connectOutTarget:{defaultFn:A.connectOutTarget},connectOverTarget:{defaultFn:A.connectOverTarget},connectStart:{defaultFn:A.connectStart},boundaryMouseEnter:{},boundaryMouseLeave:{}});A.get(t).addClass(ar+bf+A.get(g));},destructor:function(){var A=this;A.eachConnector(function(bi,bj,bk){bk.removeTransition(bi.get(p));});A.invite.destroy();A.get(al).destroy();A.get(bc).removeField(A);},addTransition:function(bj){var A=this;var bi=A.get(ab);bj=A.prepareTransition(bj);if(!bi.containsKey(bj.uid)){bj.uid=aD.guid();bi.add(bj.uid,bj);}return bj;},alignTransition:function(bj){var A=this;var bk=aD.DiagramNode.getNodeByName(bj.target);if(bk){var bi=ak(A,bk);bj=aD.merge(bj,{sourceXY:bi[0],targetXY:bi[1]});A.getConnector(bj).setAttrs({p1:aw(A,bj.sourceXY),p2:aw(bk,bj.targetXY)});}},alignTransitions:function(){var A=this;A.get(ab).each(aD.bind(A.alignTransition,A));},close:function(){var A=this;return A.destroy();},connect:function(bm,bk){var A=this;bm=A.addTransition(bm); +var bj=aD.Widget.getByNode(bi.currentTarget);A.select(bj);A._onNodeEdit(bi);bi.stopPropagation();},_onNodeEdit:function(bi){var A=this;if(!bi.target.ancestor(i+b,true)){return;}var bj=aD.Widget.getByNode(bi.currentTarget);if(bj){A.editNode(bj);}},_onNodeMouseEnter:function(bi){var A=this;var bj=aD.Widget.getByNode(bi.currentTarget);bj.set(c,true);},_onNodeMouseLeave:function(bj){var A=this;var bi=A.publishedSource;var bk=aD.Widget.getByNode(bj.currentTarget);if(!bi||!bi.boundaryDragDelegate.dd.get(ae)){bk.set(c,false);}},_onSave:function(bj){var A=this;var bi=A.editingNode;var bk=A.editingConnector;var bl=A.propertyList.get(n);if(bi){bg.each(bl.get(av),function(bm){var bn=bm.get(aN);bi.set(bn.attributeName,bn.value);});}else{if(bk){bg.each(bl.get(av),function(bm){var bn=bm.get(aN);bk.set(bn.attributeName,bn.value);});}}},_onSuggestConnectorNodeClick:function(bk){var A=this;var bl=bk.currentTarget.getData(ac);var bi=A.connector;var bj=A.addField({type:bl.get(g),xy:bi.toCoordinate(bi.get(aI))});A.hideSuggestConnetorOverlay();A.publishedSource.connectNode(bj);},_renderGraphic:function(){var A=this;var bi=A.get(az);var bj=A.get(al);bj.render(bi);aD.one(bi).on(ao,aD.bind(A._onCanvasMouseDown,A));},_setConnector:function(bj){var A=this;if(!J(bj)){var bi=A.get(az).getXY();bj=new aD.Connector(aD.merge({builder:A,graphic:A.get(al),lazyDraw:true,p1:bi,p2:bi,shapeHover:null,showName:false},bj));}return bj;},_setFieldsDragConfig:function(bj){var A=this;var bi=A.dropContainer;return aD.merge({bubbleTargets:A,container:bi,dragConfig:{plugins:[{cfg:{constrain:bi},fn:aD.Plugin.DDConstrained},{cfg:{scrollDelay:150},fn:aD.Plugin.DDWinScroll}]},nodes:i+ar},bj||{});},_setSuggestConnectorOverlay:function(bj){var A=this;if(!bj){var bi=aD.getDoc().invoke(U);bg.each(A.get(af),function(bl){var bk=bl.get(s);bi.appendChild(bk.clone().setData(ac,bk.getData(ac)));});bj=new aD.Overlay({bodyContent:bi,render:true,visible:false,zIndex:10000});bj.get(t).delegate(aS,aD.bind(A._onSuggestConnectorNodeClick,A),i+a4);}return bj;},_setupFieldsDrag:function(){var A=this;A.fieldsDrag=new aD.DD.Delegate(A.get(aF));}}});aD.DiagramBuilder=G;aD.DiagramBuilder.types={};var aj=aD.Component.create({NAME:ba,EXTENDS:aD.Base});aD.DiagramNodeManager=new aj();var bh=aD.Component.create({NAME:H,UI_ATTRS:[c,q,Q,a5],ATTRS:{builder:{validator:ai},connectors:{valueFn:"_createDataSet",writeOnce:true},controlsToolbar:{validator:O,valueFn:"_valueControlsToolbar"},description:{value:aa,validator:a6},graphic:{writeOnce:true,validator:O},height:{value:60},highlighted:{validator:a2,value:false},name:{valueFn:function(){var A=this;return A.get(g)+(++aD.Env._uidx);},validator:a6},required:{value:false,validator:a2},selected:{value:false,validator:a2},shapeBoundary:{validator:O,valueFn:"_valueShapeBoundary"},highlightBoundaryStroke:{validator:O,value:{weight:7,color:"#484B4C",opacity:0.25}},shapeInvite:{validator:O,value:{radius:12,type:"circle",stroke:{weight:6,color:"#ff6600",opacity:0.8},fill:{color:"#ffd700",opacity:0.8}}},strings:{value:{closeMessage:"Close",connectMessage:"Connect",description:"Description",editMessage:"Edit",name:"Name",type:"Type"}},tabIndex:{value:1},transitions:{value:null,writeOnce:true,setter:"_setTransitions"},type:{value:s,validator:a6},width:{value:60},zIndex:{value:100}},EXTENDS:aD.Overlay,CIRCLE_POINTS:[[35,20],[28,33],[14,34],[5,22],[10,9],[24,6],[34,16],[31,30],[18,35],[6,26],[7,12],[20,5],[33,12],[34,26],[22,35],[9,30],[6,16],[16,6],[30,9],[35,22],[26,34],[12,33],[5,20],[12,7],[26,6],[35,18],[30,31],[16,34],[6,24],[9,10],[22,5],[34,14],[33,28],[20,35],[7,28],[6,14],[18,5],[31,10],[34,24],[24,34],[10,31],[5,18],[14,6],[28,8],[35,20],[28,33],[14,34],[5,22],[10,8],[25,6],[34,16],[31,30],[18,35],[6,26],[8,12],[20,5],[33,12],[33,27],[22,35],[8,30],[6,15],[16,6],[30,9],[35,23],[26,34],[12,32],[5,20],[12,7],[27,7],[35,18],[29,32],[15,34]],DIAMOND_POINTS:[[30,5],[35,10],[40,15],[45,20],[50,25],[55,30],[50,35],[45,40],[40,45],[35,50],[30,55],[25,50],[20,45],[15,40],[10,35],[5,30],[10,25],[15,20],[20,15],[25,10]],SQUARE_POINTS:[[5,5],[10,5],[15,5],[20,5],[25,5],[30,5],[35,5],[40,5],[50,5],[55,5],[60,5],[65,5],[65,10],[65,15],[65,20],[65,25],[65,30],[65,35],[65,40],[65,45],[65,50],[65,55],[65,60],[65,65],[60,65],[55,65],[50,65],[45,65],[40,65],[35,65],[30,65],[25,65],[20,65],[15,65],[10,65],[5,65],[5,60],[5,55],[5,50],[5,45],[5,40],[5,35],[5,30],[5,25],[5,20],[5,15],[5,10]],getNodeByName:function(A){return aD.Widget.getByNode(h+aD.DiagramNode.buildNodeId(A));},buildNodeId:function(A){return aH+N+a1+N+A.replace(/[^a-z0-9.:_\-]/ig,"_");},prototype:{LABEL_TEMPLATE:'
    {label}
    ',boundary:null,hotPoints:[[0,0]],CONTROLS_TEMPLATE:'
    ',SERIALIZABLE_ATTRS:[aV,q,Q,g,V,a0,D,E],initializer:function(){var A=this;A.after({"dataset:remove":aD.bind(A._afterDataSetRemove,A),render:A._afterRender});A.on({nameChange:A._onNameChange});A.publish({connectDrop:{defaultFn:A.connectDrop},connectEnd:{defaultFn:A.connectEnd},connectMove:{defaultFn:A.connectMove},connectOutTarget:{defaultFn:A.connectOutTarget},connectOverTarget:{defaultFn:A.connectOverTarget},connectStart:{defaultFn:A.connectStart},boundaryMouseEnter:{},boundaryMouseLeave:{}});A.get(t).addClass(ar+bf+A.get(g));},destructor:function(){var A=this;A.eachConnector(function(bi,bj,bk){bk.removeTransition(bi.get(p));});A.invite.destroy();A.get(al).destroy();A.get(bc).removeField(A);},addTransition:function(bj){var A=this;var bi=A.get(ab);bj=A.prepareTransition(bj);if(!bi.containsKey(bj.uid)){bj.uid=aD.guid();bi.add(bj.uid,bj);}return bj;},alignTransition:function(bj){var A=this;var bk=aD.DiagramNode.getNodeByName(bj.target);if(bk){var bi=ak(A,bk);bj=aD.merge(bj,{sourceXY:bi[0],targetXY:bi[1]});A.getConnector(bj).setAttrs({p1:aw(A,bj.sourceXY),p2:aw(bk,bj.targetXY)});}},alignTransitions:function(){var A=this;A.get(ab).each(aD.bind(A.alignTransition,A));},close:function(){var A=this;return A.destroy();},connect:function(bm,bk){var A=this;bm=A.addTransition(bm); var bi=null;var bn=aD.DiagramNode.getNodeByName(bm.target);if(bn){if(!A.isTransitionConnected(bm)){var bj=A.get(bc);var bl=ak(A,bn);aD.mix(bm,{sourceXY:bl[0],targetXY:bl[1]});bi=new aD.Connector(aD.merge({builder:bj,graphic:bj.get(al),transition:bm},bk));A.get(m).add(bm.uid,bi);}}A.alignTransition(bm);return bi;},connectDrop:function(bi){var A=this;A.connectNode(bi.publishedTarget);},connectEnd:function(bl){var A=this;var bk=bl.target;var bi=A.get(bc);var bj=bi.publishedSource;if(!bi.isAbleToConnect()&&bi.get(P)&&bi.connector.get(au)){bi.showSuggestConnetorOverlay();}else{bi.connector.hide();bj.invite.set(au,false);}if(bi.get(S)){bi.get(u).each(function(bm){bm.set(c,false);});}},connectMove:function(bk){var A=this;var bj=A.get(bc);var bl=bk.mouseXY;bj.connector.set(aI,bl);if(bj.publishedTarget){var bi=A.invite;var bm=bi.get(aO)||0;if(!bi.get(au)){bi.set(au,true);}bi.setXY([bl[0]-bm,bl[1]-bm]);}},connectNode:function(bj){var bi=this;var A=bi.boundaryDragDelegate.dd;bi.connect(bi.prepareTransition({sourceXY:aG(A.startXY,bi.get(t)),target:bj.get(q),targetXY:aG(A.mouseXY,bj.get(t))}));},connectOutTarget:function(bj){var A=this;var bi=A.get(bc);bi.publishedTarget=null;bi.publishedSource.invite.set(au,false);},connectOverTarget:function(bj){var A=this;var bi=A.get(bc);if(bi.publishedSource!==A){bi.publishedTarget=A;}},connectStart:function(bk){var A=this;var bi=A.get(bc);var bj=bi.get(az);bi.connector.show().set(aK,bk.startXY);if(bi.get(S)){bi.get(u).each(function(bl){bl.set(c,true);});}aD.DiagramNodeManager.fire("publishedSource",{publishedSource:A});},disconnect:function(bi){var A=this;if(A.isTransitionConnected(bi)){A.removeTransition(bi);}},eachConnector:function(bk){var A=this;var bl=[],bi=[].concat(A.get(m).values),bj=bi.length;bg.each(A.get(bc).getSourceNodes(A),function(bm){bm.get(m).each(function(bn){if(A.get(q)===bn.get(p).target){bl.push(bm);bi.push(bn);}});});bg.each(bi,function(bm,bn){bk.call(A,bm,bn,(bn0){V.lineTo(W[X][0],W[X][1]);}});V.lineTo(W[0][0],W[0][1]);},translatePoints:function(W,V,Y){var A=this;var X=[];o.each(W,function(aa,Z){X.push([W[Z][0]+V,W[Z][1]+Y]);});return X;},rotatePoints:function(V,X){var A=this;var W=[];o.each(V,function(Z,Y){W.push(A.rotatePoint(X,V[Y][0],V[Y][1]));});return W;},rotatePoint:function(V,A,W){return[(A*Math.cos(V))-(W*Math.sin(V)),(A*Math.sin(V))+(W*Math.cos(V))];}};i.Connector=i.Base.create("line",i.Base,[],{SERIALIZABLE_ATTRS:[y,O,x,k,C,n,m],shape:null,shapeArrow:null,initializer:function(W){var A=this;var V=A.get(O);A.after({nameChange:A._afterNameChange,p1Change:A.draw,p2Change:A.draw,selectedChange:A._afterSelectedChange,showNameChange:A._afterShowNameChange,visibleChange:A._afterVisibleChange});A._initShapes();if(!V){A.draw();}A._uiSetVisible(A.get(S));A._uiSetName(A.get(x));A._uiSetSelected(A.get(u),!V);A._uiSetShowName(A.get(D));},destructor:function(){var A=this;A.shape.destroy();A.shapeArrow.destroy();A.get(I).remove();},draw:function(){var ao=this;var X=ao.shape;var A=ao.shapeArrow;var W=ao.get(n),V=ao.get(m),ak=ao.toCoordinate(W),ai=ao.toCoordinate(V),am=ak[0],Z=ak[1],al=ai[0],Y=ai[1],af=Math.max(Math.abs(am-al)/2,10),ad=Math.max(Math.abs(Z-Y)/2,10),ac=null,ae=8,an=d(Math.atan2(Y-Z,al-am)),aa=Math.round(Math.abs(an)/(360/ae));if(h(an)<0){ac=[[am+af,Z,al-af,Y,al,Y],[am+af,Z,al,Z-ad,al,Y],[am,Z-ad,al,Z-ad,al,Y],[am-af,Z,al,Z-ad,al,Y],[am-af,Z,al+af,Y,al,Y]];}else{ac=[[am+af,Z,al-af,Y,al,Y],[am+af,Z,al,Z+ad,al,Y],[am,Z+ad,al,Z+ad,al,Y],[am-af,Z,al,Z+ad,al,Y],[am-af,Z,al+af,Y,al,Y]];}var ab=ac[aa];X.clear();X.moveTo(am,Z);X.curveTo.apply(X,ab);X.end();var ah=l(0,[am,Z],[al,Y],[ab[0],ab[1]],[ab[2],ab[3]]),ag=l(0.075,[am,Z],[al,Y],[ab[0],ab[1]],[ab[2],ab[3]]),aj=l(0.5,[am,Z],[al,Y],[ab[0],ab[1]],[ab[2],ab[3]]);A.clear();i.PolygonUtil.drawArrow(A,ag[0],ag[1],ah[0],ah[1],ao.get(K));A.end();if(ao.get(D)){ao.get(I).center(ao.toXY(aj));}return ao;},getProperties:function(){var A=this;var V=A.getPropertyModel();o.each(V,function(W){W.value=A.get(W.attributeName);});return V;},getPropertyModel:function(){var V=this;var A=V.getStrings();return[{attributeName:x,editor:new i.TextCellEditor({validator:{rules:{value:{required:true}}}}),name:A[x]}];},getStrings:function(){return i.Connector.STRINGS;},hide:function(){var A=this;A.set(S,false);return A;},show:function(){var A=this;A.set(S,true);return A;},toCoordinate:function(V){var A=this;return A._offsetXY(V,-1);},toJSON:function(){var A=this;var V={};o.each(A.SERIALIZABLE_ATTRS,function(W){V[W]=A.get(W);});return V;},toXY:function(V){var A=this;return A._offsetXY(V,1);},_afterNameChange:function(V){var A=this;A._uiSetName(V.newVal);A.draw();},_afterSelectedChange:function(V){var A=this;A._uiSetSelected(V.newVal);},_afterShowNameChange:function(V){var A=this;A._uiSetShowName(V.newVal);},_afterVisibleChange:function(V){var A=this;A._uiSetVisible(V.newVal);},_initShapes:function(){var A=this;var V=A.shape=A.get(z).addShape(A.get(r));var W=A.shapeArrow=A.get(z).addShape(A.get(b));V.on(F,i.bind(A._onShapeClick,A));V.on(c,i.bind(A._onShapeMouseEnter,A));V.on(j,i.bind(A._onShapeMouseLeave,A));W.on(F,i.bind(A._onShapeClick,A));A.get(I).on(F,i.bind(A._onShapeClick,A));},_offsetXY:function(X,W){var A=this;var V=A.get(z).getXY();return[X[0]+V[0]*W,X[1]+V[1]*W];},_onShapeClick:function(X){var A=this;var V=A.get(U);var W=A.get(u);if(V){if(X.hasModifier()){V.closeEditProperties();}else{V.unselectConnectors();if(W){V.closeEditProperties();}else{V.editConnector(A);}}}A.set(u,!W);X.halt();},_onShapeMouseEnter:function(X){var A=this;if(!A.get(u)){var W=A.get(C);var V=A.get(p);if(W){A._updateShape(A.shape,W);}if(V){A._updateShape(A.shapeArrow,V);}}},_onShapeMouseLeave:function(V){var A=this;if(!A.get(u)){A._updateShape(A.shape,A.get(r));A._updateShape(A.shapeArrow,A.get(b));}},_setNodeName:function(V){var A=this;if(!i.instanceOf(V,i.Node)){V=new i.Template(V).render();A.get(U).canvas.append(V.unselectable());}return V;},_setShape:function(V){var A=this;return i.merge({type:e,stroke:{color:A.get(y),weight:2,opacity:1}},V);},_setShapeArrow:function(V){var A=this;return i.merge({type:e,fill:{color:A.get(y),opacity:1},stroke:{color:A.get(y),weight:2,opacity:1}},V);},_uiSetName:function(V){var A=this;A.get(I).html(V);},_uiSetSelected:function(W,V){var A=this;A._updateShape(A.shape,W?A.get(k):A.get(r),V);A._updateShape(A.shapeArrow,W?A.get(L):A.get(b),V);},_uiSetShowName:function(V){var A=this;A.get(I).toggleClass(a,!V);},_uiSetVisible:function(V){var A=this;A.shape.set(S,V);A.shapeArrow.set(S,V);A._uiSetShowName(V&&A.get(D));},_updateShape:function(W,X,V){var A=this;if(X.hasOwnProperty(B)){W.set(B,X[B]);}if(X.hasOwnProperty(f)){W.set(f,X[f]);}if(V!==false){A.draw();}}},{ATTRS:{arrowPoints:{value:i.PolygonUtil.ARROW_POINTS},builder:{},color:{value:"#27aae1",validator:g},graphic:{validator:H},lazyDraw:{value:false,validator:w},name:{valueFn:function(){var A=this;return q+(++i.Env._uidx);},validator:g},nodeName:{setter:"_setNodeName",value:[''],writeOnce:true},p1:{value:[0,0],validator:s},p2:{value:[0,0],validator:s},selected:{value:false,validator:w},shape:{value:null,setter:"_setShape"},shapeArrow:{value:null,setter:"_setShapeArrow"},shapeArrowHover:{value:{fill:{color:"#ffd700"},stroke:{color:"#ffd700",weight:5,opacity:0.8}}},shapeArrowSelected:{value:{fill:{color:"#ff6600"},stroke:{color:"#ff6600",weight:5,opacity:0.8}}},shapeHover:{value:{stroke:{color:"#ffd700",weight:5,opacity:0.8}}},shapeSelected:{value:{stroke:{color:"#ff6600",weight:5,opacity:0.8}}},showName:{validator:w,value:true},transition:{value:{},validator:E},visible:{validator:w,value:true}},STRINGS:{name:"Name"}});},"@VERSION@",{requires:["aui-base","aui-template","arraylist-add","arraylist-filter","json","graphics","dd"],skinnable:true});AUI.add("aui-diagram-builder",function(a){},"@VERSION@",{skinnable:true,use:["aui-diagram-builder-base","aui-diagram-builder-impl"]}); \ No newline at end of file diff --git a/build/aui-diagram-builder/aui-diagram-builder.js b/build/aui-diagram-builder/aui-diagram-builder.js index 889efa5559e..4c035e74a92 100644 --- a/build/aui-diagram-builder/aui-diagram-builder.js +++ b/build/aui-diagram-builder/aui-diagram-builder.js @@ -1583,9 +1583,10 @@ var DiagramBuilder = A.Component.create({ _renderGraphic: function() { var instance = this; + var canvas = instance.get(CANVAS); var graphic = instance.get(GRAPHIC); - graphic.render(instance.get(CANVAS)); + graphic.render(canvas); A.one(canvas).on(MOUSEDOWN, A.bind(instance._onCanvasMouseDown, instance)); },