JGraph
v5.12.2.2


org.jgraph.graph
Class GraphLayoutCache

java.lang.Object
  extended byorg.jgraph.graph.GraphLayoutCache
All Implemented Interfaces:
CellMapper, Serializable

public class GraphLayoutCache
extends Object
implements CellMapper, Serializable

An object that defines the view of a graphmodel. This object maps between model cells and views and provides a set of methods to change these views. The view may also contain its own set of attributes and is therefore an extension of an Observable, which may be observed by the GraphUI. It uses the model to send its changes to the command history.

See Also:
Serialized Form

Nested Class Summary
 class GraphLayoutCache.GraphLayoutCacheEdit
          An implementation of GraphLayoutCacheChange.
 
Field Summary
protected  boolean allAttributesLocal
          Controls if all attributes are local.
protected  boolean autoSizeOnValueChange
          True if the cells should be auto-sized when their values change.
protected  double collapseXScale
          Specified the initial x- and y-scaling factor for initial collapsed group bounds.
protected  double collapseYScale
          Specified the initial x- and y-scaling factor for initial collapsed group bounds.
protected  CellViewFactory factory
          Factory to create the views.
protected  GraphModel graphModel
          Reference to the graphModel
protected  Map hiddenMapping
          Maps cells to views.
protected  boolean hidesDanglingConnections
          Boolean indicating whether existing connections should be hidden if their source or target port is removed from the model.
protected  boolean hidesExistingConnections
          Boolean indicating whether existing connections should be hidden if their source or target and no parent of the ports is visible, either by hiding the cell or by changing the source or target of the edge to a hidden cell.
protected  EventListenerList listenerList
          The list of listeners that listen to the GraphLayoutCache.
protected  Set localAttributes
          A set containing all attribute keys that are stored in the cell views, in other words, the view-local attributes.
protected  Map mapping
          Maps cells to views.
protected  boolean movesChildrenOnExpand
          Boolean indicating whether children should be moved to the parent group's origin on expand.
protected  boolean movesParentsOnCollapse
          Boolean indicating whether parents should be moved to the child area origin on collapse.
protected  boolean partial
          Only portions of the model are visible.
protected  PortView[] ports
          Cached array of all ports for the view.
protected  boolean reconnectsEdgesToVisibleParent
          Deprecated. edges are moved to parent view and back automatically
protected  boolean remembersCellViews
          Boolean indicating whether cellviews should be remembered once visible in this GraphLayoutCache.
protected  boolean resizesParentsOnCollapse
          Boolean indicating whether parents should always be resized to the child area on collapse.
protected  List roots
          Ordered list of roots for the view.
protected  boolean selectsAllInsertedCells
          Boolean indicating whether inserted cells should automatically be selected.
protected  boolean selectsLocalInsertedCells
          Boolean indicating whether cells that are inserted using the local insert method should automatically be selected.
protected  boolean showsChangedConnections
          Boolean indicating whether connections should be made visible when reconnected and their source and target port is visible.
protected  boolean showsExistingConnections
          Boolean indicating whether existing connections should me made visible if their sources or targets are made visible, given the opposite end of the edge is already visible or made visible, too.
protected  boolean showsInsertedCells
          Boolean indicating whether inserted should be made visible if they are inserted via insert(Object[], Map, ConnectionSet, ParentMap, UndoableEdit[]).
protected  boolean showsInsertedConnections
          Boolean indicating whether inserted edges should me made visible if their sources or targets are already visible.
protected  boolean showsInvisibleEditedCells
          Boolean indicating whether edited cells should be made visible if they are changed via edit(Map, ConnectionSet, ParentMap, UndoableEdit[]).
protected  Set visibleSet
          The set of visible cells.
 
Constructor Summary
GraphLayoutCache()
          Constructs a graph layout cache.
GraphLayoutCache(GraphModel model, CellViewFactory factory)
          Constructs a view for the specified model that uses factory to create its views.
GraphLayoutCache(GraphModel model, CellViewFactory factory, boolean partial)
          Constructs a view for the specified model that uses factory to create its views.
GraphLayoutCache(GraphModel model, CellViewFactory factory, CellView[] cellViews, CellView[] hiddenCellViews, boolean partial)
          Constructs a view for the specified model that uses factory to create its views.
 
Method Summary
 void addGraphLayoutCacheListener(GraphLayoutCacheListener l)
          Adds a listener for the GraphLayoutCacheEvent posted after the graph layout cache changes.
