@FXML public void initialize() { // lblUrl.textProperty().isNotEmpty() && // txtUserId.textProperty().isNotEmpty() && // lblUserPass.textProperty().isNotEmpty() BooleanExpression checkFieldsBinding = BooleanExpression.booleanExpression(lblUrl.textProperty().isNotEmpty()) .and(txtUserId.textProperty().isNotEmpty()).and(lblUserPass.textProperty().isNotEmpty()); // .booleanExpression(txtUserId.textProperty().isNotEmpty()).booleanExpression(lblUserPass.textProperty().isNotEmpty()); isNotEmptyFields.bind(checkFieldsBinding); isNotEmptyFields.addListener(checkIsNotEmptyFieldChangeListener); chkEmptyUserAndPass.selectedProperty().addListener((oba, oldval, newval) -> { btnFinish.setDisable(!newval); }); }
@SuppressWarnings("unchecked") @Override public void bind(EditorHelper e, String id, BasicEntityEditor node) { ObservableValue value = e.getValueProperty(id); Class type = e.getValueClass(id); if (BasicEntity.class.isAssignableFrom(type)) { node.configure(getContext(), type); } ObservableBooleanValue editable = e.getEditableProperty(id, value); ObservableBooleanValue visible = e.getVisibleProperty(id, value); StringConverter converter = e.getConverter(id, value); if (converter != null) node.setConverter(converter); bindBidirectionalValue(node, node.valueProperty(), value); if (editable != null) node.disableProperty().bind(BooleanExpression.booleanExpression(editable).not()); if (visible != null) node.visibleProperty().bind(visible); e.onBind(id, value, node); }
/**Sets the text-color and background-color for valid and invalid text, and if {@code parentTab} isn't null, sets all <i>other</i> tabs to be disabled when the {@code fields} are invalid * @param parentTab - the tab containing these {@code fields} * @param fields - the {@code NumberTextField}s to apply this on */ public void setNumberTextFieldsValidationUI(Tab parentTab, NumberTextField... fields) { BooleanExpression andOfAllFields = new SimpleBooleanProperty(true); setNumberTextFieldValidationUI(fields); if (parentTab != null) { for (NumberTextField field: fields) andOfAllFields = andOfAllFields.and(field.getValidProperty()); for (Tab tab : tabPane.getTabs()) if (!tab.equals(parentTab)) { BooleanExpression existingExpression = tabToBindExpression.get(tab); if (existingExpression != null) andOfAllFields = andOfAllFields.and(existingExpression); tabToBindExpression.put(tab, andOfAllFields); tab.disableProperty().bind(andOfAllFields.not()); } } }
private static MenuItem createNewMenuItem( CommonMenuItem itemType, CommonMenuBuilder builder, BooleanSupplier canHandle, BooleanExpression makeVisible, Runnable onHandlable) { return createNewMenuItem(itemType, builder, canHandle, makeVisible, onHandlable, null); }
private static MenuItem createNewMenuItem( CommonMenuItem itemType, CommonMenuBuilder builder, BooleanSupplier canHandle, BooleanExpression makeVisible, Runnable onHandlable, Runnable onNotHandleable) { if (builder.isCommonMenuItemExcluded(itemType)) { return null; } MenuItem menuItem = new MenuItem(itemType.getText()); menuItem.setGraphic(itemType.getImage().createImageView()); menuItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (canHandle.getAsBoolean()) { onHandlable.run(); } else { if (onNotHandleable != null) { onNotHandleable.run(); } else { AppContext.getCommonDialogs().showInformationDialog("Invalid data selected for menu item \"" + itemType.getText() + "\"", "Can't invoke " + itemType.getText() + " for invalid data"); } } } }); menuItem.visibleProperty().bind(builder.getInvisibleWhenfalse() == null ? makeVisible : builder.getInvisibleWhenfalse().not().and(makeVisible)); return menuItem; }
@Test public void testBooleanExpression(){ final BooleanExpression actual = BooleanExpression.booleanExpression(new SimpleBooleanProperty(true)); assertThat(actual).isTrue(); assertThat(actual).hasSameValue(actual); }
protected BooleanExpression isReadyForExecution() { return isOperationReady_; }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return allValid_; }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return new SimpleBooleanProperty(true); }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return allFieldsValid; }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return frc_.allFieldsValid(); }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return operationIsReady_; }
/** * @see gov.va.isaac.gui.listview.operations.Operation#isValid() */ @Override public BooleanExpression isValid() { return newParent_.isValid(); }
/** * Creates a new instance of the {@code CellRangeGridPane} class with the * provided range restriction and initial value. * * @param validRange * the range restriction. * @param initialValue * the initial value. */ public CellRangeGridPane(final CellRange validRange, final CellRange initialValue) { super(); this.setPadding(new Insets(5)); this.setHgap(10); this.setVgap(10); this.invalid = new SimpleBooleanProperty(); if (initialValue != null) { this.from = new CellLocationGridPane(validRange, initialValue.getBeginning()); this.to = new CellLocationGridPane(validRange, initialValue.getEnd()); } else { this.from = new CellLocationGridPane(validRange); this.to = new CellLocationGridPane(validRange); } this.invalid .bind(BooleanExpression.booleanExpression( this.from.invalidProperty()).or( BooleanExpression.booleanExpression(this.to .invalidProperty()))); final GridPane rangeBox = new GridPane(); rangeBox.setHgap(10); final Label fromLabel = new Label("From:"); GridPane.setMargin(fromLabel, new Insets(10)); fromLabel .setStyle("-fx-font-family: sans-serif; -fx-font-style: italic;"); final Label toLabel = new Label("To:"); toLabel.setStyle("-fx-font-family: sans-serif; -fx-font-style: italic;"); GridPane.setMargin(toLabel, new Insets(10)); fromLabel.setLabelFor(this.from); toLabel.setLabelFor(this.to); rangeBox.add(fromLabel, 0, 0); rangeBox.add(this.from, 1, 0, 1, 2); rangeBox.add(toLabel, 0, 3); rangeBox.add(this.to, 1, 3, 1, 2); String rangeLabelText = "Range"; if (validRange != null) { rangeLabelText += " (valid within " + validRange + ")"; } rangeLabelText += ":"; final Label rangeLabel = new Label(rangeLabelText); rangeLabel .setStyle("-fx-font-family: sans-serif; -fx-font-weight: bold;"); rangeLabel.setLabelFor(rangeBox); this.add(rangeLabel, 0, 0); this.add(rangeBox, 0, 1); }
/** * Implementers should return a BooleanExpression which evaluates to true when all necessary values * for task execution have been provided. */ public abstract BooleanExpression isValid();