@@ -43,19 +43,15 @@ qx.Class.define("qxapp.component.widget.NodeView", {
43
43
let mainLayout = this . __mainLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
44
44
mainLayout . set ( {
45
45
alignX : "center" ,
46
- paddingTop : 20 ,
47
- paddingRight : 30 ,
48
- paddingBottom : 20 ,
49
- paddingLeft : 30
46
+ padding : 5
50
47
} ) ;
51
48
this . add ( mainLayout , {
52
49
flex : 1
53
50
} ) ;
54
51
55
- this . __nodesUI = [ ] ;
56
-
57
- this . __initTitle ( ) ;
58
- this . __initSettings ( ) ;
52
+ this . __settingsLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( ) ) ;
53
+ this . __mapperLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
54
+ this . __iFrameLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
59
55
this . __initButtons ( ) ;
60
56
} ,
61
57
@@ -76,40 +72,14 @@ qx.Class.define("qxapp.component.widget.NodeView", {
76
72
} ,
77
73
78
74
members : {
79
- __settingsBox : null ,
80
- __inputNodesLayout : null ,
81
75
__mainLayout : null ,
82
- __nodesUI : null ,
76
+ __inputNodesLayout : null ,
77
+ __settingsLayout : null ,
78
+ __mapperLayout : null ,
79
+ __iFrameLayout : null ,
83
80
__buttonsLayout : null ,
84
81
__openFolder : null ,
85
82
86
- __initTitle : function ( ) {
87
- let box = new qx . ui . layout . HBox ( ) ;
88
- box . set ( {
89
- spacing : 10 ,
90
- alignX : "right"
91
- } ) ;
92
- let titleBox = new qx . ui . container . Composite ( box ) ;
93
-
94
- let settLabel = new qx . ui . basic . Label ( this . tr ( "Settings" ) ) ;
95
- settLabel . set ( {
96
- alignX : "center" ,
97
- alignY : "middle"
98
- } ) ;
99
-
100
- titleBox . add ( settLabel , {
101
- width : "75%"
102
- } ) ;
103
- this . __mainLayout . add ( titleBox ) ;
104
- } ,
105
-
106
- __initSettings : function ( ) {
107
- this . __settingsBox = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
108
- this . __mainLayout . add ( this . __settingsBox , {
109
- flex : 1
110
- } ) ;
111
- } ,
112
-
113
83
__initButtons : function ( ) {
114
84
let box = new qx . ui . layout . HBox ( ) ;
115
85
box . set ( {
@@ -144,16 +114,6 @@ qx.Class.define("qxapp.component.widget.NodeView", {
144
114
} , this ) ;
145
115
146
116
buttonsLayout . add ( openFolder ) ;
147
- this . __mainLayout . add ( buttonsLayout ) ;
148
- } ,
149
-
150
- __getNodeUI : function ( id ) {
151
- for ( let i = 0 ; i < this . __nodesUI . length ; i ++ ) {
152
- if ( this . __nodesUI [ i ] . getNodeUI ( ) === id ) {
153
- return this . __nodesUI [ i ] ;
154
- }
155
- }
156
- return null ;
157
117
} ,
158
118
159
119
__arePortsCompatible : function ( node1 , port1 , node2 , port2 ) {
@@ -228,7 +188,9 @@ qx.Class.define("qxapp.component.widget.NodeView", {
228
188
return nodePorts ;
229
189
} ,
230
190
231
- __createInputPortsUIs : function ( nodeModel ) {
191
+ __addInputPortsUIs : function ( nodeModel ) {
192
+ this . __clearInputPortsUIs ( ) ;
193
+
232
194
// Add the default inputs if any
233
195
if ( Object . keys ( this . getNodeModel ( ) . getInputsDefault ( ) ) . length > 0 ) {
234
196
this . __createInputPortsUI ( this . getNodeModel ( ) , false ) ;
@@ -244,8 +206,7 @@ qx.Class.define("qxapp.component.widget.NodeView", {
244
206
this . __createInputPortsUI ( exposedInnerNode ) ;
245
207
}
246
208
} else {
247
- let inputLabel = this . __createInputPortsUI ( inputNodeModel ) ;
248
- this . __nodesUI . push ( inputLabel ) ;
209
+ this . __createInputPortsUI ( inputNodeModel ) ;
249
210
}
250
211
}
251
212
} ,
@@ -257,33 +218,92 @@ qx.Class.define("qxapp.component.widget.NodeView", {
257
218
}
258
219
} ,
259
220
260
- __applyNode : function ( nodeModel , oldNode , propertyName ) {
261
- this . __settingsBox . removeAll ( ) ;
262
- this . __settingsBox . add ( nodeModel . getPropsWidget ( ) ) ;
263
- this . __createDragDropMechanism ( nodeModel . getPropsWidget ( ) ) ;
221
+ __addSettings : function ( propsWidget ) {
222
+ this . __settingsLayout . removeAll ( ) ;
223
+ if ( propsWidget ) {
224
+ let box = new qx . ui . layout . HBox ( ) ;
225
+ box . set ( {
226
+ spacing : 10 ,
227
+ alignX : "right"
228
+ } ) ;
229
+ let titleBox = new qx . ui . container . Composite ( box ) ;
230
+ let settLabel = new qx . ui . basic . Label ( this . tr ( "Settings" ) ) ;
231
+ settLabel . set ( {
232
+ alignX : "center"
233
+ } ) ;
234
+ titleBox . add ( settLabel , {
235
+ width : "75%"
236
+ } ) ;
237
+
238
+ this . __settingsLayout . add ( titleBox ) ;
239
+ this . __settingsLayout . add ( propsWidget ) ;
240
+ this . __createDragDropMechanism ( propsWidget ) ;
241
+
242
+ this . __mainLayout . add ( this . __settingsLayout ) ;
243
+ } else if ( qx . ui . core . Widget . contains ( this . __mainLayout , this . __settingsLayout ) ) {
244
+ this . __mainLayout . remove ( this . __settingsLayout ) ;
245
+ }
246
+ } ,
264
247
265
- if ( nodeModel . getInputsMapper ( ) ) {
266
- this . __settingsBox . add ( nodeModel . getInputsMapper ( ) , {
248
+ __addMapper : function ( mapper ) {
249
+ this . __mapperLayout . removeAll ( ) ;
250
+ if ( mapper ) {
251
+ this . __mapperLayout . add ( mapper , {
267
252
flex : 1
268
253
} ) ;
254
+ this . __mainLayout . add ( this . __mapperLayout , {
255
+ flex : 1
256
+ } ) ;
257
+ } else if ( qx . ui . core . Widget . contains ( this . __mainLayout , this . __mapperLayout ) ) {
258
+ this . __mainLayout . remove ( this . __mapperLayout ) ;
269
259
}
260
+ } ,
270
261
271
- this . __clearInputPortsUIs ( ) ;
272
- this . __createInputPortsUIs ( nodeModel ) ;
262
+ __addIFrame : function ( iFrame ) {
263
+ this . __iFrameLayout . removeAll ( ) ;
264
+ if ( iFrame ) {
265
+ iFrame . addListenerOnce ( "maximize" , e => {
266
+ this . __maximizeIFrame ( true ) ;
267
+ } , this ) ;
268
+ iFrame . addListenerOnce ( "restore" , e => {
269
+ this . __maximizeIFrame ( false ) ;
270
+ } , this ) ;
271
+ this . __maximizeIFrame ( iFrame . hasState ( "maximized" ) ) ;
272
+ this . __iFrameLayout . add ( iFrame , {
273
+ flex : 1
274
+ } ) ;
275
+ this . __mainLayout . add ( this . __iFrameLayout , {
276
+ flex : 1
277
+ } ) ;
278
+ } else if ( qx . ui . core . Widget . contains ( this . __mainLayout , this . __iFrameLayout ) ) {
279
+ this . __mainLayout . remove ( this . __iFrameLayout ) ;
280
+ }
281
+ } ,
273
282
283
+ __maximizeIFrame : function ( maximize ) {
284
+ const othersStatus = maximize ? "excluded" : "visible" ;
285
+ this . __inputNodesLayout . setVisibility ( othersStatus ) ;
286
+ this . __settingsLayout . setVisibility ( othersStatus ) ;
287
+ this . __mapperLayout . setVisibility ( othersStatus ) ;
288
+ this . __buttonsLayout . setVisibility ( othersStatus ) ;
289
+ } ,
290
+
291
+ __addButtons : function ( nodeModel ) {
274
292
this . __buttonsLayout . removeAll ( ) ;
275
- let iFrameButton = nodeModel . getIFrameButton ( ) ;
276
- if ( iFrameButton ) {
277
- iFrameButton . addListener ( "execute" , e => {
278
- this . fireDataEvent ( "ShowViewer" , {
279
- url : nodeModel . getServiceUrl ( ) ,
280
- name : nodeModel . getLabel ( ) ,
281
- nodeId : nodeModel . getNodeId ( )
282
- } ) ;
283
- } , this ) ;
284
- this . __buttonsLayout . add ( iFrameButton ) ;
293
+ let restartIFrameButton = nodeModel . getRestartIFrameButton ( ) ;
294
+ if ( restartIFrameButton ) {
295
+ this . __buttonsLayout . add ( restartIFrameButton ) ;
285
296
}
286
297
this . __buttonsLayout . add ( this . __openFolder ) ;
298
+ this . __mainLayout . add ( this . __buttonsLayout ) ;
299
+ } ,
300
+
301
+ __applyNode : function ( nodeModel , oldNode , propertyName ) {
302
+ this . __addInputPortsUIs ( nodeModel ) ;
303
+ this . __addSettings ( nodeModel . getPropsWidget ( ) ) ;
304
+ this . __addMapper ( nodeModel . getInputsMapper ( ) ) ;
305
+ this . __addIFrame ( nodeModel . getIFrame ( ) ) ;
306
+ this . __addButtons ( nodeModel ) ;
287
307
}
288
308
}
289
309
} ) ;
0 commit comments