Refine search
.getTreeItem(t.getTreeTablePosition() .getRow()) .getValue().age.set(t.getNewValue())); .getTreeItem(t.getTreeTablePosition() .getRow()) .getValue().userName.set(t.getNewValue())); .getTreeItem(t.getTreeTablePosition() .getRow()) .getValue().department.set(t.getNewValue())); filterField.textProperty().addListener((o, oldVal, newVal) -> { treeView.setPredicate(userProp -> { final User user = userProp.getValue(); return user.age.get().contains(newVal) || user.department.get().contains(newVal) || user.userName.get().contains(newVal); }); }); .bind(Bindings.createStringBinding(() -> String.valueOf(treeView.getCurrentItemsCount()), treeView.currentItemsCountProperty())); main.getChildren().add(size); primaryStage.setScene(scene); primaryStage.show();
@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; }
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()); } } }
/** * If you want the {@code primaryStage}'s title and the {@code JFXDecorator}'s title to be different, then * go ahead and use this method. * <p> * By default, this title property is bound to the {@code primaryStage}'s title property-so merely setting the * {@code primaryStage}'s title, will set the {@code JFXDecorator}'s title. * */ public void setTitle(String title) { this.title.unbind(); this.title.set(title); }
@Override protected Node createUndecoratedEditor() { final TextField box = new TextField( property.get() ); property.bindBidirectional(box.textProperty() ); return box; } }
initData(); stage.setTitle("Table View Sample"); stage.setWidth(450); stage.setHeight(500); this.firstName = new SimpleStringProperty(fName); this.lastName = new SimpleStringProperty(lName); this.email = new SimpleStringProperty(email); public String getFirstName() { return firstName.get(); } public void setFirstName(String fName) { firstName.set(fName); } public StringProperty firstNameProperty() { return firstName; } public String getLastName() { return lastName.get(); } public void setLastName(String lName) { lastName.set(lName); } public StringProperty lastNameProperty() { return lastName; } public String getEmail() { return email.get(); }
stage.setScene(scene); stage.show(); nameProperty.set(name); valueProperty = value; private StringProperty nameProperty = new SimpleStringProperty(); nameProperty.set(name); this.firstName = new SimpleStringProperty(firstName); this.married = new SimpleBooleanProperty(isMarried); this.hasChildren = new SimpleBooleanProperty(hasChildren); this.favoriteMovie = new SimpleStringProperty(favoriteMovie);
StringProperty prop = new SimpleStringProperty(); StringProperty other = new SimpleStringProperty(); prop.bind(Bindings.concat("your prefix").concat(other));
public JFXCustomColorPickerDialog(Window owner) { getStyleClass().add("custom-color-dialog"); if (owner != null) { dialog.initOwner(owner); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initStyle(StageStyle.TRANSPARENT); dialog.setResizable(false); rgbField.textProperty().addListener((o, oldVal, newVal) -> updateColorFromUserInput(newVal)); hsbField.textProperty().addListener((o, oldVal, newVal) -> updateColorFromUserInput(newVal)); hexField.textProperty().addListener((o, oldVal, newVal) -> updateColorFromUserInput(newVal));
private StringProperty firstNameString = new SimpleStringProperty(); private StringProperty lastNameString = new SimpleStringProperty(); firstNameString.set(firstName); lastNameString.set(lastName); firstName.setText(firstNameString.get()); lastName.setText(lastNameString.get());
AddRemoveStringItem( final DOC column, final String label, final StringProperty value, final String tooltip, final ObservableBooleanValue enableThis) { super(label, tooltip, NO_DECORATOR); final String currentValue = value.get(); if (currentValue == null) { this.strings = FXCollections.observableArrayList(); } else { this.strings = FXCollections.observableArrayList( Stream.of(currentValue.split(",")) .filter(s -> !s.isEmpty()) .toArray(String[]::new) ); } this.column = requireNonNull(column); this.enabled = enableThis; this.cache = new SimpleStringProperty(); this.strings.addListener((ListChangeListener.Change<? extends String> c) -> { @SuppressWarnings("unchecked") final List<String> list = (List<String>) c.getList(); value.setValue(getFormatedString(list)); }); }
.getTreeItem(t.getTreeTablePosition() .getRow()) .getValue().firstName.set(t.getNewValue()); }); lastNameEditableColumn.setCellFactory((TreeTableColumn<Person, String> param) -> { .getTreeItem(t.getTreeTablePosition() .getRow()) .getValue().lastName.set(t.getNewValue()); }); ageEditableColumn.setCellFactory((TreeTableColumn<Person, Integer> param) -> { editableTreeTableView.setEditable(true); editableTreeTableViewCount.textProperty() .bind(Bindings.createStringBinding(() -> PREFIX + editableTreeTableView.getCurrentItemsCount() + POSTFIX, editableTreeTableView.currentItemsCountProperty())); searchField2.textProperty() .addListener(setupSearchField(editableTreeTableView));
promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.fontProperty().bind(getSkinnable().fontProperty()); promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.setLayoutX(1);
fieldHost.textProperty().setValue(DEFAULT_HOST); generatedHost.set(DEFAULT_HOST); fieldUser.textProperty().setValue(DEFAULT_USER); generatedUser.set(DEFAULT_USER); || fieldName.getText().equals(generatedName.get())) { item.getDefaultDbmsName().ifPresent(name -> { fieldName.textProperty().setValue(name); generatedName.set(name); }); || fieldSchema.getText().equals(generatedSchema.get())) { item.getDefaultSchemaName().ifPresent(name -> { fieldSchema.textProperty().setValue(name); generatedSchema.set(name); }); || fieldPort.getText().equals(generatedPort.get())) { final String port = Integer.toString(item.getDefaultPort()); fieldPort.textProperty().setValue(port); generatedPort.set(port); fieldHost.textProperty().addListener((ob, o, n) -> recalculateFields.run()); fieldPort.textProperty().addListener((ob, o, n) -> recalculateFields.run()); fieldFile.textProperty().addListener((ob, o, n) -> recalculateFields.run()); fieldUser.textProperty().addListener((ob, o, n) -> recalculateFields.run()); fieldName.textProperty().addListener((ob, o, n) -> recalculateFields.run()); fieldSchema.textProperty().addListener((ob, o, n) -> recalculateFields.run());
editor.textProperty().addListener(observable -> { editor.promptTextProperty().bind(control.promptTextProperty()); root.getChildren().add(editor);
StringProperty dialogResult = new SimpleStringProperty(); dialogResult.addListener(new ChangeListener<String>() { public void changed(ObservableValue<? extends String> obs, String oldValue, String newValue) { // process newValue, the value from the dialog... } }); showPrompt("Dialog Title", "Default value", dialogResult);
@Override public void rebind() { cashTxt.textProperty().removeListener(cashChangeListener); cashTxt.textProperty().unbind(); cashTxt.textProperty().addListener(cashChangeListener); gameDate.invalidate(); dateTxt.textProperty().removeListener(dateChangeListener); dateTxt.textProperty().unbind(); StringProperty date = createDateProperty(); dateTxt.textProperty().bind(date); dateTxt.textProperty().addListener(dateChangeListener); } }
public HighLightRectangle(Text text) { listener = observable -> clear(text); text.textProperty().addListener(new WeakInvalidationListener(listener)); text.localToSceneTransformProperty().addListener(new WeakInvalidationListener(listener)); }
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())); } }