public class ObservableList
extends java.lang.Object
implements java.util.List
// skip all properties whose value is a closure
def map = new ObservableList( {!(it instanceof Closure)} )
// skip all properties whose name matches a regex
def map = new ObservableList( { 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 |
ObservableList.ChangeType |
static class |
ObservableList.ElementAddedEvent |
static class |
ObservableList.ElementClearedEvent |
static class |
ObservableList.ElementEvent |
static class |
ObservableList.ElementRemovedEvent |
static class |
ObservableList.ElementUpdatedEvent |
static class |
ObservableList.MultiElementAddedEvent |
static class |
ObservableList.MultiElementRemovedEvent |
protected class |
ObservableList.ObservableIterator |
protected class |
ObservableList.ObservableListIterator |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTENT_PROPERTY |
static java.lang.String |
SIZE_PROPERTY |
| Constructor and Description |
|---|
ObservableList() |
ObservableList(Closure test) |
ObservableList(java.util.List delegate) |
ObservableList(java.util.List delegate,
Closure test) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object element) |
boolean |
add(java.lang.Object o) |
boolean |
addAll(java.util.Collection c) |
boolean |
addAll(int index,
java.util.Collection 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 c) |
boolean |
equals(java.lang.Object o) |
protected void |
fireElementAddedEvent(int index,
java.lang.Object element) |
protected void |
fireElementClearedEvent(java.util.List values) |
protected void |
fireElementEvent(ObservableList.ElementEvent event) |
protected void |
fireElementRemovedEvent(int index,
java.lang.Object element) |
protected void |
fireElementUpdatedEvent(int index,
java.lang.Object oldValue,
java.lang.Object newValue) |
protected void |
fireMultiElementAddedEvent(int index,
java.util.List values) |
protected void |
fireMultiElementRemovedEvent(java.util.List values) |
protected void |
fireSizeChangedEvent(int oldValue,
int newValue) |
java.lang.Object |
get(int index) |
java.util.List |
getContent() |
protected java.util.List |
getDelegateList() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName) |
int |
getSize() |
protected Closure |
getTest() |
int |
hashCode() |
boolean |
hasListeners(java.lang.String propertyName) |
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty() |
java.util.Iterator |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator |
listIterator() |
java.util.ListIterator |
listIterator(int index) |
java.lang.Object |
remove(int index) |
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) |
java.lang.Object |
set(int index,
java.lang.Object element) |
int |
size() |
java.util.List |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] a) |
public static final java.lang.String SIZE_PROPERTY
public static final java.lang.String CONTENT_PROPERTY
public ObservableList()
public ObservableList(java.util.List delegate)
public ObservableList(Closure test)
public ObservableList(java.util.List delegate,
Closure test)
public java.util.List getContent()
protected java.util.List getDelegateList()
protected Closure getTest()
protected void fireElementAddedEvent(int index,
java.lang.Object element)
protected void fireMultiElementAddedEvent(int index,
java.util.List values)
protected void fireElementClearedEvent(java.util.List values)
protected void fireElementRemovedEvent(int index,
java.lang.Object element)
protected void fireMultiElementRemovedEvent(java.util.List values)
protected void fireElementUpdatedEvent(int index,
java.lang.Object oldValue,
java.lang.Object newValue)
protected void fireElementEvent(ObservableList.ElementEvent event)
protected void fireSizeChangedEvent(int oldValue,
int newValue)
public void add(int index,
java.lang.Object element)
add in interface java.util.Listpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.Listpublic boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.Listpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.lang.Objectpublic java.lang.Object get(int index)
get in interface java.util.Listpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class java.lang.Objectpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.Listpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listpublic java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.lang.Object remove(int index)
remove in interface java.util.Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Listpublic java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listpublic int getSize()
public java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic 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)