public void setOnRetryButtonClicked(EventHandler<? super MouseEvent> event) { getFailurePanel().getRetryButton().setOnMouseClicked(event); } }
/** * {@inheritDoc} */ @Override protected void initEventHandlers() throws CoreException { // Listen events // Manage Pooled Command Button getView().getPooledCommand().setOnMouseClicked(getHandler(MouseEvent.MOUSE_CLICKED)); }
protected void setNextButtonAction(EventHandler<MouseEvent> nextButtonAction) { nextButton.setOnMouseClicked(event -> { nextButton.setDisable(true); nextButtonAction.handle(event); }); this.getParent().setOnCloseRequest(event -> { if (this.messageWaitingForResponse != null) { this.messageWaitingForResponse.sendCancelSignal(); } event.consume(); }); }
/** * {@inheritDoc} */ @Override protected Node createContent() { final Label descriptionLabel = new Label(); descriptionLabel.textProperty().bind(description); descriptionLabel.setWrapText(true); final GridPane propertiesGrid = createPropertiesGrid(); final Region spacer = new Region(); spacer.getStyleClass().add("detailsButtonSpacer"); final Button saveButton = new Button(tr("Save")); saveButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutChanged()).ifPresent( onShortcutChanged -> onShortcutChanged.accept(getControl().getShortcut()))); return new VBox(descriptionLabel, propertiesGrid, spacer, saveButton); }
/** * This method populates the advanced tools button group. */ private SidebarGroup<Button> createAdvancedToolsGroup() { final Button createShortcut = new Button(tr("Create shortcut")); createShortcut.getStyleClass().addAll("sidebarButton", "openTerminal"); createShortcut.setOnMouseClicked(event -> onCreateShortcut.run()); final Button runScript = new Button(tr("Run a script")); runScript.getStyleClass().addAll("sidebarButton", "scriptButton"); runScript.setOnMouseClicked(event -> { final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(tr("Open Script...")); // TODO: use correct owner window final File scriptToRun = fileChooser.showOpenDialog(null); if (scriptToRun != null) { onScriptRun.accept(scriptToRun); } }); final Button runConsole = new Button(tr("{0} console", applicationName)); runConsole.getStyleClass().addAll("sidebarButton", "consoleButton"); runConsole.setOnMouseClicked(event -> onOpenConsole.run()); SidebarGroup<Button> advancedToolsGroup = new SidebarGroup<>(tr("Advanced Tools")); advancedToolsGroup.getComponents().addAll(createShortcut, /* runScript, */runConsole); return advancedToolsGroup; }
runButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutRun()) .ifPresent(onShortcutRun -> onShortcutRun.accept(getControl().getShortcut()))); GridPane.setHalignment(runButton, HPos.CENTER); stopButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutStop()) .ifPresent(onShortcutStop -> onShortcutStop.accept(getControl().getShortcut()))); GridPane.setHalignment(stopButton, HPos.CENTER); uninstallButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutUninstall()) .ifPresent(onShortcutUninstall -> onShortcutUninstall.accept(getControl().getShortcut()))); GridPane.setHalignment(uninstallButton, HPos.CENTER);
runExecutable.setOnMouseClicked(event -> { this.lockAll(); FileChooser fileChooser = new FileChooser();
installButton.setOnMouseClicked(evt -> { try { Optional.ofNullable(getControl().getOnEngineInstall()) deleteButton.setOnMouseClicked(evt -> { try { Optional.ofNullable(getControl().getOnEngineDelete())
verbButton.getStyleClass().addAll("toolButton"); verbButton.setStyle("-fx-background-image: url('" + verb.getIcon() + "');"); verbButton.setOnMouseClicked(event -> { this.lockAll();
/** * {@inheritDoc} */ @Override public void initialise() { pause.durationProperty().bind(getControl().delayProperty()); // add an input listener to the text field getSearchField().textProperty().addListener(event -> { pause.setOnFinished(pauseEvent -> { final String searchTerm = getSearchField().getText().toLowerCase(); getControl().setSearchTerm(searchTerm); }); // delay the adoption of the new search term pause.playFromStart(); }); // add a mouse click listener to the clear button getClearButton().setOnMouseClicked(event -> { getSearchField().clear(); getControl().searchTermProperty().set(""); }); }
createButton.setOnMouseClicked(event -> { boolean error = false;
deleteButton.setOnMouseClicked(event -> this.onDeleteContainer.accept(container)); openFileBrowserButton.setOnMouseClicked(event -> this.onOpenFileBrowser.accept(container));
protected void drawFooter() { HBox footer = new HBox(); footer.setAlignment(Pos.CENTER_RIGHT); footer.setPadding(new Insets(8)); footer.setSpacing(10); footer.setPrefHeight(45); footer.setId("footer"); getParent().getRoot().setBottom(footer); Button cancelButton = new Button(tr("Cancel")); nextButton = new Button(tr("Next")); footer.getChildren().addAll(cancelButton, nextButton); cancelButton.setOnMouseClicked(event -> { cancelButton.setDisable(true); messageWaitingForResponse.sendCancelSignal(); }); }
/** * 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; }); }
/** * Refreshes the shown scripts. * When this method is called it begins by clearing the <code>scriptGrid</code>. * Afterwards this method refills it. */ private void updateScripts(final GridPane scriptGrid) { scriptGrid.getChildren().clear(); for (int i = 0; i < filteredScripts.size(); i++) { ScriptDTO script = filteredScripts.get(i); final Label scriptName = new Label(script.getScriptName()); GridPane.setHgrow(scriptName, Priority.ALWAYS); if (getControl().isShowScriptSource()) { final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource())); Tooltip.install(scriptName, tooltip); } final Button installButton = new Button(tr("Install")); installButton.setOnMouseClicked(evt -> { try { installScript(script); } catch (IllegalArgumentException e) { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("Error while trying to download the installer")) .withException(e) .build(); errorDialog.showAndWait(); } }); scriptGrid.addRow(i, scriptName, installButton); } }