javafx.application.HostServices Java Examples

The following examples show how to use javafx.application.HostServices. 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: PdfsamApp.java    From pdfsam with GNU Affero General Public License v3.0 7 votes vote down vote up
@EventListener
public void openUrl(OpenUrlRequest event) {
    HostServices services = getHostServices();
    if (nonNull(services)) {
        try {
            services.showDocument(event.getUrl());
        } catch (NullPointerException npe) {
            // service delegate can be null but there's no way to check it first so we have to catch the npe
            LOG.info("Unable to open url using HostServices, trying fallback");
            try {
                Runtime.getRuntime().exec(getOpenCmd(event.getUrl()));
            } catch (IOException e) {
                LOG.warn("Unable to open the url", e);
            }
        }
    } else {
        LOG.warn("Unable to open '{}', please copy and paste the url to your browser.", event.getUrl());
    }
}
 
Example #2
Source File: TestExporter.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Injector createInjector() {
	return new ShapePropInjector() {
		@Override
		protected void configure() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
			super.configure();
			bindToSupplier(Stage.class, () -> stage);
			bindToInstance(CanvasController.class, Mockito.mock(CanvasController.class));
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindToInstance(StatusBarController.class, Mockito.mock(StatusBarController.class));
			bindAsEagerSingleton(PSTCodeGenerator.class);
			bindToInstance(TextSetter.class, Mockito.mock(TextSetter.class));
			bindToInstance(ShapeCoordDimCustomiser.class, Mockito.mock(ShapeCoordDimCustomiser.class));
			bindAsEagerSingleton(Border.class);
			bindAsEagerSingleton(FacadeCanvasController.class);
			bindToInstance(TemplateManager.class, Mockito.mock(TemplateManager.class));
			bindAsEagerSingleton(Exporter.class);
			bindToInstance(Pencil.class, Mockito.mock(Pencil.class));
			bindAsEagerSingleton(Hand.class);
		}
	};
}
 
Example #3
Source File: DesignerRootImpl.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public DesignerRootImpl(Stage mainStage, DesignerParams params, HostServices hostServices) {
    this.mainStage = mainStage;
    this.developerMode = params.isDeveloperMode();

    registerService(LOGGER, new EventLoggerImpl(this));

    // vetoed by any other key press, so that eg CTRL+V repeatedly vetoes it
    mainStage.addEventHandler(KeyEvent.KEY_PRESSED, e -> isCtrlDown.setValue(
        e.isControlDown() && e.getCode() == KeyCode.CONTROL));
    mainStage.addEventHandler(KeyEvent.KEY_RELEASED, e -> isCtrlDown.setValue(
        e.isControlDown() && e.getCode() == KeyCode.CONTROL));

    GlobalDiskManagerImpl diskManager = new GlobalDiskManagerImpl(this, params.getSettingsDirectory());
    registerService(DISK_MANAGER, diskManager);

    params.processDefaults(diskManager.defaultAppStateFile());

    registerService(HOST_SERVICES, hostServices);
    registerService(PERSISTENCE_MANAGER, new OnDiskPersistenceManager(this, params.getPersistedInputFile(), params.getPersistedOutputFile()));
    registerService(NODE_SELECTION_CHANNEL, new MessageChannel<>(Category.SELECTION_EVENT_TRACING));
    registerService(LATEST_XPATH, new MessageChannel<>(Category.SELECTION_EVENT_TRACING));
    registerService(TEST_LOADER, new MessageChannel<>(Category.TEST_LOADING_EVENT));
    registerService(TEST_CREATOR, new TestCreatorService());
    registerService(TREE_RENDERER_REGISTRY, new TreeRendererRegistry(this));
    registerService(IS_NODE_BEING_DRAGGED, Var.newSimpleVar(false));
}
 
