@PersistentSequence public ObservableList<PropertyDescriptorSpec> getRuleProperties() { return ruleProperties.getValue(); }
builder.usesMultifile(usesMultifile.getValue()); ruleProperties.getValue().stream().map(PropertyDescriptorSpec::build).forEach(builder::defineProperty); examples.getValue().forEach(builder::addExample);
@Override public ObservableList<E> getValue() { return delegate.getValue(); }
/** * Validates a user input based on the field's selection and its validation * rules. Also considers the {@code required} flag. This method directly * updates the {@code valid} property. * * @return Returns whether the user selection is a valid value or not. */ public boolean validate() { // Check all validation rules and collect any error messages. List<String> errorMessages = validators.stream() .map(v -> v.validate(selection.getValue())) .filter(r -> !r.getResult()) .map(ValidationResult::getErrorMessage) .collect(Collectors.toList()); return super.validate(errorMessages); }
/** * Creates a new {@link MultiSelectionField} with the given properties for * items and selection. * * @param itemsBinding * The items property to be bound with. * * @param selectionBinding * The selection property to be bound with. * * @return Returns a new {@link MultiSelectionField}. */ public static <T> MultiSelectionField<T> ofMultiSelectionType(ListProperty<T> itemsBinding, ListProperty<T> selectionBinding) { return new MultiSelectionField<>(new SimpleListProperty<>(itemsBinding.getValue()), new ArrayList<>(selectionBinding.getValue().stream().map(t -> itemsBinding.getValue().indexOf(t)).collect(Collectors.toList()))).bind(itemsBinding, selectionBinding); }
/** * @return The previously oldest loaded tweets for use in {@link #loadMoreTweets()}. */ private Optional<Status> getOldestTweetLoaded() { if (tweetsProperty.isEmpty()) { getLogger().debug("No older tweets to load."); return Optional.empty(); } final Status oldest = tweetsProperty.getValue().get(tweetsProperty.size() - 1); getLogger().debug("Loading tweets before {}", oldest.getId()); return Optional.of(oldest); }
/** * Updates the list of available items to a new list, along with a * pre-defined selection. * * @param newValue * The new list of items. * @param newSelection * The new pre-defined selection. * * @return Returns the current field to allow for chaining. */ public MultiSelectionField<V> items(List<V> newValue, List<Integer> newSelection) { items.setAll(newValue); newSelection.forEach(i -> selection.add(items.get(i))); persistentSelection.setAll(selection.getValue()); return this; }
/** * Stores the field's current selection in its persistent selection. This * stores the user's changes in the model. */ public void persist() { if (!isValid()) { return; } persistentSelection.setAll(selection.getValue()); fireEvent(FieldEvent.fieldPersistedEvent(this)); }
/** * Sets the field's current selection to its persistent selection, thus * resetting any changes made by the user. */ public void reset() { if (!hasChanged()) { return; } selection.setAll(persistentSelection.getValue()); fireEvent(FieldEvent.fieldResetEvent(this)); }
/** * Creates a new {@link SingleSelectionField} with the given properties for * items and selection. * * @param itemsBinding * The items property to be bound with. * * @param selectionBinding * The selection property to be bound with. * * @return Returns a new {@link SingleSelectionField}. */ public static <T> SingleSelectionField<T> ofSingleSelectionType(ListProperty<T> itemsBinding, ObjectProperty<T> selectionBinding) { return new SingleSelectionField<>(new SimpleListProperty<>(itemsBinding.getValue()), itemsBinding.indexOf(selectionBinding.getValue())).bind(itemsBinding, selectionBinding); }
persistentSelection.addAll(this.selection.getValue());