public ReadOnlyBooleanProperty hasErrorsProperty() { return hasErrors.getReadOnlyProperty(); }
public boolean getHasErrors() { return hasErrors.get(); }
public class MyController { @FXML private Node node1 ; @FXML private Node node2 ; private final ReadOnlyBooleanWrapper injected = new ReadOnlyBooleanWrapper(this, "injected", false); public boolean isInjected() { return injected.get(); } public ReadOnlyBooleanProperty injectedProperty() { return injected.getReadOnlyProperty(); } public void initialize() { injected.set(true); // other initialization... } } // elsewhere... FXMLLoader loader = new FXMLLoader(getClass().getResource(...)); MyController controller = new MyController(); loader.setController(controller); controller.injectedProperty().addListener( /* will be invoked after injection....*/ ); Parent root = (Parent) loader.load();
final private ReadOnlyStringWrapper currentTaskName = new ReadOnlyStringWrapper(); final private ReadOnlyDoubleWrapper currentTaskProgress = new ReadOnlyDoubleWrapper(); final private ReadOnlyBooleanWrapper idle = new ReadOnlyBooleanWrapper(true); currentTaskProgress.bind(task.progressProperty()); currentTaskName.set(task.nameProperty().get()); idle.set(false); break; case FAILED: task.stateProperty().removeListener(this); idle.set(true); break; return idle.getReadOnlyProperty();
private final ReadOnlyBooleanWrapper dirty = new ReadOnlyBooleanWrapper(this, "dirty", false); public final boolean isDirty() { return dirty.get(); } public final ReadOnlyBooleanProperty dirtyProperty() { return dirty.getReadOnlyProperty(); }
public class Parent { private ReadOnlyBooleanWrapper total = new ReadOnlyBooleanWrapper(); private ObservableList<Child> children = FXCollections.observableArrayList(c -> new Observable[] {c.singleProperty()}); public Parent() { total.bind(Bindings.createBooleanBinding(() -> children.stream().anyMatch(Child::isSingle), children); } public ReadOnlyBooleanProperty totalProperty() { return total.getReadOnlyProperty(); } public ObservableList<Child> getChildren() { return children ; } }
private final ReadOnlyBooleanWrapper hasFocus = new ReadOnlyBooleanWrapper(this, "hasFocus"); hasFocus.bind( hourField.focusedProperty() .or(minuteField.focusedProperty()) .or(datePicker.focusedProperty()) .or(showTimePickerButton.focusedProperty())); // ... public ReadOnlyBooleanProperty hasFocusProperty() { return hasFocus.getReadOnlyProperty(); }
@Override protected ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) { ReadOnlyBooleanWrapper changeableProperty = new ReadOnlyBooleanWrapper(changeable); // if the disabled property changes, change the controlChangeable property as well changeableProperty.bind(getNode().disabledProperty().not()); return changeableProperty; }
/** * Creates the changeable property.<br> * * @param changeable the initial value * @return the property */ protected ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) { return new ReadOnlyBooleanWrapper(changeable); }
public DashboardTile(String title, String description, Node graphic) { getStyleClass().addAll("dashboard-modules-tile"); Label titleLabel = new Label(title); titleLabel.getStyleClass().add("dashboard-modules-tile-title"); if (nonNull(graphic)) { titleLabel.setGraphic(graphic); } Label textLabel = new Label(description); textLabel.getStyleClass().add("dashboard-modules-tile-text"); textLabel.setMinHeight(USE_PREF_SIZE); VBox topTile = new VBox(5); topTile.getChildren().addAll(titleLabel, textLabel); button.getStyleClass().add("dashboard-modules-invisible-button"); button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); armed.bind(button.armedProperty()); getChildren().addAll(new StackPane(topTile, button)); setMaxHeight(USE_PREF_SIZE); setMinHeight(USE_PREF_SIZE); }
private VBox layout = new VBox(); private ReadOnlyBooleanWrapper selected = new ReadOnlyBooleanWrapper(); public boolean isSelected() { return selected.get(); return selected.getReadOnlyProperty(); final Button ok = new Button("OK"); ok.setOnAction(e -> { selected.set(true); close(); }); selected.set(false); close(); });
class Animations { private ReadOnlyBooleanWrapper animating = new ReadOnlyBooleanWrapper() ; public ReadOnlyBooleanProperty animatingProperty() { return animating.getReadOnlyProperty(); } public boolean isAnimating() { return animatingProperty().get(); } public Pane getAnimationPane() { //returns Pane which would be used for transition } public void playAnimation() { //called only when the timeline transition is to be played Animation animation = ... ; animation.statusProperty().addListener((obs, oldStatus, newStatus) -> animating.set(newStatus == Animation.Status.RUNNING)); animation.play(); // etc } }
private ReadOnlyBooleanWrapper previousExist; { ReadOnlyBooleanWrapper ans = new ReadOnlyBooleanWrapper(); ans.bind( currentRowProperty().greaterThan(0) ); previousExist = ans; } public ReadOnlyBooleanProperty previousExist() { return previousExist.getReadOnlyProperty(); } public boolean isPreviousExist() { return previousExist().get(); }
@Override protected ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) { ReadOnlyBooleanWrapper changeableProperty; if (getComponent() instanceof TextInputControl) { changeableProperty = new ReadOnlyBooleanWrapper(changeable); // if the editable property changes, change the changeable property as well changeableProperty.bind(((TextInputControl) getComponent()).editableProperty()); } else { // use disabled property changeableProperty = super.createChangeableProperty(changeable); } return changeableProperty; }
public ViolationMapper(String path, boolean useSubPaths) { this.path = new ReadOnlyStringWrapper(path); this.useSubPaths = new ReadOnlyBooleanWrapper(useSubPaths); violations = FXCollections.observableArrayList(); }
buffering = new ReadOnlyBooleanWrapper(this, "buffering", false); value = new SimpleStringProperty(this, ""); this.input = input; return buffering.get(); return buffering.getReadOnlyProperty(); buffering.set(buffer);
public final ReadOnlyBooleanProperty armedProperty() { return armed.getReadOnlyProperty(); }
public final boolean isArmed() { return armed.get(); }