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:
Serializable
,UndoableEdit
,GraphLayoutCacheEvent.GraphLayoutCacheChange
- Enclosing class:
GraphLayoutCache
public class GraphLayoutCache.GraphLayoutCacheEdit
extends CompoundEdit
implements GraphLayoutCacheEvent.GraphLayoutCacheChange
An implementation of GraphLayoutCacheChange.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
protected Object[]
protected Set
protected CellView[]
protected Rectangle2D
The dirty region associated with this event prior to the changeprotected CellView[]
protected Object[]
protected Map
protected Object[]
protected Object[]
Fields inherited from class javax.swing.undo.CompoundEdit
edits
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
ConstructorsConstructorDescriptionGraphLayoutCacheEdit
(Object[] inserted, Map attributes, Object[] visible, Object[] invisible) Constructs a GraphViewEdit.GraphLayoutCacheEdit
(Map nested) Constructs a GraphViewEdit. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Execute this edit such that the next invocation to this method will invert the last execution.Returns a map of (cell view, attribute) pairs.Object[]
Returns the cell views that have changed.Object[]
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.Returns the dirty region for the original position of the changed cells before the change happened.Object[]
Returns the cells that habe been made visible.Returns a map of (cell view, attribute) pairs.Object[]
Returns the cells that have changed.Returns the source of this change.boolean
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
-
Field Details
-
cells
-
previousCells
-
context
-
attributes
-
previousAttributes
-
visible
-
invisible
-
dirtyRegion
The dirty region associated with this event prior to the change -
changedCells
-
-
Constructor Details
-
GraphLayoutCacheEdit
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(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 cellsattributes
- the map that defines the new attributesvisible
- an array defining which cells are visibleinvisible
- an array defining which cells are invisible
-
-
Method Details
-
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 interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the source fo this change
-
isSignificant
public boolean isSignificant()- Specified by:
isSignificant
in interfaceUndoableEdit
- Overrides:
isSignificant
in classCompoundEdit
-
getChanged
Returns the cell views that have changed.- Specified by:
getChanged
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the cell changed
-
getInserted
Returns the cells that habe been made visible.- Specified by:
getInserted
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the cells that were inserted by the change
-
getRemoved
Returns the cells that have changed.- Specified by:
getRemoved
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the cells that were removed by the change
-
getContext
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
getContext
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- array of contextual cells
-
getAttributes
Returns a map of (cell view, attribute) pairs.- Specified by:
getAttributes
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
getPreviousAttributes
Returns a map of (cell view, attribute) pairs.- Specified by:
getPreviousAttributes
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- map of attributes before the change
-
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 interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the dirty region prior to the event
-
setDirtyRegion
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 interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Parameters:
dirty
-
-
redo
Redoes a change.- Specified by:
redo
in interfaceUndoableEdit
- Overrides:
redo
in classCompoundEdit
- Throws:
CannotRedoException
- if the change cannot be redone
-
undo
Undoes a change.- Specified by:
undo
in interfaceUndoableEdit
- Overrides:
undo
in classCompoundEdit
- 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.
-