public class ObservableSet<E>
extends java.lang.Object
implements java.util.Set<E>
// 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 |
---|---|
static class |
ObservableSet.ChangeType |
static class |
ObservableSet.ElementAddedEvent |
static class |
ObservableSet.ElementClearedEvent |
static class |
ObservableSet.ElementEvent |
static class |
ObservableSet.ElementRemovedEvent |
static class |
ObservableSet.MultiElementAddedEvent |
static class |
ObservableSet.MultiElementRemovedEvent |
protected class |
ObservableSet.ObservableIterator<E> |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTENT_PROPERTY |
static java.lang.String |
SIZE_PROPERTY |
Constructor and Description |
---|
ObservableSet() |
ObservableSet(Closure test) |
ObservableSet(java.util.Set<E> delegate) |
ObservableSet(java.util.Set<E> delegate,
Closure test) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> objects) |
protected void |
fireElementAddedEvent(java.lang.Object element) |
protected void |
fireElementClearedEvent(java.util.List values) |
protected void |
fireElementEvent(ObservableSet.ElementEvent event) |
protected void |
fireElementRemovedEvent(java.lang.Object element) |
protected void |
fireMultiElementAddedEvent(java.util.List values) |
protected void |
fireMultiElementRemovedEvent(java.util.List values) |
protected void |
fireSizeChangedEvent(int oldValue,
int newValue) |
java.util.Set<E> |
getContent() |
protected java.util.Set<E> |
getDelegateSet() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName) |
protected Closure |
getTest() |
boolean |
hasListeners(java.lang.String propertyName) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] ts) |
public static final java.lang.String SIZE_PROPERTY
public static final java.lang.String CONTENT_PROPERTY
public ObservableSet()
public ObservableSet(java.util.Set<E> delegate)
public ObservableSet(Closure test)
public java.util.Set<E> getContent()
protected java.util.Set<E> getDelegateSet()
protected Closure getTest()
protected void fireElementAddedEvent(java.lang.Object element)
protected void fireMultiElementAddedEvent(java.util.List values)
protected void fireElementClearedEvent(java.util.List values)
protected void fireElementRemovedEvent(java.lang.Object element)
protected void fireMultiElementRemovedEvent(java.util.List values)
protected void fireElementEvent(ObservableSet.ElementEvent event)
protected void fireSizeChangedEvent(int oldValue, int newValue)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public boolean hasListeners(java.lang.String propertyName)
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.util.Iterator<E> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] ts)
public boolean add(E e)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> objects)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)