|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.odell.glazedlists.swing.EventTreeModel<E>
public class EventTreeModel<E>
Adapt a 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.
Field Summary | |
---|---|
protected List<TreeModelListener> |
listenerList
Listeners. |
protected TransformedList |
swingThreadSource
the proxy moves events to the Swing Event Dispatch thread |
Constructor Summary | |
---|---|
EventTreeModel(TreeList<E> source)
Creates a new tree model that extracts the tree data from the given source . |
Method Summary | |
---|---|
void |
addTreeModelListener(TreeModelListener listener)
|
void |
dispose()
Releases the resources consumed by this EventTreeModel so that it
may eventually be garbage collected. |
Object |
getChild(Object parent,
int index)
|
int |
getChildCount(Object parent)
|
int |
getIndexOfChild(Object parent,
Object child)
|
Object |
getRoot()
|
boolean |
isLeaf(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(TreeModelListener listener)
|
void |
valueForPathChanged(TreePath path,
Object newValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected TransformedList swingThreadSource
protected List<TreeModelListener> listenerList
Constructor Detail |
---|
public EventTreeModel(TreeList<E> source)
source
.
source
- a TreeList
that provides the tree dataMethod Detail |
---|
public Object getRoot()
getRoot
in interface TreeModel
public Object getChild(Object parent, int index)
getChild
in interface TreeModel
public int getChildCount(Object parent)
getChildCount
in interface TreeModel
public boolean isLeaf(Object node)
isLeaf
in interface TreeModel
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public void addTreeModelListener(TreeModelListener listener)
addTreeModelListener
in interface TreeModel
public void removeTreeModelListener(TreeModelListener listener)
removeTreeModelListener
in interface TreeModel
public 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |