1111
1212
1313import java .awt .geom .Rectangle2D ;
14- import java .util .List ;
1514import java .util .Objects ;
1615import 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 ;
1821import java .util .logging .Level ;
1922
2023import org .csstudio .display .builder .model .DisplayModel ;
@@ -74,7 +77,7 @@ public class DisplayRuntimeInstance implements AppInstance
7477 private final BorderPane layout = new BorderPane ();
7578 private final DockItemWithInput dock_item ;
7679 private final DockItemRepresentation representation ;
77- private FutureTask <Object > representation_init = new FutureTask <>(() -> {return null ;});
80+ private FutureTask <Void > representation_init = new FutureTask <>(() -> {return null ;});
7881 private Node toolbar ;
7982
8083 /** Property on the 'model_parent' of the JFX scene that holds this DisplayRuntimeInstance */
@@ -157,9 +160,10 @@ public static DisplayRuntimeInstance ofDisplayModel(final DisplayModel model)
157160 representation .fireContextMenu (model , (int )event .getScreenX (), (int )event .getScreenY ());
158161 }
159162 });
163+
160164 layout .addEventFilter (KeyEvent .KEY_PRESSED , this ::handleKeys );
165+
161166 dock_item .addClosedNotification (this ::onClosed );
162- representation_init .run ();
163167 }
164168
165169 @ Override
@@ -186,9 +190,9 @@ DisplayNavigation getNavigation()
186190 }
187191
188192 /* 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 () {
192196 return representation_init ;
193197 }
194198
@@ -313,6 +317,7 @@ public void loadDisplayFile(final DisplayInfo info)
313317 RuntimeUtil .startRuntime (model );
314318
315319 logger .log (Level .FINE , "Waiting for representation of model " + info .getPath ());
320+
316321 try
317322 {
318323 representation .awaitRepresentation (30 , TimeUnit .SECONDS );
@@ -505,11 +510,6 @@ public void onClosed()
505510 navigation .dispose ();
506511 }
507512
508- DisplayModel getActiveModel ()
509- {
510- return active_model ;
511- }
512-
513513 public void addListener (ToolkitListener listener ){
514514 this .getRepresentation ().removeListener (listener );
515515 this .getRepresentation ().addListener (listener );
0 commit comments