protected  Object[] addVisibleDependencies(Object[] cells, boolean visible)
           
protected  UndoableEdit[] augment(UndoableEdit[] e, UndoableEdit edit)
           
protected  void augmentNestedMapForValueChange(Map nested, Object cell, Object newValue)
          Hook for subclassers to add more stuff for value changes.
protected  void cellExpanded(Object cell)
          Called when a child has been made visible by expanding its parent.
 void cellViewsChanged(CellView[] cellViews)
          Invoke this method after you've changed how the cells are to be represented in the graph.
protected  void cellWillCollapse(Object cell)
           
 void collapse(Object[] groups)
          Collapses all groups by hiding all their descendants.
protected  GraphLayoutCache.GraphLayoutCacheEdit createLocalEdit(Object[] inserted, Map nested, Object[] visible, Object[] invisible)
          Creates a local edit for the specified change.
 Map createNestedMap()
          Returns a nested map of (cell, map) pairs that represent all attributes of all cell views in this view.
 void edit(Map attributes)
          A shortcut method that takes a nested map and passes it to the edit method.
 void edit(Map attributes, ConnectionSet cs, ParentMap pm, UndoableEdit[] e)
          Applies the propertyMap and the connection changes to the model.
 void edit(Object[] cells, Map attributes)
          Applies the attributes to all cells by creating a map that contains the attributes for each cell and passing it to edit on this layout cache.
 void editCell(Object cell, Map attributes)
          Applies the attributes to a single cell by creating a map that contains the attributes for this cell and passing it to edit on this layout cache.
 void expand(Object[] cells)
          Expands all groups by showing all children.
protected  void fireGraphLayoutCacheChanged(Object source, GraphLayoutCacheEvent.GraphLayoutCacheChange edit)
           
 CellView[] getAllDescendants(CellView[] views)
          Returns all views, including descendants that have a parent in views, especially the PortViews.
 CellView[] getAllViews()
          Returns all views, shortcut to getAllDescendants(getRoots())
static Rectangle2D getBounds(CellView[] views)
          Returns the bounding box for the specified cell views.
 Object[] getCells(boolean groups, boolean vertices, boolean ports, boolean edges)
          A helper method to return various arrays of cells that are visible in this cache.
 Object[] getCells(CellView[] views)
          Takes an array of views and returns the array of the corresponding cells by using getCell for each view.
 CellView[] getCellViews()
           
protected  Object getChildPort(Object edge, boolean source)
          Hook for subclassers to return the port to be used for edges that have been connected to the group.
 double getCollapseXScale()
           
 double getCollapseYScale()
           
protected  Object[] getContext(GraphModelEvent.GraphModelChange change)
          Hook for subclassers to augment the context for a graphChange.
protected  List getEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops, boolean incoming)
          Returns the incoming or outgoing edges for cell.
 CellViewFactory getFactory()
          Returns the factory that was passed to the constructor.
 GraphLayoutCacheListener[] getGraphLayoutCacheListeners()
          Return an array of all GraphLayoutCacheListener that were added to this model.
 CellView[] getHiddenCellViews()
           
 Map getHiddenMapping()
          Returns the hiddenMapping.
 List getIncomingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
          Returns the incoming edges for cell.
 Set getLocalAttributes()
           
 CellView[] getMapping(Object[] cells)
          Returns the views for the specified array of cells without creating these views on the fly.
 CellView[] getMapping(Object[] cells, boolean create)
          Returns the views for the specified array of cells.
 CellView getMapping(Object cell, boolean create)
          Returns the view for the specified cell.
 GraphModel getModel()
          Returns the current model.
 List getNeighbours(Object cell, Set exclude, boolean directed, boolean visibleCells)
          Returns a collection of cells that are connected to the specified cell by edges.
 List getOutgoingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
          Returns the outgoing edges for cell.
protected  Object getParentPort(Object edge, boolean source)
          Hook for subclassers to return the first or last visible port to replace the current source or target port of the edge.
protected  Collection getParentPorts(Object cell)
           
 boolean getPartial()
          Required for XML persistence
 PortView[] getPorts()
          Returns the ports of the view.
protected  Collection getPorts(Object cell)
           
 CellView[] getRoots()
          Returns the roots of the view.
 CellView[] getRoots(Rectangle2D clip)
          Return all root cells that intersect the given rectangle.
 Object[] getVisibleCells(Object[] cells)
          Returns a an array with the visible cells in cells.
 Set getVisibleSet()
           
 void graphChanged(GraphModelEvent.GraphModelChange change)
          Called from BasicGraphUI.ModelHandler to update the view based on the specified GraphModelEvent.
