DefaultGraphModel.GraphModelEdit (JGraph v5.12.4.2 API Specification)
Keywords: org.jgraph.graph.DefaultGraphModel.GraphModelEdit class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.12.4.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jgraph.graph
Class DefaultGraphModel.GraphModelEdit

    java.lang.Object
      javax.swing.undo.AbstractUndoableEdit
          javax.swing.undo.CompoundEdit
              org.jgraph.graph.DefaultGraphModel.GraphModelEdit

All Implemented Interfaces:
  GraphLayoutCacheEvent.GraphLayoutCacheChange, GraphModelEvent.GraphModelChange, Serializable, UndoableEdit

Enclosing class:
  DefaultGraphModel

public class DefaultGraphModel.GraphModelEdit
extends CompoundEdit
implements GraphModelEvent.GraphModelChange

An implementation of GraphModelChange that can be added to the model event.

See Also:
  Serialized Form

Field Summary
`protected Map` | `attributes`
`protected Map` | `cellViews`
`protected Object[]` | `changed`
`protected ConnectionSet` | `connectionSet`
`protected Object[]` | `context`
`protected Rectangle2D` | `dirtyRegion` The dirty region of the change prior to it happening
`protected Object[]` | `insert`
`protected Object[]` | `inserted`
`protected ParentMap` | `parentMap`
`protected Map` | `previousAttributes`
`protected ConnectionSet` | `previousConnectionSet`
`protected ParentMap` | `previousParentMap`
`protected Object[]` | `remove`
`protected Object[]` | `removed`

Fields inherited from class javax.swing.undo.CompoundEdit
`edits`

Fields inherited from class javax.swing.undo.AbstractUndoableEdit
`RedoName, UndoName`

Constructor Summary
`DefaultGraphModel.GraphModelEdit(Object[] inserted, Object[] removed, Map attributes, ConnectionSet connectionSet, ParentMap parentMap)` Constructs an edit record.

Method Summary
`protected void` | `changeChildCount(Map childCount, Object parent, int change)`
`void` | `execute()` Execute this edit such that the next invocation to this method will invert the last execution.
`Object[]` | `filterParents(Map childCount, int children)`
`Map` | `getAttributes()` Returns a map of (object, view attributes).
`Object[]` | `getChanged()` Returns the cells that have changed.
`ConnectionSet` | `getConnectionSet()` Returns the connectionSet.
`Object[]` | `getContext()` Returns the objects that have not changed explicitly, but implicitly because one of their dependent cells has changed.
`Rectangle2D` | `getDirtyRegion()` Returns the dirty region for the original position of the changed cells before the change happened.
`Object[]` | `getInserted()` Returns the cells that were inserted.
`ParentMap` | `getParentMap()` Returns the parentMap.
`Map` | `getPreviousAttributes()` Returns a map that contains (object, map) pairs of the attributes that have been stored in the model.
`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 were inserted.
`Object` | `getSource()` Returns the source of this change.
`CellView[]` | `getViews(GraphLayoutCache view)` Allows a `GraphLayoutCache` to retrieve an array of `CellViews` that was previously stored with `putViews(GraphLayoutCache, CellView[])`.
`protected void` | `handleEmptyGroups(Object[] groups)` Adds the groups that become empty to the cells that will be removed.
`boolean` | `isSignificant()`
`void` | `putViews(GraphLayoutCache view, CellView[] views)` Allows a `GraphLayoutCache` to store cell views for cells that have been removed.
`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.
`String` | `toString()`
`void` | `undo()` Undoes a change.

Methods inherited from class javax.swing.undo.CompoundEdit
`addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, lastEdit`

