|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface that defines a suitable data model for a JGraph.
Method Summary | |
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. |
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(ConnectionSet cs,
java.util.Map propertyMap,
ParentMap pm,
javax.swing.undo.UndoableEdit[] e)
Applies the propertyMap and the connection changes to
the model. |
java.util.Map |
getAttributes(java.lang.Object node)
Returns a Map 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 . |
void |
insert(java.lang.Object[] roots,
ConnectionSet cs,
ParentMap pm,
java.util.Map attributeMap)
Inserts the cells and connections into the model,
and passes attributeMap to the views. |
boolean |
isAttributeStore()
Returns true if the model stores all attributes. |
boolean |
isLeaf(java.lang.Object node)
Returns whether the specified node is a leaf node. |
boolean |
isOrdered()
Returns true if the model order should be used. |
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. |
Method Detail |
public int getRootCount()
public java.lang.Object getRootAt(int index)
public int getIndexOfRoot(java.lang.Object root)
root
in the model.
If root is null
, returns -1.
null
public boolean contains(java.lang.Object node)
true
if node
or one of its
ancestors is in the model.
true
if node
is in the modelpublic boolean isAttributeStore()
true
if the model stores all attributes.
Otherwise, the view attributes and model properties are stored
in separate places, allowing a cell to have multiple attribute
sets among different views ("view-dependent" attributes).
true
if the model handles attributes.public java.util.Map getAttributes(java.lang.Object node)
Map
that represents the properties for
the specified cell. This properties have precedence over each
view's attributes, regardless of isAttributeStore.
node
as a Map
public void toBack(java.lang.Object[] cells)
cells
to back.
public void toFront(java.lang.Object[] cells)
cells
to front.
public boolean isOrdered()
true
if the model order should be used.
Typically, this returns the value of isAttributeStore.
public 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 edgepublic 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 edgepublic 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
.public 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
.public 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 source
Iterator
that represents the connected edgespublic java.lang.Object getParent(java.lang.Object child)
child
- a node in the graph, obtained from this data source
public int 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 in
null
public java.lang.Object getChild(java.lang.Object parent, int index)
parent
- a node in the tree, obtained from this data source
public int getChildCount(java.lang.Object parent)
parent
- a node in the tree, obtained from this data source
public boolean isLeaf(java.lang.Object node)
askAllowsChildren
setting.
node
- the node to check
public void insert(java.lang.Object[] roots, ConnectionSet cs, ParentMap pm, java.util.Map attributeMap)
cells
and connections into the model,
and passes attributeMap
to the views.
Notifies the model- and undo listeners of the change.
public void remove(java.lang.Object[] roots)
cells
from the model. If removeChildren
is true
, the children are also removed.
Notifies the model- and undo listeners of the change.
public void edit(ConnectionSet cs, java.util.Map propertyMap, 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.
public void addGraphModelListener(GraphModelListener l)
public void removeGraphModelListener(GraphModelListener l)
public 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.
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |