org.jgraph.graph

Class GraphLayoutCache.GraphLayoutCacheEdit

public class GraphLayoutCache.GraphLayoutCacheEdit extends CompoundEdit implements GraphLayoutCacheEvent.GraphLayoutCacheChange

An implementation of GraphLayoutCacheChange.
Field Summary
protected Mapattributes
protected Object[]cells
protected SetchangedCells
protected CellView[]context
protected Rectangle2DdirtyRegion
The dirty region associated with this event prior to the change
protected CellView[]hidden
protected Object[]invisible
protected MappreviousAttributes
protected Object[]previousCells
protected Object[]visible
Constructor Summary
GraphLayoutCacheEdit(Map nested)
Constructs a GraphViewEdit.
GraphLayoutCacheEdit(Object[] inserted, Map attributes, Object[] visible, Object[] invisible)
Constructs a GraphViewEdit.
Method Summary
voidexecute()
Execute this edit such that the next invocation to this method will invert the last execution.
MapgetAttributes()
Returns a map of (cell view, attribute) pairs.
Object[]getChanged()
Returns the cell views that have changed.
Object[]getContext()
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.
Rectangle2DgetDirtyRegion()
Object[]getInserted()
Returns the cells that habe been made visible.
MapgetPreviousAttributes()
Returns a map of (cell view, attribute) pairs.
Object[]getRemoved()
Returns the cells that have changed.
ObjectgetSource()
booleanisSignificant()
voidredo()
Redoes a change.
voidsetDirtyRegion(Rectangle2D dirty)
voidundo()
Undoes a change.

Field Detail

attributes

protected Map attributes

cells

protected Object[] cells

changedCells

protected Set changedCells

context

protected CellView[] context

dirtyRegion

protected Rectangle2D dirtyRegion
The dirty region associated with this event prior to the change

hidden

protected CellView[] hidden

invisible

protected Object[] invisible

previousAttributes

protected Map previousAttributes

previousCells

protected Object[] previousCells

visible

protected Object[] visible

Constructor Detail

GraphLayoutCacheEdit

public GraphLayoutCacheEdit(Map nested)
Constructs a GraphViewEdit. This modifies the attributes of the specified views and may be used to notify UndoListeners.

Parameters: nested the map that defines the new attributes

GraphLayoutCacheEdit

public GraphLayoutCacheEdit(Object[] inserted, Map attributes, Object[] visible, Object[] invisible)
Constructs a GraphViewEdit. This modifies the attributes of the specified views and may be used to notify UndoListeners. This should also take an array of removed cell views, but it is not possible to add further UndoableEdits to an already executed CompoundEdit, such as a GraphModel change. Thus, to handle implicit changes -- rather than piggybacking on the model's event -- the CompoundEdit's addEdit method should be extended to accept and instantly execute sub- sequent edits (implicit changes to the view, such as removing a mapping, hiding a view or the like).

Parameters: inserted an array of inserted cells attributes the map that defines the new attributes visible an array defining which cells are visible invisible an array defining which cells are invisible

Method Detail

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 a map of (cell view, attribute) pairs.

getChanged

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

getContext

public Object[] getContext()
Returns the views that have not changed explicitly, but implicitly because one of their dependent cells has changed.

getDirtyRegion

public Rectangle2D getDirtyRegion()

getInserted

public Object[] getInserted()
Returns the cells that habe been made visible.

getPreviousAttributes

public Map getPreviousAttributes()
Returns a map of (cell view, attribute) pairs.

getRemoved

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

getSource

public Object getSource()

isSignificant

public boolean isSignificant()

redo

public void redo()
Redoes a change.

Throws: CannotRedoException if the change cannot be redone

setDirtyRegion

public void setDirtyRegion(Rectangle2D dirty)

undo

public void undo()
Undoes a change.

Throws: CannotUndoException if the change cannot be undone

Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.