borland Packages Class Hierarchy jbcl.model Package Index
borland.jbcl.model.GraphModel +----borland.jbcl.model.WritableGraphModel
Properties Methods Event Listeners
Implemented by BasicTreeContainer, LinkedTreeContainer
The WritableGraphModel interface contains the methods required for a read-write graph model object; that is, a model that holds data in a hierarchical relationship like a directory listing. Each node (except the root node, or origin of the graph) has a parent node from which it descends. Each node may or may not have one or more sibling nodes (descendants from the same parent) and one or more child nodes (descendants from itself).
WritableGraphModel extends the GraphModel interface and adds the methods needed to add, change, and delete nodes in a hierarchy. Usually, you will extend a class that implements this interface, such as BasicTreeContainer. If you are creating an entirely new component, you can implement the interface directly.
To establish a root node, call the setRoot() method. To add a node, call addChild(). To remove one or more nodes, choose from the remove(), removeAll(), or removeChildren() methods. The set() method sets the data object at the specified node.
Whether or not the data object at a node can be modified depends on whether canset() returns true or false. The variableSize property determines whether the size of the graph model can change.
public boolean isVariableSize()Determines whether nodes can be added or removed from the graph. If variableSize is true, nodes can be added and deleted; if it is false, the size of the graph cannot vary.
public GraphLocation addChild(borland.jbcl.model.GraphLocation parent, borland.jbcl.model.GraphLocation aheadOf, java.lang.Object data)Inserts a data object in the chain of children of the specified parent node and returns the location of the inserted object.
Parameters:
public GraphLocation addChild(borland.jbcl.model.GraphLocation parent, java.lang.Object data)Appends a data object as the last child in the chain of children of the specified parent node.
Parameters:
public boolean canSet(borland.jbcl.model.GraphLocation node)Determines whether the data object at the specified node can be modified. If canSet() returns true, the data object can be modified.
Parameters:
public void enableModelEvents(boolean enable)Determines whether the broadcasting of graph-model events is enabled or disabled.
Parameters:
public void remove(borland.jbcl.model.GraphLocation node)Removes a node from the graph.
Parameters:
public void removeAll()Removes all nodes from the graph.
public void removeChildren(borland.jbcl.model.GraphLocation parent)Removes all children from the specified node from the graph.
Parameters:
public void set(borland.jbcl.model.GraphLocation node, java.lang.Object data)Sets the data object at a given node in the graph.
Parameters:
public GraphLocation setRoot(java.lang.Object data)Sets the root node of the graph, returning the location of the node.
Parameters:
public void touched(borland.jbcl.model.GraphLocation node)Notifies all listeners that the data object at the specified location was manipulated.
Parameters:
public void addModelListener(borland.jbcl.model.GraphModelListener listener) public void removeModelListener(borland.jbcl.model.GraphModelListener listener)