private static void setTextFieldBehaviour(TextInputControl text, boolean useDefaultValue, ObservableStringValue defaultValue, StringProperty customValue) { if (useDefaultValue) { customValue.unbind(); text.textProperty().bind(defaultValue); } else { text.textProperty().unbind(); text.setText(customValue.get()); customValue.bind(text.textProperty()); } } }
document.typeMapperProperty().bind( binding );
private void refreshSliderValueBinding() { sliderValue.textProperty().unbind(); if (((JFXSlider) getSkinnable()).getValueFactory() != null) { sliderValue.textProperty() .bind(((JFXSlider) getSkinnable()).getValueFactory().call((JFXSlider) getSkinnable())); } else { sliderValue.textProperty().bind(Bindings.createStringBinding(() -> { if (getSkinnable().getLabelFormatter() != null) { return getSkinnable().getLabelFormatter().toString(getSkinnable().getValue()); } else { return String.valueOf(Math.round(getSkinnable().getValue())); } }, getSkinnable().valueProperty())); } }
promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.fontProperty().bind(getSkinnable().fontProperty()); promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.setLayoutX(1);
.map(s -> "(" + s + ")"); workspace.textProperty().bind( Bindings.createStringBinding(() -> String.format( "Speedment settings for %s '%s' %s",
promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.fontProperty().bind(getSkinnable().fontProperty()); promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.setLayoutX(1);
promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.fontProperty().bind(getSkinnable().fontProperty()); promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.setLayoutX(1);
promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.fontProperty().bind(getSkinnable().fontProperty()); promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.setLayoutX(1);
@Override protected Node createUndecoratedEditor() { //TODO: CustomValue should be bound to defaultValue until we disable auto for the first time final HBox container = new HBox(); final TextInputControl textInput = getInputControl(); final CheckBox auto = new CheckBox("Auto"); final boolean useDefaultValue = value.isEmpty().get() || value.get().equals(defaultValue.get()); textInput.disableProperty().bind(auto.selectedProperty()); if (useDefaultValue) { textInput.textProperty().bind(defaultValue); } else { textInput.setText(value.get()); } customValue.bind(textInput.textProperty()); attachListener(textInput.textProperty(), (ov, o, n) -> { if (n == null || n.isEmpty() || n.equalsIgnoreCase(defaultValue.getValue())) { value.setValue(null); } else { value.setValue(n); } }); auto.selectedProperty().setValue(useDefaultValue); attachListener(auto.selectedProperty(), (ov, o, isAuto) -> setTextFieldBehaviour(textInput, isAuto, defaultValue, customValue) ); HBox.setHgrow(textInput, Priority.ALWAYS); HBox.setHgrow(auto, Priority.NEVER); container.getChildren().addAll(auto, textInput); return container; }
public ToolbarTitledPane() { getStyleClass().add("tool-bar-title"); // change the default setCollapsible(false); toolBar.setPadding(Insets.EMPTY); Label titleLabel = new Label("Title"); titleLabel.textProperty().bind(title); titleLabel.getStyleClass().add("title-label"); toolBar.getItems().add(titleLabel); setGraphic(toolBar); // should be an empty string, binding prevents to set it textProperty().bind(Val.constant("")); // The toolbar is too large for the title region and is not // centered unless we bind the height, like follows Val.wrap(toolBar.parentProperty()) .values() .filter(Objects::nonNull) .subscribe(parent -> { // The title region is provided by the skin, // this is the only way to access it outside of css StackPane titleRegion = (StackPane) parent; toolBar.maxHeightProperty().unbind(); toolBar.maxHeightProperty().bind(titleRegion.heightProperty()); toolBar.minHeightProperty().unbind(); toolBar.minHeightProperty().bind(titleRegion.heightProperty()); toolBar.prefHeightProperty().unbind(); toolBar.prefHeightProperty().bind(titleRegion.heightProperty()); }); }
.bind(Bindings.createStringBinding(() -> String.valueOf(treeView.getCurrentItemsCount()), treeView.currentItemsCountProperty())); main.getChildren().add(size);
private void createPromptNode() { if (promptText != null || !linesWrapper.usePromptText.get()) { return; } promptText = new Text(); StackPane.setAlignment(promptText, Pos.CENTER_LEFT); // create my custom pane for the prompt node promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.getStyleClass().addAll("text"); promptText.getTransforms().add(linesWrapper.promptTextScale); promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.setTranslateX(1); linesWrapper.promptContainer.getChildren().add(promptText); if (getSkinnable().isFocused() && ((JFXComboBox<T>) getSkinnable()).isLabelFloat()) { promptText.setTranslateY(-snapPosition(promptText.getBaselineOffset() + promptText.getLayoutBounds().getHeight() * .36)); linesWrapper.promptTextScale.setX(0.85); linesWrapper.promptTextScale.setY(0.85); } }
@Override protected void beforeParentInit() { try { SettingsPersistenceUtil.restoreProperties(this, DesignerUtil.getSettingsFile()); } catch (Exception e) { // shouldn't prevent the app from opening // in case the file is corrupted, it will be overwritten on shutdown e.printStackTrace(); } initializeViewAnimation(); licenseMenuItem.setOnAction(e -> showLicensePopup()); openFileMenuItem.setOnAction(e -> onOpenFileClicked()); openRecentMenu.setOnAction(e -> updateRecentFilesMenu()); openRecentMenu.setOnShowing(e -> updateRecentFilesMenu()); fileMenu.setOnShowing(e -> onFileMenuShowing()); setupAuxclasspathMenuItem.setOnAction(e -> sourceEditorController.showAuxclasspathSetupPopup(designerRoot)); openEventLogMenuItem.setOnAction(e -> eventLogController.getValue().showPopup()); openEventLogMenuItem.textProperty().bind( designerRoot.getLogger().numNewLogEntriesProperty().map(i -> "Exception log (" + (i > 0 ? i : "no") + " new)") ); }
@SuppressWarnings("unchecked") final HasNameProperty withName = (HasNameProperty) item; textProperty().bind(withName.nameProperty()); } else { textProperty().unbind();
); myPopupStage.titleProperty().bind(this.titleProperty()); binding = binding.and( () -> myPopupStage.titleProperty().unbind()
private void setupReadOnlyTableView() { setupCellValueFactory(firstNameColumn, Person::firstNameProperty); setupCellValueFactory(lastNameColumn, Person::lastNameProperty); setupCellValueFactory(ageColumn, p -> p.age.asObject()); ObservableList<Person> dummyData = generateDummyData(100); treeTableView.setRoot(new RecursiveTreeItem<>(dummyData, RecursiveTreeObject::getChildren)); treeTableView.setShowRoot(false); treeTableViewCount.textProperty() .bind(Bindings.createStringBinding(() -> PREFIX + treeTableView.getCurrentItemsCount() + POSTFIX, treeTableView.currentItemsCountProperty())); treeTableViewAdd.disableProperty() .bind(Bindings.notEqual(-1, treeTableView.getSelectionModel().selectedIndexProperty())); treeTableViewRemove.disableProperty() .bind(Bindings.equal(-1, treeTableView.getSelectionModel().selectedIndexProperty())); treeTableViewAdd.setOnMouseClicked((e) -> { dummyData.add(createNewRandomPerson()); final IntegerProperty currCountProp = treeTableView.currentItemsCountProperty(); currCountProp.set(currCountProp.get() + 1); }); treeTableViewRemove.setOnMouseClicked((e) -> { dummyData.remove(treeTableView.getSelectionModel().selectedItemProperty().get().getValue()); final IntegerProperty currCountProp = treeTableView.currentItemsCountProperty(); currCountProp.set(currCountProp.get() - 1); }); searchField.textProperty().addListener(setupSearchField(treeTableView)); }
details.addRow(3, new Label("Size"), sizeControl); sizeLabel.textProperty().bind(sizeSlider.valueProperty().asString("%.0f"));
Text text = new Text(); text.wrappingWidthProperty().bind(cell.widthProperty()); text.textProperty().bind(cell.itemProperty()); cell.setGraphic(text); return cell;
editableTreeTableView.setEditable(true); editableTreeTableViewCount.textProperty() .bind(Bindings.createStringBinding(() -> PREFIX + editableTreeTableView.getCurrentItemsCount() + POSTFIX, editableTreeTableView.currentItemsCountProperty())); searchField2.textProperty()