TWE 2.3-2 API

org.enhydra.jawe.components.graph
Class JaWEGraphModel.GraphModelEdit

java.lang.Object
  extended byjavax.swing.undo.AbstractUndoableEdit
      extended byjavax.swing.undo.CompoundEdit
          extended byorg.enhydra.jawe.components.graph.JaWEGraphModel.GraphModelEdit
All Implemented Interfaces:
org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange, org.jgraph.event.GraphModelEvent.GraphModelChange, java.io.Serializable, javax.swing.undo.UndoableEdit
Enclosing class:
JaWEGraphModel

public class JaWEGraphModel.GraphModelEdit
extends javax.swing.undo.CompoundEdit
implements org.jgraph.event.GraphModelEvent.GraphModelChange

An implementation of GraphModelChange that can be added to the model event.

See Also:
Serialized Form

Field Summary
protected  java.util.Map attributes
           
protected  java.util.Map cellViews
           
protected  java.lang.Object[] changed
           
protected  org.jgraph.graph.ConnectionSet connectionSet
           
protected  java.lang.Object[] context
           
protected  java.lang.Object[] insert
           
protected  java.lang.Object[] inserted
           
protected  java.lang.String name
           
protected  org.jgraph.graph.ParentMap parentMap
           
protected  java.util.Map previousAttributes
           
protected  org.jgraph.graph.ConnectionSet previousConnectionSet
           
protected  org.jgraph.graph.ParentMap previousParentMap
           
protected  java.lang.Object[] remove
           
protected  java.lang.Object[] removed
           
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
JaWEGraphModel.GraphModelEdit(java.lang.Object[] inserted, java.lang.Object[] removed, java.util.Map attributes, org.jgraph.graph.ConnectionSet connectionSet, org.jgraph.graph.ParentMap parentMap, java.lang.String name)
          Constructs an edit record.
 
Method Summary
protected  void changeChildCount(java.util.Map childCount, java.lang.Object parent, int change)
           
 void execute()
          Execute this edit such that the next invocation to this method will invert the last execution.
 java.lang.Object[] filterParents(java.util.Map childCount, int children)
           
 java.util.Map getAttributes()
          Returns a map of (object, view attributes).
 java.lang.Object[] getChanged()
          Returns the cells that have changed.
 org.jgraph.graph.ConnectionSet getConnectionSet()
          Returns the connectionSet.
 java.lang.Object[] getContext()
          Returns the objects that have not changed explicitly, but implicitly because one of their dependent cells has changed.
 java.lang.Object[] getInserted()
          Returns the cells that were inserted.
 org.jgraph.graph.ParentMap getParentMap()
          Returns the parentMap.
 java.lang.String getPresentationName()
          Returns getPresentationName from the last UndoableEdit added to edits.
 java.util.Map getPreviousAttributes()
          Returns a map that contains (object, map) pairs of the attributes that have been stored in the model.
 org.jgraph.graph.ConnectionSet getPreviousConnectionSet()
           
 org.jgraph.graph.ParentMap getPreviousParentMap()
           
 java.lang.Object[] getRemoved()
          Returns the cells that were inserted.
 java.lang.Object getSource()
          Returns the source of this change.
 org.jgraph.graph.CellView[] getViews(org.jgraph.graph.GraphLayoutCache view)
           
protected  void handleEmptyGroups(java.lang.Object[] groups)
          Adds the groups that become empty to the cells that will be removed.
 boolean isSignificant()
           
 void putViews(org.jgraph.graph.GraphLayoutCache view, org.jgraph.graph.CellView[] views)
           
 void redo()
          Redoes a change.
 java.lang.String toString()
           
 void undo()
          Undoes a change.
 
Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, canRedo, canUndo, die, end, getRedoPresentationName, getUndoPresentationName, isInProgress, lastEdit
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

insert

protected java.lang.Object[] insert

changed

protected java.lang.Object[] changed

remove

protected java.lang.Object[] remove

context

protected java.lang.Object[] context

inserted

protected java.lang.Object[] inserted

removed

protected java.lang.Object[] removed

attributes

protected java.util.Map attributes

previousAttributes

protected java.util.Map previousAttributes

parentMap

protected org.jgraph.graph.ParentMap parentMap

previousParentMap

protected org.jgraph.graph.ParentMap previousParentMap

connectionSet

protected org.jgraph.graph.ConnectionSet connectionSet

previousConnectionSet

protected org.jgraph.graph.ConnectionSet previousConnectionSet

