Java Examples for javafx.application.HostServices

The following java examples will help you to understand the usage of javafx.application.HostServices. These source code samples are taken from different open source projects.

Example 1
Project: SnakeFX-master  File: Launcher.java View source code
@Override
public void start(final Stage primaryStage) {
    EasyDI easyDI = new EasyDI();
    easyDI.bindProvider(HostServices.class, this::getHostServices);
    easyDI.bindInterface(HighscoreDao.class, HighscoreJsonDao.class);
    easyDI.markAsSingleton(GridModel.class);
    MvvmFX.setCustomDependencyInjector(easyDI::getInstance);
    final ViewTuple<MainView, MainViewModel> viewTuple = FluentViewLoader.fxmlView(MainView.class).load();
    Scaling.detectDefaultScaling();
    final int fontSize = Scaling.getFontSize();
    Scene scene = new Scene(viewTuple.getView(), fontSize * 60, fontSize * 50);
    Scaling.enableScaling(scene);
    scene.setOnKeyPressed(easyDI.getInstance(KeyboardHandler.class));
    CentralViewModel viewModel = easyDI.getInstance(CentralViewModel.class);
    highscorePopup = new TriggerablePopup(HighscoreView.class, primaryStage);
    highscorePopup.trigger().bindBidirectional(viewModel.highscoreWindowOpen);
    newHighscorePopup = new TriggerablePopup(NewHighscoreView.class, highscorePopup.getStage());
    newHighscorePopup.trigger().bindBidirectional(viewModel.newHighscoreWindowOpen);
    primaryStage.setTitle("SnakeFX");
    primaryStage.setScene(scene);
    primaryStage.sizeToScene();
    primaryStage.show();
}
Example 2
Project: VisibleTesla-master  File: VersionUpdater.java View source code
//"https://dl.dropboxusercontent.com/u/7045813/VTExtras/test_versions.xml";
/*==============================================================================
 * -------                                                               -------
 * -------              Public Interface To This Class                   ------- 
 * -------                                                               -------
 *============================================================================*/
public static boolean checkForNewerVersion(String thisVersion, Stage stage, final HostServices svcs, boolean experimentalOK) {
    final Versions versions = Versions.getVersionInfo(VersionsFile);
    // Missing, empty, or corrupt versions file
    if (versions == null)
        return false;
    List<Release> releases = versions.getReleases();
    if (releases != null && !releases.isEmpty()) {
        Release lastRelease = null;
        for (Release cur : releases) {
            if (cur.getInvisible())
                continue;
            if (cur.getExperimental() && !experimentalOK)
                continue;
            lastRelease = cur;
            break;
        }
        if (lastRelease == null)
            return false;
        String releaseNumber = lastRelease.getReleaseNumber();
        if (Utils.compareVersions(thisVersion, releaseNumber) < 0) {
            VBox customPane = new VBox();
            String msgText = String.format("A newer version of VisibleTesla is available:\n" + "Version: %s, Date: %tD", releaseNumber, lastRelease.getReleaseDate());
            Label msg = new Label(msgText);
            Hyperlink platformLink = null;
            final URL platformURL;
            final String linkText;
            if (SystemUtils.IS_OS_MAC) {
                linkText = "Download the latest Mac version";
                platformURL = lastRelease.getMacURL();
            } else if (SystemUtils.IS_OS_WINDOWS) {
                linkText = "Download the latest Windows version";
                platformURL = lastRelease.getWindowsURL();
            } else {
                linkText = "Download the latest Generic version";
                platformURL = lastRelease.getReleaseURL();
            }
            if (platformURL != null) {
                platformLink = new Hyperlink(linkText);
                platformLink.setStyle("-fx-color: blue; -fx-text-fill: blue;");
                platformLink.setOnAction(new EventHandler<ActionEvent>() {

                    @Override
                    public void handle(ActionEvent t) {
                        svcs.showDocument(platformURL.toExternalForm());
                    }
                });
            }
            Hyperlink rnLink = new Hyperlink("Click to view the release notes");
            rnLink.setOnAction(new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent t) {
                    svcs.showDocument(versions.getReleaseNotes().toExternalForm());
                }
            });
            customPane.getChildren().addAll(msg, rnLink);
            customPane.getChildren().add(platformLink);
            Dialogs.showCustomDialog(stage, customPane, "Newer Version Available", "Checking for Updates", Dialogs.DialogOptions.OK, null);
            return true;
        }
    }
    return false;
}
Example 3
Project: TerasologyLauncher-master  File: ApplicationController.java View source code
public void initialize(final File newLauncherDirectory, final File newDownloadDirectory, final File newTempDirectory, final BaseLauncherSettings newLauncherSettings, final TerasologyGameVersions newGameVersions, final Stage newStage, final HostServices hostServices) {
    this.launcherDirectory = newLauncherDirectory;
    this.downloadDirectory = newDownloadDirectory;
    this.tempDirectory = newTempDirectory;
    this.launcherSettings = newLauncherSettings;
    this.gameVersions = newGameVersions;
    this.stage = newStage;
    this.hostServies = hostServices;
    // add Logback view appender view to both the root logger and the tab
    Logger rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    if (rootLogger instanceof ch.qos.logback.classic.Logger) {
        ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) rootLogger;
        LogViewAppender viewLogger = new LogViewAppender(loggingView);
        viewLogger.setContext(logbackLogger.getLoggerContext());
        // CHECK: do I really need to start it manually here?
        viewLogger.start();
        logbackLogger.addAppender(viewLogger);
    }
    gameStarter = new GameStarter();
    populateJobBox();
    downloadButton.managedProperty().bind(downloadButton.visibleProperty());
    cancelDownloadButton.managedProperty().bind(cancelDownloadButton.visibleProperty());
    updateGui();
}
Example 4
Project: grantmaster-master  File: AboutTabController.java View source code
public void setHostServices(HostServices hostServices) {
    this.hostServices = hostServices;
}
Example 5
Project: Illarion-Java-master  File: GuiModel.java View source code
@Nonnull
public HostServices getHostServices() {
    return hostServices;
}
Example 6
Project: sportstracker-master  File: STContextImpl.java View source code
@Override
public HostServices getHostServices() {
    return application.getHostServices();
}
Example 7
Project: Augendiagnose-master  File: Application.java View source code
/**
	 * Get the host services.
	 *
	 * @return The host services.
	 */
public static HostServices getApplicationHostServices() {
    return mHostServices;
}
Example 8
Project: MinimaxSimulator-master  File: Main.java View source code
/**
     * Gets the {@link HostServices} of the application.<br>
     * This method is meant to be a static version of {@link Application#getHostServices()}.
     *
     * @return
     *          the {@code HostServices} of the application
     */
public static HostServices getHostServicesStatic() {
    return hostServices;
}
Example 9
Project: livestreamer-twitch-gui-master  File: MainController.java View source code
public void setHostServices(HostServices hostServices) {
    this.hostServices = hostServices;
}
Example 10
Project: AsciidocFX-master  File: ApplicationController.java View source code
public void setHostServices(HostServices hostServices) {
    this.hostServices = hostServices;
}