public interface GraphModel
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsSource(java.lang.Object edge,
java.lang.Object port)
Returns
true if port is a valid source for
edge . |
boolean |
acceptsTarget(java.lang.Object edge,
java.lang.Object port)
Returns
true if port is a valid target for
edge . |
void |
addGraphModelListener(GraphModelListener l)
Adds a listener for the GraphModelEvent posted after the model changes.
|
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Adds an undo listener for notification of any changes.
|
void |
beginUpdate()
Indicates the start of one level of an executable change
|
java.util.Map |
cloneCells(java.lang.Object[] cells)
Returns a map of (cell, clone)-pairs for all
cells and
their children. |
boolean |
contains(java.lang.Object node)
Returns
true if node or one of its
ancestors is in the model. |
java.util.Iterator |
edges(java.lang.Object port)
Returns an iterator of the edges connected to
port . |
void |
edit(java.util.Map attributes,
ConnectionSet cs,
ParentMap pm,
javax.swing.undo.UndoableEdit[] e)
Applies the
propertyMap and the connection changes to the
model. |
void |
endUpdate()
Indicates the end of the current level of an executable change
|
void |
execute(ExecutableChange change)
Executes the specified executable change on this graph model
|
AttributeMap |
getAttributes(java.lang.Object node)
Returns a
AttributeMap that represents the properties for
the specified cell. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Returns the child of parent at index index in the
parent's child array.
|
int |
getChildCount(java.lang.Object parent)
Returns the number of children of parent .
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Returns the index of child in parent.
|
int |
getIndexOfRoot(java.lang.Object root)
Returns the index of
root in the model. |
java.lang.Object |
getParent(java.lang.Object child)
Returns the parent of child in the model.
|
java.lang.Object |
getRootAt(int index)
Returns the root at index index in the model.
|
int |
getRootCount()
Returns the number of roots in the model.
|
java.lang.Object |
getSource(java.lang.Object edge)
Returns the source of
edge . |
java.lang.Object |
getTarget(java.lang.Object edge)
Returns the target of
edge . |
java.lang.Object |
getValue(java.lang.Object node)
Returns the user object for the specified cell.
|
void |
insert(java.lang.Object[] roots,
java.util.Map attributes,
ConnectionSet cs,
ParentMap pm,
javax.swing.undo.UndoableEdit[] e)
Inserts the
cells and connections into the model, and
passes attributes to the views. |
boolean |
isEdge(java.lang.Object edge)
Returns
true if edge is a valid edge. |
boolean |
isLeaf(java.lang.Object node)
Returns whether the specified node is a leaf node.
|
boolean |
isPort(java.lang.Object port)
Returns
true if port is a valid port,
possibly supporting edge connection. |
void |
remove(java.lang.Object[] roots)
Removes
cells from the model. |
void |
removeGraphModelListener(GraphModelListener l)
Removes a listener previously added with addGraphModelListener() .
|
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Removes an undo listener.
|
void |
toBack(java.lang.Object[] cells)
Sends
cells to back. |
void |
toFront(java.lang.Object[] cells)
Brings
cells to front. |
java.lang.Object |
valueForCellChanged(java.lang.Object cell,
java.lang.Object newValue)
Messaged when the value of the cell has changed, eg from within the edit
method.
|
int getRootCount()
java.lang.Object getRootAt(int index)
int getIndexOfRoot(java.lang.Object root)
root
in the model. If root is
null
, returns -1.root
- a root in the model, obtained from this data sourcenull
boolean contains(java.lang.Object node)
true
if node
or one of its
ancestors is in the model.true
if node
is in the modelAttributeMap getAttributes(java.lang.Object node)
AttributeMap
that represents the properties for
the specified cell.node
as a Map
java.lang.Object getValue(java.lang.Object node)
node
java.lang.Object getSource(java.lang.Object edge)
edge
. edge must be an
object previously obtained from this data source.Object
that represents the source of edge java.lang.Object getTarget(java.lang.Object edge)
edge
. edge must be an
object previously obtained from this data source.Object
that represents the target of edge boolean acceptsSource(java.lang.Object edge, java.lang.Object port)
true
if port
is a valid source for
edge
. edge and port must be objects
previously obtained from this data source.true
if port
is a valid source for
edge
.boolean acceptsTarget(java.lang.Object edge, java.lang.Object port)
true
if port
is a valid target for
edge
. edge and port must be objects
previously obtained from this data source.true
if port
is a valid target for
edge
.java.util.Iterator edges(java.lang.Object port)
port
.
port must be a object previously obtained from this data source.
This method never returns null.port
- a port in the graph, obtained from this data sourceIterator
that represents the connected edgesboolean isEdge(java.lang.Object edge)
true
if edge
is a valid edge.true
if edge
is a valid edge.boolean isPort(java.lang.Object port)
true
if port
is a valid port,
possibly supporting edge connection.true
if port
is a valid port.java.lang.Object getParent(java.lang.Object child)
child
- a node in the graph, obtained from this data sourceint getIndexOfChild(java.lang.Object parent, java.lang.Object child)
null
, returns -1.parent
- a note in the tree, obtained from this data sourcechild
- the node we are interested innull
java.lang.Object getChild(java.lang.Object parent, int index)
parent
- a node in the tree, obtained from this data sourceint getChildCount(java.lang.Object parent)
parent
- a node in the tree, obtained from this data sourceboolean isLeaf(java.lang.Object node)
askAllowsChildren
setting.node
- the node to checkvoid insert(java.lang.Object[] roots, java.util.Map attributes, ConnectionSet cs, ParentMap pm, javax.swing.undo.UndoableEdit[] e)
cells
and connections into the model, and
passes attributes
to the views. Notifies the model- and
undo listeners of the change.void remove(java.lang.Object[] roots)
cells
from the model. Notifies the model- and undo
listeners of the change.void edit(java.util.Map attributes, ConnectionSet cs, ParentMap pm, javax.swing.undo.UndoableEdit[] e)
propertyMap
and the connection changes to the
model. The initial edits
that triggered the call are
considered to be part of this transaction. Notifies the model- and undo
listeners of the change. Note: If only
edits
is non-null, the edits are directly passed to the
UndoableEditListeners.void beginUpdate()
void endUpdate()
void execute(ExecutableChange change)
change
- the change to be executedjava.util.Map cloneCells(java.lang.Object[] cells)
cells
and
their children. Special care should be taken to replace references
between cells.java.lang.Object valueForCellChanged(java.lang.Object cell, java.lang.Object newValue)
void toBack(java.lang.Object[] cells)
cells
to back.void toFront(java.lang.Object[] cells)
cells
to front.void addGraphModelListener(GraphModelListener l)
void removeGraphModelListener(GraphModelListener l)
void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
UndoableEdit
will cause the
appropriate ModelEvent to be fired to keep the view(s) in sync with the
model.void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.