Example #4
Source File: StartUpView.java    From LogFX with GNU General Public License v3.0 6 votes vote down vote up
public StartUpView( HostServices hostServices,
                    Stage stage,
                    Consumer<File> openFile ) {
    VBox box = new AboutLogFXView( hostServices ).createNode();

    String metaKey = FxUtils.isMac() ? "⌘" : "Ctrl+";

    Hyperlink link = new Hyperlink( String.format( "Open file (%sO)", metaKey ) );
    link.getStyleClass().add( "large-background-text" );
    link.setOnAction( ( event ) -> new FileOpener( stage, openFile ) );

    Text dropText = new Text( "Or drop files here" );
    dropText.getStyleClass().add( "large-background-text" );

    StackPane fileDropPane = new StackPane( dropText );
    fileDropPane.getStyleClass().add("drop-file-pane");

    FileDragAndDrop.install( fileDropPane, openFile );

    box.getChildren().addAll( link, fileDropPane );
    getChildren().addAll( box );
}
 
Example #5
Source File: TestCodeInserter.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
@ConfigureInjection
Injector createInjector() {
	return new Injector() {
		@Override
		protected void configure() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
			status = Mockito.mock(StatusBarController.class);
			bindToInstance(Injector.class, this);
			bindAsEagerSingleton(PreferencesService.class);
			bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle());
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindToInstance(CopierCutterPaster.class, Mockito.mock(CopierCutterPaster.class));
			bindToInstance(StatusBarController.class, status);
			bindToInstance(Drawing.class, ShapeFactory.INST.createDrawing());
			bindAsEagerSingleton(CodeInserter.class);
		}
	};
}
 
Example #6
Source File: TestFileLoaderSaver.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Injector createInjector() {
	return new Injector() {
		@Override
		protected void configure() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
			bindToInstance(Injector.class, this);
			bindAsEagerSingleton(PreferencesService.class);
			bindAsEagerSingleton(LaTeXDataService.class);
			bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle());
			bindToInstance(LaTeXGenerator.class, Mockito.mock(LaTeXGenerator.class));
			bindAsEagerSingleton(ViewFactory.class);
			bindAsEagerSingleton(SVGShapesFactory.class);
			bindToInstance(JfxUI.class, Mockito.mock(LaTeXDraw.class));
			bindToSupplier(Stage.class, () -> stage);
			bindToInstance(PreferencesSetter.class, Mockito.mock(PreferencesSetter.class));
			bindToInstance(StatusBarController.class, Mockito.mock(StatusBarController.class));
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindToInstance(Drawing.class, ShapeFactory.INST.createDrawing());
			bindToInstance(Canvas.class, Mockito.mock(Canvas.class));
			bindAsEagerSingleton(SVGDocumentGenerator.class);
			bindAsEagerSingleton(FileLoaderSaver.class);
		}
	};
}
 
Example #7
Source File: TestHelper.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Injector createInjector() {
	return new Injector() {
		@Override
		protected void configure() throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
			bindToInstance(Injector.class, this);
			bindAsEagerSingleton(PreferencesService.class);
			bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle());
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindAsEagerSingleton(ShortcutsController.class);
			bindAsEagerSingleton(AboutController.class);
			bindAsEagerSingleton(Helper.class);
		}
	};
}
 
Example #8
Source File: MainController.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
@SneakyThrows
@Override
public void initialize(URL location, ResourceBundle resources) {
    hostServices = beanFactory.getBean(HostServices.class);
    StageConstants.primaryStage = beanFactory.getBean(Stage.class);

    // 把菜单的长度和主布局控件绑定
    menuBar.prefWidthProperty().bind(borderPane.widthProperty());

    dataSourceTreeViewInit.treeViewInit(treeViewDataSource);

    // init mapperCheckBox
    mapperCheckBoxInit.checkBoxInit(mapperCheckBoxHBox1, mapperCheckBoxHBox2);

    // 从文件加载数据源至pane
    dataSourceTreeItemInit.initLoadData(treeItemDataSourceRoot);
    // 添加表搜索监听
    dataSourceTreeItemInit.addListenOnDataSourceBorderPane(treeViewDataSource);

    FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setLocation(getClass().getResource("/fxml/component/vbox-context-menu.fxml"));
    fxmlLoader.setControllerFactory(beanFactory::getBean);

    ListView<HBox> rightListViewInit = fxmlLoader.load();
    borderPane1.setCenter(rightListViewInit);
}
 
