javafx.util.BuilderFactory Java Examples
The following examples show how to use
javafx.util.BuilderFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OldScoresModule.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override protected void configure() { String mathRecenteredJSONFile = MATH_RECENTERED_JSON_FILE; String verbalRecenteredJSONFile = VERBAL_RECENTERED_JSON_FILE; String settingsFileName = SETTINGS_FILE_NAME; bind(BuilderFactory.class).to(JavaFXBuilderFactory.class); bind(String.class).annotatedWith(Names.named("mathRecenteredJSONFile")).toInstance(mathRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("verbalRecenteredJSONFile")).toInstance(verbalRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("settingsFileName")).toInstance(settingsFileName); bind(SettingsDAO.class).to(SettingsDAOImpl.class).asEagerSingleton(); bind(RecenteredDAO.class).to(RecenteredDAOImpl.class).asEagerSingleton(); bindInterceptor(Matchers.subclassesOf(ManagedDataSource.class), Matchers.any(), new ManagedDataSourceInterceptor()); }
Example #2
Source File: OldScoresModule.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override protected void configure() { String mathRecenteredJSONFile = MATH_RECENTERED_JSON_FILE; String verbalRecenteredJSONFile = VERBAL_RECENTERED_JSON_FILE; String settingsFileName = SETTINGS_FILE_NAME; bind(BuilderFactory.class).to(JavaFXBuilderFactory.class); bind(String.class).annotatedWith(Names.named("mathRecenteredJSONFile")).toInstance(mathRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("verbalRecenteredJSONFile")).toInstance(verbalRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("settingsFileName")).toInstance(settingsFileName); bind(SettingsDAO.class).to(SettingsDAOImpl.class).asEagerSingleton(); bind(RecenteredDAO.class).to(RecenteredDAOImpl.class).asEagerSingleton(); }
Example #3
Source File: OldScoresModule.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override protected void configure() { String mathRecenteredJSONFile = MATH_RECENTERED_JSON_FILE; String verbalRecenteredJSONFile = VERBAL_RECENTERED_JSON_FILE; String settingsFileName = SETTINGS_FILE_NAME; bind(BuilderFactory.class).to(JavaFXBuilderFactory.class); bind(String.class).annotatedWith(Names.named("mathRecenteredJSONFile")).toInstance(mathRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("verbalRecenteredJSONFile")).toInstance(verbalRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("settingsFileName")).toInstance(settingsFileName); bind(SettingsDAO.class).to(SettingsDAOImpl.class).asEagerSingleton(); bind(RecenteredDAO.class).to(RecenteredDAOImpl.class).asEagerSingleton(); bindInterceptor(Matchers.subclassesOf(ManagedDataSource.class), Matchers.any(), new ManagedDataSourceInterceptor()); }
Example #4
Source File: ShapePropInjector.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Override protected void configure() throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { bindToInstance(JfxUI.class, Mockito.mock(LaTeXDraw.class)); bindToInstance(Injector.class, this); bindToInstance(BuilderFactory.class, new LatexdrawBuilderFactory(this)); bindAsEagerSingleton(LaTeXDataService.class); bindAsEagerSingleton(PreferencesService.class); bindAsEagerSingleton(EditingService.class); bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle()); bindAsEagerSingleton(ShapeFactoryImpl.class); bindAsEagerSingleton(PSTViewsFactory.class); bindAsEagerSingleton(ViewFactory.class); bindAsEagerSingleton(SVGShapesFactory.class); bindAsEagerSingleton(Canvas.class); bindWithCommand(Drawing.class, Canvas.class, canvas -> canvas.getDrawing()); bindWithCommand(MagneticGrid.class, Canvas.class, canvas -> canvas.getMagneticGrid()); bindWithCommand(ViewsSynchroniserHandler.class, Canvas.class, canvas -> canvas); bindAsEagerSingleton(PSTCodeGenerator.class); bindWithCommand(LaTeXGenerator.class, PSTCodeGenerator.class, gen -> gen); bindAsEagerSingleton(SVGDocumentGenerator.class); }
Example #5
Source File: DesignerUtil.java From pmd-designer with BSD 2-Clause "Simplified" License | 6 votes |
public static BuilderFactory customBuilderFactory(@NonNull DesignerRoot owner) { return type -> { boolean needsRoot = Arrays.stream(type.getConstructors()).anyMatch(it -> ArrayUtils.contains(it.getParameterTypes(), DesignerRoot.class)); if (needsRoot) { // Controls that need the DesignerRoot can declare a constructor // with a parameter w/ signature @NamedArg("designerRoot") DesignerRoot // to be injected with the relevant instance of the app. ProxyBuilder<Object> builder = new ProxyBuilder<>(type); builder.put("designerRoot", owner); return builder; } else { return null; //use default } }; }
Example #6
Source File: TestExporter.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Export.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root); pane.setCenter(stage.getScene().getRoot()); stage.getScene().setRoot(pane); }
Example #7
Source File: OldScoresApplication1.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { if( logger.isDebugEnabled() ) { logger.debug("[START]"); } Injector injector = Guice.createInjector(new OldScoresModule()); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml1/MainView.fxml"), null, injector.getInstance(BuilderFactory.class), injector.getInstance(GuiceControllerFactory.class)); Parent p = loader.load(); MainViewController mv = loader.getController(); Scene scene = new Scene( p ); scene.setOnKeyPressed(evt -> { if( evt.getCode().equals(KeyCode.F1) ) { try { if( logger.isDebugEnabled() ) { logger.debug("[OPEN HELP]"); } mv.openHelpDialog(); } catch (IOException exc) { String msg = "error showing help dialog"; logger.error(msg); Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.showAndWait(); } } }); primaryStage.setTitle("Old Scores"); primaryStage.setScene(scene); primaryStage.show(); }
Example #8
Source File: OldScoresApplication2.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { if( logger.isDebugEnabled() ) { logger.debug("[START]"); } Injector injector = Guice.createInjector(new OldScoresModule()); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml2/MainView.fxml"), null, injector.getInstance(BuilderFactory.class), injector.getInstance(GuiceControllerFactory.class)); Parent p = loader.load(); MainViewController mv = loader.getController(); Scene scene = new Scene( p ); scene.setOnKeyPressed(evt -> { if( evt.getCode().equals(KeyCode.F1) ) { try { if( logger.isDebugEnabled() ) { logger.debug("[OPEN HELP]"); } mv.openHelpDialog(); } catch (IOException exc) { String msg = "error showing help dialog"; logger.error(msg); Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.showAndWait(); } } }); primaryStage.setTitle("Old Scores"); primaryStage.setScene(scene); primaryStage.show(); }
Example #9
Source File: TestShapeDeleter.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Deleter.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root); pane.setCenter(stage.getScene().getRoot()); stage.getScene().setRoot(pane); }
Example #10
Source File: TestUndoRedoManager.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Undo.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root); pane.setCenter(stage.getScene().getRoot()); stage.getScene().setRoot(pane); }
Example #11
Source File: TestZoomer.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Zoom.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root); pane.setCenter(stage.getScene().getRoot()); stage.getScene().setRoot(pane); }
Example #12
Source File: TestTemplateManager.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final TitledPane root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/Template.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root.getContent()); pane.setCenter(stage.getScene().getRoot()); stage.getScene().setRoot(pane); }
Example #13
Source File: TestCopierCutterPaster.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void start(final Stage aStage) throws Exception { super.start(aStage); final Parent root = FXMLLoader.load(LaTeXDraw.class.getResource("/fxml/CopyPaste.fxml"), injector.getInstance(ResourceBundle.class), injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); final BorderPane pane = new BorderPane(); pane.setTop(root); pane.setCenter(aStage.getScene().getRoot()); aStage.getScene().setRoot(pane); }
Example #14
Source File: LaTeXDraw.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override public void start(final Stage stage) { final Task<Void> task = new Task<>() { @Override protected Void call() throws IOException { updateProgress(0.1, 1d); final CountDownLatch latch = new CountDownLatch(1); Platform.runLater(() -> { mainStage = new Stage(StageStyle.DECORATED); mainStage.setIconified(true); injector = new LatexdrawInjector(LaTeXDraw.this); latch.countDown(); }); // We need to wait for the javafx thread to perform its job before loading the UI (because of the injector). try { latch.await(); }catch(final InterruptedException ex) { Thread.currentThread().interrupt(); throw new RuntimeException(ex); } final PreferencesService prefs = injector.getInstance(PreferencesService.class); prefs.readPreferences(); final Parent root = FXMLLoader.load(getClass().getResource("/fxml/UI.fxml"), prefs.getBundle(), //NON-NLS injector.getInstance(BuilderFactory.class), cl -> injector.getInstance(cl)); updateProgress(0.6, 1d); final Scene scene = new Scene(root); updateProgress(0.7, 1d); scene.getStylesheets().add("css/style.css"); //NON-NLS // Binding the title of the app on the title of the drawing. mainStage.titleProperty().bind(injector.getInstance(Drawing.class).titleProperty().concat(" -- " + LABEL_APP)); updateProgress(0.8, 1d); Platform.runLater(() -> { mainStage.setScene(scene); updateProgress(0.9, 1d); setModified(false); mainStage.show(); registerScene(scene); // Preventing the stage to close automatically. mainStage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, WindowEvent::consume); mainStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png")); //NON-NLS mainStage.centerOnScreen(); injector.getInstance(TabSelector.class).centreViewport(); injector.getInstance(Canvas.class).requestFocus(); // Checking a new version if required. if(VersionChecker.WITH_UPDATE && injector.getInstance(PreferencesSetter.class).isVersionCheckEnable()) { new Thread(new VersionChecker(injector.getInstance(StatusBarController.class), prefs.getBundle())).start(); } setModified(false); }); return null; } }; task.setOnFailed(BadaboomCollector.INSTANCE); showSplash(stage, task); new Thread(task).start(); }
Example #15
Source File: TestTabSelector.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override protected Injector createInjector() { return new Injector() { @Override protected void configure() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { bindToInstance(Injector.class, this); bindToInstance(BuilderFactory.class, new LatexdrawBuilderFactory(this)); bindToInstance(JfxUI.class, Mockito.mock(LaTeXDraw.class)); bindToSupplier(Stage.class, () -> stage); bindAsEagerSingleton(PreferencesService.class); bindAsEagerSingleton(LaTeXDataService.class); bindAsEagerSingleton(EditingService.class); bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle()); bindAsEagerSingleton(ViewFactory.class); bindAsEagerSingleton(SVGShapesFactory.class); bindAsEagerSingleton(PSTViewsFactory.class); bindAsEagerSingleton(Canvas.class); bindWithCommand(Drawing.class, Canvas.class, canvas -> canvas.getDrawing()); bindWithCommand(MagneticGrid.class, Canvas.class, canvas -> canvas.getMagneticGrid()); bindWithCommand(ViewsSynchroniserHandler.class, Canvas.class, canvas -> canvas); bindAsEagerSingleton(SVGDocumentGenerator.class); bindAsEagerSingleton(ExceptionsManager.class); bindAsEagerSingleton(ShortcutsController.class); bindToInstance(HostServices.class, Mockito.mock(HostServices.class)); bindAsEagerSingleton(StatusBarController.class); bindAsEagerSingleton(AboutController.class); bindAsEagerSingleton(CanvasController.class); bindToInstance(Border.class, Mockito.mock(Border.class)); bindAsEagerSingleton(FacadeCanvasController.class); bindToInstance(Zoomer.class, zoomer); bindToInstance(UndoRedoManager.class, undo); bindToInstance(EditingSelector.class, selector); bindAsEagerSingleton(PSTCodeGenerator.class); bindWithCommand(LaTeXGenerator.class, PSTCodeGenerator.class, gen -> gen); bindAsEagerSingleton(CodePanelController.class); bindToInstance(DrawingPropertiesCustomiser.class, Mockito.mock(DrawingPropertiesCustomiser.class)); bindToInstance(TemplateManager.class, Mockito.mock(TemplateManager.class)); bindToInstance(CodeInserter.class, Mockito.mock(CodeInserter.class)); bindToInstance(CopierCutterPaster.class, paster); bindToInstance(ShapeArcCustomiser.class, Mockito.mock(ShapeArcCustomiser.class)); bindToInstance(ShapeArrowCustomiser.class, Mockito.mock(ShapeArrowCustomiser.class)); bindToInstance(ShapeAxesCustomiser.class, Mockito.mock(ShapeAxesCustomiser.class)); bindToInstance(ShapeBorderCustomiser.class, Mockito.mock(ShapeBorderCustomiser.class)); bindToInstance(ShapeCoordDimCustomiser.class, Mockito.mock(ShapeCoordDimCustomiser.class)); bindToInstance(ShapeDotCustomiser.class, Mockito.mock(ShapeDotCustomiser.class)); bindToInstance(ShapeDoubleBorderCustomiser.class, Mockito.mock(ShapeDoubleBorderCustomiser.class)); bindToInstance(ShapeFillingCustomiser.class, Mockito.mock(ShapeFillingCustomiser.class)); bindToInstance(ShapeFreeHandCustomiser.class, Mockito.mock(ShapeFreeHandCustomiser.class)); bindToInstance(ShapeGridCustomiser.class, Mockito.mock(ShapeGridCustomiser.class)); bindToInstance(ShapePlotCustomiser.class, Mockito.mock(ShapePlotCustomiser.class)); bindToInstance(ShapeRotationCustomiser.class, Mockito.mock(ShapeRotationCustomiser.class)); bindToInstance(ShapeShadowCustomiser.class, Mockito.mock(ShapeShadowCustomiser.class)); bindToInstance(ShapeStdGridCustomiser.class, Mockito.mock(ShapeStdGridCustomiser.class)); bindToInstance(ShapeTextCustomiser.class, Mockito.mock(ShapeTextCustomiser.class)); bindToInstance(MetaShapeCustomiser.class, meta); bindToInstance(PreferencesSetter.class, prefSetter); bindToInstance(FileLoaderSaver.class, Mockito.mock(FileLoaderSaver.class)); bindToInstance(Exporter.class, Mockito.mock(Exporter.class)); bindToInstance(TextSetter.class, textSetter); bindToInstance(Hand.class, Mockito.mock(Hand.class)); bindToInstance(Helper.class, Mockito.mock(Helper.class)); bindToInstance(Pencil.class, Mockito.mock(Pencil.class)); bindToInstance(ShapeDeleter.class, deleter); bindToInstance(ShapeGrouper.class, Mockito.mock(ShapeGrouper.class)); bindToInstance(ShapePositioner.class, Mockito.mock(ShapePositioner.class)); bindToInstance(ShapeTransformer.class, Mockito.mock(ShapeTransformer.class)); bindAsEagerSingleton(TabSelector.class); } }; }
Example #16
Source File: LatexdrawInjector.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override protected void configure() throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { bindToInstance(Injector.class, this); bindToInstance(JfxUI.class, app); bindToInstance(Application.class, app); bindToInstance(LaTeXDraw.class, app); bindToSupplier(Stage.class, () -> app.getMainStage()); bindToInstance(BuilderFactory.class, new LatexdrawBuilderFactory(this)); bindAsEagerSingleton(LaTeXDataService.class); bindAsEagerSingleton(PreferencesService.class); bindAsEagerSingleton(BadaboomController.class); bindAsEagerSingleton(EditingService.class); bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle()); bindAsEagerSingleton(ViewFactory.class); bindAsEagerSingleton(PSTViewsFactory.class); bindAsEagerSingleton(SVGShapesFactory.class); bindAsEagerSingleton(ExceptionsManager.class); bindAsEagerSingleton(ShortcutsController.class); bindWithCommand(HostServices.class, Application.class, fxApp -> fxApp.getHostServices()); bindAsEagerSingleton(StatusBarController.class); bindAsEagerSingleton(AboutController.class); bindAsEagerSingleton(Canvas.class); bindWithCommand(MagneticGrid.class, Canvas.class, canvas -> canvas.getMagneticGrid()); bindAsEagerSingleton(CanvasController.class); bindWithCommand(Drawing.class, Canvas.class, canvas -> canvas.getDrawing()); bindWithCommand(ViewsSynchroniserHandler.class, Canvas.class, canvas -> canvas); bindAsEagerSingleton(SVGDocumentGenerator.class); bindAsEagerSingleton(Zoomer.class); bindAsEagerSingleton(UndoRedoManager.class); bindAsEagerSingleton(PSTCodeGenerator.class); bindWithCommand(LaTeXGenerator.class, PSTCodeGenerator.class, gen -> gen); bindAsEagerSingleton(CodePanelController.class); bindAsEagerSingleton(DrawingPropertiesCustomiser.class); bindAsEagerSingleton(TemplateManager.class); bindAsEagerSingleton(CodeInserter.class); bindAsEagerSingleton(CopierCutterPaster.class); bindAsEagerSingleton(Exporter.class); bindAsEagerSingleton(PreferencesSetter.class); bindAsEagerSingleton(FileLoaderSaver.class); bindAsEagerSingleton(Helper.class); bindAsEagerSingleton(TextSetter.class); bindAsEagerSingleton(Pencil.class); bindAsEagerSingleton(Hand.class); bindAsEagerSingleton(ShapeArcCustomiser.class); bindAsEagerSingleton(ShapeArrowCustomiser.class); bindAsEagerSingleton(ShapeAxesCustomiser.class); bindAsEagerSingleton(ShapeBorderCustomiser.class); bindAsEagerSingleton(ShapeCoordDimCustomiser.class); bindAsEagerSingleton(ShapeDeleter.class); bindAsEagerSingleton(ShapeDotCustomiser.class); bindAsEagerSingleton(ShapeDoubleBorderCustomiser.class); bindAsEagerSingleton(ShapeFillingCustomiser.class); bindAsEagerSingleton(ShapeFreeHandCustomiser.class); bindAsEagerSingleton(ShapeGridCustomiser.class); bindAsEagerSingleton(ShapeGrouper.class); bindAsEagerSingleton(ShapeGridTransformer.class); bindAsEagerSingleton(ShapePlotCustomiser.class); bindAsEagerSingleton(ShapePositioner.class); bindAsEagerSingleton(ShapeRotationCustomiser.class); bindAsEagerSingleton(ShapeShadowCustomiser.class); bindAsEagerSingleton(ShapeStdGridCustomiser.class); bindAsEagerSingleton(ShapeTextCustomiser.class); bindAsEagerSingleton(ShapeTransformer.class); bindAsEagerSingleton(MetaShapeCustomiser.class); bindAsEagerSingleton(Border.class); bindAsEagerSingleton(FacadeCanvasController.class); bindAsEagerSingleton(EditingSelector.class); bindAsEagerSingleton(TabSelector.class); }
Example #17
Source File: OldScoresApplication3.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { if( logger.isDebugEnabled() ) { logger.debug("[START]"); } Injector injector = Guice.createInjector(new OldScoresModule()); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml3/MainView.fxml"), null, injector.getInstance(BuilderFactory.class), injector.getInstance(GuiceControllerFactory.class)); Parent p = loader.load(); MainViewController mv = loader.getController(); Scene scene = new Scene( p ); scene.setOnKeyPressed(evt -> { if( evt.getCode().equals(KeyCode.F1) ) { try { if( logger.isDebugEnabled() ) { logger.debug("[OPEN HELP]"); } injector.getInstance(NavigationDelegate.class).openHelpDialog(); } catch (Exception exc) { String msg = "error showing help dialog"; logger.error(msg); Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.showAndWait(); } } }); primaryStage.setTitle("Old Scores"); primaryStage.setScene(scene); primaryStage.show(); }