Search in sources :

Example 1 with AboutPane

use of se.trixon.almond.util.fx.dialogs.about.AboutPane in project java-jotasync by trixon.

the class MainApp method initActions.

private void initActions() {
    // DRAWER
    // history
    mHistoryAction = new Action(Dict.HISTORY.toString(), (ActionEvent event) -> {
        mWorkbench.hideNavigationDrawer();
        mWorkbench.openModule(mHistoryModule);
    });
    mHistoryAction.disabledProperty().bind(mManager.connectedProperty().not());
    // options
    mOptionsAction = new Action(Dict.OPTIONS.toString(), (ActionEvent event) -> {
        mWorkbench.hideNavigationDrawer();
        displayOptions();
    });
    // help
    mHelpAction = new Action(Dict.HELP.toString(), (ActionEvent event) -> {
        mWorkbench.hideNavigationDrawer();
        SystemHelper.desktopBrowse("https://trixon.se/projects/jotasync/documentation/");
    });
    // about rsync
    mAboutRsyncAction = new Action(String.format(Dict.ABOUT_S.toString(), "rsync"), (ActionEvent event) -> {
        mWorkbench.hideNavigationDrawer();
        try {
            String aboutRsync = mManager.getServerCommander().getAboutRsync();
            mWorkbench.showInformationDialog(String.format(Dict.ABOUT_S.toString(), "rsync"), aboutRsync, null);
        } catch (RemoteException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mAboutRsyncAction.disabledProperty().bind(mManager.connectedProperty().not());
    // about
    mAboutAction = new Action(Dict.ABOUT.toString(), (ActionEvent event) -> {
        mWorkbench.hideNavigationDrawer();
        PomInfo pomInfo = new PomInfo(MainApp.class, "se.trixon", "jotasync");
        AboutModel aboutModel = new AboutModel(SystemHelper.getBundle(getClass(), "about"), SystemHelperFx.getResourceAsImageView(MainApp.class, "logo.png"));
        aboutModel.setAppVersion(pomInfo.getVersion());
        AboutPane aboutPane = new AboutPane(aboutModel);
        double scaledFontSize = FxHelper.getScaledFontSize();
        Label appLabel = new Label(aboutModel.getAppName());
        appLabel.setFont(new Font(scaledFontSize * 1.8));
        Label verLabel = new Label(String.format("%s %s", Dict.VERSION.toString(), aboutModel.getAppVersion()));
        verLabel.setFont(new Font(scaledFontSize * 1.2));
        Label dateLabel = new Label(aboutModel.getAppDate());
        dateLabel.setFont(new Font(scaledFontSize * 1.2));
        VBox box = new VBox(appLabel, verLabel, dateLabel);
        box.setAlignment(Pos.CENTER_LEFT);
        box.setPadding(new Insets(0, 0, 0, 22));
        BorderPane topBorderPane = new BorderPane(box);
        topBorderPane.setLeft(aboutModel.getImageView());
        topBorderPane.setPadding(new Insets(22));
        BorderPane mainBorderPane = new BorderPane(aboutPane);
        mainBorderPane.setTop(topBorderPane);
        WorkbenchDialog dialog = WorkbenchDialog.builder(Dict.ABOUT.toString(), mainBorderPane, ButtonType.CLOSE).build();
        mWorkbench.showDialog(dialog);
    });
}
Also used : Action(org.controlsfx.control.action.Action) BorderPane(javafx.scene.layout.BorderPane) PomInfo(se.trixon.almond.util.PomInfo) AboutPane(se.trixon.almond.util.fx.dialogs.about.AboutPane) Insets(javafx.geometry.Insets) ActionEvent(javafx.event.ActionEvent) Label(javafx.scene.control.Label) AboutModel(se.trixon.almond.util.fx.AboutModel) Font(javafx.scene.text.Font) WorkbenchDialog(com.dlsc.workbenchfx.model.WorkbenchDialog) RemoteException(java.rmi.RemoteException) VBox(javafx.scene.layout.VBox)

Aggregations

WorkbenchDialog (com.dlsc.workbenchfx.model.WorkbenchDialog)1 RemoteException (java.rmi.RemoteException)1 ActionEvent (javafx.event.ActionEvent)1 Insets (javafx.geometry.Insets)1 Label (javafx.scene.control.Label)1 BorderPane (javafx.scene.layout.BorderPane)1 VBox (javafx.scene.layout.VBox)1 Font (javafx.scene.text.Font)1 Action (org.controlsfx.control.action.Action)1 PomInfo (se.trixon.almond.util.PomInfo)1 AboutModel (se.trixon.almond.util.fx.AboutModel)1 AboutPane (se.trixon.almond.util.fx.dialogs.about.AboutPane)1