JGraph
v5.12.0.4


org.jgraph.graph
Class GraphLayoutCache.GraphLayoutCacheEdit

java.lang.Object
  extended byjavax.swing.undo.AbstractUndoableEdit
      extended byjavax.swing.undo.CompoundEdit
          extended byorg.jgraph.graph.GraphLayoutCache.GraphLayoutCacheEdit
All Implemented Interfaces:
GraphLayoutCacheEvent.GraphLayoutCacheChange, Serializable, UndoableEdit
Enclosing class:
GraphLayoutCache

public class GraphLayoutCache.GraphLayoutCacheEdit
extends CompoundEdit
implements GraphLayoutCacheEvent.GraphLayoutCacheChange

An implementation of GraphLayoutCacheChange.

See Also:
Serialized Form

Field Summary
protected  Map attributes
           
protected  Object[] cells
           
protected  Set changedCells
           
protected  CellView[] context
           
protected  Rectangle2D dirtyRegion
          The dirty region associated with this event prior to the change
protected  CellView[] hidden
           
protected  Object[] invisible
           
protected  Map previousAttributes
           
protected  Object[] previousCells
           
protected  Object[] visible
           
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
GraphLayoutCache.GraphLayoutCacheEdit(Map nested)
          Constructs a GraphViewEdit.
GraphLayoutCache.GraphLayoutCacheEdit(Object[] inserted, Map attributes, Object[] visible, Object[] invisible)
          Constructs a GraphViewEdit.
 
Method Summary
 void execute()
          Execute this edit such that the next invocation to this method will invert the last execution.
 Map getAttributes()
          Returns a map of (cell view, attribute) pairs.
 Object[] getChanged()
          Returns the cell views that have changed.
 Object[] getContext()
          Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.
 Rectangle2D getDirtyRegion()
          Returns the dirty region for the original position of the changed cells before the change happened.
 Object[] getInserted()
          Returns the cells that habe been made visible.
 Map getPreviousAttributes()
          Returns a map of (cell view, attribute) pairs.
 Object[] getRemoved()
          Returns the cells that have changed.
 Object getSource()
          Returns the source of this change.
 boolean isSignificant()
           
 void redo()
          Redoes a change.
 void setDirtyRegion(Rectangle2D dirty)
          In some cases the class firing this event will not have access to the dirty region prior to the change.
 void undo()
          Undoes a change.
 
Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, lastEdit, toString
 
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

cells

protected Object[] cells

previousCells

protected Object[] previousCells

context

protected CellView[] context

hidden

protected CellView[] hidden

attributes

protected Map attributes

previousAttributes

protected Map previousAttributes

visible

protected Object[] visible

invisible

protected Object[] invisible

dirtyRegion

protected Rectangle2D dirtyRegion
The dirty region associated with this event prior to the change


changedCells

protected Set changedCells
Constructor Detail

GraphLayoutCache.GraphLayoutCacheEdit

public GraphLayoutCache.GraphLayoutCacheEdit(Map nested)
Constructs a GraphViewEdit. This modifies the attributes of the specified views and may be used to notify UndoListeners.

Parameters:
nested - the map that defines the new attributes

GraphLayoutCache.GraphLayoutCacheEdit

public GraphLayoutCache.GraphLayoutCacheEdit(Object[] inserted,
                                             Map attributes,
                                             Object[] visible,
                                             Object[] invisible)
Constructs a GraphViewEdit. This modifies the attributes of the specified views and may be used to notify UndoListeners. This should also take an array of removed cell views, but it is not possible to add further UndoableEdits to an already executed CompoundEdit, such as a GraphModel change. Thus, to handle implicit changes -- rather than piggybacking on the model's event -- the CompoundEdit's addEdit method should be extended to accept and instantly execute sub- sequent edits (implicit changes to the view, such as removing a mapping, hiding a view or the like).

Parameters:
inserted - an array of inserted cells
attributes - the map that defines the new attributes
visible - an array defining which cells are visible
invisible - an array defining which cells are invisible
Method Detail

getSource

public Object getSource()
Description copied from interface: GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns the source of this change. This can either be a view or a model, if this change is a GraphModelChange. Note: This is not necessarily the same as the source of the event and is used separately in the graphundomanager.

Specified by:
getSource in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the source fo this change

isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface UndoableEdit

getChanged

public Object[] getChanged()
Returns the cell views that have changed.

Specified by:
getChanged in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cell changed

getInserted

public Object[] getInserted()
Returns the cells that habe been made visible.

Specified by:
getInserted in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cells that were inserted by the change

getRemoved

public Object[] getRemoved()
Returns the cells that have changed.

Specified by:
getRemoved in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cells that were removed by the change

getContext

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

Specified by:
getContext in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
array of contextual cells

getAttributes

public Map getAttributes()
Returns a map of (cell view, attribute) pairs.

Specified by:
getAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getPreviousAttributes

public Map getPreviousAttributes()
Returns a map of (cell view, attribute) pairs.

Specified by:
getPreviousAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
map of attributes before the change

getDirtyRegion

public Rectangle2D getDirtyRegion()
Description copied from interface: GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns the dirty region for the original position of the changed cells before the change happened.

Specified by:
getDirtyRegion in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the dirty region prior to the event

setDirtyRegion

public void setDirtyRegion(Rectangle2D dirty)
Description copied from interface: GraphLayoutCacheEvent.GraphLayoutCacheChange
In some cases the class firing this event will not have access to the dirty region prior to the change. It is then up to the receiving class to set it once.

Specified by:
setDirtyRegion in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Parameters:
dirty -

redo

public void redo()
          throws CannotRedoException
Redoes a change.

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

undo

public void undo()
          throws CannotUndoException
Undoes a change.

Specified by:
undo in interface UndoableEdit
Throws:
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.


JGraph
v5.12.0.4


Copyright (C) 2001-2006 Gaudenz Alder. All rights reserved.