@Override public int size() { return delegate.size(); }
@Override public void extractValues(ListProperty<?> originalValue, ValueExtractor.ValueReceiver receiver) { for ( int i = 0; i < originalValue.size(); i++ ) { receiver.indexedValue( NodeImpl.LIST_ELEMENT_NODE_NAME, i, originalValue.get( i ) ); } } }
/** * {@inheritDoc} */ protected boolean validateRequired() { return !isRequired() || (isRequired() && selection.size() > 0); }
/** * @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); }
/** * Removes the element at the given index from the current selection. * * @param index * The index of the element to be removed. * * @return Returns the current field to allow for chaining. */ public MultiSelectionField<V> deselect(int index) { if (index < items.size() && selection.contains(items.get(index))) { selection.remove(items.get(index)); } return this; }
/** * Adds the element at the given index to the current selection. * * @param index * The index of the element to be selected. * * @return Returns the current field to allow for chaining. */ public MultiSelectionField<V> select(int index) { if (index < items.size() && index > -1 && !selection.contains(items.get(index))) { selection.add(items.get(index)); } return this; }
/** * Sets the selection to the element at the given index. * * @param index * The index of the element to be selected. * * @return Returns the current field to allow for chaining. */ public SingleSelectionField<V> select(int index) { if (index == -1) { selection.setValue(null); } else if (index < items.size() && index > -1 && (selection.get() == null || (selection.get() != null && !selection.get().equals(items.get(index))))) { selection.setValue(items.get(index)); } return this; }
if (i < this.items.size() && i >= 0) { this.selection.add(this.items.get(i));
if (selection < items.size() && selection >= 0) { this.selection.set(this.items.get(selection)); persistentSelection.setValue(this.selection.getValue());