Example #9
Source File: TestStatusBarController.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testClickHyperlink() {
	final Hyperlink link = find("#link");
	Cmds.of(CmdFXVoid.of(() -> {
		link.setText("gridGapProp");
		link.setVisible(true);
	}), () -> clickOn(link)).execute();
	Mockito.verify(injector.getInstance(HostServices.class), Mockito.times(1)).showDocument("gridGapProp");
}
 
Example #10
Source File: TestStatusBarController.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Injector createInjector() {
	return new Injector() {
		@Override
		protected void configure() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
			bindAsEagerSingleton(PreferencesService.class);
			bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle());
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindAsEagerSingleton(StatusBarController.class);
		}
	};
}
 
Example #11
Source File: MapperGenApplication.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
@Override
public void init() {
    applicationContext = SpringApplication.run(MapperGenApplication.class);
    fxmlLoader = new FXMLLoader();
    fxmlLoader.setControllerFactory(applicationContext::getBean);
    HostServices hostServices = getHostServices();
    applicationContext.getBeanFactory().registerSingleton("hostServices", hostServices);
}
 
Example #12
Source File: Helper.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public Helper(final Injector injector, final ResourceBundle lang, final HostServices services) {
	super();
	this.injector = Objects.requireNonNull(injector);
	this.lang = Objects.requireNonNull(lang);
	this.services = Objects.requireNonNull(services);
}
 
Example #13
Source File: TestEditingSelector.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Injector createInjector() {
	return new Injector() {
		@Override
		protected void configure() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
			bindToInstance(Injector.class, this);
			bindAsEagerSingleton(PreferencesService.class);
			bindToInstance(LaTeXDataService.class, Mockito.mock(LaTeXDataService.class));
			bindToInstance(EditingService.class, Mockito.mock(EditingService.class));
			bindWithCommand(ResourceBundle.class, PreferencesService.class, pref -> pref.getBundle());
			bindAsEagerSingleton(ViewFactory.class);
			bindToInstance(TextSetter.class, Mockito.mock(TextSetter.class));
			bindToInstance(LaTeXGenerator.class, Mockito.mock(LaTeXGenerator.class));
			bindToInstance(HostServices.class, Mockito.mock(HostServices.class));
			bindToInstance(ShapeTextCustomiser.class, Mockito.mock(ShapeTextCustomiser.class));
			bindToInstance(ShapePlotCustomiser.class, Mockito.mock(ShapePlotCustomiser.class));
			bindToInstance(Drawing.class, ShapeFactory.INST.createDrawing());
			bindToInstance(Hand.class, Mockito.mock(Hand.class));
			bindToInstance(Canvas.class, Mockito.mock(Canvas.class));
			bindToInstance(Pencil.class, Mockito.mock(Pencil.class));
			bindToInstance(ShapeAxesCustomiser.class, Mockito.mock(ShapeAxesCustomiser.class));
			bindToInstance(ShapeDoubleBorderCustomiser.class, Mockito.mock(ShapeDoubleBorderCustomiser.class));
			bindToInstance(ShapeFreeHandCustomiser.class, Mockito.mock(ShapeFreeHandCustomiser.class));
			bindToInstance(ShapeCoordDimCustomiser.class, Mockito.mock(ShapeCoordDimCustomiser.class));
			bindToInstance(ShapeShadowCustomiser.class, Mockito.mock(ShapeShadowCustomiser.class));
			bindToInstance(ShapeTransformer.class, Mockito.mock(ShapeTransformer.class));
			bindToInstance(ShapeGrouper.class, Mockito.mock(ShapeGrouper.class));
			bindToInstance(ShapePositioner.class, Mockito.mock(ShapePositioner.class));
			bindToInstance(ShapeRotationCustomiser.class, Mockito.mock(ShapeRotationCustomiser.class));
			bindToInstance(ShapeDotCustomiser.class, Mockito.mock(ShapeDotCustomiser.class));
			bindToInstance(ShapeBorderCustomiser.class, Mockito.mock(ShapeBorderCustomiser.class));
			bindToInstance(ShapeArcCustomiser.class, Mockito.mock(ShapeArcCustomiser.class));
			bindToInstance(ShapeFillingCustomiser.class, Mockito.mock(ShapeFillingCustomiser.class));
			bindToInstance(ShapeGridCustomiser.class, Mockito.mock(ShapeGridCustomiser.class));
			bindToInstance(ShapeArrowCustomiser.class, Mockito.mock(ShapeArrowCustomiser.class));
			bindToInstance(ShapeStdGridCustomiser.class, Mockito.mock(ShapeStdGridCustomiser.class));
			bindToInstance(MetaShapeCustomiser.class, Mockito.mock(MetaShapeCustomiser.class));
			bindToInstance(MagneticGrid.class, Mockito.mock(MagneticGrid.class));
			bindToInstance(Border.class, Mockito.mock(Border.class));
			bindToInstance(ShapeDeleter.class, Mockito.mock(ShapeDeleter.class));
			bindToInstance(CodeInserter.class, Mockito.mock(CodeInserter.class));
			bindAsEagerSingleton(EditingSelector.class);
		}
	};
}
 
