jbcl.model Package
java.lang.Object +----com.borland.jbcl.model.AbstractGraphModel
Constructors Properties Methods Event Listeners
Implements GraphModel, Serializable
AbstractGraphModel
is an abstract implementation of the GraphModel
interface. It provides the event management for a GraphModel
implementor.
To create a fully functional read-only GraphModel
, subclass AbstractGraphModel
, and implement these methods:
To create a fully functional read/write GraphModel
(WritableGraphModel
), add "implements WritableGraphModel" to your class definition, and implement the following methods:
The find(Object data) method of AbstractGraphModel
always returns -1; therefore, it cannot find items in the graph model. To be able to locate items in this model, override this method and search for the passed data object in your graph data structure.
public AbstractGraphModel()An empty constructor for this abstract class.
public boolean isVariableSize()Returns true, which means that items can be added and removed to the model. This is usually desirable if the model is being used as a
WritableGraphModel
. To prevent items from being added or removed, override this method and have it return false.
public boolean canSet(GraphLocation node)Returns true, which means that item specified with the
node
parameter in can be edited. This is usually desirable if the model is being used as a WritableGraphModel
. To prevent items from being edited, override this method and have it return false.
public void enableModelEvents(boolean enable)Determines whether events are enabled for this graph model class. If the
enable
parameter is true, events are enabled and a structure-changed event is fired. If the enable
parameter is false, events are not enabled.
protected void fireContentChanged()This event fires when the contents of the entire graph has changed, but the item count has not changed.
protected void fireItemChanged(GraphLocation node)This event fires when the specified node in the graph has changed.
protected void fireItemTouched(GraphLocation node)This event fires when an item in the graph has been touched.
protected void fireNodeAdded(GraphLocation node)This event fires when a new item is added to the graph.
protected void fireNodeRemoved(GraphLocation node)This event fires when a item is removed from the graph.
protected void fireNodeReplaced(GraphLocation node)This event fires when an entire item in the graph has been replaced.
protected void fireStructureChanged()This event fires when the entire graph has changed, including changes to the node count.
fireStructureChanged()
notifies all listeners that the model should be analyzed again.
public void touched(GraphLocation node)Calls
fireItemTouched()
, notifying listeners that the node has been touched.
public void addModelListener(GraphModelListener listener) public void removeModelListener(GraphModelListener listener)