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);
}
Aggregations