Package org.jgraph.graph
Class GraphLayoutCache.GraphLayoutCacheEdit
- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.undo.CompoundEdit
-
- org.jgraph.graph.GraphLayoutCache.GraphLayoutCacheEdit
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.undo.UndoableEdit,GraphLayoutCacheEvent.GraphLayoutCacheChange
- Enclosing class:
- GraphLayoutCache
public class GraphLayoutCache.GraphLayoutCacheEdit extends javax.swing.undo.CompoundEdit implements GraphLayoutCacheEvent.GraphLayoutCacheChange
An implementation of GraphLayoutCacheChange.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Mapattributesprotected java.lang.Object[]cellsprotected java.util.SetchangedCellsprotected CellView[]contextprotected java.awt.geom.Rectangle2DdirtyRegionThe dirty region associated with this event prior to the changeprotected CellView[]hiddenprotected java.lang.Object[]invisibleprotected java.util.MappreviousAttributesprotected java.lang.Object[]previousCellsprotected java.lang.Object[]visible
-
Constructor Summary
Constructors Constructor Description GraphLayoutCacheEdit(java.lang.Object[] inserted, java.util.Map attributes, java.lang.Object[] visible, java.lang.Object[] invisible)Constructs a GraphViewEdit.GraphLayoutCacheEdit(java.util.Map nested)Constructs a GraphViewEdit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()Execute this edit such that the next invocation to this method will invert the last execution.java.util.MapgetAttributes()Returns a map of (cell view, attribute) pairs.java.lang.Object[]getChanged()Returns the cell views that have changed.java.lang.Object[]getContext()Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.java.awt.geom.Rectangle2DgetDirtyRegion()Returns the dirty region for the original position of the changed cells before the change happened.java.lang.Object[]getInserted()Returns the cells that habe been made visible.java.util.MapgetPreviousAttributes()Returns a map of (cell view, attribute) pairs.java.lang.Object[]getRemoved()Returns the cells that have changed.java.lang.ObjectgetSource()Returns the source of this change.booleanisSignificant()voidredo()Redoes a change.voidsetDirtyRegion(java.awt.geom.Rectangle2D dirty)In some cases the class firing this event will not have access to the dirty region prior to the change.voidundo()Undoes a change.
-
-
-
Field Detail
-
cells
protected java.lang.Object[] cells
-
previousCells
protected java.lang.Object[] previousCells
-
context
protected CellView[] context
-
hidden
protected CellView[] hidden
-
attributes
protected java.util.Map attributes
-
previousAttributes
protected java.util.Map previousAttributes
-
visible
protected java.lang.Object[] visible
-
invisible
protected java.lang.Object[] invisible
-
dirtyRegion
protected java.awt.geom.Rectangle2D dirtyRegion
The dirty region associated with this event prior to the change
-
changedCells
protected java.util.Set changedCells
-
-
Constructor Detail
-
GraphLayoutCacheEdit
public GraphLayoutCacheEdit(java.util.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
-
GraphLayoutCacheEdit
public GraphLayoutCacheEdit(java.lang.Object[] inserted, java.util.Map attributes, java.lang.Object[] visible, java.lang.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 cellsattributes- the map that defines the new attributesvisible- an array defining which cells are visibleinvisible- an array defining which cells are invisible
-
-
Method Detail
-
getSource
public java.lang.Object getSource()
Description copied from interface:GraphLayoutCacheEvent.GraphLayoutCacheChangeReturns 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:
getSourcein interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the source fo this change
-
isSignificant
public boolean isSignificant()
- Specified by:
isSignificantin interfacejavax.swing.undo.UndoableEdit- Overrides:
isSignificantin classjavax.swing.undo.CompoundEdit
-
getChanged
public java.lang.Object[] getChanged()
Returns the cell views that have changed.- Specified by:
getChangedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cell changed
-
getInserted
public java.lang.Object[] getInserted()
Returns the cells that habe been made visible.- Specified by:
getInsertedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cells that were inserted by the change
-
getRemoved
public java.lang.Object[] getRemoved()
Returns the cells that have changed.- Specified by:
getRemovedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cells that were removed by the change
-
getContext
public java.lang.Object[] getContext()
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
getContextin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- array of contextual cells
-
getAttributes
public java.util.Map getAttributes()
Returns a map of (cell view, attribute) pairs.- Specified by:
getAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
getPreviousAttributes
public java.util.Map getPreviousAttributes()
Returns a map of (cell view, attribute) pairs.- Specified by:
getPreviousAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- map of attributes before the change
-
getDirtyRegion
public java.awt.geom.Rectangle2D getDirtyRegion()
Description copied from interface:GraphLayoutCacheEvent.GraphLayoutCacheChangeReturns the dirty region for the original position of the changed cells before the change happened.- Specified by:
getDirtyRegionin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the dirty region prior to the event
-
setDirtyRegion
public void setDirtyRegion(java.awt.geom.Rectangle2D dirty)
Description copied from interface:GraphLayoutCacheEvent.GraphLayoutCacheChangeIn 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:
setDirtyRegionin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
redo
public void redo() throws javax.swing.undo.CannotRedoExceptionRedoes a change.- Specified by:
redoin interfacejavax.swing.undo.UndoableEdit- Overrides:
redoin classjavax.swing.undo.CompoundEdit- Throws:
javax.swing.undo.CannotRedoException- if the change cannot be redone
-
undo
public void undo() throws javax.swing.undo.CannotUndoExceptionUndoes a change.- Specified by:
undoin interfacejavax.swing.undo.UndoableEdit- Overrides:
undoin classjavax.swing.undo.CompoundEdit- 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.
-
-