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); }
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; }
@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; }