Groovy 1.7.10

## groovy.util
[Java] Class ObservableList

    java.lang.Object
      groovy.util.ObservableList

All Implemented Interfaces:
  List

    public class ObservableList
    extends Object

List decorator that will trigger PropertyChangeEvents when a value changes.
An optional Closure may be specified and will work as a filter, if it returns true the property will trigger an event (if the value indeed changed), otherwise it won't. The Closure may receive 1 or 2 parameters, the single one being the value, the other one both the key and value, for example:

     // skip all properties whose value is a closure
     def map = new ObservableList( {!(it instanceof Closure)} )
     <p/>
     // 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

- ObservableList.ElementAddedEvent - a new element is added to the list
- ObservableList.ElementRemovedEvent - a element is removed from the list
- ObservableList.ElementUpdatedEvent - a element changes value (same as regular PropertyChangeEvent)
- ObservableList.ElementClearedEvent - all elements have been removed from the list
- ObservableList.MultiElementAddedEvent - triggered by calling list.addAll()
- ObservableList.MultiElementRemoveedEvent - triggered by calling list.removeAll()/list.retainAll()

Authors:
  Andres Almiray

Nested Class Summary
`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`

Constructor Summary
`ObservableList()`
`ObservableList(List delegate)`
`ObservableList(Closure test)`
`ObservableList(List delegate, Closure test)`

Method Summary
`void` | `add(int index, Object element)`
`boolean` | `add(Object o)`
`boolean` | `addAll(Collection c)`
`boolean` | `addAll(int index, Collection c)`
`void` | `addPropertyChangeListener(PropertyChangeListener listener)`
`void` | `addPropertyChangeListener(String propertyName, PropertyChangeListener listener)`
`void` | `clear()`
`boolean` | `contains(Object o)`
`boolean` | `containsAll(Collection c)`
`boolean` | `equals(Object o)`
`Object` | `get(int index)`
`PropertyChangeListener[]` | `getPropertyChangeListeners()`
`PropertyChangeListener[]` | `getPropertyChangeListeners(String propertyName)`
`boolean` | `hasListeners(String propertyName)`
`int` | `hashCode()`
`int` | `indexOf(Object o)`
`boolean` | `isEmpty()`
`Iterator` | `iterator()`
`int` | `lastIndexOf(Object o)`
`ListIterator` | `listIterator()`
`ListIterator` | `listIterator(int index)`
`Object` | `remove(int index)`
`boolean` | `remove(Object o)`
`boolean` | `removeAll(Collection c)`
`void` | `removePropertyChangeListener(PropertyChangeListener listener)`
`void` | `removePropertyChangeListener(String propertyName, PropertyChangeListener listener)`
`boolean` | `retainAll(Collection c)`
`Object` | `set(int index, Object element)`
`int` | `size()`
`List` | `subList(int fromIndex, int toIndex)`
`Object[]` | `toArray()`
`Object[]` | `toArray(Object[] a)`

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Constructor Detail

### ObservableList

    public ObservableList()

### ObservableList

    public ObservableList(List delegate)

### ObservableList

    public ObservableList(Closure test)

### ObservableList

    public ObservableList(List delegate, Closure test)

Method Detail

### add

    public void add(int index, Object element)

### add

    public boolean add(Object o)

### addAll

    public boolean addAll(Collection c)

### addAll

    public boolean addAll(int index, Collection c)

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

### addPropertyChangeListener

    public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)

### clear

    public void clear()

### contains

    public boolean contains(Object o)

### containsAll

    public boolean containsAll(Collection c)

### equals

    public boolean equals(Object o)

### get

    public Object get(int index)

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners()

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)

### hasListeners

    public boolean hasListeners(String propertyName)

### hashCode

    public int hashCode()

### indexOf

    public int indexOf(Object o)

### isEmpty

    public boolean isEmpty()

### iterator

    public Iterator iterator()

### lastIndexOf

    public int lastIndexOf(Object o)

### listIterator

    public ListIterator listIterator()

### listIterator

    public ListIterator listIterator(int index)

### remove

    public Object remove(int index)

### remove

    public boolean remove(Object o)

### removeAll

    public boolean removeAll(Collection c)

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)

### retainAll

    public boolean retainAll(Collection c)

### set

    public Object set(int index, Object element)

### size

    public int size()

### subList

    public List subList(int fromIndex, int toIndex)

### toArray

    public Object[] toArray()

### toArray

    public Object[] toArray(Object[] a)

Copyright © 2003-2010 The Codehaus. All rights reserved.