org.jgraph.graph

Class DefaultGraphModel.GraphModelLayerEdit

Enclosing Class:
DefaultGraphModel
Implemented Interfaces:
GraphLayoutCacheEvent.GraphLayoutCacheChange, GraphModelEvent.GraphModelChange

public class DefaultGraphModel.GraphModelLayerEdit
extends AbstractUndoableEdit
implements GraphModelEvent.GraphModelChange

An implementation of GraphViewChange.

Field Summary

static int
BACK
static int
FRONT
protected Object[]
cells
protected Object
changeSource
protected Object[]
changed
protected int
layer
protected int[]
next
protected int[]
prev

Constructor Summary

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()
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)
void
undo()
Undoes a change.
protected void
updateListeners()
protected void
updateNext()

Field Details

BACK

public static final int BACK
Field Value:
-2

FRONT

public static final int FRONT
Field Value:
-1

cells

protected Object[] cells

changeSource

protected Object changeSource

changed

protected Object[] changed

layer

protected int layer

Constructor Details

GraphModelLayerEdit

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

Method Details

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.

execute

public void execute()
Execute this edit such that the next invocation to this method will invert the last execution.

getAttributes

public Map getAttributes()
Returns null.
Specified by:
getAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getChanged

public Object[] getChanged()
Returns the cells that have changed.
Specified by:
getChanged in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getConnectionSet

public ConnectionSet getConnectionSet()
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

getContext

public Object[] getContext()
Returns null.
Specified by:
getContext in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getDirtyRegion

public Rectangle2D getDirtyRegion()
Specified by:
getDirtyRegion in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getInserted

public Object[] getInserted()
Returns the cells that have changed.
Specified by:
getInserted in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getParentList

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

getParentMap

public ParentMap getParentMap()
Returns null.
Specified by:
getParentMap in interface GraphModelEvent.GraphModelChange

getPreviousAttributes

public Map getPreviousAttributes()
Returns null.
Specified by:
getPreviousAttributes in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

getPreviousConnectionSet

public ConnectionSet getPreviousConnectionSet()
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

getPreviousParentMap

public ParentMap getPreviousParentMap()
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

getRemoved

public Object[] getRemoved()
Returns the cells that have changed.
Specified by:
getRemoved in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

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

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

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

redo

public void redo()
            throws CannotRedoException
Redoes a change.

setDirtyRegion

public void setDirtyRegion(Rectangle2D dirty)
Specified by:
setDirtyRegion in interface GraphLayoutCacheEvent.GraphLayoutCacheChange

undo

public void undo()
            throws CannotUndoException
Undoes a change.

updateListeners

protected void updateListeners()

updateNext

protected void updateNext()

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