@@ -21,9 +21,17 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
21
21
*
22
22
* @param vizWidget {Widget} visualization widget to embedd
23
23
*/
24
- construct : function ( form , nodeModel ) {
24
+ construct : function ( form , workbenchModel , nodeModel ) {
25
+ // workbenchModel and nodeModel are necessary for creating links
26
+ if ( workbenchModel ) {
27
+ this . setWorkbenchModel ( workbenchModel ) ;
28
+ } else {
29
+ this . setWorkbenchModel ( null ) ;
30
+ }
25
31
if ( nodeModel ) {
26
32
this . setNodeModel ( nodeModel ) ;
33
+ } else {
34
+ this . setNodeModel ( null ) ;
27
35
}
28
36
29
37
this . base ( arguments , form ) ;
@@ -40,8 +48,14 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
40
48
} ,
41
49
42
50
properties : {
51
+ workbenchModel : {
52
+ check : "qxapp.data.model.WorkbenchModel" ,
53
+ nullable : true
54
+ } ,
55
+
43
56
nodeModel : {
44
- check : "qxapp.data.model.NodeModel"
57
+ check : "qxapp.data.model.NodeModel" ,
58
+ nullable : true
45
59
}
46
60
} ,
47
61
@@ -145,12 +159,19 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
145
159
}
146
160
} ,
147
161
148
- __arePortsCompatible : function ( node1 , port1 , node2 , port2 ) {
149
- return qxapp . data . Store . getInstance ( ) . arePortsCompatible ( node1 , port1 , node2 , port2 ) ;
162
+ __arePortsCompatible : function ( node1Id , port1Id , node2Id , port2Id ) {
163
+ if ( this . getWorkbenchModel ( ) ) {
164
+ const node1 = this . getWorkbenchModel ( ) . getNodeModel ( node1Id ) ;
165
+ const port1 = node1 . getOutput ( port1Id ) ;
166
+ const node2 = this . getWorkbenchModel ( ) . getNodeModel ( node2Id ) ;
167
+ const port2 = node2 . getInput ( port2Id ) ;
168
+ return qxapp . data . Store . getInstance ( ) . arePortsCompatible ( port1 , port2 ) ;
169
+ }
170
+ return false ;
150
171
} ,
151
172
152
173
__createDropMechanism : function ( uiElement , portId ) {
153
- if ( this . isPropertyInitialized ( "nodeModel" ) ) {
174
+ if ( this . getNodeModel ( ) ) {
154
175
uiElement . setDroppable ( true ) ;
155
176
uiElement . nodeId = this . getNodeModel ( ) . getNodeId ( ) ;
156
177
uiElement . portId = portId ;
0 commit comments