Example #14
Source File: LatexdrawInjector.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@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 #15
Source File: TestHelper.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Before
public void setUp() {
	helper = injector.getInstance(Helper.class);
	services = injector.getInstance(HostServices.class);
}
 
Example #16
Source File: StatusBarController.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public StatusBarController(final HostServices services) {
	super();
	this.services = Objects.requireNonNull(services);
}
 
Example #17
Source File: TestTabSelector.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@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 #18
Source File: ApplicationController.java    From AsciidocFX with Apache License 2.0 4 votes vote down vote up
public void setHostServices(HostServices hostServices) {
    this.hostServices = hostServices;
}
 
Example #19
Source File: ApplicationController.java    From AsciidocFX with Apache License 2.0 4 votes vote down vote up
public HostServices getHostServices() {
    return hostServices;
}
 
Example #20
Source File: AboutLogFXView.java    From LogFX with GNU General Public License v3.0 4 votes vote down vote up
public AboutLogFXView( HostServices hostServices ) {
    this.hostServices = hostServices;
}
 
Example #21
Source File: Controller.java    From ModPackDownloader with MIT License 4 votes vote down vote up
void setHostServices(HostServices hostServices) {
	this.hostServices = hostServices;
}
 
Example #22
Source File: AboutDialog.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@FxThread
protected void createContent(@NotNull final VBox root) {
    super.createContent(root);

    final JfxApplication application = JfxApplication.getInstance();
    final HostServices hostServices = application.getHostServices();

    final GridPane gridPane = new GridPane();

    final Label applicationLabel = new Label(Config.TITLE);
    applicationLabel.setGraphic(new ImageView(Icons.APPLICATION_64));

    final Label versionLabel = new Label(Messages.ABOUT_DIALOG_VERSION + ":");
    versionLabel.prefWidthProperty().bind(gridPane.widthProperty().multiply(0.5));

    final Label versionField = new Label(Config.STRING_VERSION);

    final Label projectHomeLabel = new Label(Messages.ABOUT_DIALOG_PROJECT_HOME + ":");

    final Hyperlink projectHomeField = new Hyperlink("bitbucket.org");
    projectHomeField.setOnAction(event -> hostServices.showDocument(PROJECT_HOME));
    projectHomeField.setFocusTraversable(false);

    final Label forumThreadLabel = new Label(Messages.ABOUT_DIALOG_FORUM_THREAD + ":");

    final Hyperlink forumThreadField = new Hyperlink("hub.jmonkeyengine.org");
    forumThreadField.setOnAction(event -> hostServices.showDocument(FORUM_THREAD));
    forumThreadField.setFocusTraversable(false);

    final Label usedLibrariesLabel = new Label(Messages.ABOUT_DIALOG_USED_LIBRARIES + ":");
    usedLibrariesLabel.prefWidthProperty().bind(gridPane.widthProperty());

    final Label usedIcons = new Label(Messages.ABOUT_DIALOG_USED_ICONS + ":");
    usedIcons.prefWidthProperty().bind(gridPane.widthProperty());

    final TextArea librariesArea = new TextArea(LIBRARIES);
    librariesArea.setEditable(false);
    librariesArea.setFocusTraversable(false);

    final TextArea iconsArea = new TextArea(ICONS);
    iconsArea.setEditable(false);
    iconsArea.setFocusTraversable(false);

    gridPane.add(applicationLabel, 0, 0, 2, 1);
    gridPane.add(versionLabel, 0, 1, 1, 1);
    gridPane.add(versionField, 1, 1, 1, 1);
    gridPane.add(projectHomeLabel, 0, 2, 1, 1);
    gridPane.add(projectHomeField, 1, 2, 1, 1);
    gridPane.add(forumThreadLabel, 0, 3, 1, 1);
    gridPane.add(forumThreadField, 1, 3, 1, 1);
    gridPane.add(usedLibrariesLabel, 0, 4, 2, 1);
    gridPane.add(librariesArea, 0, 5, 2, 1);
    gridPane.add(usedIcons, 0, 6, 2, 1);
    gridPane.add(iconsArea, 0, 7, 2, 1);

    FXUtils.addToPane(gridPane, root);

    FXUtils.addClassTo(root, CssClasses.ABOUT_DIALOG);
    FXUtils.addClassTo(gridPane, CssClasses.DEF_GRID_PANE);
    FXUtils.addClassTo(usedLibrariesLabel, usedIcons, CssClasses.ABOUT_DIALOG_LONG_LABEL);
    FXUtils.addClassesTo(versionLabel, projectHomeLabel, forumThreadLabel, usedLibrariesLabel, usedIcons,
            versionField, projectHomeField, forumThreadField, CssClasses.SPECIAL_FONT_16);
    FXUtils.addClassTo(applicationLabel, CssClasses.ABOUT_DIALOG_TITLE_LABEL);
}
 
