public class ObservableSet<E> extends Object implements 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 String |
CONTENT_PROPERTY |
static String |
SIZE_PROPERTY |
Constructor and Description |
---|
ObservableSet() |
ObservableSet(Closure test) |
ObservableSet(Set<E> delegate) |
ObservableSet(Set<E> delegate,
Closure test) |
public static final String SIZE_PROPERTY
public static final String CONTENT_PROPERTY
public ObservableSet()
public ObservableSet(Closure test)
protected Closure getTest()
protected void fireElementAddedEvent(Object element)
protected void fireMultiElementAddedEvent(List values)
protected void fireElementClearedEvent(List values)
protected void fireElementRemovedEvent(Object element)
protected void fireMultiElementRemovedEvent(List values)
protected void fireElementEvent(ObservableSet.ElementEvent event)
protected void fireSizeChangedEvent(int oldValue, int newValue)
public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public PropertyChangeListener[] getPropertyChangeListeners()
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
public boolean hasListeners(String propertyName)
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] ts)
public boolean add(E e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> objects)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean addAll(Collection<? extends E> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)