Class RelationTreeModel
java.lang.Object
org.openstreetmap.josm.gui.dialogs.relation.RelationTreeModel
- All Implemented Interfaces:
TreeModel
This is a
TreeModel which provides the hierarchical structure of Relations
to a JTree.
The model is initialized with a root relation or with a list of RelationMembers, see
populate(Relation) and populate(List) respectively.- Since:
- 1828
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CopyOnWriteArrayList<TreeModelListener>the tree model listenersprivate Relationthe root relation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidfireRefreshNode(TreePath path) Notifies tree model listeners about an update of the trees nodes.protected voidNotifies tree model listeners about a replacement of the root.intgetChildCount(Object parent) protected intgetIndexForRelationChild(Relation parent, Relation child) Replies the index of a particularchildwith respect to itsparent.intgetIndexOfChild(Object parent, Object child) protected intgetNumRelationChildren(Relation parent) Replies the number of children of type relation for a particular relationparentprotected RelationgetRelationChildByIdx(Relation parent, int idx) Replies the i-th child of type relation for a particular relationparent.getRoot()booleanvoidpopulate(List<RelationMember> members) Populates the model with a list of relation membersvoidPopulates the model with a root relationvoidrefreshNode(TreePath pathToNode) Invoke to notify all listeners about an update of a particular nodevoidvoidvalueForPathChanged(TreePath path, Object newValue)
-
Field Details
-
root
the root relation -
listeners
the tree model listeners
-
-
Constructor Details
-
RelationTreeModel
public RelationTreeModel()constructor
-
-
Method Details
-
getNumRelationChildren
Replies the number of children of type relation for a particular relationparent- Parameters:
parent- the parent relation- Returns:
- the number of children of type relation
-
getRelationChildByIdx
Replies the i-th child of type relation for a particular relationparent.- Parameters:
parent- the parent relationidx- the index- Returns:
- the i-th child of type relation for a particular relation
parent; null, if no such child exists
-
getIndexForRelationChild
Replies the index of a particularchildwith respect to itsparent.- Parameters:
parent- the parent relationchild- the child relation- Returns:
- the index of a particular
childwith respect to itsparent; -1 if either parent or child are null or ifchildisn't a child ofparent.
-
populate
Populates the model with a root relation- Parameters:
root- the root relation- See Also:
-
populate
Populates the model with a list of relation members- Parameters:
members- the relation members
-
fireRootReplacedEvent
Notifies tree model listeners about a replacement of the root. -
fireRefreshNode
Notifies tree model listeners about an update of the trees nodes.- Parameters:
path- the tree path to the node
-
refreshNode
Invoke to notify all listeners about an update of a particular node- Parameters:
pathToNode- the tree path to the node
-
getChild
-
getChildCount
- Specified by:
getChildCountin interfaceTreeModel
-
getIndexOfChild
- Specified by:
getIndexOfChildin interfaceTreeModel
-
getRoot
-
isLeaf
-
addTreeModelListener
- Specified by:
addTreeModelListenerin interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListenerin interfaceTreeModel
-
valueForPathChanged
- Specified by:
valueForPathChangedin interfaceTreeModel
-