borland Packages  Class Hierarchy  jbcl.model Package  Index 

WritableGraphModel interface

borland.jbcl.model.GraphModel
   +----borland.jbcl.model.WritableGraphModel

About the WritableGraphModel interface

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.


WritableGraphModel properties

*Read-only properties **Write-only properties

Properties defined in this interface

Properties implemented in borland.jbcl.model.GraphModel

WritableGraphModel methods

Methods defined in this interface

Methods implemented in borland.jbcl.model.GraphModel

WritableGraphModel event listeners


WritableGraphModel properties

variableSize

 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.

WritableGraphModel methods

addChild(borland.jbcl.model.GraphLocation, borland.jbcl.model.GraphLocation, java.lang.Object)

  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:

parent
The node whose chain of children node the data object is inserted into.
aheadOf
The node the data object is inserted before in the chain of child nodes.
data
The data object added to the graph.

addChild(borland.jbcl.model.GraphLocation, java.lang.Object)

  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:

parent
The node whose chain of children the data object is appended to.
data
The data object that is appended to the chain of children.

canSet(borland.jbcl.model.GraphLocation)

  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:

node
The node whose edit state is being determined.

enableModelEvents(boolean)

  public void enableModelEvents(boolean enable)
Determines whether the broadcasting of graph-model events is enabled or disabled.

Parameters:

enable
If enable is true, the broadcasting of graph-model events is enabled and a STRUCTURE_CHANGED event is fired to all graph-model listeners. If it is false, graph-model events are not broadcast.

remove(borland.jbcl.model.GraphLocation)

  public void remove(borland.jbcl.model.GraphLocation node)
Removes a node from the graph.

Parameters:

node
The node to be removed from the graph.

removeAll()

  public void removeAll()
Removes all nodes from the graph.

removeChildren(borland.jbcl.model.GraphLocation)

  public void removeChildren(borland.jbcl.model.GraphLocation parent)
Removes all children from the specified node from the graph.

Parameters:

parent
The node whose child nodes are to be removed.

set(borland.jbcl.model.GraphLocation, java.lang.Object)

  public void set(borland.jbcl.model.GraphLocation node, java.lang.Object data)
Sets the data object at a given node in the graph.

Parameters:

node
The node in the graph where the data object is set.
data
The data object being set at the specified node.

setRoot(java.lang.Object)

  public GraphLocation setRoot(java.lang.Object data)
Sets the root node of the graph, returning the location of the node.

Parameters:

data
The data object being set at the root.

touched(borland.jbcl.model.GraphLocation)

  public void touched(borland.jbcl.model.GraphLocation node)
Notifies all listeners that the data object at the specified location was manipulated.

Parameters:

node
The node where the data was manipulated.

WritableGraphModel event listeners

This interface is a source for the following event sets. For information on the JBCL event sets, see Events in JBCL.

model

 public void addModelListener(borland.jbcl.model.GraphModelListener listener)
 public void removeModelListener(borland.jbcl.model.GraphModelListener listener)