Package org.jgraph.graph
Class DefaultGraphModel.GraphModelLayerEdit
- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- org.jgraph.graph.DefaultGraphModel.GraphModelLayerEdit
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.undo.UndoableEdit,GraphLayoutCacheEvent.GraphLayoutCacheChange,GraphModelEvent.GraphModelChange
- Enclosing class:
- DefaultGraphModel
public class DefaultGraphModel.GraphModelLayerEdit extends javax.swing.undo.AbstractUndoableEdit implements GraphModelEvent.GraphModelChange
An implementation of GraphViewChange.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GraphModelLayerEdit(java.lang.Object[] cells, int layer)Constructs a GraphModelEdit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddImplicitEdit(javax.swing.undo.UndoableEdit edit)Allows aGraphLayoutCacheto add and execute and UndoableEdit in this change.voidexecute()Execute this edit such that the next invocation to this method will invert the last execution.java.util.MapgetAttributes()Returns null.java.lang.Object[]getChanged()Returns the cells that have changed.ConnectionSetgetConnectionSet()Returns a connection set representing the graph structure after the change was appliedjava.lang.Object[]getContext()Returns null.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 have changed.protected java.util.ListgetParentList(java.lang.Object cell)Returns the list that exclusively containsview.ParentMapgetParentMap()Returns null.java.util.MapgetPreviousAttributes()Returns null.ConnectionSetgetPreviousConnectionSet()Returns a connection set representing the graph structure before the change was applied ( an "undo" of the change).ParentMapgetPreviousParentMap()Returns a parent map representing the group structure before the change was applied ( an "undo" of the change )java.lang.Object[]getRemoved()Returns the cells that have changed.java.lang.ObjectgetSource()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.voidputViews(GraphLayoutCache view, CellView[] cellViews)Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.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.protected voidupdateListeners()protected voidupdateNext()
-
-
-
Field Detail
-
FRONT
public static final int FRONT
- See Also:
- Constant Field Values
-
BACK
public static final int BACK
- See Also:
- Constant Field Values
-
changeSource
protected java.lang.Object changeSource
-
cells
protected transient java.lang.Object[] cells
-
next
protected transient int[] next
-
prev
protected transient int[] prev
-
layer
protected int layer
-
changed
protected java.lang.Object[] changed
-
-
Method Detail
-
updateNext
protected void updateNext()
-
getSource
public java.lang.Object getSource()
Returns the source of this change. This can either be a view or a model, if this change is a GraphModelChange.- Specified by:
getSourcein interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the source fo this change
-
getChanged
public java.lang.Object[] getChanged()
Returns the cells that have changed.- Specified by:
getChangedin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- the cell changed
-
getInserted
public java.lang.Object[] getInserted()
Returns the cells that have changed.- 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 null.- Specified by:
getContextin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- array of contextual cells
-
getAttributes
public java.util.Map getAttributes()
Returns null.- Specified by:
getAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange
-
getPreviousAttributes
public java.util.Map getPreviousAttributes()
Returns null.- Specified by:
getPreviousAttributesin interfaceGraphLayoutCacheEvent.GraphLayoutCacheChange- Returns:
- map of attributes before the change
-
getConnectionSet
public ConnectionSet getConnectionSet()
Description copied from interface:GraphModelEvent.GraphModelChangeReturns a connection set representing the graph structure after the change was applied- Specified by:
getConnectionSetin interfaceGraphModelEvent.GraphModelChange- Returns:
- the connection set of the graph after the change
-
getPreviousConnectionSet
public ConnectionSet getPreviousConnectionSet()
Description copied from interface:GraphModelEvent.GraphModelChangeReturns a connection set representing the graph structure before the change was applied ( an "undo" of the change).- Specified by:
getPreviousConnectionSetin interfaceGraphModelEvent.GraphModelChange- Returns:
- the connection set of the graph before the change
-
getParentMap
public ParentMap getParentMap()
Returns null.- Specified by:
getParentMapin interfaceGraphModelEvent.GraphModelChange- Returns:
- the changed parent map
-
getPreviousParentMap
public ParentMap getPreviousParentMap()
Description copied from interface:GraphModelEvent.GraphModelChangeReturns a parent map representing the group structure before the change was applied ( an "undo" of the change )- Specified by:
getPreviousParentMapin interfaceGraphModelEvent.GraphModelChange- Returns:
- the previous parent map
-
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
-
addImplicitEdit
public void addImplicitEdit(javax.swing.undo.UndoableEdit edit)
Allows aGraphLayoutCacheto 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
public CellView[] getViews(GraphLayoutCache view)
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
getViewsin interfaceGraphModelEvent.GraphModelChange- Parameters:
view- theGraphLayoutCachewhose stored cells are to be retrieved
-
putViews
public void putViews(GraphLayoutCache view, CellView[] cellViews)
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.- Specified by:
putViewsin interfaceGraphModelEvent.GraphModelChange- Parameters:
view- theGraphLayoutCacheto store the removed cellscellViews- the cell views to be stored
-
redo
public void redo() throws javax.swing.undo.CannotRedoExceptionRedoes a change.- Specified by:
redoin interfacejavax.swing.undo.UndoableEdit- Overrides:
redoin classjavax.swing.undo.AbstractUndoableEdit- 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.AbstractUndoableEdit- 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.
-
updateListeners
protected void updateListeners()
-
getParentList
protected java.util.List getParentList(java.lang.Object cell)
Returns the list that exclusively containsview.
-
-