Button verbButton = new Button(verb.getScriptName()); verbButton.getStyleClass().addAll("toolButton"); verbButton.setStyle("-fx-background-image: url('" + verb.getIcon() + "');"); verbButton.setOnMouseClicked(event -> { this.lockAll();
public Builder(ScriptDTO scriptDTO) { this.withTypeId(scriptDTO.getTypeId()) .withCategoryId(scriptDTO.getCategoryId()) .withApplicationId(scriptDTO.getApplicationId()) .withId(scriptDTO.getId()) .withScriptName(scriptDTO.getScriptName()) .withScript(scriptDTO.getScript()) .withCompatibleOperatingSystems(scriptDTO.getCompatibleOperatingSystems()) .withTestingOperatingSystems(scriptDTO.getTestingOperatingSystems()) .withFree(scriptDTO.isFree()) .withRequiresPatch(scriptDTO.requiresPatch) .withIcon(scriptDTO.getIcon()); }
/** * Constructor * * @param control The control belonging to the skin */ public ContainerEngineToolsPanelSkin(ContainerEngineToolsPanel control) { super(control); // map the tool scripts to a tool button this.toolButtons = new MappedList<>(control.getEngineToolScripts(), tool -> { final Button toolButton = new Button(tool.getScriptName()); toolButton.getStyleClass().addAll("toolButton"); toolButton.setStyle("-fx-background-image: url('" + tool.getIcon() + "');"); toolButton.disableProperty().bind(getControl().lockToolsProperty()); toolButton.setOnMouseClicked(event -> { getControl().setLockTools(true); final ContainerDTO container = getControl().getContainer(); // TODO: find a better way to get the engine ID getControl().getEngineToolsManager().runTool(container.getEngine().toLowerCase(), container.getName(), tool.getId(), () -> getControl().setLockTools(false), e -> Platform.runLater(() -> { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("Error")) .withException(e) .build(); errorDialog.showAndWait(); })); }); return toolButton; }); }