@@ -54,16 +54,14 @@ This file belongs to the Servoy development and deployment environment, Copyrigh
54
54
public class NGClientWindow extends BaseWindow implements INGClientWindow
55
55
{
56
56
57
- private final INGClientWebsocketSession websocketSession ;
58
-
59
57
/**
60
58
* @param websocketSession
59
+ * @param windowUuid
61
60
* @param windowName
62
61
*/
63
- public NGClientWindow (INGClientWebsocketSession websocketSession , String windowName )
62
+ public NGClientWindow (INGClientWebsocketSession websocketSession , String windowUuid , String windowName )
64
63
{
65
- super (windowName );
66
- this .websocketSession = websocketSession ;
64
+ super (websocketSession , windowUuid , windowName );
67
65
}
68
66
69
67
public static INGClientWindow getCurrentWindow ()
@@ -91,13 +89,13 @@ public INGApplication getClient()
91
89
@ Override
92
90
public Container getForm (String formName )
93
91
{
94
- return (Container )websocketSession .getClient ().getFormManager ().getForm (formName ).getFormUI ();
92
+ return (Container )getSession () .getClient ().getFormManager ().getForm (formName ).getFormUI ();
95
93
}
96
94
97
95
@ Override
98
96
public void sendChanges () throws IOException
99
97
{
100
- if (websocketSession .getClient () != null ) websocketSession .getClient ().changesWillBeSend ();
98
+ if (getSession () .getClient () != null ) getSession () .getClient ().changesWillBeSend ();
101
99
super .sendChanges ();
102
100
}
103
101
@@ -111,7 +109,7 @@ protected Object invokeApi(WebComponent receiver, WebObjectApiDefinition apiFunc
111
109
boolean delayedCall = isDelayedApiCall (receiver , apiFunction );
112
110
if (!delayedCall )
113
111
{
114
- IWebFormController form = websocketSession .getClient ().getFormManager ().getForm (receiver .findParent (IWebFormUI .class ).getName ());
112
+ IWebFormController form = getSession () .getClient ().getFormManager ().getForm (receiver .findParent (IWebFormUI .class ).getName ());
115
113
touchForm (form .getForm (), form .getName (), false );
116
114
}
117
115
if (receiver instanceof WebFormComponent && ((WebFormComponent )receiver ).getComponentContext () != null )
@@ -162,7 +160,7 @@ public void touchForm(Form form, String realInstanceName, boolean async)
162
160
String currentWindowName = getCurrentWindow ().getName ();
163
161
if (currentWindowName == null )
164
162
{
165
- currentWindowName = websocketSession .getClient ().getRuntimeWindowManager ().getMainApplicationWindow ().getName ();
163
+ currentWindowName = getSession () .getClient ().getRuntimeWindowManager ().getMainApplicationWindow ().getName ();
166
164
}
167
165
formUI .setParentWindowName (currentWindowName );
168
166
}
@@ -185,7 +183,7 @@ public void touchForm(Form form, String realInstanceName, boolean async)
185
183
{
186
184
// this means a previous async touchForm already sent URL and JS code (updateController) to client, but the client form was not yet loaded (directives, scopes....)
187
185
// so probably a tabpanel or component that asked for it changed it's mind and no longer showed it; make sure it will show before waiting!
188
- websocketSession .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("requireFormLoaded" ,
186
+ getSession () .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("requireFormLoaded" ,
189
187
new Object [] { formName });
190
188
}
191
189
Debug .debug ("touchForm(" + async + ") - will suspend: " + form .getName ());
@@ -200,7 +198,7 @@ public void touchForm(Form form, String realInstanceName, boolean async)
200
198
}
201
199
try
202
200
{
203
- websocketSession .getEventDispatcher ().suspend (formUrl , IWebsocketEndpoint .EVENT_LEVEL_SYNC_API_CALL , EventDispatcher .CONFIGURED_TIMEOUT );
201
+ getSession () .getEventDispatcher ().suspend (formUrl , IWebsocketEndpoint .EVENT_LEVEL_SYNC_API_CALL , EventDispatcher .CONFIGURED_TIMEOUT );
204
202
}
205
203
catch (CancellationException e )
206
204
{
@@ -243,11 +241,11 @@ protected void updateController(Form form, final String realFormName, final bool
243
241
@ Override
244
242
public void run ()
245
243
{
246
- if (websocketSession .getClient ().isEventDispatchThread () && forceLoad )
244
+ if (getSession () .getClient ().isEventDispatchThread () && forceLoad )
247
245
{
248
246
try
249
247
{
250
- websocketSession .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeServiceCall ("updateController" ,
248
+ getSession () .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeServiceCall ("updateController" ,
251
249
new Object [] { realFormName , jsTemplate , realUrl , Boolean .valueOf (forceLoad ), htmlTemplate });
252
250
}
253
251
catch (IOException e )
@@ -257,7 +255,7 @@ public void run()
257
255
}
258
256
else
259
257
{
260
- websocketSession .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("updateController" ,
258
+ getSession () .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("updateController" ,
261
259
new Object [] { realFormName , jsTemplate , realUrl , Boolean .valueOf (forceLoad ), htmlTemplate });
262
260
}
263
261
}
@@ -289,7 +287,7 @@ protected String dropSessionIdFrom(String realNewURL)
289
287
290
288
protected Pair <String , Boolean > getRealFormURLAndSeeIfItIsACopy (Form form , String realFormName , boolean addSessionID )
291
289
{
292
- FlattenedSolution fs = websocketSession .getClient ().getFlattenedSolution ();
290
+ FlattenedSolution fs = getSession () .getClient ().getFlattenedSolution ();
293
291
Solution sc = fs .getSolutionCopy (false );
294
292
String realUrl = getDefaultFormURLStart (form , realFormName );
295
293
boolean copy = false ;
@@ -334,7 +332,7 @@ protected String getDefaultFormURLStart(Form form, String name)
334
332
335
333
public void destroyForm (String name )
336
334
{
337
- websocketSession .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("destroyController" , new Object [] { name });
335
+ getSession () .getClientService (NGRuntimeWindowManager .WINDOW_SERVICE ).executeAsyncServiceCall ("destroyController" , new Object [] { name });
338
336
// also remove it from the endpoint as a form that is on the client.
339
337
getEndpoint ().formDestroyed (name );
340
338
}
0 commit comments