// skip all properties whose value is a closure
def set = new ObservableSet( {!(it instanceof Closure)} )
<p/>
// skip all properties whose name matches a regex
def set = new ObservableSet( { name, value -> !(name =˜ /[A-Z+]/) } )
The current implementation will trigger specialized events in the following scenarios, you need
not register a different listener as those events extend from PropertyChangeEvent
Bound properties
| Modifier and Type | Class and Description |
|---|---|
| public static enum | |
| public static class | |
| public static class | |
| public abstract static class | |
| public static class | |
| public static class | |
| public static class | |
| protected class |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| private final Set | |
| private final PropertyChangeSupport | |
| public static final String | |
| private final Closure |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(E
element to be added to this set e)Implements java. |
| public boolean | addAll(Collection<? extends E>
collection containing elements to be added to this set c)Implements java. |
| public void | |
| public void | |
| public void | clear()
Implements java. |
| public boolean | contains(Object
element whose presence in this set is to be tested o)Implements java. true if this set contains the specified element.
|
| public boolean | containsAll(Collection<?>
collection to be checked for containment in this set objects)Implements java. true if this set contains all of the elements of the
specified collection.
|
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| public Set | |
| protected Set | |
| public PropertyChangeListener[] | |
| public PropertyChangeListener[] | |
| protected Closure | |
| public boolean | |
| public boolean | |
| public Iterator | |
| public boolean | remove(Object
object to be removed from this set, if present o)Implements java. |
| public boolean | removeAll(Collection<?>
collection containing elements to be removed from this set c)Implements java. |
| public void | |
| public void | |
| public boolean | retainAll(Collection<?>
collection containing elements to be retained in this set c)Implements java. |
| public int | |
| public Object[] | toArray()
Implements java. |
| public <T> T[] | toArray(T[]
the array into which the elements of this set are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose. ts)Implements java. |
| CONTENT_PROPERTY | back to summary |
|---|---|
| public static final String CONTENT_PROPERTY | |
| delegate | back to summary |
|---|---|
| private final Set<E> delegate | |
| pcs | back to summary |
|---|---|
| private final PropertyChangeSupport pcs | |
| SIZE_PROPERTY | back to summary |
|---|---|
| public static final String SIZE_PROPERTY | |
| test | back to summary |
|---|---|
| private final Closure<V> test | |
| ObservableSet | back to summary |
|---|---|
| public ObservableSet() | |
| ObservableSet | back to summary |
|---|---|
| public ObservableSet(Set<E> delegate) | |
| ObservableSet | back to summary |
|---|---|
| public ObservableSet(Closure<V> test) | |
| ObservableSet | back to summary |
|---|---|
| public ObservableSet(Set<E> delegate, Closure<V> test) | |
| add | back to summary |
|---|---|
| public boolean add(E e) Implements java. Doc from java. Adds the specified element to this set if it is not already present
(optional operation). More formally, adds the specified element
The stipulation above does not imply that sets must accept all
elements; sets may refuse to add any particular element, including
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends E> c) Implements java. Doc from java. Adds all of the elements in the specified collection to this set if
they're not already present (optional operation). If the specified
collection is also a set, the
| |
| addPropertyChangeListener | back to summary |
|---|---|
| public void addPropertyChangeListener(PropertyChangeListener listener) | |
| addPropertyChangeListener | back to summary |
|---|---|
| public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Doc from java. Removes all of the elements from this set (optional operation). The set will be empty after this call returns. | |
| contains | back to summary |
|---|---|
| public boolean contains(Object o) Implements java. Doc from java. Returns
| |
| containsAll | back to summary |
|---|---|
| public boolean containsAll(Collection<?> objects) Implements java. Doc from java. Returns
| |
| fireElementAddedEvent | back to summary |
|---|---|
| protected void fireElementAddedEvent(Object element) | |
| fireElementClearedEvent | back to summary |
|---|---|
| protected void fireElementClearedEvent(List<E> values) | |
| fireElementEvent | back to summary |
|---|---|
| protected void fireElementEvent(ObservableSet. | |
| fireElementRemovedEvent | back to summary |
|---|---|
| protected void fireElementRemovedEvent(Object element) | |
| fireMultiElementAddedEvent | back to summary |
|---|---|
| protected void fireMultiElementAddedEvent(List<E> values) | |
| fireMultiElementRemovedEvent | back to summary |
|---|---|
| protected void fireMultiElementRemovedEvent(List<E> values) | |
| fireSizeChangedEvent | back to summary |
|---|---|
| protected void fireSizeChangedEvent(int oldValue, int newValue) | |
| getContent | back to summary |
|---|---|
| public Set | |
| getDelegateSet | back to summary |
|---|---|
| protected Set | |
| getPropertyChangeListeners | back to summary |
|---|---|
| public PropertyChangeListener[] getPropertyChangeListeners() | |
| getPropertyChangeListeners | back to summary |
|---|---|
| public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) | |
| getTest | back to summary |
|---|---|
| protected Closure | |
| hasListeners | back to summary |
|---|---|
| public boolean hasListeners(String propertyName) | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).
| |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Implements java. Doc from java. Removes the specified element from this set if it is present
(optional operation). More formally, removes an element
| |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(Collection<?> c) Implements java. Doc from java. Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.
| |
| removePropertyChangeListener | back to summary |
|---|---|
| public void removePropertyChangeListener(PropertyChangeListener listener) | |
| removePropertyChangeListener | back to summary |
|---|---|
| public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) | |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(Collection<?> c) Implements java. Doc from java. Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.
| |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs.
| |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(T[] ts) Implements java. Doc from java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set. If this set fits in the specified array with room to spare
(i.e., the array has more elements than this set), the element in
the array immediately following the end of the set is set to
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Like the Suppose
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final ObservableSet. | |
| public static final ObservableSet. | |
| public static final ObservableSet. | |
| public static final ObservableSet. | |
| public static final Object | |
| public static final ObservableSet. | |
| public static final Object | |
| public static final ObservableSet. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ObservableSet. | |
| public static ObservableSet. |
| ADDED | back to summary |
|---|---|
| public static final ObservableSet. | |
| CLEARED | back to summary |
|---|---|
| public static final ObservableSet. | |
| MULTI_ADD | back to summary |
|---|---|
| public static final ObservableSet. | |
| MULTI_REMOVE | back to summary |
|---|---|
| public static final ObservableSet. | |
| newValue | back to summary |
|---|---|
| public static final Object newValue | |
| NONE | back to summary |
|---|---|
| public static final ObservableSet. | |
| oldValue | back to summary |
|---|---|
| public static final Object oldValue | |
| REMOVED | back to summary |
|---|---|
| public static final ObservableSet. | |
| ChangeType | back to summary |
|---|---|
| private ChangeType() | |
| valueOf | back to summary |
|---|---|
| public static ObservableSet. | |
| values | back to summary |
|---|---|
| public static ObservableSet. | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides groovy. | |
| ElementAddedEvent | back to summary |
|---|---|
| public ElementAddedEvent(Object source, Object newValue) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public List |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides groovy. | |
| values | back to summary |
|---|---|
| private List<E> values | |
| ElementClearedEvent | back to summary |
|---|---|
| public ElementClearedEvent(Object source, List<E> values) | |
| getValues | back to summary |
|---|---|
| public List | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private final ObservableSet. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ObservableSet. | |
| public int | |
| public String |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| type | back to summary |
|---|---|
| private final ObservableSet. | |
| ElementEvent | back to summary |
|---|---|
| public ElementEvent(Object source, Object oldValue, Object newValue, ObservableSet. | |
| getChangeType | back to summary |
|---|---|
| public ObservableSet. | |
| getType | back to summary |
|---|---|
| public int getType() | |
| getTypeAsString | back to summary |
|---|---|
| public String getTypeAsString() | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides groovy. | |
| ElementRemovedEvent | back to summary |
|---|---|
| public ElementRemovedEvent(Object source, Object value) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public List |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides groovy. | |
| values | back to summary |
|---|---|
| private List<E> values | |
| MultiElementAddedEvent | back to summary |
|---|---|
| public MultiElementAddedEvent(Object source, List<E> values) | |
| getValues | back to summary |
|---|---|
| public List | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public List |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides groovy. | |
| values | back to summary |
|---|---|
| private List<E> values | |
| MultiElementRemovedEvent | back to summary |
|---|---|
| public MultiElementRemovedEvent(Object source, List<E> values) | |
| getValues | back to summary |
|---|---|
| public List | |
| Modifier and Type | Field and Description |
|---|---|
| private final Iterator | |
| private final Stack |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Iterator | |
| public boolean | |
| public E | |
| public void | remove()
Overrides default java. |
| iterDelegate | back to summary |
|---|---|
| private final Iterator<E> iterDelegate | |
| stack | back to summary |
|---|---|
| private final Stack<E> stack | |
| ObservableIterator | back to summary |
|---|---|
| public ObservableIterator(Iterator<E> iterDelegate) | |
| getDelegate | back to summary |
|---|---|
| public Iterator | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public E next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the | |