/** * Creates the changeable property.<br> * * @param changeable the initial value * @return the property */ protected ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) { return new ReadOnlyBooleanWrapper(changeable); }
final private ReadOnlyStringWrapper currentTaskName = new ReadOnlyStringWrapper(); final private ReadOnlyDoubleWrapper currentTaskProgress = new ReadOnlyDoubleWrapper(); final private ReadOnlyBooleanWrapper idle = new ReadOnlyBooleanWrapper(true);
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(); }
public ViolationMapper(String path, boolean useSubPaths) { this.path = new ReadOnlyStringWrapper(path); this.useSubPaths = new ReadOnlyBooleanWrapper(useSubPaths); violations = FXCollections.observableArrayList(); }
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 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 = new ReadOnlyBooleanWrapper(changeable); // if the disabled property changes, change the controlChangeable property as well changeableProperty.bind(getNode().disabledProperty().not()); return changeableProperty; }
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();
@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; }
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 VBox layout = new VBox(); private ReadOnlyBooleanWrapper selected = new ReadOnlyBooleanWrapper(); public boolean isSelected() { return selected.get();
private final ReadOnlyBooleanWrapper dirty = new ReadOnlyBooleanWrapper(this, "dirty", false); public final boolean isDirty() { return dirty.get(); } public final ReadOnlyBooleanProperty dirtyProperty() { return dirty.getReadOnlyProperty(); }
buffering = new ReadOnlyBooleanWrapper(this, "buffering", false); value = new SimpleStringProperty(this, ""); this.input = input;