com.jgraph.example.adapter
Class JGraphAdapterModel

java.lang.Object
  extended by javax.swing.undo.UndoableEditSupport
      extended by org.jgraph.graph.DefaultGraphModel
          extended by com.jgraph.example.adapter.JGraphAdapterModel
All Implemented Interfaces:
java.io.Serializable, org.jgraph.graph.GraphModel
Direct Known Subclasses:
JGraphSQLBusinessModel

public class JGraphAdapterModel
extends org.jgraph.graph.DefaultGraphModel

Maps from business objects to cells and manages prototypes to create new cells on the fly. Maps from userobjects to cells and manages cell prototypes.

See Also:
Serialized Form

Nested Class Summary
 class JGraphAdapterModel.BusinessModelEdit
           
 
Nested classes/interfaces inherited from class org.jgraph.graph.DefaultGraphModel
org.jgraph.graph.DefaultGraphModel.EmptyIterator, org.jgraph.graph.DefaultGraphModel.GraphModelEdit, org.jgraph.graph.DefaultGraphModel.GraphModelLayerEdit
 
Field Summary
static java.lang.String VERSION
           
 
Constructor Summary
JGraphAdapterModel()
           
JGraphAdapterModel(java.util.List roots, org.jgraph.graph.AttributeMap attributes)
           
JGraphAdapterModel(java.util.List roots, org.jgraph.graph.AttributeMap attributes, JGraphAdapterBackend backend)
           
 
Method Summary
 void addProperty(java.lang.Object cell, java.lang.Object key, java.lang.Object value)
           
 void edit(java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, javax.swing.undo.UndoableEdit[] edits)
           
 void fireAttributesChanged(java.lang.Object cell, java.util.Map change, boolean validate)
           
 void fireCellRemoved(java.lang.Object object, boolean validate)
           
 void fireCommit()
           
 void fireEdgeAdded(java.lang.Object edge, java.lang.Object source, java.lang.Object target, boolean validate)
           
 void fireParentChanged(java.lang.Object child, java.lang.Object parent, boolean validate)
           
 void fireRollback()
           
 void fireSourceChanged(java.lang.Object edge, java.lang.Object source, boolean validate)
           
 void fireTargetChanged(java.lang.Object edge, java.lang.Object target, boolean validate)
           
 void fireVertexAdded(java.lang.Object vertex, boolean validate)
           
 JGraphAdapterBackend getBackend()
           
 java.lang.Object getMapping(java.lang.Object obj)
           
 java.lang.Object getParentUserObject(java.lang.Object child)
           
 java.lang.Object getSourceVertexUserObject(java.lang.Object edge)
           
 java.lang.Object getTargetVertexUserObject(java.lang.Object edge)
           
 void insert(java.lang.Object[] cells, java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, javax.swing.undo.UndoableEdit[] edits)
           
 void processInsert(java.lang.Object[] cells, java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, boolean validate)
           
 void remove(java.lang.Object[] cells)
           
 void setBackend(JGraphAdapterBackend backend)
           
 java.lang.Object valueForCellChanged(java.lang.Object cell, java.lang.Object newValue)
           
 
Methods inherited from class org.jgraph.graph.DefaultGraphModel
acceptsSource, acceptsTarget, addGraphModelListener, beginUpdate, cellsChanged, cloneCell, cloneCell, cloneCells, contains, containsEdgeBetween, edges, edit, endUpdate, execute, getAll, getAttributes, getAttributes, getChild, getChildCount, getConnectionSet, getDescendants, getEdges, getEdges, getEdgesBetween, getGraphModelListeners, getIncomingEdges, getIndexOfChild, getIndexOfRoot, getOpposite, getOutgoingEdges, getParent, getRootAt, getRootCount, getRoots, getRoots, getRoots, getRootsAsCollection, getSource, getSourceVertex, getTarget, getTargetVertex, getTopmostCells, getUpdateLevel, getUserObject, getValue, hasAncestorIn, isEdge, isGroup, isLeaf, isPort, isRemoveEmptyGroups, isVertex, order, removeGraphModelListener, setRemoveEmptyGroups, setSourcePort, setTargetPort, toBack, toFront
 
Methods inherited from class javax.swing.undo.UndoableEditSupport
addUndoableEditListener, getUndoableEditListeners, postEdit, removeUndoableEditListener, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jgraph.graph.GraphModel
addUndoableEditListener, removeUndoableEditListener
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

JGraphAdapterModel

public JGraphAdapterModel()

JGraphAdapterModel

public JGraphAdapterModel(java.util.List roots,
                          org.jgraph.graph.AttributeMap attributes)
Parameters:
roots -
attributes -