Methods inherited from class javax.swing.undo.AbstractUndoableEdit
`replaceEdit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### insert

    protected Object[] insert

### changed

    protected Object[] changed

### remove

    protected Object[] remove

### context

    protected Object[] context

### inserted

    protected Object[] inserted

### removed

    protected Object[] removed

### attributes

    protected Map attributes

### previousAttributes

    protected Map previousAttributes

### parentMap

    protected ParentMap parentMap

### previousParentMap

    protected ParentMap previousParentMap

### dirtyRegion

    protected Rectangle2D dirtyRegion

  The dirty region of the change prior to it happening

### connectionSet

    protected ConnectionSet connectionSet

### previousConnectionSet

    protected ConnectionSet previousConnectionSet

### cellViews

    protected Map cellViews

Constructor Detail

### DefaultGraphModel.GraphModelEdit

    public DefaultGraphModel.GraphModelEdit(Object[] inserted,
                                            Object[] removed,
                                            Map attributes,
                                            ConnectionSet connectionSet,
                                            ParentMap parentMap)

  Constructs an edit record.

Parameters:
  `inserted` - a set of roots that were inserted
  `removed` - a set of elements that were removed
  `attributes` - the attribute changes made by the edit
  `connectionSet` - the set of changed connections
  `parentMap` - the map of changed parents

Method Detail

### filterParents

    public Object[] filterParents(Map childCount,
                                  int children)

### changeChildCount

    protected void changeChildCount(Map childCount,
                                    Object parent,
                                    int change)

### handleEmptyGroups

    protected void handleEmptyGroups(Object[] groups)

  Adds the groups that become empty to the cells that will be removed. (Auto remove empty cells.) Removed cells will be re-inserted on undo, and the parent- child relations will be restored.

### isSignificant

    public boolean isSignificant()

  Specified by:
    `isSignificant` in interface `UndoableEdit`

### 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. This includes the cells that have been changed through a call to getAttributes and the edges that have been changed with the ConnectionSet.

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

### getContext

    public Object[] getContext()

  Returns the objects that have not changed explicitly, but implicitly because one of their dependent cells has changed.

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

### getInserted

    public Object[] getInserted()

  Returns the cells that were inserted.

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

### getRemoved

    public Object[] getRemoved()

  Returns the cells that were inserted.

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

### getPreviousAttributes

    public Map getPreviousAttributes()

  Returns a map that contains (object, map) pairs of the attributes that have been stored in the model.

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

### getAttributes

    public Map getAttributes()

  Returns a map of (object, view attributes). The objects are model objects which need to be mapped to views.

  Specified by:
    `getAttributes` in interface `GraphLayoutCacheEvent.GraphLayoutCacheChange`

### getConnectionSet

    public ConnectionSet getConnectionSet()

  Returns the connectionSet.

  Specified by:
    `getConnectionSet` in interface `GraphModelEvent.GraphModelChange`
  Returns:
    ConnectionSet

### 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 the parentMap.

  Specified by:
    `getParentMap` in interface `GraphModelEvent.GraphModelChange`
  Returns:
    ParentMap

### 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` -

### 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.

### putViews

    public void putViews(GraphLayoutCache view,
                         CellView[] views)

  Description copied from interface: `GraphModelEvent.GraphModelChange`
  Allows a `GraphLayoutCache` to store cell views for cells that have been removed. Such cell views are used for re-insertion and restoring the visual attributes.

  Specified by:
    `putViews` in interface `GraphModelEvent.GraphModelChange`
  Parameters:
    `view` - the `GraphLayoutCache` to store the removed cells
    `views` - the cell views to be stored

### getViews

    public CellView[] getViews(GraphLayoutCache view)

  Description copied from interface: `GraphModelEvent.GraphModelChange`
  Allows a `GraphLayoutCache` to retrieve an array of `CellViews` that was previously stored with `putViews(GraphLayoutCache, CellView[])`.

  Specified by:
    `getViews` in interface `GraphModelEvent.GraphModelChange`
  Parameters:
    `view` - the `GraphLayoutCache` whose stored cells are to be retrieved

### toString

    public String toString()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.12.4.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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