com.jgoodies.common.collect
Class LinkedListModel<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
java.util.LinkedList<E>
com.jgoodies.common.collect.LinkedListModel<E>
- Type Parameters:
E - the type of the list elements
- All Implemented Interfaces:
- ObservableList<E>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Deque<E>, java.util.List<E>, java.util.Queue<E>, javax.swing.ListModel
public class LinkedListModel<E>
- extends java.util.LinkedList<E>
- implements ObservableList<E>
Adds ListModel capabilities to its superclass.
It allows to observe changes in the content and structure. Useful for
Lists that are bound to list views such as JList, JComboBox and JTable.
This class should be be final and it will be marked final in a future
version, if its subclass in the JGoodies Binding has been removed.
- Version:
- $Revision: 1.4 $
- Author:
- Karsten Lentzsch
- See Also:
ObservableList,
ArrayListModel,
Serialized Form
| Fields inherited from class java.util.AbstractList |
modCount |
|
Constructor Summary |
LinkedListModel()
Constructs an empty LinkedListModel. |
LinkedListModel(java.util.Collection<? extends E> c)
Constructs a LinkedListModel containing the elements of the specified
collection, in the order they are returned by the collection's
iterator. |
| Methods inherited from class java.util.LinkedList |
addAll, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, removeFirstOccurrence, removeLastOccurrence, size, toArray, toArray |
| Methods inherited from class java.util.AbstractSequentialList |
iterator |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, isEmpty, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, removeAll, retainAll, size, subList, toArray, toArray |
| Methods inherited from interface java.util.Deque |
iterator |
LinkedListModel
public LinkedListModel()
- Constructs an empty LinkedListModel.
LinkedListModel
public LinkedListModel(java.util.Collection<? extends E> c)
- Constructs a LinkedListModel containing the elements of the specified
collection, in the order they are returned by the collection's
iterator.
- Parameters:
c - the collection whose elements are to be placed into this list.
- Throws:
java.lang.NullPointerException - if c is null
add
public final void add(int index,
E element)
- Specified by:
add in interface java.util.List<E>- Overrides:
add in class java.util.LinkedList<E>
add
public final boolean add(E e)
- Specified by:
add in interface java.util.Collection<E>- Specified by:
add in interface java.util.Deque<E>- Specified by:
add in interface java.util.List<E>- Specified by:
add in interface java.util.Queue<E>- Overrides:
add in class java.util.LinkedList<E>
addAll
public final boolean addAll(int index,
java.util.Collection<? extends E> c)
- Specified by:
addAll in interface java.util.List<E>- Overrides:
addAll in class java.util.LinkedList<E>
addFirst
public final void addFirst(E e)
- Specified by:
addFirst in interface java.util.Deque<E>- Overrides:
addFirst in class java.util.LinkedList<E>
addLast
public final void addLast(E e)
- Specified by:
addLast in interface java.util.Deque<E>- Overrides:
addLast in class java.util.LinkedList<E>
clear
public final void clear()
- Specified by:
clear in interface java.util.Collection<E>- Specified by:
clear in interface java.util.List<E>- Overrides:
clear in class java.util.LinkedList<E>
remove
public final E remove(int index)
- Specified by:
remove in interface java.util.List<E>- Overrides:
remove in class java.util.LinkedList<E>
remove
public final boolean remove(java.lang.Object o)
- Specified by:
remove in interface java.util.Collection<E>- Specified by:
remove in interface java.util.Deque<E>- Specified by:
remove in interface java.util.List<E>- Overrides:
remove in class java.util.LinkedList<E>
removeFirst
public final E removeFirst()
- Specified by:
removeFirst in interface java.util.Deque<E>- Overrides:
removeFirst in class java.util.LinkedList<E>
removeLast
public final E removeLast()
- Specified by:
removeLast in interface java.util.Deque<E>- Overrides:
removeLast in class java.util.LinkedList<E>
removeRange
protected final void removeRange(int fromIndex,
int toIndex)
- Overrides:
removeRange in class java.util.AbstractList<E>
set
public final E set(int index,
E element)
- Specified by:
set in interface java.util.List<E>- Overrides:
set in class java.util.LinkedList<E>
listIterator
public final java.util.ListIterator<E> listIterator(int index)
- Specified by:
listIterator in interface java.util.List<E>- Overrides:
listIterator in class java.util.LinkedList<E>
addListDataListener
public final void addListDataListener(javax.swing.event.ListDataListener l)
- Specified by:
addListDataListener in interface javax.swing.ListModel
removeListDataListener
public final void removeListDataListener(javax.swing.event.ListDataListener l)
- Specified by:
removeListDataListener in interface javax.swing.ListModel
getElementAt
public final E getElementAt(int index)
- Specified by:
getElementAt in interface javax.swing.ListModel
getSize
public final int getSize()
- Specified by:
getSize in interface javax.swing.ListModel
fireContentsChanged
public final void fireContentsChanged(int index)
- Notifies all registered
ListDataListeners that the element
at the specified index has changed. Useful if there's a content change
without any structural change.
This method must be called after the element of the list changes.
- Parameters:
index - the index of the element that has changed- See Also:
EventListenerList
getListDataListeners
public final javax.swing.event.ListDataListener[] getListDataListeners()
- Returns an array of all the list data listeners
registered on this
LinkedListModel.
- Returns:
- all of this model's
ListDataListeners,
or an empty array if no list data listeners
are currently registered - See Also:
addListDataListener(ListDataListener),
removeListDataListener(ListDataListener)
Copyright © 2009-2011 JGoodies Karsten Lentzsch. All Rights Reserved.