protected  Map handleAttributes(Map attributes)
          Attention: Undo will not work for routing-change if ROUTING and POINTS are stored in different locations.
protected  boolean hasVisibleParent(Object cell, Set invisible)
          Checks if the port or one of its parents is visible.
 void hideCells(Object[] cells, boolean descandants)
          Hides the specified cells with all children if descandants is true.
protected  void hideCellsForChange(GraphModelEvent.GraphModelChange change)
           
 void insert(Object cell)
          Inserts the specified vertex into the graph model.
 void insert(Object[] cells)
          Inserts the specified cells into the graph model.
 void insert(Object[] cells, Map nested, ConnectionSet cs, ParentMap pm)
          Variant of the insert method that allows to pass a default connection set and parent map and nested map.
 void insert(Object[] roots, Map attributes, ConnectionSet cs, ParentMap pm, UndoableEdit[] e)
          Inserts the cells and connections into the model, and absorbs the local attributes.
 Object[] insertClones(Object[] cells, Map clones, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy)
          Inserts the cloned cells from the clone map and clones the passed-in arguments according to the clone map before insertion and returns the clones in order of the cells.
 void insertEdge(Object edge, Object source, Object target)
          Inserts the specified edge into the graph model.
 void insertGroup(Object group, Object[] children)
          Inserts the specified cell as a parent of children.
 void insertViews(CellView[] views)
          Adds the specified model root cells to the view.
 boolean isAllAttributesLocal()
           
 boolean isAutoSizeOnValueChange()
          Returns true if cells should be auto-sized when their values change
protected  boolean isControlAttribute(Object cell, Object key, Object value)
          Returns true if key is a control attribute
 boolean isHidesDanglingConnections()
          Returns the hidesDanglingConnections.
 boolean isHidesExistingConnections()
          Returns the hidesExistingConnections.
protected  boolean isLocalAttribute(Object cell, Object key, Object value)
          Returns true if the set of local attributes contains key
 boolean isMovesChildrenOnExpand()
           
 boolean isMovesParentsOnCollapse()
           
 boolean isPartial()
           
 boolean isReconnectsEdgesToVisibleParent()
          Deprecated. edges are moved to parent view and back automatically
 boolean isRemembersCellViews()
          Returns the remembersCellViews.
 boolean isResizesParentsOnCollapse()
           
 boolean isSelectsAllInsertedCells()
           
 boolean isSelectsLocalInsertedCells()
           
 boolean isShowsChangedConnections()
           
 boolean isShowsExistingConnections()
          Returns the showsExistingConnections.
 boolean isShowsInsertedConnections()
          Returns the showsInsertedConnections.
 boolean isShowsInvisibleEditedCells()
           
 boolean isVisible(Object cell)
           
 void putMapping(Object cell, CellView view)
          Associates the specified model cell with the specified view.
 void refresh(CellView[] views, boolean create)
           
 void refresh(CellView view, boolean create)
           
 void reload()
          Remaps all existing views using the CellViewFactory and replaces the respective root views.
