Search in sources :

Example 1 with UpdaterView

use of org.mapton.base.ui.updater.UpdaterView in project mapton by trixon.

the class UpdaterTopComponent method createScene.

private Scene createScene() {
    UpdaterView updaterView = new UpdaterView();
    Action updateAction = new Action(Dict.UPDATE.toString(), event -> {
        updaterView.update();
    });
    updateAction.setGraphic(MaterialIcon._Action.SYSTEM_UPDATE_ALT.getImageView(getIconSizeToolBarInt()));
    Action refreshAction = new Action(Dict.REFRESH.toString(), event -> {
        updaterView.refreshUpdaters();
    });
    refreshAction.setGraphic(MaterialIcon._Navigation.REFRESH.getImageView(getIconSizeToolBarInt()));
    Action clearAction = new Action(Dict.CLEAR.toString(), event -> {
        updaterView.clear();
    });
    clearAction.setGraphic(MaterialIcon._Content.CLEAR.getImageView(getIconSizeToolBarInt()));
    List<Action> actions = Arrays.asList(updateAction, refreshAction, clearAction);
    ToolBar toolBar = ActionUtils.createToolBar(actions, ActionUtils.ActionTextBehavior.SHOW);
    toolBar.getItems().stream().filter((item) -> (item instanceof ButtonBase)).map((item) -> (ButtonBase) item).forEachOrdered((buttonBase) -> {
        FxHelper.undecorateButton(buttonBase);
    });
    toolBar.setStyle("-fx-spacing: 0px;");
    toolBar.setPadding(Insets.EMPTY);
    updateAction.disabledProperty().bind(updaterView.runningProperty().or(updaterView.selectedProperty().not()));
    refreshAction.disabledProperty().bind(updaterView.runningProperty());
    BorderPane root = new BorderPane(updaterView.getLogPanel());
    root.setLeft(updaterView.getListNode());
    root.setTop(toolBar);
    return new Scene(root);
}
Also used : TopComponent(org.openide.windows.TopComponent) Scene(javafx.scene.Scene) Arrays(java.util.Arrays) ActionID(org.openide.awt.ActionID) ConvertAsProperties(org.netbeans.api.settings.ConvertAsProperties) ToolBar(javafx.scene.control.ToolBar) ButtonBase(javafx.scene.control.ButtonBase) Action(org.controlsfx.control.action.Action) ActionUtils(org.controlsfx.control.action.ActionUtils) MTopComponent(org.mapton.core.api.MTopComponent) MaterialIcon(se.trixon.almond.util.icons.material.MaterialIcon) ActionReference(org.openide.awt.ActionReference) UpdaterView(org.mapton.base.ui.updater.UpdaterView) List(java.util.List) ActionReferences(org.openide.awt.ActionReferences) Insets(javafx.geometry.Insets) Dict(se.trixon.almond.util.Dict) Mapton.getIconSizeToolBarInt(org.mapton.api.Mapton.getIconSizeToolBarInt) BorderPane(javafx.scene.layout.BorderPane) NbBundle(org.openide.util.NbBundle) FxHelper(se.trixon.almond.util.fx.FxHelper) Action(org.controlsfx.control.action.Action) BorderPane(javafx.scene.layout.BorderPane) UpdaterView(org.mapton.base.ui.updater.UpdaterView) ToolBar(javafx.scene.control.ToolBar) ButtonBase(javafx.scene.control.ButtonBase) Scene(javafx.scene.Scene)

Aggregations

Arrays (java.util.Arrays)1 List (java.util.List)1 Insets (javafx.geometry.Insets)1 Scene (javafx.scene.Scene)1 ButtonBase (javafx.scene.control.ButtonBase)1 ToolBar (javafx.scene.control.ToolBar)1 BorderPane (javafx.scene.layout.BorderPane)1 Action (org.controlsfx.control.action.Action)1 ActionUtils (org.controlsfx.control.action.ActionUtils)1 Mapton.getIconSizeToolBarInt (org.mapton.api.Mapton.getIconSizeToolBarInt)1 UpdaterView (org.mapton.base.ui.updater.UpdaterView)1 MTopComponent (org.mapton.core.api.MTopComponent)1 ConvertAsProperties (org.netbeans.api.settings.ConvertAsProperties)1 ActionID (org.openide.awt.ActionID)1 ActionReference (org.openide.awt.ActionReference)1 ActionReferences (org.openide.awt.ActionReferences)1 NbBundle (org.openide.util.NbBundle)1 TopComponent (org.openide.windows.TopComponent)1 Dict (se.trixon.almond.util.Dict)1 FxHelper (se.trixon.almond.util.fx.FxHelper)1