private Button addButton(final ListView<String> listView) { final Button button = new Button("Add Item", FontAwesome.PLUS.view()); button.setOnAction(e -> { final int newIndex = listView.getItems().size(); final Set<String> set = new HashSet<>(strings); final AtomicInteger i = new AtomicInteger(0); while (!set.add(DEFAULT_FIELD + i.incrementAndGet())) {} listView.getItems().add(DEFAULT_FIELD + i.get()); listView.scrollTo(newIndex); listView.getSelectionModel().select(newIndex); // There is a strange behavior in JavaFX if you try to start editing // a field on the same animation frame as another field lost focus. // Therefore, we wait one animation cycle before setting the field // into the editing state runLater(() -> listView.edit(newIndex)); }); return button; }
@Override public void initialize(URL location, ResourceBundle resources) { brand.logoLarge().map(Image::new).ifPresent(titleImage::setImage); license.setText(license.getText().replace("{title}", infoComponent.getTitle())); version.setText(infoComponent.getImplementationVersion()); external.setText(infoComponent.getLicenseName()); close.setOnAction(newCloseHandler()); } }
stage.initModality(Modality.WINDOW_MODAL); setClassPathButton.setOnAction(e -> { stage.close(); onApply.accept(fileListView.getItems()); }); cancelButton.setOnAction(e -> stage.close());
@Override protected void afterShow(Stage stage) { JFXDialogLayout layout = new JFXDialogLayout(); layout.setBody(new Label("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.")); JFXAlert<Void> alert = new JFXAlert<>(stage); alert.setOverlayClose(true); alert.setAnimation(JFXAlertAnimation.CENTER_ANIMATION); alert.setContent(layout); alert.initModality(Modality.NONE); leftButton.setOnAction(action-> alert.showAndWait()); }
@Override public void initialize(URL location, ResourceBundle resources) { BooleanBinding noSelection = fileListView.getSelectionModel().selectedItemProperty().isNull(); removeFileButton.disableProperty().bind(noSelection); moveItemUpButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(0))); // we can't just map the val because we need an ObservableNumberValue IntegerBinding lastIndexBinding = Bindings.createIntegerBinding(() -> fileListView.getItems().size() - 1, Val.wrap(fileListView.itemsProperty()).flatMap(LiveList::sizeOf)); moveItemDownButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(lastIndexBinding))); fileListView.setCellFactory(DesignerUtil.simpleListCellFactory(File::getName, File::getAbsolutePath)); selectFilesButton.setOnAction(e -> onSelectFileClicked()); removeFileButton.setOnAction(e -> onRemoveFileClicked()); moveItemUpButton.setOnAction(e -> moveUp()); moveItemDownButton.setOnAction(e -> moveDown()); }
@Override public void initialize(URL location, ResourceBundle resources) { title.setTextFill(Color.web("#45a6fc")); // TODO Use styleClass instead header.setText("Component Explorer"); final RootItem root = new RootItem(speedment); root.getChildren().addAll(components()); tree.setRoot(root); close.setOnAction(newCloseHandler()); }
@Override public Button createNode() { final Button btn = new Button(text, icon.view()); btn.setTextAlignment(TextAlignment.CENTER); btn.setAlignment(Pos.CENTER); btn.setMnemonicParsing(false); btn.setLayoutX(10); btn.setLayoutY(10); btn.setPadding(new Insets(8, 12, 8, 12)); btn.setOnAction(handler); btn.setTooltip(new Tooltip(tooltip)); return btn; } }
fieldFileBtn.setOnAction(ev -> { fileChooser.setTitle("Open Database File"); buttonConnect.setOnAction(ev -> { final DbmsType type = dbmsType.get();
private Button removeButton(final ListView<String> listView) { final Button button = new Button("Remove Selected", FontAwesome.TIMES.view()); button.setOnAction(e -> { final int selectedIdx = listView.getSelectionModel().getSelectedIndex(); if (selectedIdx != -1 && listView.getItems().size() > 1) { final int newSelectedIdx = (selectedIdx == listView.getItems().size() - 1) ? selectedIdx - 1 : selectedIdx; listView.getItems().remove(selectedIdx); listView.getSelectionModel().select(newSelectedIdx); } }); return button; }
)); okey.setOnAction(ev -> { loader.loadAndShow("Connect");
private Button populateButton(final ListView<String> listView) { final Button button = new Button("Populate", FontAwesome.DATABASE.view()); button.setOnAction(e -> { final Column col = column.getMappedColumn();
@Override public void initialize(URL location, ResourceBundle resources) { commitButton.setOnAction(e -> { commitHandler.ifPresent(Runnable::run); getStage().close(); this.free(); }); commitButton.disableProperty().bind(validationSupport.invalidProperty()); Platform.runLater(() -> { typeId.bind(typeChoiceBox.getSelectionModel().selectedItemProperty()); typeChoiceBox.setConverter(DesignerUtil.stringConverter(PropertyTypeId::getStringId, PropertyTypeId::lookupMnemonic)); typeChoiceBox.getItems().addAll(PropertyTypeId.typeIdsToConstants().values()); FXCollections.sort(typeChoiceBox.getItems()); }); Platform.runLater(this::registerBasicValidators); typeIdProperty().values() .filter(Objects::nonNull) .subscribe(this::registerTypeDependentValidators); }
button.disableProperty().bind(validation.invalidProperty()); button.setOnAction(f -> { DesignerUtil.stackTraceToXPath(area.getText()).ifPresent(xpathExpressionArea::replaceText); popup.close();
btnClose.setOnAction( (ev) -> closeWindow() ); btnProceed.setOnAction( (ev) -> closeWindowAndGenerate()); btnProceed.disableProperty().bind(hasErrors);
button.setOnAction(action -> treeView.scrollTo(treeView.getRow(node))); final StackPane container = new StackPane(button); container.setPickOnBounds(false);
@Override protected void beforeParentInit() { xpathExpressionArea.setSyntaxHighlighter(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); initialiseVersionSelection(); expressionTitledPane.titleProperty().bind(xpathVersionUIProperty.map(v -> "XPath Expression (" + v + ")")); xpathResultListView.setCellFactory(v -> new XpathViolationListCell()); exportXpathToRuleButton.setOnAction(e -> showExportXPathToRuleWizard()); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .map(TextAwareNodeWrapper::getNode) .subscribe(parent::onNodeItemSelected); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) // Reevaluate XPath anytime the expression or the XPath version changes .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); }
}); cancel.setOnAction(ev -> { if (!task.cancel(true)) { LOGGER.error("Failed to cancel task.");
private Button buildButton(String text, boolean response) { Button button = new Button(text); button.getStyleClass().addAll(Style.BUTTON.css()); button.setOnAction(e -> { this.response = response; hide(); }); return button; }
closeButton.setOnAction(action->{ TabPaneBehavior behavior = getBehavior(); if (behavior.canCloseTab(tab)) {
private HBox buildFooter() { Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close")); closeButton.getStyleClass().addAll(Style.BUTTON.css()); closeButton.setTextAlignment(TextAlignment.CENTER); closeButton.setOnAction(e -> eventStudio().broadcast(activeteCurrentModule())); HBox footer = new HBox(closeButton); footer.getStyleClass().addAll(Style.CLOSE_FOOTER.css()); return footer; }