Ldc
2024-04-07 0652600959e5e3b5796fb6e8da129704ca95347a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
draw2d.ExclusiveGateway=function(_url){
    _url="js/designer/icons/type.gateway.exclusive.png";
    draw2d.ResizeImage.call(this,_url);
    this.rightOutputPort=null;
    this.leftOutputPort=null;
    this.topOutputPort=null;
    this.bottomOutputPort=null;
    this.gatewayId=null;
    this.gatewayName=null;
    this.setDimension(40,40);
};
draw2d.ExclusiveGateway.prototype=new draw2d.Node();
draw2d.ExclusiveGateway.prototype.type="draw2d.ExclusiveGateway";
draw2d.ExclusiveGateway.prototype.generateId=function(){
    this.id="exclusiveGateway"+Sequence.create();
    this.gatewayId=this.id;
    this.gatewayName=this.id;
};
draw2d.ExclusiveGateway.prototype.createHTMLElement=function(){
    var item = draw2d.ResizeImage.prototype.createHTMLElement.call(this);
    return item;
};
draw2d.ExclusiveGateway.prototype.setDimension=function(w, h){
    draw2d.ResizeImage.prototype.setDimension.call(this, w, h);
};
draw2d.ExclusiveGateway.prototype.setWorkflow=function(_4fe5){
    draw2d.ResizeImage.prototype.setWorkflow.call(this,_4fe5);
    this.resizeable=false;//不让改变大小
    if(_4fe5!==null&&this.rightOutputPort===null){
        this.rightOutputPort=new draw2d.MyOutputPort();
        this.rightOutputPort.setMaxFanOut(1);
        this.rightOutputPort.setWorkflow(_4fe5);
        this.rightOutputPort.setName("rightOutputPort");
        //this.rightOutputPort.setBackgroundColor(new draw2d.Color(245,115,115));
        this.addPort(this.rightOutputPort,this.width,this.height/2);
    }
    if(_4fe5!==null&&this.leftOutputPort===null){
        this.leftOutputPort=new draw2d.MyOutputPort();
        this.leftOutputPort.setMaxFanOut(1);
        this.leftOutputPort.setWorkflow(_4fe5);
        this.leftOutputPort.setName("leftOutputPort");
        //this.leftOutputPort.setBackgroundColor(new draw2d.Color(245,115,115));
        this.addPort(this.leftOutputPort,0,this.height/2);
    }
    if(_4fe5!==null&&this.topOutputPort===null){
        this.topOutputPort=new draw2d.MyOutputPort();
        this.topOutputPort.setMaxFanOut(1);
        this.topOutputPort.setWorkflow(_4fe5);
        this.topOutputPort.setName("topOutputPort");
        //this.topOutputPort.setBackgroundColor(new draw2d.Color(245,115,115));
        this.addPort(this.topOutputPort,this.width/2,0);
    }
    if(_4fe5!==null&&this.bottomOutputPort===null){
        this.bottomOutputPort=new draw2d.MyOutputPort();
        this.bottomOutputPort.setMaxFanOut(1);
        this.bottomOutputPort.setWorkflow(_4fe5);
        this.bottomOutputPort.setName("bottomOutputPort");
        //this.bottomOutputPort.setBackgroundColor(new draw2d.Color(245,115,115));
        this.addPort(this.bottomOutputPort,this.width/2,this.height);
    }
};
draw2d.ExclusiveGateway.prototype.figureDoubleClick=function(){
    var data = {event:this};
    var event = data.event;
    var tid = event.getId();
    openGatewayProperties(tid);
}
draw2d.ExclusiveGateway.prototype.getContextMenu=function(){
    if(this.workflow.disabled)return null;
    var menu =new draw2d.ContextMenu(100, 50);
    var data = {event:this};
    menu.appendMenuItem(new draw2d.ContextMenuItem("Properties", "properties-icon",data,function(x,y)
    {
        var data = this.getData();
        var event = data.event;
        var tid = event.getId();
        if(typeof openGatewayProperties != "undefined"){
            openGatewayProperties(tid);
        }
    }));
    
    return menu;
};
draw2d.ExclusiveGateway.prototype.toXML=function(){
    var name = this.gatewayId;
    var newName = trim(this.gatewayName);
    if(newName != null && newName != "")
        name = newName;
    var xml='<exclusiveGateway id="'+this.gatewayId+'" name="'+name+'"></exclusiveGateway>\n';
    return xml;
};
draw2d.ExclusiveGateway.prototype.toBpmnDI=function(){
    var w=this.getWidth();
    var h=this.getHeight();
    var x=this.getAbsoluteX();
    var y=this.getAbsoluteY();
    var xml='<bpmndi:BPMNShape bpmnElement="'+this.gatewayId+'" id="BPMNShape_'+this.gatewayId+'">\n';
    xml=xml+'<omgdc:Bounds height="'+h+'" width="'+w+'" x="'+x+'" y="'+y+'"/>\n';
    xml=xml+'</bpmndi:BPMNShape>\n';
    return xml;
};