Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.util
Class ObservableList

    java.lang.Object
      groovy.util.ObservableList

All Implemented Interfaces:
  Iterable, Collection, List

    public class ObservableList

extends Object
implements List

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()

Author:
  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(Closure test)`
`ObservableList(List delegate)`
`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)`
`int` | `hashCode()`
`boolean` | `hasListeners(String propertyName)`
`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 java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

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)

  Specified by:
    `add` in interface `List`

### add

    public boolean add(Object o)

  Specified by:
    `add` in interface `Collection`
  Specified by:
    `add` in interface `List`

### addAll

    public boolean addAll(Collection c)

  Specified by:
    `addAll` in interface `Collection`
  Specified by:
    `addAll` in interface `List`

### addAll

    public boolean addAll(int index,
                          Collection c)

  Specified by:
    `addAll` in interface `List`

### clear

    public void clear()

  Specified by:
    `clear` in interface `Collection`
  Specified by:
    `clear` in interface `List`

### contains

    public boolean contains(Object o)

  Specified by:
    `contains` in interface `Collection`
  Specified by:
    `contains` in interface `List`

### containsAll

    public boolean containsAll(Collection c)

  Specified by:
    `containsAll` in interface `Collection`
  Specified by:
    `containsAll` in interface `List`

### equals

    public boolean equals(Object o)

  Specified by:
    `equals` in interface `Collection`
  Specified by:
    `equals` in interface `List`
  Overrides:
    `equals` in class `Object`

### get

    public Object get(int index)

  Specified by:
    `get` in interface `List`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Collection`
  Specified by:
    `hashCode` in interface `List`
  Overrides:
    `hashCode` in class `Object`

### indexOf

    public int indexOf(Object o)

  Specified by:
    `indexOf` in interface `List`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Collection`
  Specified by:
    `isEmpty` in interface `List`

### iterator

    public Iterator iterator()

  Specified by:
    `iterator` in interface `Iterable`
  Specified by:
    `iterator` in interface `Collection`
  Specified by:
    `iterator` in interface `List`

### lastIndexOf

    public int lastIndexOf(Object o)

  Specified by:
    `lastIndexOf` in interface `List`

### listIterator

    public ListIterator listIterator()

  Specified by:
    `listIterator` in interface `List`

### listIterator

    public ListIterator listIterator(int index)

  Specified by:
    `listIterator` in interface `List`

### remove

    public Object remove(int index)

  Specified by:
    `remove` in interface `List`

### remove

    public boolean remove(Object o)

  Specified by:
    `remove` in interface `Collection`
  Specified by:
    `remove` in interface `List`

### removeAll

    public boolean removeAll(Collection c)

  Specified by:
    `removeAll` in interface `Collection`
  Specified by:
    `removeAll` in interface `List`

### retainAll

    public boolean retainAll(Collection c)

  Specified by:
    `retainAll` in interface `Collection`
  Specified by:
    `retainAll` in interface `List`

### set

    public Object set(int index,
                      Object element)

  Specified by:
    `set` in interface `List`

### size

    public int size()

  Specified by:
    `size` in interface `Collection`
  Specified by:
    `size` in interface `List`

### subList

    public List subList(int fromIndex,
                        int toIndex)

  Specified by:
    `subList` in interface `List`

### toArray

    public Object[] toArray()

  Specified by:
    `toArray` in interface `Collection`
  Specified by:
    `toArray` in interface `List`

### toArray

    public Object[] toArray(Object[] a)

  Specified by:
    `toArray` in interface `Collection`
  Specified by:
    `toArray` in interface `List`

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

### addPropertyChangeListener

    public void addPropertyChangeListener(String propertyName,
                                          PropertyChangeListener listener)

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners()

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(String propertyName,
                                             PropertyChangeListener listener)

### hasListeners

    public boolean hasListeners(String propertyName)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2008 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD