public void showExportXPathToRuleWizard() { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root; try { root = loader.load(); } catch (IOException e) { throw new RuntimeException(e); } Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
private FXMLLoader createLoader(final Object controller, String fxmlName, ViewConfiguration viewConfiguration) throws FxmlLoadException { Class<?> controllerClass = controller.getClass(); String foundFxmlName = getFxmlName(controllerClass); if (fxmlName != null) { foundFxmlName = fxmlName; } if (foundFxmlName == null) { throw new FxmlLoadException("No FXML File specified!"); } FXMLLoader fxmlLoader = new FXMLLoader( controllerClass.getResource(foundFxmlName)); fxmlLoader.setBuilderFactory(viewConfiguration.getBuilderFactory()); fxmlLoader.setCharset(viewConfiguration.getCharset()); fxmlLoader.setResources(viewConfiguration.getResources()); fxmlLoader.setController(controller); fxmlLoader.setControllerFactory(c -> controller); return fxmlLoader; }
private Stage createStage(Stage mainStage) { FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log.fxml")); loader.setController(this); final Stage dialog = new Stage(); dialog.initOwner(mainStage.getScene().getWindow()); dialog.initModality(Modality.NONE); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setScene(scene); return dialog; }
private FXMLLoader createLoader(final Object controller, String fxmlName, ViewConfiguration viewConfiguration) throws FxmlLoadException { Class<?> controllerClass = controller.getClass(); String foundFxmlName = getFxmlName(controllerClass); if (fxmlName != null) { foundFxmlName = fxmlName; } if (foundFxmlName == null) { throw new FxmlLoadException("No FXML File specified!"); } FXMLLoader fxmlLoader = new FXMLLoader( controllerClass.getResource(foundFxmlName)); fxmlLoader.setBuilderFactory(viewConfiguration.getBuilderFactory()); fxmlLoader.setCharset(viewConfiguration.getCharset()); fxmlLoader.setResources(viewConfiguration.getResources()); fxmlLoader.setController(controller); fxmlLoader.setControllerFactory(new Callback<Class<?>, Object>() { @Override public Object call(Class<?> arg0) { return controller; } }); return fxmlLoader; }
private Stage createEditPropertyDialog() { EditPropertyDialogController wizard = new EditPropertyDialogController(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("edit-property-dialog.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(this.getScene().getWindow()); dialog.initModality(Modality.WINDOW_MODAL); dialog.initStyle(StageStyle.UNDECORATED); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setTitle("Edit property"); dialog.setScene(scene); dialog.setUserData(wizard); return dialog; }
loader.setController(new InputController()); toolbarPopup = new JFXPopup(loader.load());
public WorldPane() { log.finest("constructing world pane"); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("WorldPane.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } }
public FailurePane() { getStyleClass().add("failure"); setMinWidth(220.0d); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FailurePane.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } }
@Override public void run() { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("Login.fxml")); loader.setController(controller); Parent root = (Parent) loader.load(); Scene scene = new Scene(root); fxPanel.setScene(scene); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } });
/** * Constructor * @param clientContext the client context * @param controllerName the controller name of the controller definition on the server that should * be used with this view. * @param fxmlLocation the location (url) of the FXML file that defines the layout of the view. */ public AbstractFXMLViewController(ClientContext clientContext, String controllerName, URL fxmlLocation) { super(clientContext, controllerName); Assert.requireNonNull(fxmlLocation, "fxmlLocation"); try { FXMLLoader loader = new FXMLLoader(fxmlLocation); loader.setController(this); rootNode = loader.load(); } catch (Exception e) { throw new RuntimeException("Can not create view based on FXML location " + fxmlLocation, e); } }
/** * @param recognizer * the {@link RecognitionScreenView} */ public RecognitionScreenView(final Recognition recognizer) { super(recognizer); this.recognizer = recognizer; this.gestureLength = recognizer.getFrameLength(); // CREATE AND SET THE CONTROLLER. INIT THE BORDER PANE Platform.runLater(() -> { final FXMLLoader loader = new FXMLLoader(); loader.setController(this); loader.setLocation(this.getClass().getResource(FXMLScreens.HOME.getPath())); try { this.recorderPane = (BorderPane) loader.load(); } catch (final IOException e1) { e1.printStackTrace(); } }); RecognitionScreenView.LOG.getClass(); }
/** * Loads the <class name>.fxml file, which is expected to be in the same package as the specified type. * <br/> <br/> * Sets: * <ul> * <li>the {@link ClassLoader} to the ClassLoader of the specified type</li> * <li>the {@link ResourceBundle} by looking for a {@code Bundle.properties} file in the package of the specified * type (or a locale specific derivation) using the default {@link Locale}</li> * </ul> * * The root element of the FXML document is expected to be: * <br/> <br/> * {@code <fx:root type="{super-type}" xmlns:fx="http://javafx.com/fxml">} * <br/> <br/> * where "super-type" is the super type of the specified type. * @param type the type * @param rootController the Object acting as the root and as the controller. * @throws IOException */ public static void loadRoot(Class<?> type, final Object rootController) throws IOException { FXMLLoader loader = createFXMLLoader(type); loader.setRoot(rootController); loader.setController(rootController); load(loader, type); }
@Override public Node createContent() { FXMLLoader fxmlLoader=null; if (controller.getFxmlResource() != GenericFilterController.EMPTY_DUMMY_URL) { fxmlLoader = new FXMLLoader(controller.getFxmlResource()); fxmlLoader.setController(controller); } if (fxmlLoader != null) { try { return (Parent) fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } } return new Group(); } }
/** * Load a content from an FXML definition */ protected Node loadFXML(URL fxmlLocation) { try { if (fxmlLocation != null) { final FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(fxmlLocation); fxmlLoader.setController(this); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory()); return fxmlLoader.load(); } } catch (final IOException e) { e.printStackTrace(); } return null; }
/** * Load a content from an FXML definition */ public static Object loadFXML(URL fxmlLocation, Object controller) { Object result = null; try { Assert.notNull(fxmlLocation); Assert.notNull(controller); final FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(fxmlLocation); fxmlLoader.setController(controller); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory()); result = fxmlLoader.load(); } catch (final Exception e) { e.printStackTrace(); throw new IllegalArgumentException(e); } return result; }
public void openGuiColorsDialog() { FXMLLoader loader = new FXMLLoader(getClass().getResource("GuiColors.fxml")); GuiColorsController guiColorsController = new GuiColorsController(previewPane.getScene(), settingsModel); loader.setController(guiColorsController); try { AnchorPane guiColorsPane = (AnchorPane)loader.load(); Scene scene = new Scene(guiColorsPane); Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); dialog.setScene(scene); dialog.showAndWait(); } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor * @param clientContext the DOlphin Platform client context * @param controllerName the controller name of the Dolphin Platform controller definition on the server that should * be used with this view. * @param fxmlLocation the location (url) of the FXML file that defines the layout of the view. */ public AbstractFXMLViewBinder(ClientContext clientContext, String controllerName, URL fxmlLocation) { super(clientContext, controllerName); Assert.requireNonNull(fxmlLocation, "fxmlLocation"); try { FXMLLoader loader = new FXMLLoader(fxmlLocation); loader.setController(this); rootNode = loader.load(); } catch (Exception e) { throw new FxmlLoadException("Can not create view based on FXML location " + fxmlLocation, e); } }
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); loader.setController(this); loader.load(); controller.setMainWindow(primaryStage); controller.enableNetworkProcessorClientProperty().set(true); controller.setLidarScanMessageConsumer(lidarScanLogViewer::renderLidarScanMessage); lidarScanLogViewer.start(); lidarScanLogWriterControlPaneController.initialize(controller, lidarScanLogViewer); lidarScanLogReaderControlPaneController.initialize(controller); View3DFactory view3dFactory = View3DFactory.createSubscene(); view3dFactory.addCameraController(); view3dFactory.addWorldCoordinateSystem(0.3); view3dFactory.attachSubSceneTo(centerPane); view3dFactory.addNodeToView(lidarScanLogViewer.getRoot()); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.setScene(new Scene(mainPane, 600, 400)); primaryStage.show(); primaryStage.setOnCloseRequest(event -> stop()); }
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); loader.setController(this); loader.load(); controller.setMainWindow(primaryStage); controller.enableNetworkProcessorClientProperty().set(true); controller.setLidarScanMessageConsumer(lidarScanLogViewer::renderLidarScanMessage); lidarScanLogViewer.start(); lidarScanLogWriterControlPaneController.initialize(controller, lidarScanLogViewer); lidarScanLogReaderControlPaneController.initialize(controller); View3DFactory view3dFactory = View3DFactory.createSubscene(); view3dFactory.addCameraController(); view3dFactory.addWorldCoordinateSystem(0.3); view3dFactory.attachSubSceneTo(centerPane); view3dFactory.addNodeToView(lidarScanLogViewer.getRoot()); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.setScene(new Scene(mainPane, 600, 400)); primaryStage.show(); primaryStage.setOnCloseRequest(event -> stop()); }
loader.setController(this); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); mainPane = loader.load();