|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.gui.dialogs.relation.RelationTreeModel
public class RelationTreeModel
This is a TreeModel
which provides the hierarchical structure of Relation
s
to a JTree
.
The model is initialized with a root relation or with a list of RelationMember
s, see
populate(Relation)
and populate(List)
respectively.
Field Summary | |
---|---|
private java.util.concurrent.CopyOnWriteArrayList<javax.swing.event.TreeModelListener> |
listeners
the tree model listeners |
private Relation |
root
the root relation |
Constructor Summary | |
---|---|
RelationTreeModel()
constructor |
|
RelationTreeModel(java.util.List<RelationMember> members)
constructor |
|
RelationTreeModel(Relation root)
constructor |
Method Summary | |
---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
|
protected void |
fireRefreshNode(javax.swing.tree.TreePath path)
Notifies tree model listeners about an update of the trees nodes. |
protected void |
fireRootReplacedEvent()
Notifies tree model listeners about a replacement of the root. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
|
int |
getChildCount(java.lang.Object parent)
|
protected int |
getIndexForRelationChild(Relation parent,
Relation child)
Replies the index of a particular child with respect to its
parent . |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
protected int |
getNumRelationChildren(Relation parent)
Replies the number of children of type relation for a particular relation parent |
protected Relation |
getRelationChildByIdx(Relation parent,
int idx)
Replies the i-th child of type relation for a particular relation parent . |
java.lang.Object |
getRoot()
|
boolean |
isLeaf(java.lang.Object node)
|
void |
populate(java.util.List<RelationMember> members)
Populates the model with a list of relation members |
void |
populate(Relation root)
Populates the model with a root relation |
void |
refreshNode(javax.swing.tree.TreePath pathToNode)
Invoke to notify all listeners about an update of a particular node |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Relation root
private java.util.concurrent.CopyOnWriteArrayList<javax.swing.event.TreeModelListener> listeners
Constructor Detail |
---|
public RelationTreeModel()
public RelationTreeModel(Relation root)
root
- the root relationpublic RelationTreeModel(java.util.List<RelationMember> members)
members
- a list of membersMethod Detail |
---|
protected int getNumRelationChildren(Relation parent)
parent
parent
- the parent relation
protected Relation getRelationChildByIdx(Relation parent, int idx)
parent
.
parent
- the parent relationidx
- the index
parent
; null, if no such child existsprotected int getIndexForRelationChild(Relation parent, Relation child)
child
with respect to its
parent
.
parent
- the parent relationchild
- the child relation
child
with respect to its
parent
; -1 if either parent or child are null or if child
isn't a child of parent
.public void populate(Relation root)
root
- the root relationpopulate(List)
public void populate(java.util.List<RelationMember> members)
members
- the relation membersprotected void fireRootReplacedEvent()
protected void fireRefreshNode(javax.swing.tree.TreePath path)
path
- the tree path to the nodepublic void refreshNode(javax.swing.tree.TreePath pathToNode)
pathToNode
- the tree path to the nodepublic java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public boolean isLeaf(java.lang.Object node)
isLeaf
in interface javax.swing.tree.TreeModel
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface javax.swing.tree.TreeModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |