public class BPDGraphModel extends UndoableEditSupport implements Serializable, org.jgraph.graph.GraphModel
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BPDGraphModel.EmptyIterator |
class |
BPDGraphModel.GraphModelEdit
An implementation of GraphModelChange that can be added to the model
event.
|
class |
BPDGraphModel.GraphModelLayerEdit
An implementation of GraphViewChange.
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
asksAllowsChildren
Indicates whether isLeaf is based on a node's allowsChildren value.
|
protected Iterator |
emptyIterator
Default instance of an empty iterator.
|
protected EventListenerList |
listenerList
The list of listeners that listen to the model.
|
protected List |
roots
Set that contains all root cells of this model.
|
compoundEdit, listeners, realSource, updateLevel| 构造器和说明 |
|---|
BPDGraphModel()
Constructs a model that is not an attribute store.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acceptsSource(Object edge,
Object port)
Returns
true if port is a valid source
for edge. |
boolean |
acceptsTarget(Object edge,
Object port)
Returns
true if port is a valid target
for edge. |
void |
addGraphModelListener(org.jgraph.event.GraphModelListener l)
Adds a listener for the GraphModelEvent posted after the graph changes.
|
Map |
cloneCells(Object[] cells)
Returns a map of (cell, clone)-pairs for all
cells
and their children. |
protected void |
connect(Object edge,
Object port,
boolean isSource,
boolean remove)
Connects or disconnects the edge and port in this model
based on
remove. |
boolean |
contains(Object node)
Returns
true if node or one of its
ancestors is in the model. |
protected BPDGraphModel.GraphModelEdit |
createCellEdit(Map attributes,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
UndoableEdit[] edits,
String name)
Returns an edit that represents a change.
|
protected BPDGraphModel.GraphModelEdit |
createEdit(Object[] inserted,
Object[] removed,
Map attributes,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
String name) |
protected BPDGraphModel.GraphModelEdit |
createInsertEdit(Object[] cells,
Map attributeMap,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
UndoableEdit[] edits,
String name)
Returns an edit that represents an insert.
|
protected BPDGraphModel.GraphModelLayerEdit |
createLayerEdit(Object[] cells,
int layer) |
protected BPDGraphModel.GraphModelEdit |
createRemoveAndCellEdit(Object[] cells,
Map attributes,
String name)
Returns an edit that represents a remove and a change.
|
protected BPDGraphModel.GraphModelEdit |
createRemoveEdit(Object[] cells,
String name)
Returns an edit that represents a remove.
|
Iterator |
edges(Object port)
Returns an iterator of the edges connected to
port. |
void |
edit(Map attributes,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
UndoableEdit[] edits)
Applies
attributes and the connection changes to
the model. |
void |
editFonts(Map attributes)
Used for editing font sizes without haveing an undo action set.
|
protected void |
fireGraphChanged(Object source,
org.jgraph.event.GraphModelEvent.GraphModelChange edit) |
static Set |
getAllActivitiesInModel(org.jgraph.graph.GraphModel model)
Gets all existing activities within model.
|
static Set |
getAllCellsInModel(org.jgraph.graph.GraphModel model)
Gets all existing cells within model.
|
static Set |
getAllParticipantsInModel(org.jgraph.graph.GraphModel model)
Gets all existing participants within model.
|
static Set |
getAllTransitionsInModel(org.jgraph.graph.GraphModel model)
Gets all existing transitions within model.
|
Map |
getAttributes(Object node)
Returns a
Map that represents the attributes for
the specified cell. |
Object |
getChild(Object parent,
int index)
Returns the child of parent at index index in the parent's
child array.
|
int |
getChildCount(Object parent)
Returns the number of children of parent.
|
static List |
getDescendantList(org.jgraph.graph.GraphModel model,
Object[] cells) |
static Set |
getDescendants(org.jgraph.graph.GraphModel model,
Object[] cells)
Flattens the given array of root cells by adding the roots
and their descandants.
|
static Set |
getEdges(org.jgraph.graph.GraphModel model,
Object[] cells)
Return the set of edges that are connected to the
specified cells.
|
org.jgraph.event.GraphModelListener[] |
getGraphModelListeners()
Return an array of all GraphModelListeners that were added to this model.
|
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of child in parent.
|
int |
getIndexOfRoot(Object root)
Returns the index of
root in the model. |
Object |
getParent(Object child)
Returns the parent of child in the model.
|
Object |
getRootAt(int index)
Returns the root at index index in the model.
|
int |
getRootCount()
Returns the number of roots in the model.
|
static Set |
getRootParticipants(org.jgraph.graph.GraphModel model)
Returns the root participants of the specified model as a set.
|
static Object[] |
getRoots(org.jgraph.graph.GraphModel model)
Returns the roots of the specified model as an array.
|
Object |
getSource(Object edge)
Returns the source of
edge. |
static Object |
getSourceVertex(org.jgraph.graph.GraphModel model,
Object edge)
Returns the source vertex of the edge by calling getParent on
getSource on the specified model.
|
Object |
getTarget(Object edge)
Returns the target of
edge. |
static Object |
getTargetVertex(org.jgraph.graph.GraphModel model,
Object edge)
Returns the target vertex of the edge by calling getParent on
getTarget on the specified model.
|
protected Map |
handleAttributes(Map attributes)
Applies
attributes to the cells specified as keys. |
protected void |
handleConnection(org.jgraph.graph.ConnectionSet.Connection c)
Inserts the specified connection into the model.
|
protected org.jgraph.graph.ConnectionSet |
handleConnectionSet(org.jgraph.graph.ConnectionSet cs)
Applies
connectionSet to the model. |
protected Object[] |
handleInsert(Object[] cells)
Inserts
cells into the model. |
protected org.jgraph.graph.ParentMap |
handleParentMap(org.jgraph.graph.ParentMap parentMap)
Applies
cells to the model. |
protected Object[] |
handleRemove(Object[] cells)
Removes
cells from the model. |
void |
insert(Object[] roots,
Map attributes,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
UndoableEdit[] edits)
Inserts the
roots and connections into the model. |
void |
insertAndEdit(Object[] roots,
Map attributes,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm,
UndoableEdit[] edits,
String undoMsg)
Inserts the
roots and connections into the model. |
boolean |
isEdge(Object edge)
Returns
true if edge is a valid edge. |
boolean |
isLeaf(Object node)
Returns whether the specified node is a leaf node.
|
boolean |
isPort(Object port)
Returns
true if port is a valid
port, possibly supporting edge connection. |
void |
remove(Object[] roots)
Removes
cells from the model. |
void |
removeAndEdit(Object[] roots,
Map attributes,
String name)
Removes
cells from the model and edits cells given in
a propertyMap. |
void |
removeBubbles(Object[] bubbles,
org.jgraph.event.GraphModelListener gml)
Used for editing font sizes without haveing an undo action set.
|
void |
removeGraphModelListener(org.jgraph.event.GraphModelListener l)
Removes a listener previously added with addGraphModelListener().
|
void |
toBack(Object[] cells)
Sends
cells to back. |
void |
toFront(Object[] cells)
Brings
cells to front. |
_postEdit, addUndoableEditListener, beginUpdate, createCompoundEdit, endUpdate, getUndoableEditListeners, getUpdateLevel, postEdit, removeUndoableEditListener, toStringprotected transient EventListenerList listenerList
protected transient Iterator emptyIterator
protected List roots
protected boolean asksAllowsChildren
public int getRootCount()
getRootCount 在接口中 org.jgraph.graph.GraphModelpublic Object getRootAt(int index)
getRootAt 在接口中 org.jgraph.graph.GraphModelpublic int getIndexOfRoot(Object root)
root in the model.
If root is null, returns -1.getIndexOfRoot 在接口中 org.jgraph.graph.GraphModelroot - a root in the model, obtained from this data sourcenullpublic boolean contains(Object node)
true if node or one of its
ancestors is in the model.contains 在接口中 org.jgraph.graph.GraphModeltrue if node is in the modelpublic Map getAttributes(Object node)
Map that represents the attributes for
the specified cell. This attributes have precedence over each
view's attributes, regardless of isAttributeStore.getAttributes 在接口中 org.jgraph.graph.GraphModelnode as a Mappublic Object getSource(Object edge)
edge. edge must be an object
previously obtained from this data source.getSource 在接口中 org.jgraph.graph.GraphModelObject that represents the source of edgepublic Object getTarget(Object edge)
edge. edge must be an object
previously obtained from this data source.getTarget 在接口中 org.jgraph.graph.GraphModelObject that represents the target of edgepublic boolean acceptsSource(Object edge, Object port)
true if port is a valid source
for edge. edge and port must be
objects previously obtained from this data source.acceptsSource 在接口中 org.jgraph.graph.GraphModeltrue if port is a valid source
for edge.public boolean acceptsTarget(Object edge, Object port)
true if port is a valid target
for edge. edge and port must be
objects previously obtained from this data source.acceptsTarget 在接口中 org.jgraph.graph.GraphModeltrue if port is a valid target
for edge.public Iterator edges(Object port)
port.
port must be a object previously obtained from
this data source. This method never returns null.edges 在接口中 org.jgraph.graph.GraphModelport - a port in the graph, obtained from this data sourceIterator that represents the connected edgespublic boolean isEdge(Object edge)
true if edge is a valid edge.isEdge 在接口中 org.jgraph.graph.GraphModeltrue if edge is a valid edge.public boolean isPort(Object port)
true if port is a valid
port, possibly supporting edge connection.isPort 在接口中 org.jgraph.graph.GraphModeltrue if port is a valid port.public Map cloneCells(Object[] cells)
cells
and their children. Special care is taken to replace the anchor
references between ports. (Iterative implementation.)cloneCells 在接口中 org.jgraph.graph.GraphModelpublic Object getParent(Object child)
getParent 在接口中 org.jgraph.graph.GraphModelchild - a node in the graph, obtained from this data sourcepublic int getIndexOfChild(Object parent, Object child)
null, returns -1.getIndexOfChild 在接口中 org.jgraph.graph.GraphModelparent - a note in the tree, obtained from this data sourcechild - the node we are interested innullpublic Object getChild(Object parent, int index)
getChild 在接口中 org.jgraph.graph.GraphModelparent - a node in the tree, obtained from this data sourcepublic int getChildCount(Object parent)
getChildCount 在接口中 org.jgraph.graph.GraphModelparent - a node in the tree, obtained from this data sourcepublic boolean isLeaf(Object node)
isLeaf 在接口中 org.jgraph.graph.GraphModelnode - the node to checkpublic void insert(Object[] roots, Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, UndoableEdit[] edits)
roots and connections into the model.
Notifies the model- and undo listeners of the change. The passed-in
edits are executed if they implement the
GraphModelEvent.ExecutableGraphChange interface
in ascending array-order, after execution of the model change.
(Note: The external order is important in a
special case: After insertion on a partial view, ie. one that does not
display all cells of the model, the cell is made visible after
it is inserted into the model. This requires the inserting view
to be able to add the cell to the visible set before it is
inserted into the model.)
Note: The passed-in propertyMap may contains PortViews
which must be turned into Points when stored in the model.insert 在接口中 org.jgraph.graph.GraphModelpublic void remove(Object[] roots)
cells from the model.
Notifies the model- and undo listeners of the change.remove 在接口中 org.jgraph.graph.GraphModelpublic void edit(Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, UndoableEdit[] edits)
attributes and the connection changes to
the model. The initial edits that triggered the call
are considered to be part of this transaction. The passed-in
edits are executed if they implement the
GraphModelEvent.ExecutableGraphChange interface
in ascending array-order, after execution of the model change.
Notifies the model- and undo listeners of the change.
Note: If only edits is non-null, the
edits are directly passed to the UndoableEditListeners.
Note: The passed-in propertyMap may contains PortViews
which must be turned into Points when stored in the model.edit 在接口中 org.jgraph.graph.GraphModelpublic void editFonts(Map attributes)
public void removeBubbles(Object[] bubbles, org.jgraph.event.GraphModelListener gml)
public void insertAndEdit(Object[] roots, Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, UndoableEdit[] edits, String undoMsg)
roots and connections into the model.
Notifies the model- and undo listeners of the change. The passed-in
edits are executed if they implement the
GraphModelEvent.ExecutableGraphChange interface
in ascending array-order, after execution of the model change.
(Note: The external order is important in a
special case: After insertion on a partial view, ie. one that does not
display all cells of the model, the cell is made visible after
it is inserted into the model. This requires the inserting view
to be able to add the cell to the visible set before it is
inserted into the model.)
Note: The passed-in propertyMap may contains PortViews
which must be turned into Points when stored in the model.public void removeAndEdit(Object[] roots, Map attributes, String name)
cells from the model and edits cells given in
a propertyMap. If removeChildren
is true, the children are also removed.
Notifies the model- and undo listeners of the change.public void toBack(Object[] cells)
cells to back.toBack 在接口中 org.jgraph.graph.GraphModelpublic void toFront(Object[] cells)
cells to front.toFront 在接口中 org.jgraph.graph.GraphModelprotected BPDGraphModel.GraphModelLayerEdit createLayerEdit(Object[] cells, int layer)
protected BPDGraphModel.GraphModelEdit createInsertEdit(Object[] cells, Map attributeMap, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, UndoableEdit[] edits, String name)
protected BPDGraphModel.GraphModelEdit createRemoveEdit(Object[] cells, String name)
protected BPDGraphModel.GraphModelEdit createCellEdit(Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, UndoableEdit[] edits, String name)
protected BPDGraphModel.GraphModelEdit createEdit(Object[] inserted, Object[] removed, Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, String name)
protected BPDGraphModel.GraphModelEdit createRemoveAndCellEdit(Object[] cells, Map attributes, String name)
protected Object[] handleInsert(Object[] cells)
cells into the model. Returns
the cells that were inserted (including descendants).protected Object[] handleRemove(Object[] cells)
cells from the model. Returns
the cells that were removed as roots.protected org.jgraph.graph.ParentMap handleParentMap(org.jgraph.graph.ParentMap parentMap)
cells to the model. Returns
a parent map that may be used to undo this change.protected Map handleAttributes(Map attributes)
attributes to the cells specified as keys.
Returns the attributes to undo the change.protected org.jgraph.graph.ConnectionSet handleConnectionSet(org.jgraph.graph.ConnectionSet cs)
connectionSet to the model. Returns
a connection set that may be used to undo this change.protected void handleConnection(org.jgraph.graph.ConnectionSet.Connection c)
protected void connect(Object edge, Object port, boolean isSource, boolean remove)
remove. Subclassers should override
this to update connectivity datastructures.public void addGraphModelListener(org.jgraph.event.GraphModelListener l)
addGraphModelListener 在接口中 org.jgraph.graph.GraphModell - the listener to addremoveGraphModelListener(org.jgraph.event.GraphModelListener)public void removeGraphModelListener(org.jgraph.event.GraphModelListener l)
removeGraphModelListener 在接口中 org.jgraph.graph.GraphModell - the listener to removeaddGraphModelListener(org.jgraph.event.GraphModelListener)protected void fireGraphChanged(Object source, org.jgraph.event.GraphModelEvent.GraphModelChange edit)
public org.jgraph.event.GraphModelListener[] getGraphModelListeners()
public static Object getSourceVertex(org.jgraph.graph.GraphModel model, Object edge)
public static Object getTargetVertex(org.jgraph.graph.GraphModel model, Object edge)
public static Object[] getRoots(org.jgraph.graph.GraphModel model)
public static Set getRootParticipants(org.jgraph.graph.GraphModel model)
public static Set getEdges(org.jgraph.graph.GraphModel model, Object[] cells)
public static Set getDescendants(org.jgraph.graph.GraphModel model, Object[] cells)
public static List getDescendantList(org.jgraph.graph.GraphModel model, Object[] cells)
public static Set getAllCellsInModel(org.jgraph.graph.GraphModel model)
public static Set getAllParticipantsInModel(org.jgraph.graph.GraphModel model)
public static Set getAllActivitiesInModel(org.jgraph.graph.GraphModel model)
public static Set getAllTransitionsInModel(org.jgraph.graph.GraphModel model)
Copyright © 2023 onecode. All rights reserved.