protected  void reloadRoots()
          Completely reloads all roots from the model in the order returned by DefaultGraphModel.getAll.
 void remove(Object[] cells)
          Removes cells from the model.
 void remove(Object[] cells, boolean descendants, boolean edges)
          Removes cells from the model, including all children and connected edges if children or edges is true, respectively.
 CellView[] removeCells(Object[] cells)
          Removes the specified model root cells from the view by removing the mapping between the cell and its view and makes the cells invisible.
 void removeGraphLayoutCacheListener(GraphLayoutCacheListener l)
          Removes a listener previously added with addGraphLayoutCacheListener() .
 CellView removeMapping(Object cell)
          Removes the associaten for the specified model cell and returns the view that was previously associated with the cell.
 boolean removeViewLocalAttribute(Object key, boolean addToModel, boolean override)
          Handles the removal of view local attributes.
 void setAllAttributesLocal(boolean allAttributesLocal)
           
 void setAutoSizeOnValueChange(boolean flag)
          Determines whether cells should be auto-sized when their values change.
 void setCollapsedState(Object[] collapse, Object[] expand)
          Collapses and/or expands the specified cell(s)
 void setCollapseXScale(double collapseXScale)
           
 void setCollapseYScale(double collapseYScale)
           
 void setFactory(CellViewFactory factory)
          Sets the factory that creates the cell views.
 void setHiddenSet(Map hiddenSet)
          Sets the hiddenSet.
 void setHidesDanglingConnections(boolean hidesDanglingConnections)
          Sets the hidesDanglingConnections
 void setHidesExistingConnections(boolean hidesExistingConnections)
          Sets the hidesExistingConnections
 void setLocalAttributes(Set localAttributes)
           
 void setModel(GraphModel model)
          Sets the current model.
 void setMovesChildrenOnExpand(boolean moveChildrenOnExpand)
           
 void setMovesParentsOnCollapse(boolean movesParentsOnCollapse)
           
 void setReconnectsEdgesToVisibleParent(boolean reconnectsEdgesToVisibleParent)
          Deprecated. edges are moved to parent view and back automatically
 void setRemembersCellViews(boolean rememberCellViews)
          Sets the rememberCellViews.
 void setResizesParentsOnCollapse(boolean resizesParentsOnCollapse)
           
 void setSelectsAllInsertedCells(boolean selectsAllInsertedCells)
           
 void setSelectsLocalInsertedCells(boolean selectsLocalInsertedCells)
           
 void setShowsChangedConnections(boolean showsChangedConnections)
           
 void setShowsExistingConnections(boolean showsExistingConnections)
          Sets the showsExistingConnections
 void setShowsInsertedConnections(boolean showsInsertedConnections)
          Sets the showsInsertedConnections
 void setShowsInvisibleEditedCells(boolean showsInvisibleEditedCells)
           
 void setVisible(Object[] cells, boolean visible)
          Makes the specified cells visible or invisible depending on the flag passed in.
 void setVisible(Object[] visible, Object[] invisible)
          Changes the visibility state of the cells passed in.
 void setVisible(Object[] visible, Object[] invisible, ConnectionSet cs)
          Changes the visibility state of the cells passed in.
 void setVisible(Object[] visible, Object[] invisible, Map attributes, ConnectionSet cs)
          Changes the visibility state of the cells passed in.
 void setVisible(Object cell, boolean visible)
          Makes the specified cell visible or invisible depending on the flag passed in.
 boolean setVisibleImpl(Object[] cells, boolean visible)
          The actual implementation of changing cells' visibility state.
 void setVisibleSet(Set visible)
           
 void showCells(Object[] cells, boolean descandants)
          Shows the specified cells with all children if descandants is true.
protected  void showCellsForChange(GraphModelEvent.GraphModelChange change)
           
 void toBack(Object[] cells)
          Sends cells to back.
 void toFront(Object[] cells)
          Brings cells to front.
 void toggleCollapsedState(Object[] cells, boolean collapseOnly, boolean expandOnly)
          Toggles the collapsed state of the specified cells.
static void translateViews(CellView[] views, double dx, double dy)
          Translates the specified views by the given amount.
 Object[] ungroup(Object[] cells)
          Ungroups all groups in cells and returns the children that are not ports.
 void update(CellView view)
           
 void update(CellView[] views)
           
protected  void updatePorts()
          Updates the cached array of ports.
 void valueForCellChanged(Object cell, Object newValue)
          Messaged when the user has altered the value for the item identified by cell to newValue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

autoSizeOnValueChange

protected boolean autoSizeOnValueChange
True if the cells should be auto-sized when their values change. Default is false.


showsExistingConnections

protected boolean showsExistingConnections
Boolean indicating whether existing connections should me made visible if their sources or targets are made visible, given the opposite end of the edge is already visible or made visible, too. Default is true.


showsChangedConnections

protected boolean showsChangedConnections
Boolean indicating whether connections should be made visible when reconnected and their source and target port is visible. Default is true.


showsInvisibleEditedCells

protected boolean showsInvisibleEditedCells
Boolean indicating whether edited cells should be made visible if they are changed via edit(Map, ConnectionSet, ParentMap, UndoableEdit[]). Default is false.


showsInsertedCells

protected boolean showsInsertedCells
Boolean indicating whether inserted should be made visible if they are inserted via insert(Object[], Map, ConnectionSet, ParentMap, UndoableEdit[]). Default is true.


showsInsertedConnections

protected boolean showsInsertedConnections
Boolean indicating whether inserted edges should me made visible if their sources or targets are already visible. Default is true.


hidesExistingConnections