cellViews

protected java.util.Map cellViews
Constructor Detail

JaWEGraphModel.GraphModelEdit

public JaWEGraphModel.GraphModelEdit(java.lang.Object[] inserted,
                                     java.lang.Object[] removed,
                                     java.util.Map attributes,
                                     org.jgraph.graph.ConnectionSet connectionSet,
                                     org.jgraph.graph.ParentMap parentMap,
                                     java.lang.String name)
Constructs an edit record.

Parameters:
inserted - a set of roots that were inserted
removed - a set of elements that were removed
attributes -
connectionSet -
parentMap -
name -
Method Detail

filterParents

public java.lang.Object[] filterParents(java.util.Map childCount,
                                        int children)

changeChildCount

protected void changeChildCount(java.util.Map childCount,
                                java.lang.Object parent,
                                int change)

handleEmptyGroups

protected void handleEmptyGroups(java.lang.Object[] groups)
Adds the groups that become empty to the cells that will be removed. (Auto remove empty cells.) Removed cells will be re-inserted on undo, and the parent- child relations will be restored.


isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface javax.swing.undo.UndoableEdit

getPresentationName

public java.lang.String getPresentationName()
Returns getPresentationName from the last UndoableEdit added to edits. If edits is empty, calls super.

Specified by:
getPresentationName in interface javax.swing.undo.UndoableEdit

getSource

public java.lang.Object getSource()
Returns the source of this change. This can either be a view or a model, if this change is a GraphModelChange.

Specified by:
getSource in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getChanged

public java.lang.Object[] getChanged()
Returns the cells that have changed. This includes the cells that have been changed through a call to getAttributes and the edges that have been changed with the ConnectionSet.

Specified by:
getChanged in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getContext

public java.lang.Object[] getContext()
Returns the objects that have not changed explicitly, but implicitly because one of their dependent cells has changed.

Specified by:
getContext in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getInserted

public java.lang.Object[] getInserted()
Returns the cells that were inserted.

Specified by:
getInserted in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getRemoved

public java.lang.Object[] getRemoved()
Returns the cells that were inserted.

Specified by:
getRemoved in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getPreviousAttributes

public java.util.Map getPreviousAttributes()
Returns a map that contains (object, map) pairs of the attributes that have been stored in the model.

Specified by:
getPreviousAttributes in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getAttributes

public java.util.Map getAttributes()
Returns a map of (object, view attributes). The objects are model objects which need to be mapped to views.

Specified by:
getAttributes in interface org.jgraph.event.GraphLayoutCacheEvent.GraphLayoutCacheChange

getConnectionSet

public org.jgraph.graph.ConnectionSet getConnectionSet()
Returns the connectionSet.

Specified by:
getConnectionSet in interface org.jgraph.event.GraphModelEvent.GraphModelChange
Returns:
ConnectionSet

getPreviousConnectionSet

public org.jgraph.graph.ConnectionSet getPreviousConnectionSet()
Specified by:
getPreviousConnectionSet in interface org.jgraph.event.GraphModelEvent.GraphModelChange

getParentMap

public org.jgraph.graph.ParentMap getParentMap()
Returns the parentMap.

Specified by:
getParentMap in interface org.jgraph.event.GraphModelEvent.GraphModelChange
Returns:
ParentMap

getPreviousParentMap

public org.jgraph.graph.ParentMap getPreviousParentMap()
Specified by:
getPreviousParentMap in interface org.jgraph.event.GraphModelEvent.GraphModelChange

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Redoes a change.

Specified by:
redo in interface javax.swing.undo.UndoableEdit
Throws:
javax.swing.undo.CannotRedoException - if the change cannot be redone

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Undoes a change.

Specified by:
undo in interface javax.swing.undo.UndoableEdit
Throws:
javax.swing.undo.CannotUndoException - if the change cannot be undone

execute

public void execute()
Execute this edit such that the next invocation to this method will invert the last execution.


putViews

public void putViews(org.jgraph.graph.GraphLayoutCache view,
                     org.jgraph.graph.CellView[] views)
Specified by:
putViews in interface org.jgraph.event.GraphModelEvent.GraphModelChange

getViews

public org.jgraph.graph.CellView[] getViews(org.jgraph.graph.GraphLayoutCache view)
Specified by:
getViews in interface org.jgraph.event.GraphModelEvent.GraphModelChange

toString

public java.lang.String toString()

TWE 2.3-2 API