private void hideShowBehaviour(Node node){ node.visibleProperty().bind(enabled); node.managedProperty().bind(enabled); node.disableProperty().bind(Bindings.not(enabled)); }
public void disableByFeature(Node node, String featureName) { node.disableProperty().bind(createFeatureProperty(featureName).not()); }
public void disableByFeature(Node node, String featureName) { node.disableProperty().bind(createFeatureProperty(featureName).not()); }
/** * {@inheritDoc} */ @Override protected Void call() { try { button.setUserData(actionableComp); final Optional<VLViewComponentXML> actionComponent = configuration.getComponentById("Handler"); actionComponent.ifPresent(handler -> ComponentToButtonBaseHelper.setButtonActions(controller, handler, button, e)); } catch (final Exception e) { e.printStackTrace(); } finally { // reenable the button whatever the issue getDisplay().disableProperty().set(false); } return null; }
public static <F> Optional<F> showAndWaitDialog(Window window, F parent, Function<String, F> folderCreator, Predicate<String> folderUnique) { Objects.requireNonNull(window); Objects.requireNonNull(parent); Objects.requireNonNull(folderCreator); Objects.requireNonNull(folderUnique); Dialog<F> dialog = new Dialog<>(); try { dialog.setTitle(RESOURCE_BUNDLE.getString("NewFolder")); dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); NewFolderPane<F> newProjectPane = new NewFolderPane<>(folderCreator, folderUnique); newProjectPane.setPrefSize(350, 100); dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(newProjectPane.validatedProperty().not()); dialog.getDialogPane().setContent(newProjectPane); dialog.setResizable(true); dialog.initOwner(window); dialog.setResultConverter(buttonType -> buttonType == ButtonType.OK ? newProjectPane.createFolder() : null); return dialog.showAndWait(); } finally { dialog.close(); } } }
private void rename() { TreeItem<Object> item = contingencyTree.getSelectionModel().getSelectedItem(); Contingency contingency = (Contingency) item.getValue(); TextInputDialog dialog = new TextInputDialog(contingency.getId()); dialog.setTitle(RESOURCE_BUNDLE.getString("RenameContingency")); dialog.setHeaderText(null); dialog.setGraphic(null); dialog.setContentText(RESOURCE_BUNDLE.getString("Name")); TextField inputField = dialog.getEditor(); BooleanBinding isInvalid = Bindings.createBooleanBinding(() -> inputField.getText().equals(contingency.getId()) || inputField.getText().isEmpty(), inputField.textProperty()); dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(isInvalid); Optional<String> result = dialog.showAndWait(); result.ifPresent(newName -> { contingency.setId(newName); contingencyTree.refresh(); saved.set(false); }); }
public static Optional<String> showAndWaitDialog(AbstractNodeBase node, Predicate<String> nodeNameUnique) { Dialog<String> dialog = new Dialog<>(); try { dialog.setTitle(RESOURCE_BUNDLE.getString("RenameFile")); dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); RenamePane renamePane = new RenamePane(node, nodeNameUnique); renamePane.setPrefSize(350, 100); dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(renamePane.validatedProperty().not()); dialog.getDialogPane().setContent(renamePane); dialog.setResizable(true); dialog.setResultConverter(buttonType -> buttonType == ButtonType.OK ? renamePane.getNameTextField().getText() : null); return dialog.showAndWait(); } finally { dialog.close(); } } }
dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(table.getSelectionModel().selectedItemProperty().isNull());