Package org.jgraph.graph
Class DefaultGraphModel.GraphModelLayerEdit
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
org.jgraph.graph.DefaultGraphModel.GraphModelLayerEdit
- All Implemented Interfaces:
Serializable
,UndoableEdit
,GraphLayoutCacheEvent.GraphLayoutCacheChange
,GraphModelEvent.GraphModelChange
- Enclosing class:
- DefaultGraphModel
public class DefaultGraphModel.GraphModelLayerEdit
extends AbstractUndoableEdit
implements GraphModelEvent.GraphModelChange
An implementation of GraphViewChange.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
protected Object[]
protected Object[]
protected Object
static final int
protected int
protected int[]
protected int[]
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addImplicitEdit
(UndoableEdit edit) Allows aGraphLayoutCache
to add and execute and UndoableEdit in this change.void
execute()
Execute this edit such that the next invocation to this method will invert the last execution.Returns null.Object[]
Returns the cells that have changed.Returns a connection set representing the graph structure after the change was appliedObject[]
Returns null.Returns the dirty region for the original position of the changed cells before the change happened.Object[]
Returns the cells that have changed.protected List
getParentList
(Object cell) Returns the list that exclusively containsview
.Returns null.Returns null.Returns a connection set representing the graph structure before the change was applied ( an "undo" of the change).Returns a parent map representing the group structure before the change was applied ( an "undo" of the change )Object[]
Returns the cells that have changed.Returns the source of this change.CellView[]
getViews
(GraphLayoutCache view) Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.void
putViews
(GraphLayoutCache view, CellView[] cellViews) Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.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.protected void
protected void
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
-
Field Details
-
FRONT
public static final int FRONT- See Also:
-
BACK
public static final int BACK- See Also:
-
changeSource
-
cells
-
next
protected transient int[] next -
prev
protected transient int[] prev -
layer
protected int layer -
changed
-
-
Constructor Details
-
GraphModelLayerEdit
Constructs a GraphModelEdit. This modifies the order of the cells in the model.
-
-
Method Details
-
updateNext
protected void updateNext() -
getSource
Returns the source of this change. This can either be a view or a model, if this change is a GraphModelChange.- Specified by:
getSource
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the source fo this change
-
getChanged
Returns the cells that have changed.- Specified by:
getChanged
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- the cell changed
-
getInserted
Returns the cells that have changed.- 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 null.- Specified by:
getContext
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- array of contextual cells
-
getAttributes
Returns null.- Specified by:
getAttributes
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
getPreviousAttributes
Returns null.- Specified by:
getPreviousAttributes
in interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
- Returns:
- map of attributes before the change
-
getConnectionSet
Description copied from interface:GraphModelEvent.GraphModelChange
Returns a connection set representing the graph structure after the change was applied- Specified by:
getConnectionSet
in interfaceGraphModelEvent.GraphModelChange
- Returns:
- the connection set of the graph after the change
-
getPreviousConnectionSet
Description copied from interface:GraphModelEvent.GraphModelChange
Returns a connection set representing the graph structure before the change was applied ( an "undo" of the change).- Specified by:
getPreviousConnectionSet
in interfaceGraphModelEvent.GraphModelChange
- Returns:
- the connection set of the graph before the change
-
getParentMap
Returns null.- Specified by:
getParentMap
in interfaceGraphModelEvent.GraphModelChange
- Returns:
- the changed parent map
-
getPreviousParentMap
Description copied from interface:GraphModelEvent.GraphModelChange
Returns a parent map representing the group structure before the change was applied ( an "undo" of the change )- Specified by:
getPreviousParentMap
in interfaceGraphModelEvent.GraphModelChange
- Returns:
- the previous parent map
-
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
-
addImplicitEdit
Allows aGraphLayoutCache
to add and execute and UndoableEdit in this change. This does also work if the parent edit has already been executed, in which case the to be added edit will be executed immediately, after addition. This is used to handle changes to the view that are triggered by certain changes of the model. Such implicit edits may be associated with the view so that they may be undone and redone correctly, and are stored in the model's global history together with the parent event as one unit. -
getViews
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
getViews
in interfaceGraphModelEvent.GraphModelChange
- Parameters:
view
- theGraphLayoutCache
whose stored cells are to be retrieved
-
putViews
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
putViews
in interfaceGraphModelEvent.GraphModelChange
- Parameters:
view
- theGraphLayoutCache
to store the removed cellscellViews
- the cell views to be stored
-
redo
Redoes a change.- Specified by:
redo
in interfaceUndoableEdit
- Overrides:
redo
in classAbstractUndoableEdit
- Throws:
CannotRedoException
- if the change cannot be redone
-
undo
Undoes a change.- Specified by:
undo
in interfaceUndoableEdit
- Overrides:
undo
in classAbstractUndoableEdit
- 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. -
updateListeners
protected void updateListeners() -
getParentList
Returns the list that exclusively containsview
.
-