public FXMLLoader fxmlLoader() { final FXMLLoader loader = new FXMLLoader(StandardCharsets.UTF_8); loader.setControllerFactory(clazz -> MapStream.of(constructors) .filterKey(clazz::isAssignableFrom) .values() .findFirst() .map(Supplier::get) .map(injector::inject) .orElseThrow(() -> new SpeedmentToolException( "FXML Controller '" + clazz.getName() + "' have not been installed in " + getClass().getSimpleName() + "." ))); return loader; }
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 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; }
static void showNotification(FlowPane area, String message, Icon icon, Palette palette, Runnable onClose) { final FXMLLoader loader = new FXMLLoader(NotificationController.class.getResource(NOTIFICATION_FXML)); final AtomicReference<NotificationController> ref = new AtomicReference<>(); loader.setControllerFactory(clazz -> {
FXMLLoader fxmlLoader = new FXMLLoader(DesignerUtil.getFxml("auxclasspath-setup-popup.fxml"));
= new FXMLLoader(DesignerUtil.getFxml("designer.fxml"));
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; }
try { Stage popup = new Stage(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("generate-xpath-from-stack-trace.fxml")); Parent root = loader.load(); Button button = (Button) loader.getNamespace().get("generateButton");
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ui/popup/MainPopup.fxml")); loader.setController(new InputController()); toolbarPopup = new JFXPopup(loader.load());
@Nonnull protected FXMLLoader createFxmlLoader(@Nonnull URL viewResource) { return new FXMLLoader(viewResource); }
public static FXMLLoader load(Class clazz) { final FXMLLoader loader = new FXMLLoader(FXUtil.class.getClassLoader().getResource(resource(clazz))); return loader; } }
/** * Loads and parses a fxml document. * * @param fxml * the stream containing the document * @param closeStream * close the stream after processing */ public void load(InputStream fxml, boolean closeStream) throws Exception { FXMLLoader loader = new FXMLLoader(); fxmlRoot = loader.load(fxml); if (closeStream) fxml.close(); }
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); } } });
FXMLLoader loadSynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException { final FXMLLoader loader = new FXMLLoader(resource, bundle); PresenterFactory factory = discover(); Callback<Class<?>, Object> controllerFactory = (Class<?> p) -> factory.instantiatePresenter(p, this.injectionContext); loader.setControllerFactory(controllerFactory); try { loader.load(); } catch (IOException ex) { throw new IllegalStateException("Cannot load " + conventionalName, ex); } return loader; }
/** * Loads an object hierarchy from a FXML document.<br> * * @param <T> the object's type * @param location the url * @return the object * @throws IOException if loading failed */ public static <T> T load(URL location) throws IOException { FXMLLoader loader = new FXMLLoader(location, null, FxFactory.getInstance().getBuilderFactory()); return loader.load(); }
/** * Loads an object hierarchy from a FXML document.<br> * * @param <T> the object's type * @param location the url * @param resources the optional resources * @return the object * @throws IOException if loading failed */ public static <T> T load(URL location, ResourceBundle resources) throws IOException { FXMLLoader loader = new FXMLLoader(location, resources, FxFactory.getInstance().getBuilderFactory()); return loader.load(); }
@Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Scene.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); scene.getStylesheets().add("/styles/Styles.css"); stage.setTitle("Pose List 3D Plot"); stage.setScene(scene); FXMLController controller = loader.getController(); controller.setStage(stage); stage.show(); }
/** * 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; }