hok.model
Class ATreeModel

java.lang.Object
  extended by hok.model.ATreeModel
All Implemented Interfaces:
ITreeListeners, ITreeNode
Direct Known Subclasses:
TreeElement

public abstract class ATreeModel
extends java.lang.Object
implements ITreeListeners, ITreeNode

The ATreeModel is the model for the TreeViewer of the ConstraintDialog. It implements the Composite design pattern.

Author:
holger

Constructor Summary
ATreeModel(ITreeNode parent)
          The Constructor.
 
Method Summary
 void addChild(ITreeNode child)
          Adds a child to the tree model.
 void addListener(ITreeNode element)
          Adds a listener to the model.
 java.util.Set<ITreeNode> getChildren(ITreeNode parentElement)
          Returns the children of a parent element.
 ITreeNode getParent()
          Returns the parent of the current element.
 boolean hasChildren()
          Checks if the current element has children.
 void removeChild(ITreeNode child)
          Removes a child from the model.
 void removeListener(ITreeNode element)
          Removes a listener from the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ATreeModel

public ATreeModel(ITreeNode parent)
The Constructor. It sets the parent of this element or null if this element is the root of the tree.

Parameters:
parent - the parent element or null.
Method Detail

addListener

public void addListener(ITreeNode element)
Description copied from interface: ITreeListeners
Adds a listener to the model.

Specified by:
addListener in interface ITreeListeners
Parameters:
element - the listener to add.

removeListener

public void removeListener(ITreeNode element)
Description copied from interface: ITreeListeners
Removes a listener from the model.

Specified by:
removeListener in interface ITreeListeners
Parameters:
element - the listener to remove.

getChildren

public java.util.Set<ITreeNode> getChildren(ITreeNode parentElement)
Description copied from interface: ITreeNode
Returns the children of a parent element.

Specified by:
getChildren in interface ITreeNode
Parameters:
parentElement - the parent element.
Returns:
a list of ITreeNode elements.

getParent

public ITreeNode getParent()
Description copied from interface: ITreeNode
Returns the parent of the current element.

Specified by:
getParent in interface ITreeNode
Returns:
the parent element.

hasChildren

public boolean hasChildren()
Description copied from interface: ITreeNode
Checks if the current element has children.

Specified by:
hasChildren in interface ITreeNode
Returns:
true if the element has children, false otherwise.

addChild

public void addChild(ITreeNode child)
Description copied from interface: ITreeNode
Adds a child to the tree model.

Specified by:
addChild in interface ITreeNode
Parameters:
child - the child to add.

removeChild

public void removeChild(ITreeNode child)
Description copied from interface: ITreeNode
Removes a child from the model.

Specified by:
removeChild in interface ITreeNode
Parameters:
child - the child to remove.