public final void set24HourView(final boolean value) { _24HourViewProperty().setValue(value); }
@Override void installMenuItems(ProjectTreeComponent projectTree) { projectTree.installContextMenu(SchemaProperty.class, (treeCell, node) -> { final MenuItem enableTables = new MenuItem("Enable All Tables"); final MenuItem disableTables = new MenuItem("Disable All Tables"); enableTables.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(TableProperty.class::isInstance) .forEach(doc -> ((TableProperty) doc).enabledProperty().setValue(true)) ); disableTables.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(TableProperty.class::isInstance) .forEach(doc -> ((TableProperty) doc).enabledProperty().setValue(false)) ); return Stream.of(enableTables, disableTables); }); } }
@Override void installMenuItems(ProjectTreeComponent projectTree) { projectTree.installContextMenu(TableProperty.class, (treeCell, node) -> { final MenuItem enableColumns = new MenuItem("Enable All Columns"); final MenuItem disableColumns = new MenuItem("Disable All Columns"); enableColumns.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(ColumnProperty.class::isInstance) .forEach(doc -> ((ColumnProperty) doc).enabledProperty().setValue(true)) ); disableColumns.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(ColumnProperty.class::isInstance) .forEach(doc -> ((ColumnProperty) doc).enabledProperty().setValue(false)) ); return Stream.of(enableColumns, disableColumns); }); } }
private <DOC extends DocumentProperty> Stream<MenuItem> installForDocumentType(TreeCell<DocumentProperty> treeCell, DOC node) { final MenuItem expandAll = new MenuItem("Expand All", ProjectTreeIcon.BOOK_OPEN.view()); final MenuItem collapseAll = new MenuItem("Collapse All", ProjectTreeIcon.BOOK.view()); expandAll.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(HasExpandedProperty.class::isInstance) .forEach(doc -> ((HasExpandedProperty) doc).expandedProperty().setValue(true)) ); collapseAll.setOnAction(ev -> DocumentUtil.traverseOver(node) .filter(HasExpandedProperty.class::isInstance) .forEach(doc -> ((HasExpandedProperty) doc).expandedProperty().setValue(false)) ); return Stream.of(expandAll, collapseAll); } }
@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; }
/** * Sets the value of the closeButtonEnabled property. * * @param enabled * if false, the pop over will not be closeable by the header's close button * * @see #closeButtonEnabledProperty() */ public final void setCloseButtonEnabled(boolean enabled) { closeButtonEnabled.setValue(enabled); }
/** * Sets the value of the headerAlwaysVisible property. * * @param visible * if true, then the header is visible even while attached * * @see #headerAlwaysVisibleProperty() */ public final void setHeaderAlwaysVisible(boolean visible) { headerAlwaysVisible.setValue(visible); }
@Override public void run() { playing.setValue(false); } }, lengthMS, TimeUnit.MILLISECONDS);
/** * Sets this form's {@code persistable} property based on its contained * groups' persistable properties. */ protected void setPersistableProperty() { persistable.setValue(groups.stream().anyMatch(Group::hasChanged) && groups.stream().allMatch(Group::isValid)); }
/** * Sets this group's {@code changed} property based on its contained * elements' changed properties. */ private void setChangedProperty() { changed.setValue(elements.stream() .filter(e -> e instanceof Field) .map(e -> (Field) e) .anyMatch(Field::hasChanged)); }
public void enableAll() { for (NoticeBoardMenuEntry menuEntry : menuEntries) { menuEntry.disabledProperty().setValue(false); } }
@Override public void play() { clip.play(); playing.setValue(true); }
/** * Sets this form's {@code valid} property based on its contained groups' * changed properties. */ protected void setValidProperty() { valid.setValue(groups.stream().allMatch(Group::isValid)); setPersistableProperty(); }
/** * Set the expanded state. This will update the {@link #expandedProperty()} accordingly. * * @param expanded Wheter the row editor should be expanded or not */ public void setExpanded(Boolean expanded) { expandedProperty().setValue(expanded); }
@Override public void play() { player.play(); playing.setValue(true); int lengthMS = (int) (getLength() * 1000+1000); timer.schedule(new TimerTask() { @Override public void run() { playing.setValue(false); } }, lengthMS, TimeUnit.MILLISECONDS); }
/** * Toggle the expanded state of the row at the given index. * * @param index The index of the row you want to toggle expansion for. */ public void toggleExpanded(int index) { BooleanProperty expanded = (BooleanProperty) getCellObservableValue(index); expanded.setValue(!expanded.getValue()); }
@Override default void setEnabled(Boolean enabled) { document().enabledProperty().setValue(enabled); } }
/** * Toggle the expanded state of this row editor. */ public void toggleExpanded() { BooleanProperty expanded = expandedProperty(); expanded.setValue(!expanded.getValue()); }
@Override public void initialize() { notificationPane.visibleProperty().bind(shouldDisplay); notificationPane.managedProperty().bind(shouldDisplay); notificationPane.setOnMouseClicked(e -> shouldDisplay.setValue(false)); notificationContent.textProperty().addListener((observable, oldValue, newValue) -> { notificationContent.visibleProperty().setValue(!newValue.isEmpty()); notificationContent.managedProperty().setValue(!newValue.isEmpty()); }); LOG.debug("Starting internal notification system. Listening on new notification requests."); internalNotificationSystem.notificationProperty().addListener((o, prev, cur) -> this.handleChange(cur)); }
private MenuItem menuItem(LanguageText text, CheckComboBox<T> comboBox, boolean value) { final MenuItem menuItem = new MenuItem(uniformDesign.getText(text)); menuItem.setOnAction(event -> { comboBox.getItems().stream().map(comboBox::getItemBooleanProperty).forEach(s -> s.setValue(value)); updateCheckComboBox(comboBox); }); return menuItem; }