public class EventTreeModel<E> extends java.lang.Object implements javax.swing.tree.TreeModel, ListEventListener<E>
TreeList for use in a JTree.
Ongoing problem: TreeList cannot cache all tree data on the swing thread proxy due to the extra data in a tree.
Developer Preview this class is still under heavy development and subject to API changes. It's also really slow at the moment and won't scale to lists of size larger than a hundred or so efficiently.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<javax.swing.event.TreeModelListener> |
listenerList
Listeners.
|
protected TransformedList |
swingThreadSource
the proxy moves events to the Swing Event Dispatch thread
|
| Constructor and Description |
|---|
EventTreeModel(TreeList<E> source)
Creates a new tree model that extracts the tree data from the given
source. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener listener) |
void |
dispose()
Releases the resources consumed by this
EventTreeModel so that it
may eventually be garbage collected. |
java.lang.Object |
getChild(java.lang.Object parent,
int index) |
int |
getChildCount(java.lang.Object parent) |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child) |
java.lang.Object |
getRoot() |
boolean |
isLeaf(java.lang.Object node) |
void |
listChanged(ListEvent<E> listChanges)
When the underlying list changes, this notification allows the
object to repaint itself or update itself as necessary.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener listener) |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue) |
protected TransformedList swingThreadSource
protected java.util.List<javax.swing.event.TreeModelListener> listenerList
public java.lang.Object getRoot()
getRoot in interface javax.swing.tree.TreeModelpublic java.lang.Object getChild(java.lang.Object parent,
int index)
getChild in interface javax.swing.tree.TreeModelpublic int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModelpublic boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModelpublic void valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
valueForPathChanged in interface javax.swing.tree.TreeModelpublic int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelpublic void addTreeModelListener(javax.swing.event.TreeModelListener listener)
addTreeModelListener in interface javax.swing.tree.TreeModelpublic void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
removeTreeModelListener in interface javax.swing.tree.TreeModelpublic void listChanged(ListEvent<E> listChanges)
It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.
listChanged in interface ListEventListener<E>listChanges - a ListEvent describing the changes to the listpublic void dispose()
EventTreeModel so that it
may eventually be garbage collected.
An EventTreeModel will be garbage collected without a call to
dispose(), but not before its source EventList is garbage
collected. By calling dispose(), you allow the EventTreeModel
to be garbage collected before its source EventList. This is
necessary for situations where an EventTreeModel is short-lived but
its source EventList is long-lived.
Warning: It is an error
to call any method on an EventTreeModel after it has been disposed.
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by mockbuild at 2017-07-26 15:03