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 Mapprotected Object[]protected Setprotected CellView[]protected Rectangle2DThe dirty region associated with this event prior to the changeprotected CellView[]protected Object[]protected Mapprotected Object[]protected Object[]Fields inherited from class javax.swing.undo.CompoundEdit
editsFields 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 TypeMethodDescriptionvoidexecute()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.booleanvoidredo()Redoes a change.voidsetDirtyRegion(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.Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, lastEdit, toStringMethods 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.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 interfaceUndoableEdit- Overrides:
isSignificantin classCompoundEdit
-
getChanged
Returns the cell views that have changed.- Specified by:
getChangedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cell changed
-
getInserted
Returns the cells that habe been made visible.- Specified by:
getInsertedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cells that were inserted by the change
-
getRemoved
Returns the cells that have changed.- Specified by:
getRemovedin 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:
getContextin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- array of contextual cells
-
getAttributes
Returns a map of (cell view, attribute) pairs.- Specified by:
getAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
getPreviousAttributes
Returns a map of (cell view, attribute) pairs.- Specified by:
getPreviousAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- map of attributes before the change
-
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
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
Redoes a change.- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classCompoundEdit- Throws:
CannotRedoException- if the change cannot be redone
-
undo
Undoes a change.- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin 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.
-