Example #23
Source File: JfxEnv.java    From AudioBookConverter with GNU General Public License v2.0 4 votes vote down vote up
public JfxEnv(Scene scene, HostServices hostServices) {
    this.scene = scene;
    this.hostServices = hostServices;
}
 
Example #24
Source File: ArmMenuBar.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * creates all the graphical elements in the menu bar
 * @param services the host services to use http clickable links
 */
public ArmMenuBar(HostServices services){
	this.services = services;
	
     Menu fileMenu = new Menu("File");
     Menu windowMenu = new Menu("Window");
     Menu runMenu = new Menu("Run");
     Menu helpMenu = new Menu("Help");

    //FILE
    this.neW = new MenuItem("New");
    this.openFile = new MenuItem("Open File...");
    this.save = new MenuItem("Save");
    this.saveAs = new MenuItem("Save As...");
    this.preferences = new MenuItem("Preferences");
    this.exitMenu = new MenuItem("Exit");
    fileMenu.getItems().addAll(neW, openFile, new SeparatorMenuItem(), save, saveAs,new SeparatorMenuItem(), preferences, new SeparatorMenuItem(), exitMenu);

    //WINDOW
    this.newMemoryWindow = new MenuItem("new Memory");
    this.newRegistersWindow = new MenuItem("new Registers");
    this.newLedGameWindow = new MenuItem("new Led Game");
    this.newEightSegmentDisplayWindow = new MenuItem("EightSegment");
    windowMenu.getItems().addAll(this.newMemoryWindow, this.newRegistersWindow, this.newLedGameWindow, this.newEightSegmentDisplayWindow);

    //RUN
    this.switchMode = new MenuItem("Switch Mode");
    this.runMenuItem = new MenuItem("Run");
    this.runStepMenuItem = new MenuItem("Run Step by Step");
    this.stopMenuItem = new MenuItem("Stop");
    this.reloadMenuItem = new MenuItem("Reload");
    runMenu.getItems().addAll(this.switchMode, runMenuItem, runStepMenuItem, stopMenuItem, reloadMenuItem);

    final MenuItem aboutMenu = new MenuItem("About");
    helpMenu.getItems().add(aboutMenu);

    Menu interpreter = new Menu("Interpreter");
    this.newInterpreterWindow = new MenuItem("Launch");
    interpreter.getItems().add(newInterpreterWindow);
    
    this.menuBar = new MenuBar();
    menuBar.getMenus().addAll(fileMenu, windowMenu, runMenu, interpreter, helpMenu);

    disableInEdition = new HashSet<>();
    disableInExecution = new HashSet<>();

    disableInExecution.add(neW);
    disableInExecution.add(openFile);
    disableInExecution.add(save);
    disableInExecution.add(saveAs);

    disableInEdition.add(runMenuItem);
    disableInEdition.add(runStepMenuItem);
    disableInEdition.add(stopMenuItem);
    disableInEdition.add(reloadMenuItem);

    exitMenu.setOnAction(actionEvent -> Platform.exit());
    
    aboutMenu.setOnAction(actionEvent -> {
        	final Stage aboutPopUp = new Stage();
            aboutPopUp.setTitle("#@RMStrong");
            Image applicationIcon = new Image("file:logo.png");
            aboutPopUp.getIcons().add(applicationIcon);
            aboutPopUp.getIcons().add(applicationIcon);
            aboutPopUp.setTitle("About - #@RMStrong");
            
try {
	VBox main = FXMLLoader.load(getClass().getResource("/resources/aboutView.fxml"));
	main.getStylesheets().add("/resources/style.css");
	aboutPopUp.setScene(new Scene(main, 500, 280));
	Hyperlink gitLink = (Hyperlink)main.lookup("#linkGit");
	gitLink.setOnAction(actionEvent1 -> this.services.showDocument(gitLink.getText()));
	
} catch (IOException e) {
	e.printStackTrace();
}

            aboutPopUp.show();
        });
}
 
