JGraph
v5.12.4.2


org.jgraph.graph
Class DefaultGraphModel.GraphModelLayerEdit

java.lang.Object
  extended byjavax.swing.undo.AbstractUndoableEdit
      extended byorg.jgraph.graph.DefaultGraphModel.GraphModelLayerEdit
All Implemented Interfaces:
GraphLayoutCacheEvent.GraphLayoutCacheChange, GraphModelEvent.GraphModelChange, Serializable, UndoableEdit
Enclosing class:
DefaultGraphModel

public class DefaultGraphModel.GraphModelLayerEdit
extends AbstractUndoableEdit
implements GraphModelEvent.GraphModelChange

An implementation of GraphViewChange.

See Also:
Serialized Form

Field Summary
static int BACK
           
protected  Object[] cells
           
protected  Object[] changed
           
protected  Object changeSource
           
static int FRONT
           
protected  int layer
           
protected  int[] next
           
protected  int[] prev
           
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
DefaultGraphModel.GraphModelLayerEdit(Object[] cells, int layer)
          Constructs a GraphModelEdit.
 
Method Summary
 void addImplicitEdit(UndoableEdit edit)
          Allows a GraphLayoutCache 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.
 Map getAttributes()
          Returns null.
 Object[] getChanged()
          Returns the cells that have changed.
 ConnectionSet getConnectionSet()
          Returns a connection set representing the graph structure after the change was applied
 Object[] getContext()
          Returns null.
 Rectangle2D getDirtyRegion()
          Returns the dirty region for the original position of the changed cells before the change happened.
 Object[] getInserted()
          Returns the cells that have changed.
protected  List getParentList(Object cell)
          Returns the list that exclusively contains view.
 ParentMap getParentMap()
          Returns null.
 Map getPreviousAttributes()
          Returns null.
 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 have changed.
 Object getSource()
          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 updateListeners()
           
protected  void updateNext()
           
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 Object changeSource

cells

protected transient Object[] cells

next

protected transient int[] next

prev

protected transient int[] prev

layer

protected int layer

changed

protected Object[] changed
Constructor Detail

DefaultGraphModel.GraphModelLayerEdit

public DefaultGraphModel.GraphModelLayerEdit(Object[] cells,
                                             int layer)
Constructs a GraphModelEdit. This modifies the order of the cells in the model.

Method Detail

updateNext

protected void updateNext()

getSource

public 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:
getSource in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the source fo this change

getChanged

public Object[] getChanged()
Returns the cells that have changed.

Specified by:
getChanged in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cell changed

getInserted

public Object[] getInserted()
Returns the cells that have changed.

Specified by:
getInserted in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cells that were inserted by the change

getRemoved

public Object[] getRemoved()
Returns the cells that have changed.

Specified by:
getRemoved in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the cells that were removed by the change

getContext

public Object[] getContext()
Returns null.

Specified by:
getContext in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
array of contextual cells

getAttributes

public Map getAttributes()
Returns null.

Specified by:
getAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getPreviousAttributes

public Map getPreviousAttributes()
Returns null.

Specified by:
getPreviousAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
map of attributes before the change

getConnectionSet

public ConnectionSet getConnectionSet()
Description copied from interface: GraphModelEvent.GraphModelChange
Returns a connection set representing the graph structure after the change was applied

Specified by:
getConnectionSet in interface GraphModelEvent.GraphModelChange
Returns:
the connection set of the graph after the change

getPreviousConnectionSet

public ConnectionSet 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 interface GraphModelEvent.GraphModelChange
Returns:
the connection set of the graph before the change

getParentMap

public ParentMap getParentMap()
Returns null.

Specified by:
getParentMap in interface GraphModelEvent.GraphModelChange
Returns:
the changed parent map

getPreviousParentMap

public ParentMap 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 interface GraphModelEvent.GraphModelChange
Returns:
the previous parent map

getDirtyRegion

public Rectangle2D 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 interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Returns:
the dirty region prior to the event

setDirtyRegion

public void setDirtyRegion(Rectangle2D dirty)
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 interface GraphLayoutCacheEvent.GraphLayoutCacheChange
Parameters:
dirty -

addImplicitEdit

public void addImplicitEdit(UndoableEdit edit)
Allows a GraphLayoutCache 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

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:
getViews in interface GraphModelEvent.GraphModelChange
Parameters:
view - the GraphLayoutCache whose 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:
putViews in interface GraphModelEvent.GraphModelChange
Parameters:
view - the GraphLayoutCache to store the removed cells
cellViews - the cell views to be stored

redo

public void redo()
          throws CannotRedoException
Redoes a change.

Specified by:
redo in interface UndoableEdit
Throws:
CannotRedoException - if the change cannot be redone

undo

public void undo()
          throws CannotUndoException
Undoes a change.

Specified by:
undo in interface UndoableEdit
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

protected List getParentList(Object cell)
Returns the list that exclusively contains view.


JGraph
v5.12.4.2


Copyright (C) 2001-2008 Gaudenz Alder. All rights reserved.