protected boolean hidesExistingConnections
Boolean indicating whether existing connections should be hidden if their source or target and no parent of the ports is visible, either by hiding the cell or by changing the source or target of the edge to a hidden cell. Default is true.


hidesDanglingConnections

protected boolean hidesDanglingConnections
Boolean indicating whether existing connections should be hidden if their source or target port is removed from the model. Default is false.


remembersCellViews

protected boolean remembersCellViews
Boolean indicating whether cellviews should be remembered once visible in this GraphLayoutCache. Default is true.


selectsAllInsertedCells

protected boolean selectsAllInsertedCells
Boolean indicating whether inserted cells should automatically be selected. Default is true. This is ignored if the cache is partial. Note: Despite the name of this field the implementation is located in the BasicGraphUI.GraphModelHandler.graphChanged method.


selectsLocalInsertedCells

protected boolean selectsLocalInsertedCells
Boolean indicating whether cells that are inserted using the local insert method should automatically be selected. Default is true. This is ignored if the cache is not partial and selectsAllInsertedCells is true, in which case the cells will be selected through another mechanism. Note: Despite the name of this field the implementation is located in the BasicGraphUI.GraphLayoutCacheObserver.changed method.


movesChildrenOnExpand

protected boolean movesChildrenOnExpand
Boolean indicating whether children should be moved to the parent group's origin on expand. Default is true.


movesParentsOnCollapse

protected boolean movesParentsOnCollapse
Boolean indicating whether parents should be moved to the child area origin on collapse. Default is true.


resizesParentsOnCollapse

protected boolean resizesParentsOnCollapse
Boolean indicating whether parents should always be resized to the child area on collapse. If false the size is only initially updated if it has not yet been assigned. Default is false.


collapseXScale

protected double collapseXScale
Specified the initial x- and y-scaling factor for initial collapsed group bounds. Default is 1.0, ie. no scaling.


collapseYScale

protected double collapseYScale
Specified the initial x- and y-scaling factor for initial collapsed group bounds. Default is 1.0, ie. no scaling.


reconnectsEdgesToVisibleParent

protected boolean reconnectsEdgesToVisibleParent
Deprecated. edges are moved to parent view and back automatically

Boolean indicating whether edges should be reconneted to visible parents on collapse/expand. Default is false.


listenerList

protected EventListenerList listenerList
The list of listeners that listen to the GraphLayoutCache.


graphModel

protected GraphModel graphModel
Reference to the graphModel


mapping

protected Map mapping
Maps cells to views.


hiddenMapping

protected transient Map hiddenMapping
Maps cells to views. The hidden mapping is used to remembed cell views that are hidden, based on the remembersCellViews setting. hiddenMapping must use weak keys for the cells since when cells are removed hiddenMapping is not updated.


factory

protected CellViewFactory factory
Factory to create the views.


visibleSet

protected Set visibleSet
The set of visible cells.


roots

protected List roots
Ordered list of roots for the view.


ports

protected PortView[] ports
Cached array of all ports for the view.


partial

protected boolean partial
Only portions of the model are visible.


allAttributesLocal

protected boolean allAttributesLocal
Controls if all attributes are local. If this is false then the createLocalEdit will check the localAttributes set to see if a specific attribute is local, otherwise it will assume that all attributes are local. This allows to make all attributes local without actually knowing them. Default is false.


localAttributes

protected Set localAttributes
A set containing all attribute keys that are stored in the cell views, in other words, the view-local attributes.

Constructor Detail

GraphLayoutCache

public GraphLayoutCache()
Constructs a graph layout cache.


GraphLayoutCache

public GraphLayoutCache(GraphModel model,
                        CellViewFactory factory)
Constructs a view for the specified model that uses factory to create its views.

Parameters:
model - the model that constitues the data source

GraphLayoutCache

public GraphLayoutCache(GraphModel model,
                        CellViewFactory factory,
                        boolean partial)
Constructs a view for the specified model that uses factory to create its views.

Parameters:
model - the model that constitues the data source

GraphLayoutCache

public GraphLayoutCache(GraphModel model,
                        CellViewFactory factory,
                        CellView[] cellViews,
                        CellView[] hiddenCellViews,
                        boolean partial)
Constructs a view for the specified model that uses factory to create its views.

Parameters:
model - the model that constitues the data source
Method Detail

addGraphLayoutCacheListener

public void addGraphLayoutCacheListener(GraphLayoutCacheListener l)
Adds a listener for the GraphLayoutCacheEvent posted after the graph layout cache changes.