JGraphAdapterModel

public JGraphAdapterModel(java.util.List roots,
                          org.jgraph.graph.AttributeMap attributes,
                          JGraphAdapterBackend backend)
Parameters:
roots -
attributes -
Method Detail

addProperty

public void addProperty(java.lang.Object cell,
                        java.lang.Object key,
                        java.lang.Object value)

getBackend

public JGraphAdapterBackend getBackend()
Returns:
Returns the backend.

setBackend

public void setBackend(JGraphAdapterBackend backend)
Parameters:
backend - The backend to set.

getMapping

public java.lang.Object getMapping(java.lang.Object obj)
Parameters:
obj -
Returns:
the object that the specified object maps to

getParentUserObject

public java.lang.Object getParentUserObject(java.lang.Object child)
Parameters:
child -
Returns:
the user object associated with the parent of the specified child

getSourceVertexUserObject

public java.lang.Object getSourceVertexUserObject(java.lang.Object edge)
Parameters:
edge -
Returns:
the user object associated with the vertex connected to the source end of this edge

getTargetVertexUserObject

public java.lang.Object getTargetVertexUserObject(java.lang.Object edge)
Parameters:
edge -
Returns:
the user object associated with the vertex connected to the target end of this edge

edit

public void edit(java.util.Map attributes,
                 org.jgraph.graph.ConnectionSet cs,
                 org.jgraph.graph.ParentMap pm,
                 javax.swing.undo.UndoableEdit[] edits)
Specified by:
edit in interface org.jgraph.graph.GraphModel
Overrides:
edit in class org.jgraph.graph.DefaultGraphModel

valueForCellChanged

public java.lang.Object valueForCellChanged(java.lang.Object cell,
                                            java.lang.Object newValue)
Specified by:
valueForCellChanged in interface org.jgraph.graph.GraphModel
Overrides:
valueForCellChanged in class org.jgraph.graph.DefaultGraphModel

insert

public void insert(java.lang.Object[] cells,
                   java.util.Map attributes,
                   org.jgraph.graph.ConnectionSet cs,
                   org.jgraph.graph.ParentMap pm,
                   javax.swing.undo.UndoableEdit[] edits)
Specified by:
insert in interface org.jgraph.graph.GraphModel
Overrides:
insert in class org.jgraph.graph.DefaultGraphModel

remove

public void remove(java.lang.Object[] cells)
Specified by:
remove in interface org.jgraph.graph.GraphModel
Overrides:
remove in class org.jgraph.graph.DefaultGraphModel

processInsert

public void processInsert(java.lang.Object[] cells,
                          java.util.Map attributes,
                          org.jgraph.graph.ConnectionSet cs,
                          org.jgraph.graph.ParentMap pm,
                          boolean validate)
                   throws java.lang.Exception
Throws:
java.lang.Exception

fireCommit

public void fireCommit()
                throws java.lang.Exception
Throws:
java.lang.Exception

fireRollback

public void fireRollback()
                  throws java.lang.Exception
Throws:
java.lang.Exception

fireVertexAdded

public void fireVertexAdded(java.lang.Object vertex,
                            boolean validate)
                     throws java.lang.Exception
Parameters:
vertex -
validate -
Throws:
java.lang.Exception

fireEdgeAdded

public void fireEdgeAdded(java.lang.Object edge,
                          java.lang.Object source,
                          java.lang.Object target,
                          boolean validate)
                   throws java.lang.Exception
Parameters:
edge -
source -
target -
validate -
Throws:
java.lang.Exception

fireCellRemoved

public void fireCellRemoved(java.lang.Object object,
                            boolean validate)
                     throws java.lang.Exception
Parameters:
object -
validate -
Throws:
java.lang.Exception

fireParentChanged

public void fireParentChanged(java.lang.Object child,
                              java.lang.Object parent,
                              boolean validate)
                       throws java.lang.Exception
Parameters:
child -
parent -
validate -
Throws:
java.lang.Exception

fireSourceChanged

public void fireSourceChanged(java.lang.Object edge,
                              java.lang.Object source,
                              boolean validate)
                       throws java.lang.Exception
Parameters:
edge -
source -
validate -
Throws:
java.lang.Exception

fireTargetChanged

public void fireTargetChanged(java.lang.Object edge,
                              java.lang.Object target,
                              boolean validate)
                       throws java.lang.Exception
Parameters:
edge -
target -
validate -
Throws:
java.lang.Exception

fireAttributesChanged

public void fireAttributesChanged(java.lang.Object cell,
                                  java.util.Map change,
                                  boolean validate)
                           throws java.lang.Exception
Parameters:
cell -
change -
validate -
Throws:
java.lang.Exception