public class DefaultGraphModel.GraphModelEdit extends CompoundEdit implements GraphModelEvent.GraphModelChange
Modifier and Type | Field and Description |
---|---|
protected Map |
attributes |
protected Map |
cellViews |
protected Object[] |
changed |
protected ConnectionSet |
connectionSet |
protected Object[] |
context |
protected Rectangle2D |
dirtyRegion
The dirty region of the change prior to it happening
|
protected Object[] |
insert |
protected Object[] |
inserted |
protected ParentMap |
parentMap |
protected Map |
previousAttributes |
protected ConnectionSet |
previousConnectionSet |
protected ParentMap |
previousParentMap |
protected Object[] |
remove |
protected Object[] |
removed |
edits
RedoName, UndoName
Constructor and Description |
---|
GraphModelEdit(Object[] inserted,
Object[] removed,
Map attributes,
ConnectionSet connectionSet,
ParentMap parentMap)
Constructs an edit record.
|
Modifier and Type | Method and Description |
---|---|
protected void |
changeChildCount(Map childCount,
Object parent,
int change) |
void |
execute()
Execute this edit such that the next invocation to this method will
invert the last execution.
|
Object[] |
filterParents(Map childCount,
int children) |
Map |
getAttributes()
Returns a map of (object, view attributes).
|
Object[] |
getChanged()
Returns the cells that have changed.
|
ConnectionSet |
getConnectionSet()
Returns the connectionSet.
|
Object[] |
getContext()
Returns the objects 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 were inserted.
|
ParentMap |
getParentMap()
Returns the parentMap.
|
Map |
getPreviousAttributes()
Returns a map that contains (object, map) pairs of the attributes
that have been stored in the model.
|
ConnectionSet |
getPreviousConnectionSet()
Returns a connection set representing the graph structure before the
change was applied ( an "undo" of the change).
|
ParentMap |
getPreviousParentMap()
Returns a parent map representing the group structure before the
change was applied ( an "undo" of the change )
|
Object[] |
getRemoved()
Returns the cells that were inserted.
|
Object |
getSource()
Returns the source of this change.
|
CellView[] |
getViews(GraphLayoutCache view)
Allows a
GraphLayoutCache to retrieve an array of
CellViews that was previously stored with
putViews(GraphLayoutCache, CellView[]) . |
protected void |
handleEmptyGroups(Object[] groups)
Adds the groups that become empty to the cells that will be removed.
|
boolean |
isSignificant() |
void |
putViews(GraphLayoutCache view,
CellView[] views)
Allows a
GraphLayoutCache to store cell views for
cells that have been removed. |
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.
|
String |
toString() |
void |
undo()
Undoes a change.
|
addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, lastEdit
replaceEdit
protected Object[] insert
protected Object[] changed
protected Object[] remove
protected Object[] context
protected Object[] inserted
protected Object[] removed
protected Map attributes
protected Map previousAttributes
protected ParentMap parentMap
protected ParentMap previousParentMap
protected Rectangle2D dirtyRegion
protected ConnectionSet connectionSet
protected ConnectionSet previousConnectionSet
protected Map cellViews
public GraphModelEdit(Object[] inserted, Object[] removed, Map attributes, ConnectionSet connectionSet, ParentMap parentMap)
inserted
- a set of roots that were insertedremoved
- a set of elements that were removedattributes
- the attribute changes made by the editconnectionSet
- the set of changed connectionsparentMap
- the map of changed parentsprotected void handleEmptyGroups(Object[] groups)
public boolean isSignificant()
isSignificant
in interface UndoableEdit
isSignificant
in class CompoundEdit
public Object getSource()
getSource
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Object[] getChanged()
getChanged
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Object[] getContext()
getContext
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Object[] getInserted()
getInserted
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Object[] getRemoved()
getRemoved
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Map getPreviousAttributes()
getPreviousAttributes
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public Map getAttributes()
getAttributes
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public ConnectionSet getConnectionSet()
getConnectionSet
in interface GraphModelEvent.GraphModelChange
public ConnectionSet getPreviousConnectionSet()
GraphModelEvent.GraphModelChange
getPreviousConnectionSet
in interface GraphModelEvent.GraphModelChange
public ParentMap getParentMap()
getParentMap
in interface GraphModelEvent.GraphModelChange
public ParentMap getPreviousParentMap()
GraphModelEvent.GraphModelChange
getPreviousParentMap
in interface GraphModelEvent.GraphModelChange
public Rectangle2D getDirtyRegion()
GraphLayoutCacheEvent.GraphLayoutCacheChange
getDirtyRegion
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public void setDirtyRegion(Rectangle2D dirty)
GraphLayoutCacheEvent.GraphLayoutCacheChange
setDirtyRegion
in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
public void redo() throws CannotRedoException
redo
in interface UndoableEdit
redo
in class CompoundEdit
CannotRedoException
- if the change cannot be redonepublic void undo() throws CannotUndoException
undo
in interface UndoableEdit
undo
in class CompoundEdit
CannotUndoException
- if the change cannot be undonepublic void execute()
public void putViews(GraphLayoutCache view, CellView[] views)
GraphModelEvent.GraphModelChange
GraphLayoutCache
to store cell views for
cells that have been removed. Such cell views are used for
re-insertion and restoring the visual attributes.putViews
in interface GraphModelEvent.GraphModelChange
view
- the GraphLayoutCache
to store the removed
cellsviews
- the cell views to be storedpublic CellView[] getViews(GraphLayoutCache view)
GraphModelEvent.GraphModelChange
GraphLayoutCache
to retrieve an array of
CellViews
that was previously stored with
putViews(GraphLayoutCache, CellView[])
.getViews
in interface GraphModelEvent.GraphModelChange
view
- the GraphLayoutCache
whose stored cells are
to be retrievedpublic String toString()
toString
in class CompoundEdit
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.