11
11
12
12
13
13
import java .awt .geom .Rectangle2D ;
14
- import java .util .List ;
15
14
import java .util .Objects ;
16
15
import java .util .Optional ;
17
- import java .util .concurrent .*;
16
+ import java .util .concurrent .Callable ;
17
+ import java .util .concurrent .Future ;
18
+ import java .util .concurrent .TimeUnit ;
19
+ import java .util .concurrent .TimeoutException ;
20
+ import java .util .concurrent .FutureTask ;
18
21
import java .util .logging .Level ;
19
22
20
23
import org .csstudio .display .builder .model .DisplayModel ;
@@ -74,7 +77,7 @@ public class DisplayRuntimeInstance implements AppInstance
74
77
private final BorderPane layout = new BorderPane ();
75
78
private final DockItemWithInput dock_item ;
76
79
private final DockItemRepresentation representation ;
77
- private FutureTask <Object > representation_init = new FutureTask <>(() -> {return null ;});
80
+ private FutureTask <Void > representation_init = new FutureTask <>(() -> {return null ;});
78
81
private Node toolbar ;
79
82
80
83
/** Property on the 'model_parent' of the JFX scene that holds this DisplayRuntimeInstance */
@@ -157,9 +160,10 @@ public static DisplayRuntimeInstance ofDisplayModel(final DisplayModel model)
157
160
representation .fireContextMenu (model , (int )event .getScreenX (), (int )event .getScreenY ());
158
161
}
159
162
});
163
+
160
164
layout .addEventFilter (KeyEvent .KEY_PRESSED , this ::handleKeys );
165
+
161
166
dock_item .addClosedNotification (this ::onClosed );
162
- representation_init .run ();
163
167
}
164
168
165
169
@ Override
@@ -186,9 +190,9 @@ DisplayNavigation getNavigation()
186
190
}
187
191
188
192
/* Clients waiting for the representation to be initialized can get() this,
189
- * which will block until the representation is initialized.
190
- */
191
- public FutureTask <Object > getRepresentation_init () {
193
+ * which will block until the representation is initialized.
194
+ */
195
+ public FutureTask <Void > getRepresentation_init () {
192
196
return representation_init ;
193
197
}
194
198
@@ -313,6 +317,7 @@ public void loadDisplayFile(final DisplayInfo info)
313
317
RuntimeUtil .startRuntime (model );
314
318
315
319
logger .log (Level .FINE , "Waiting for representation of model " + info .getPath ());
320
+
316
321
try
317
322
{
318
323
representation .awaitRepresentation (30 , TimeUnit .SECONDS );
@@ -505,11 +510,6 @@ public void onClosed()
505
510
navigation .dispose ();
506
511
}
507
512
508
- DisplayModel getActiveModel ()
509
- {
510
- return active_model ;
511
- }
512
-
513
513
public void addListener (ToolkitListener listener ){
514
514
this .getRepresentation ().removeListener (listener );
515
515
this .getRepresentation ().addListener (listener );
0 commit comments