Example #25
Source File: MZmineGUI.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void openWebPage(URL url) {
  HostServices openWPService = getHostServices();
  openWPService.showDocument(String.valueOf(url));
}
 
Example #26
Source File: Application.java    From Augendiagnose with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the host services.
 *
 * @return The host services.
 */
public static HostServices getApplicationHostServices() {
	return mHostServices;
}
 
Example #27
Source File: LocalServerServicesController.java    From arcgis-runtime-samples-java with Apache License 2.0 2 votes vote down vote up
/**
 * Allows access to the Host Services of the main JavaFX application.
 * 
 * @param hostServices Hosted Services from main JavaFX application
 */
void setHostServices(HostServices hostServices) {

  this.hostServices = hostServices;
}
 
Example #28
Source File: EditorUtil.java    From jmonkeybuilder with Apache License 2.0 2 votes vote down vote up
/**
 * Get the host services.
 *
 * @return the host services.
 */
@FxThread
public static @NotNull HostServices getHostServices() {
    return jfxApplication.getHostServices();
}
 
Example #29
Source File: NSLMainController.java    From ns-usbloader with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Provide hostServices to Settings tab
 * */
public void setHostServices(HostServices hs ){ SettingsTabController.registerHostServices(hs);}
 
Example #30
Source File: SettingsController.java    From ns-usbloader with GNU General Public License v3.0 votes vote down vote up
public void registerHostServices(HostServices hostServices){this.hs = hostServices;}