Parameters:
l - the listener to add
See Also:
removeGraphLayoutCacheListener(org.jgraph.event.GraphLayoutCacheListener)

removeGraphLayoutCacheListener

public void removeGraphLayoutCacheListener(GraphLayoutCacheListener l)
Removes a listener previously added with addGraphLayoutCacheListener() .

Parameters:
l - the listener to remove
See Also:
addGraphLayoutCacheListener(org.jgraph.event.GraphLayoutCacheListener)

cellViewsChanged

public void cellViewsChanged(CellView[] cellViews)
Invoke this method after you've changed how the cells are to be represented in the graph.


fireGraphLayoutCacheChanged

protected void fireGraphLayoutCacheChanged(Object source,
                                           GraphLayoutCacheEvent.GraphLayoutCacheChange edit)

getGraphLayoutCacheListeners

public GraphLayoutCacheListener[] getGraphLayoutCacheListeners()
Return an array of all GraphLayoutCacheListener that were added to this model.


setFactory

public void setFactory(CellViewFactory factory)
Sets the factory that creates the cell views.


getFactory

public CellViewFactory getFactory()
Returns the factory that was passed to the constructor.


setModel

public void setModel(GraphModel model)
Sets the current model.


getCellViews

public CellView[] getCellViews()
Returns:
Returns an unordered array of all visible cellviews.

getBounds

public static Rectangle2D getBounds(CellView[] views)
Returns the bounding box for the specified cell views.


getCells

public Object[] getCells(boolean groups,
                         boolean vertices,
                         boolean ports,
                         boolean edges)
A helper method to return various arrays of cells that are visible in this cache. For example, to get all selected vertices in a graph, do graph.getSelectionCells(graph.getGraphLayoutCache().getCells(false, true, false, false));


createNestedMap

public Map createNestedMap()
Returns a nested map of (cell, map) pairs that represent all attributes of all cell views in this view.

See Also:
getCellViews()

getHiddenCellViews

public CellView[] getHiddenCellViews()
Returns:
Returns an unordered array of all hidden cellviews.

reload

public void reload()
Remaps all existing views using the CellViewFactory and replaces the respective root views.


getModel

public GraphModel getModel()
Returns the current model.


getRoots

public CellView[] getRoots()
Returns the roots of the view.


getRoots

public CellView[] getRoots(Rectangle2D clip)
Return all root cells that intersect the given rectangle.


getVisibleCells

public Object[] getVisibleCells(Object[] cells)
Returns a an array with the visible cells in cells.


getPorts

public PortView[] getPorts()
Returns the ports of the view.


updatePorts

protected void updatePorts()
Updates the cached array of ports.


refresh

public void refresh(CellView[] views,
                    boolean create)

refresh

public void refresh(CellView view,
                    boolean create)

update

public void update(CellView[] views)

update

public void update(CellView view)

graphChanged

public void graphChanged(GraphModelEvent.GraphModelChange change)
Called from BasicGraphUI.ModelHandler to update the view based on the specified GraphModelEvent.


reloadRoots

protected void reloadRoots()
Completely reloads all roots from the model in the order returned by DefaultGraphModel.getAll. This uses the current visibleSet and mapping to fetch the cell views for the cells.


getContext

protected Object[] getContext(GraphModelEvent.GraphModelChange change)
Hook for subclassers to augment the context for a graphChange. This means you can add additional cells that should be refreshed on a special change event. eg. parallel edges when one is removed or added.


hideCellsForChange

protected void hideCellsForChange(GraphModelEvent.GraphModelChange change)

hasVisibleParent

protected boolean hasVisibleParent(Object cell,
                                   Set invisible)
Checks if the port or one of its parents is visible.


showCellsForChange

protected void showCellsForChange(GraphModelEvent.GraphModelChange change)

insertViews

public void insertViews(CellView[] views)
Adds the specified model root cells to the view. Do not add a view that is already in roots.


removeCells

public CellView[] removeCells(Object[] cells)
Removes the specified model root cells from the view by removing the mapping between the cell and its view and makes the cells invisible.


getCells

public Object[] getCells(CellView[] views)
Takes an array of views and returns the array of the corresponding cells by using getCell for each view.


getMapping

public CellView getMapping(Object cell,
                           boolean create)
Returns the view for the specified cell. If create is true and no view is found then a view is created using createView(Object).

Specified by:
getMapping in interface CellMapper
Parameters:
create - whether a new view should created if a view does not already exist

getMapping

public