org.jgraph.graph.GraphLayoutCache Class Reference

Inheritance diagram for org.jgraph.graph.GraphLayoutCache:

org.jgraph.graph.CellMapper List of all members.

Public Member Functions

 GraphLayoutCache ()
 GraphLayoutCache (GraphModel model, CellViewFactory factory)
 GraphLayoutCache (GraphModel model, CellViewFactory factory, boolean partial)
 GraphLayoutCache (GraphModel model, CellViewFactory factory, CellView[] cellViews, CellView[] hiddenCellViews, boolean partial)
void addGraphLayoutCacheListener (GraphLayoutCacheListener l)
void removeGraphLayoutCacheListener (GraphLayoutCacheListener l)
void cellViewsChanged (final CellView[] cellViews)
GraphLayoutCacheListener[] getGraphLayoutCacheListeners ()
void setFactory (CellViewFactory factory)
CellViewFactory getFactory ()
void setModel (GraphModel model)
CellView[] getCellViews ()
Object[] getCells (boolean groups, boolean vertices, boolean ports, boolean edges)
Map createNestedMap ()
CellView[] getHiddenCellViews ()
synchronized void reload ()
GraphModel getModel ()
CellView[] getRoots ()
CellView[] getRoots (Rectangle2D clip)
Object[] getVisibleCells (Object[] cells)
PortView[] getPorts ()
void refresh (CellView[] views, boolean create)
void refresh (CellView view, boolean create)
void update (CellView[] views)
void update (CellView view)
void graphChanged (GraphModelEvent.GraphModelChange change)
void insertViews (CellView[] views)
CellView[] removeCells (Object[] cells)
Object[] getCells (CellView[] views)
CellView getMapping (Object cell, boolean create)
CellView[] getMapping (Object[] cells)
CellView[] getMapping (Object[] cells, boolean create)
void putMapping (Object cell, CellView view)
CellView removeMapping (Object cell)
boolean isVisible (Object cell)
Set getVisibleSet ()
void setVisibleSet (Set visible)
void setVisible (Object cell, boolean visible)
void setVisible (Object[] cells, boolean visible)
void setVisible (Object[] visible, Object[] invisible)
void setVisible (Object[] visible, Object[] invisible, ConnectionSet cs)
boolean setVisibleImpl (Object[] cells, boolean visible)
boolean isPartial ()
void valueForCellChanged (Object cell, Object newValue)
void insert (Object[] roots, Map attributes, ConnectionSet cs, ParentMap pm, UndoableEdit[] e)
Object[] insertClones (Object[] cells, Map clones, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy)
void insert (Object cell)
void insertEdge (Object edge, Object source, Object target)
void insert (Object[] cells)
void insert (Object[] cells, Map nested, ConnectionSet cs, ParentMap pm)
void insertGroup (Object group, Object[] children)
void remove (Object[] cells)
void remove (Object[] cells, boolean descendants, boolean edges)
void hideCells (Object[] cells, boolean descandants)
void showCells (Object[] cells, boolean descandants)
Object[] ungroup (Object[] cells)
void toggleCollapsedState (Object[] cells, boolean collapseOnly, boolean expandOnly)
void collapse (Object[] groups)
void expand (Object[] cells)
void setCollapsedState (Object[] collapse, Object[] expand)
void edit (Map attributes, ConnectionSet cs, ParentMap pm, UndoableEdit[] e)
void edit (Map attributes)
void edit (Object[] cells, Map attributes)
void editCell (Object cell, Map attributes)
void toBack (Object[] cells)
void toFront (Object[] cells)
boolean removeViewLocalAttribute (Object key, boolean addToModel, boolean override)
List getNeighbours (Object cell, Set exclude, boolean directed, boolean visibleCells)
List getOutgoingEdges (Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
List getIncomingEdges (Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
CellView[] getAllViews ()
CellView[] getAllDescendants (CellView[] views)
Map getHiddenMapping ()
void setShowsExistingConnections (boolean showsExistingConnections)
boolean isShowsExistingConnections ()
void setShowsInsertedConnections (boolean showsInsertedConnections)
boolean isShowsInsertedConnections ()
void setHidesExistingConnections (boolean hidesExistingConnections)
boolean isHidesExistingConnections ()
void setHidesDanglingConnections (boolean hidesDanglingConnections)
boolean isHidesDanglingConnections ()
void setRemembersCellViews (boolean rememberCellViews)
boolean isRemembersCellViews ()
void setHiddenSet (Map hiddenSet)
Set getLocalAttributes ()
void setLocalAttributes (Set localAttributes)
boolean isAllAttributesLocal ()
void setAllAttributesLocal (boolean allAttributesLocal)
boolean isAutoSizeOnValueChange ()
void setAutoSizeOnValueChange (boolean flag)
boolean isSelectsAllInsertedCells ()
void setSelectsAllInsertedCells (boolean selectsAllInsertedCells)
boolean isSelectsLocalInsertedCells ()
void setSelectsLocalInsertedCells (boolean selectsLocalInsertedCells)
boolean isReconnectsEdgesToVisibleParent ()
void setReconnectsEdgesToVisibleParent (boolean reconnectsEdgesToVisibleParent)
boolean isShowsChangedConnections ()
void setShowsChangedConnections (boolean showsChangedConnections)
boolean isMovesChildrenOnExpand ()
void setMovesChildrenOnExpand (boolean moveChildrenOnExpand)
double getCollapseXScale ()
void setCollapseXScale (double collapseXScale)
double getCollapseYScale ()
void setCollapseYScale (double collapseYScale)
boolean isMovesParentsOnCollapse ()
void setMovesParentsOnCollapse (boolean movesParentsOnCollapse)
boolean isResizesParentsOnCollapse ()
void setResizesParentsOnCollapse (boolean resizesParentsOnCollapse)

Static Public Member Functions

static Rectangle2D getBounds (CellView[] views)
static void translateViews (CellView[] views, double dx, double dy)

Protected Member Functions

void fireGraphLayoutCacheChanged (Object source, GraphLayoutCacheEvent.GraphLayoutCacheChange edit)
void updatePorts ()
void reloadRoots ()
Object[] getContext (GraphModelEvent.GraphModelChange change)
void hideCellsForChange (GraphModelEvent.GraphModelChange change)
boolean hasVisibleParent (Object cell, Set invisible)
void showCellsForChange (GraphModelEvent.GraphModelChange change)
Object[] addVisibleDependencies (Object[] cells, boolean visible)
Collection getParentPorts (Object cell)
Collection getPorts (Object cell)
void augmentNestedMapForValueChange (Map nested, Object cell, Object newValue)
Object getParentPort (Object edge, boolean source)
Object getChildPort (Object edge, boolean source)
UndoableEdit[] augment (UndoableEdit[] e, UndoableEdit edit)
GraphLayoutCacheEdit createLocalEdit (Object[] inserted, Map nested, Object[] visible, Object[] invisible)
boolean isLocalAttribute (Object cell, Object key, Object value)
boolean isControlAttribute (Object cell, Object key, Object value)
void cellExpanded (Object cell)
void cellWillCollapse (Object cell)
Map handleAttributes (Map attributes)
List getEdges (Object cell, Set exclude, boolean visibleCells, boolean selfLoops, boolean incoming)

Protected Attributes

boolean autoSizeOnValueChange = false
boolean showsExistingConnections = true
boolean showsChangedConnections = true
boolean showsInvisibleEditedCells = true
boolean showsInsertedCells = true
boolean showsInsertedConnections = true
boolean hidesExistingConnections = true
boolean hidesDanglingConnections = false
boolean remembersCellViews = true
boolean selectsAllInsertedCells = true
boolean selectsLocalInsertedCells = true
boolean movesChildrenOnExpand = true
boolean movesParentsOnCollapse = true
boolean resizesParentsOnCollapse = false
double collapseXScale = 1.0
double collapseYScale = 1.0
boolean reconnectsEdgesToVisibleParent = false
EventListenerList listenerList = new EventListenerList()
GraphModel graphModel
Map mapping = new Hashtable()
Map hiddenMapping = new WeakHashMap()
CellViewFactory factory = null
Set visibleSet = new HashSet()
List roots = new ArrayList()
PortView[] ports
boolean partial = false
boolean allAttributesLocal = false
Set localAttributes = new HashSet()

Private Member Functions

void copyRemovedViewValue (Object key, boolean addToModel, boolean override, Collection coll)

Classes

class  GraphLayoutCacheEdit

Detailed Description

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.

Version:
1.0 1/1/02
Author:
Gaudenz Alder


Constructor & Destructor Documentation

org.jgraph.graph.GraphLayoutCache.GraphLayoutCache  ) 
 

Constructs a graph layout cache.

org.jgraph.graph.GraphLayoutCache.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

org.jgraph.graph.GraphLayoutCache.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

org.jgraph.graph.GraphLayoutCache.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


Member Function Documentation

void org.jgraph.graph.GraphLayoutCache.addGraphLayoutCacheListener GraphLayoutCacheListener  l  ) 
 

Adds a listener for the GraphLayoutCacheEvent posted after the graph layout cache changes.

See also:
removeGraphLayoutCacheListener
Parameters:
l the listener to add

Object [] org.jgraph.graph.GraphLayoutCache.addVisibleDependencies Object[]  cells,
boolean  visible
[protected]
 

UndoableEdit [] org.jgraph.graph.GraphLayoutCache.augment UndoableEdit[]  e,
UndoableEdit  edit
[protected]
 

void org.jgraph.graph.GraphLayoutCache.augmentNestedMapForValueChange Map  nested,
Object  cell,
Object  newValue
[protected]
 

Hook for subclassers to add more stuff for value changes. Currently this adds the new value to the change.

void org.jgraph.graph.GraphLayoutCache.cellExpanded Object  cell  )  [protected]
 

Called when a child has been made visible by expanding its parent. This implementation translates the child so that it reflects the offset of the parent group since the child was last visible (see movesChildrenOnExpand).

void org.jgraph.graph.GraphLayoutCache.cellViewsChanged final CellView[]  cellViews  ) 
 

Invoke this method after you've changed how the cells are to be represented in the graph.

void org.jgraph.graph.GraphLayoutCache.cellWillCollapse Object  cell  )  [protected]
 

void org.jgraph.graph.GraphLayoutCache.collapse Object[]  groups  ) 
 

Collapses all groups by hiding all their descendants.

Parameters:
groups 

void org.jgraph.graph.GraphLayoutCache.copyRemovedViewValue Object  key,
boolean  addToModel,
boolean  override,
Collection  coll
[private]
 

Helper method to copy removed view local attributes to model cell's

Parameters:
key the key of the view local attribute
addToModel whether or not to move the attribute values to the graph model
override whether or not to override the key's value in the model cell's attribute map if it exists
coll the current collection being analysed

GraphLayoutCacheEdit org.jgraph.graph.GraphLayoutCache.createLocalEdit Object[]  inserted,
Map  nested,
Object[]  visible,
Object[]  invisible
[protected]
 

Creates a local edit for the specified change. A local operation contains all visibility changes, as well as all changes to attributes that are local, and all control attributes.
Note: You must use cells as keys for the nested map, not cell views.

Map org.jgraph.graph.GraphLayoutCache.createNestedMap  ) 
 

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

See also:
getCellViews

void org.jgraph.graph.GraphLayoutCache.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. Example:

 Map attrs = new java.util.Hashtable();
 GraphConstants.setBackground(attrs, Color.RED);
 graph.getGraphLayoutCache().edit(graph.getSelectionCells(), attrs);
 

void org.jgraph.graph.GraphLayoutCache.edit Map  attributes  ) 
 

A shortcut method that takes a nested map and passes it to the edit method.

void org.jgraph.graph.GraphLayoutCache.edit Map  attributes,
ConnectionSet  cs,
ParentMap  pm,
UndoableEdit[]  e
 

Applies the propertyMap and the connection changes to the model. The initial edits that triggered the call are considered to be part of this transaction. Notifies the model- and undo listeners of the change. Note: The passed in attributes may contain PortViews.

void org.jgraph.graph.GraphLayoutCache.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. Example:

 Map attrs = new java.util.Hashtable();
 GraphConstants.setBackground(attrs, Color.RED);
 graph.getGraphLayoutCache().editCell(graph.getSelectionCell(), attrs);
 

void org.jgraph.graph.GraphLayoutCache.expand Object[]  cells  ) 
 

Expands all groups by showing all children. (Note: This does not show all descandants, but only the first generation of children.)

void org.jgraph.graph.GraphLayoutCache.fireGraphLayoutCacheChanged Object  source,
GraphLayoutCacheEvent.GraphLayoutCacheChange  edit
[protected]
 

CellView [] org.jgraph.graph.GraphLayoutCache.getAllDescendants CellView[]  views  ) 
 

Returns all views, including descendants that have a parent in views, especially the PortViews. Note: Iterative Implementation using model.getChild and getMapping on this cell mapper.

CellView [] org.jgraph.graph.GraphLayoutCache.getAllViews  ) 
 

Returns all views, shortcut to getAllDescendants(getRoots())

static Rectangle2D org.jgraph.graph.GraphLayoutCache.getBounds CellView[]  views  )  [static]
 

Returns the bounding box for the specified cell views.

Object [] org.jgraph.graph.GraphLayoutCache.getCells CellView[]  views  ) 
 

Takes an array of views and returns the array of the corresponding cells by using getCell for each view.

Object [] org.jgraph.graph.GraphLayoutCache.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));

CellView [] org.jgraph.graph.GraphLayoutCache.getCellViews  ) 
 

Returns:
Returns an unordered array of all visible cellviews.

Object org.jgraph.graph.GraphLayoutCache.getChildPort Object  edge,
boolean  source
[protected]
 

Hook for subclassers to return the port to be used for edges that have been connected to the group. This is called from expand. This returns the first port of the first or last vertex depending on source.

double org.jgraph.graph.GraphLayoutCache.getCollapseXScale  ) 
 

Returns:
Returns the collapseXScale.

double org.jgraph.graph.GraphLayoutCache.getCollapseYScale  ) 
 

Returns:
Returns the collapseYScale.

Object [] org.jgraph.graph.GraphLayoutCache.getContext GraphModelEvent.GraphModelChange  change  )  [protected]
 

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 manas.event. eg. parallel edges when one is removed or added.

List org.jgraph.graph.GraphLayoutCache.getEdges Object  cell,
Set  exclude,
boolean  visibleCells,
boolean  selfLoops,
boolean  incoming
[protected]
 

Returns the incoming or outgoing edges for cell. Cell should be a port or a vertex.

Parameters:
cell The cell from which the edges will be determined
exclude The set of edges to ignore when searching
visibleCells whether or not only visible cells should be processed
selfLoops whether or not to include self loops in the returned list
incoming true if incoming edges are to be obtained, false if outgoing edges are to be obtained
Returns:
Returns the list of incoming or outgoing edges for cell

CellViewFactory org.jgraph.graph.GraphLayoutCache.getFactory  ) 
 

Returns the factory that was passed to the constructor.

GraphLayoutCacheListener [] org.jgraph.graph.GraphLayoutCache.getGraphLayoutCacheListeners  ) 
 

Return an array of all GraphLayoutCacheListener that were added to this model.

CellView [] org.jgraph.graph.GraphLayoutCache.getHiddenCellViews  ) 
 

Returns:
Returns an unordered array of all hidden cellviews.

Map org.jgraph.graph.GraphLayoutCache.getHiddenMapping  ) 
 

Returns the hiddenMapping.

Returns:
Map

List org.jgraph.graph.GraphLayoutCache.getIncomingEdges Object  cell,
Set  exclude,
boolean  visibleCells,
boolean  selfLoops
 

Returns the incoming edges for cell. Cell should be a port or a vertex.

Parameters:
cell The cell from which the incoming edges will be determined
exclude The set of edges to ignore when searching
visibleCells whether or not only visible cells should be processed
selfLoops whether or not to include self loops in the returned list
Returns:
Returns the list of incoming edges for cell

Set org.jgraph.graph.GraphLayoutCache.getLocalAttributes  ) 
 

Returns:
Returns the localAttributes.

CellView [] org.jgraph.graph.GraphLayoutCache.getMapping Object[]  cells,
boolean  create
 

Returns the views for the specified array of cells. Returned array may contain null pointers if the respective cell is not mapped in this view and create is false.

CellView [] org.jgraph.graph.GraphLayoutCache.getMapping Object[]  cells  ) 
 

Returns the views for the specified array of cells without creating these views on the fly.

CellView org.jgraph.graph.GraphLayoutCache.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).

Implements org.jgraph.graph.CellMapper.

GraphModel org.jgraph.graph.GraphLayoutCache.getModel  ) 
 

Returns the current model.

List org.jgraph.graph.GraphLayoutCache.getNeighbours Object  cell,
Set  exclude,
boolean  directed,
boolean  visibleCells
 

Returns a collection of cells that are connected to the specified cell by edges. Any cells specified in the exclude set will be ignored.

Parameters:
cell The cell from which the neighbours will be determined
exclude The set of cells to ignore when searching
directed whether or not direction of edges should be taken into account
visibleCells whether or not to only consider visible cells
Returns:
Returns the list of neighbours for cell

List org.jgraph.graph.GraphLayoutCache.getOutgoingEdges Object  cell,
Set  exclude,
boolean  visibleCells,
boolean  selfLoops
 

Returns the outgoing edges for cell. Cell should be a port or a vertex.

Parameters:
cell The cell from which the outgoing edges will be determined
exclude The set of edges to ignore when searching
visibleCells whether or not only visible cells should be processed
selfLoops whether or not to include self loops in the returned list
Returns:
Returns the list of outgoing edges for cell

Object org.jgraph.graph.GraphLayoutCache.getParentPort Object  edge,
boolean  source
[protected]
 

Hook for subclassers to return the first or last visible port to replace the current source or target port of the edge. This is called when groups are collapsed for the edges that cross the group, ie. go from a child cell to a cell which is outside the group. This implementation returns the first port of the parent group if source is true, otherwise it returns the last port of the parent group.

Collection org.jgraph.graph.GraphLayoutCache.getParentPorts Object  cell  )  [protected]
 

Collection org.jgraph.graph.GraphLayoutCache.getPorts Object  cell  )  [protected]
 

PortView [] org.jgraph.graph.GraphLayoutCache.getPorts  ) 
 

Returns the ports of the view.

CellView [] org.jgraph.graph.GraphLayoutCache.getRoots Rectangle2D  clip  ) 
 

Return all root cells that intersect the given rectangle.

CellView [] org.jgraph.graph.GraphLayoutCache.getRoots  ) 
 

Returns the roots of the view.

Object [] org.jgraph.graph.GraphLayoutCache.getVisibleCells Object[]  cells  ) 
 

Returns a an array with the visible cells in cells.

Set org.jgraph.graph.GraphLayoutCache.getVisibleSet  ) 
 

void org.jgraph.graph.GraphLayoutCache.graphChanged GraphModelEvent.GraphModelChange  change  ) 
 

Called from BasicGraphUI.ModelHandler to update the view based on the specified GraphModelEvent.

Map org.jgraph.graph.GraphLayoutCache.handleAttributes Map  attributes  )  [protected]
 

Attention: Undo will not work for routing-change if ROUTING and POINTS are stored in different locations. This happens if the model holds the routing attribute and the routing changes from unrouted to routed. In this case the points in the view are already routed according to the new scheme when written to the command history (-> no undo).

boolean org.jgraph.graph.GraphLayoutCache.hasVisibleParent Object  cell,
Set  invisible
[protected]
 

Checks if the port or one of its parents is visible.

void org.jgraph.graph.GraphLayoutCache.hideCells Object[]  cells,
boolean  descandants
 

Hides the specified cells with all children if descandants is true.

void org.jgraph.graph.GraphLayoutCache.hideCellsForChange GraphModelEvent.GraphModelChange  change  )  [protected]
 

void org.jgraph.graph.GraphLayoutCache.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 org.jgraph.graph.GraphLayoutCache.insert Object[]  cells  ) 
 

Inserts the specified cells into the graph model. This method is a general implementation of cell insertion. If the source and target port are null, then no connection set is created. The method uses the attributes from the specified edge and the egdge's children to construct the insert call. This example shows how to insert an edge with a special arrow between two known vertices:

 Object source = graph.getDefaultPortForCell(sourceVertex).getCell();
 Object target = graph.getDefaultPortForCell(targetVertex).getCell();
 DefaultEdge edge = new DefaultEdge("Hello, world!");
 edge.setSource(source);
 edge.setTarget(target);
 Map attrs = edge.getAttributes();
 GraphConstants.setLineEnd(attrs, GraphConstants.ARROW_TECHNICAL);
 graph.getGraphLayoutCache().insert(edge);
 

void org.jgraph.graph.GraphLayoutCache.insert Object  cell  ) 
 

Inserts the specified vertex into the graph model. This method does in fact nothing, it calls insert edge with the vertex and the source and target port set to null. This example shows how to add a vertex with a port and a black border:

 DefaultGraphCell vertex = new DefaultGraphCell("Hello, world!");
 Map attrs = vertex.getAttributes();
 GraphConstants.setOpaque(attrs, false);
 GraphConstants.setBorderColor(attrs, Color.black);
 DefaultPort port = new DefaultPort();
 vertex.add(port);
 port.setParent(vertex);
 graph.getGraphLayoutCache().insert(vertex);
 

Parameters:
cell inserts the specified cell in the cache

void org.jgraph.graph.GraphLayoutCache.insert Object[]  roots,
Map  attributes,
ConnectionSet  cs,
ParentMap  pm,
UndoableEdit[]  e
 

Inserts the cells and connections into the model, and absorbs the local attributes. This implementation sets the inserted cells visible and selects the new roots depending on graph.selectNewCells.

Object [] org.jgraph.graph.GraphLayoutCache.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. This example shows how to clone the current selection and get a reference to the clones:

 Object[] cells = graph.getDescendants(graph.order(graph.getSelectionCells()));
 ConnectionSet cs = ConnectionSet.create(graphModel, cells, false);
 ParentMap pm = ParentMap.create(graphModel, cells, false, true);
 cells = graphLayoutCache.insertClones(cells, graph.cloneCells(cells),
 		attributes, cs, pm, 0, 0);
 

void org.jgraph.graph.GraphLayoutCache.insertEdge Object  edge,
Object  source,
Object  target
 

Inserts the specified edge into the graph model. This method does in fact nothing, it calls insert with a default connection set.

Parameters:
edge the edge to be inserted
source the source port this edge is connected to
target the target port this edge is connected to

void org.jgraph.graph.GraphLayoutCache.insertGroup Object  group,
Object[]  children
 

Inserts the specified cell as a parent of children. Note: All cells that are not yet in the model will be inserted. This example shows how to group the current selection and pass the group default bounds in case it is later collapsed:

 DefaultGraphCell group = new DefaultGraphCell("Hello, world!");
 Object[] cells = DefaultGraphModel.order(graph.getModel(), graph
 		.getSelectionCells());
 Rectangle2D bounds = graph.getCellBounds(cells);
 if (bounds != null) {
 	bounds = new Rectangle2D.Double(bounds.getX() + bounds.getWidth() / 4,
 			bounds.getY() + bounds.getHeight() / 4, bounds.getWidth() / 2,
 			bounds.getHeight() / 2);
 	GraphConstants.setBounds(group.getAttributes(), bounds);
 }
 graph.getGraphLayoutCache().insertGroup(group, cells);
 

void org.jgraph.graph.GraphLayoutCache.insertViews CellView[]  views  ) 
 

Adds the specified model root cells to the view. Do not add a view that is already in roots.

boolean org.jgraph.graph.GraphLayoutCache.isAllAttributesLocal  ) 
 

Returns:
Returns the askLocalAttribute.

boolean org.jgraph.graph.GraphLayoutCache.isAutoSizeOnValueChange  ) 
 

Returns true if cells should be auto-sized when their values change

Returns:
true if cells should be auto-sized when their values change

boolean org.jgraph.graph.GraphLayoutCache.isControlAttribute Object  cell,
Object  key,
Object  value
[protected]
 

Returns true if key is a control attribute

boolean org.jgraph.graph.GraphLayoutCache.isHidesDanglingConnections  ) 
 

Returns the hidesDanglingConnections.

Returns:
boolean

boolean org.jgraph.graph.GraphLayoutCache.isHidesExistingConnections  ) 
 

Returns the hidesExistingConnections.

Returns:
boolean

boolean org.jgraph.graph.GraphLayoutCache.isLocalAttribute Object  cell,
Object  key,
Object  value
[protected]
 

Returns true if the set of local attributes contains key

boolean org.jgraph.graph.GraphLayoutCache.isMovesChildrenOnExpand  ) 
 

Returns:
Returns the moveChildrenOnExpand.

boolean org.jgraph.graph.GraphLayoutCache.isMovesParentsOnCollapse  ) 
 

Returns:
Returns the movesParentsOnCollapse.

boolean org.jgraph.graph.GraphLayoutCache.isPartial  ) 
 

boolean org.jgraph.graph.GraphLayoutCache.isReconnectsEdgesToVisibleParent  ) 
 

Returns:
Returns the reconnectsEdgesToVisibleParent.
Deprecated:
edges are moved to parent view and back automatically

boolean org.jgraph.graph.GraphLayoutCache.isRemembersCellViews  ) 
 

Returns the remembersCellViews.

Returns:
boolean

boolean org.jgraph.graph.GraphLayoutCache.isResizesParentsOnCollapse  ) 
 

Returns:
Returns the resizesParentsOnCollapse.

boolean org.jgraph.graph.GraphLayoutCache.isSelectsAllInsertedCells  ) 
 

Returns:
Returns the selectsAllInsertedCells.

boolean org.jgraph.graph.GraphLayoutCache.isSelectsLocalInsertedCells  ) 
 

Returns:
Returns the selectsLocalInsertedCells.

boolean org.jgraph.graph.GraphLayoutCache.isShowsChangedConnections  ) 
 

Returns:
Returns the showsChangedConnections.

boolean org.jgraph.graph.GraphLayoutCache.isShowsExistingConnections  ) 
 

Returns the showsExistingConnections.

Returns:
boolean

boolean org.jgraph.graph.GraphLayoutCache.isShowsInsertedConnections  ) 
 

Returns the showsInsertedConnections.

Returns:
boolean

boolean org.jgraph.graph.GraphLayoutCache.isVisible Object  cell  ) 
 

void org.jgraph.graph.GraphLayoutCache.putMapping Object  cell,
CellView  view
 

Associates the specified model cell with the specified view.

Implements org.jgraph.graph.CellMapper.

void org.jgraph.graph.GraphLayoutCache.refresh CellView  view,
boolean  create
 

void org.jgraph.graph.GraphLayoutCache.refresh CellView[]  views,
boolean  create
 

synchronized void org.jgraph.graph.GraphLayoutCache.reload  ) 
 

void org.jgraph.graph.GraphLayoutCache.reloadRoots  )  [protected]
 

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.

void org.jgraph.graph.GraphLayoutCache.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.

Parameters:
cells The cells to remove.
descendants Whether to remove all descendants as well.
edges Whether to remove all connected edges as well.

void org.jgraph.graph.GraphLayoutCache.remove Object[]  cells  ) 
 

Removes cells from the model.

CellView [] org.jgraph.graph.GraphLayoutCache.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 org.jgraph.graph.GraphLayoutCache.removeGraphLayoutCacheListener GraphLayoutCacheListener  l  ) 
 

Removes a listener previously added with addGraphLayoutCacheListener() .

See also:
addGraphLayoutCacheListener
Parameters:
l the listener to remove

CellView org.jgraph.graph.GraphLayoutCache.removeMapping Object  cell  ) 
 

Removes the associaten for the specified model cell and returns the view that was previously associated with the cell. Updates the portlist if necessary.

boolean org.jgraph.graph.GraphLayoutCache.removeViewLocalAttribute Object  key,
boolean  addToModel,
boolean  override
 

Handles the removal of view local attributes. Since these attributes are only being stored in the view, the option is provided to copy the values for that key into the model. Without this, those values are lost.

Parameters:
key the key of the view local attribute
addToModel whether or not to move the attribute values to the graph model
override whether or not to override the key's value in the model cell's attribute map if it exists
Returns:
whether or not the operation completed sucessfully

void org.jgraph.graph.GraphLayoutCache.setAllAttributesLocal boolean  allAttributesLocal  ) 
 

Parameters:
allAttributesLocal The allAttributesLocal to set.

void org.jgraph.graph.GraphLayoutCache.setAutoSizeOnValueChange boolean  flag  ) 
 

Determines whether cells should be auto-sized when their values change. Fires a property change manas.event if the new setting is different from the existing setting.

Parameters:
flag a boolean value, true if cells should be auto-sized when their values change

void org.jgraph.graph.GraphLayoutCache.setCollapsedState Object[]  collapse,
Object[]  expand
 

Collapses and/or expands the specified cell(s)

Parameters:
collapse the cells to be collapsed
expand the cells to be expanded

void org.jgraph.graph.GraphLayoutCache.setCollapseXScale double  collapseXScale  ) 
 

Parameters:
collapseXScale The collapseXScale to set.

void org.jgraph.graph.GraphLayoutCache.setCollapseYScale double  collapseYScale  ) 
 

Parameters:
collapseYScale The collapseYScale to set.

void org.jgraph.graph.GraphLayoutCache.setFactory CellViewFactory  factory  ) 
 

Sets the factory that creates the cell views.

void org.jgraph.graph.GraphLayoutCache.setHiddenSet Map  hiddenSet  ) 
 

Sets the hiddenSet.

Parameters:
hiddenSet The hiddenSet to set

void org.jgraph.graph.GraphLayoutCache.setHidesDanglingConnections boolean  hidesDanglingConnections  ) 
 

Sets the hidesDanglingConnections

Parameters:
hidesDanglingConnections 

void org.jgraph.graph.GraphLayoutCache.setHidesExistingConnections boolean  hidesExistingConnections  ) 
 

Sets the hidesExistingConnections

Parameters:
hidesExistingConnections 

void org.jgraph.graph.GraphLayoutCache.setLocalAttributes Set  localAttributes  ) 
 

Parameters:
localAttributes The localAttributes to set.

void org.jgraph.graph.GraphLayoutCache.setModel GraphModel  model  ) 
 

Sets the current model.

void org.jgraph.graph.GraphLayoutCache.setMovesChildrenOnExpand boolean  moveChildrenOnExpand  ) 
 

Parameters:
moveChildrenOnExpand The moveChildrenOnExpand to set.

void org.jgraph.graph.GraphLayoutCache.setMovesParentsOnCollapse boolean  movesParentsOnCollapse  ) 
 

Parameters:
movesParentsOnCollapse The movesParentsOnCollapse to set.

void org.jgraph.graph.GraphLayoutCache.setReconnectsEdgesToVisibleParent boolean  reconnectsEdgesToVisibleParent  ) 
 

Parameters:
reconnectsEdgesToVisibleParent The reconnectsEdgesToVisibleParent to set.
Deprecated:
edges are moved to parent view and back automatically

void org.jgraph.graph.GraphLayoutCache.setRemembersCellViews boolean  rememberCellViews  ) 
 

Sets the rememberCellViews.

Parameters:
rememberCellViews The rememberCellViews to set

void org.jgraph.graph.GraphLayoutCache.setResizesParentsOnCollapse boolean  resizesParentsOnCollapse  ) 
 

Parameters:
resizesParentsOnCollapse The resizesParentsOnCollapse to set.

void org.jgraph.graph.GraphLayoutCache.setSelectsAllInsertedCells boolean  selectsAllInsertedCells  ) 
 

Parameters:
selectsAllInsertedCells The selectsAllInsertedCells to set.

void org.jgraph.graph.GraphLayoutCache.setSelectsLocalInsertedCells boolean  selectsLocalInsertedCells  ) 
 

Parameters:
selectsLocalInsertedCells The selectsLocalInsertedCells to set.

void org.jgraph.graph.GraphLayoutCache.setShowsChangedConnections boolean  showsChangedConnections  ) 
 

Parameters:
showsChangedConnections The showsChangedConnections to set.

void org.jgraph.graph.GraphLayoutCache.setShowsExistingConnections boolean  showsExistingConnections  ) 
 

Sets the showsExistingConnections

Parameters:
showsExistingConnections 

void org.jgraph.graph.GraphLayoutCache.setShowsInsertedConnections boolean  showsInsertedConnections  ) 
 

Sets the showsInsertedConnections

Parameters:
showsInsertedConnections 

void org.jgraph.graph.GraphLayoutCache.setVisible Object[]  visible,
Object[]  invisible,
ConnectionSet  cs
 

void org.jgraph.graph.GraphLayoutCache.setVisible Object[]  visible,
Object[]  invisible
 

void org.jgraph.graph.GraphLayoutCache.setVisible Object[]  cells,
boolean  visible
 

void org.jgraph.graph.GraphLayoutCache.setVisible Object  cell,
boolean  visible
 

boolean org.jgraph.graph.GraphLayoutCache.setVisibleImpl Object[]  cells,
boolean  visible
 

void org.jgraph.graph.GraphLayoutCache.setVisibleSet Set  visible  ) 
 

void org.jgraph.graph.GraphLayoutCache.showCells Object[]  cells,
boolean  descandants
 

Shows the specified cells with all children if descandants is true.

void org.jgraph.graph.GraphLayoutCache.showCellsForChange GraphModelEvent.GraphModelChange  change  )  [protected]
 

void org.jgraph.graph.GraphLayoutCache.toBack Object[]  cells  ) 
 

Sends cells to back. Note: This expects an array of cells!

void org.jgraph.graph.GraphLayoutCache.toFront Object[]  cells  ) 
 

Brings cells to front. Note: This expects an array of cells!

void org.jgraph.graph.GraphLayoutCache.toggleCollapsedState Object[]  cells,
boolean  collapseOnly,
boolean  expandOnly
 

Toggles the collapsed state of the specified cells.

Parameters:
cells The cells to toggle the collapsed state for.
collapseOnly Whether cells should only be collapsed.
expandOnly Whether cells should only be expanded.

static void org.jgraph.graph.GraphLayoutCache.translateViews CellView[]  views,
double  dx,
double  dy
[static]
 

Translates the specified views by the given amount.

Parameters:
views an array of cell view to each be translated
dx the amount to translate the views in the x-axis
dy the amount to translate the views in the x-axis

Object [] org.jgraph.graph.GraphLayoutCache.ungroup Object[]  cells  ) 
 

Ungroups all groups in cells and returns the children that are not ports. Note: This replaces the parents with their group cells in the group structure.

void org.jgraph.graph.GraphLayoutCache.update CellView  view  ) 
 

void org.jgraph.graph.GraphLayoutCache.update CellView[]  views  ) 
 

void org.jgraph.graph.GraphLayoutCache.updatePorts  )  [protected]
 

Updates the cached array of ports.

void org.jgraph.graph.GraphLayoutCache.valueForCellChanged Object  cell,
Object  newValue
 

Messaged when the user has altered the value for the item identified by cell to newValue. If newValue signifies a truly new value the model should post a graphCellsChanged manas.event. This calls augmentNestedMapForValueChange.


Member Data Documentation

boolean org.jgraph.graph.GraphLayoutCache.allAttributesLocal = false [protected]
 

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.

boolean org.jgraph.graph.GraphLayoutCache.autoSizeOnValueChange = false [protected]
 

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

double org.jgraph.graph.GraphLayoutCache.collapseXScale = 1.0 [protected]
 

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

double org.jgraph.graph.GraphLayoutCache.collapseYScale = 1.0 [protected]
 

CellViewFactory org.jgraph.graph.GraphLayoutCache.factory = null [protected]
 

Factory to create the views.

GraphModel org.jgraph.graph.GraphLayoutCache.graphModel [protected]
 

Reference to the graphModel

Map org.jgraph.graph.GraphLayoutCache.hiddenMapping = new WeakHashMap() [protected]
 

boolean org.jgraph.graph.GraphLayoutCache.hidesDanglingConnections = false [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.hidesExistingConnections = true [protected]
 

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.

EventListenerList org.jgraph.graph.GraphLayoutCache.listenerList = new EventListenerList() [protected]
 

The list of listeners that listen to the model.

Set org.jgraph.graph.GraphLayoutCache.localAttributes = new HashSet() [protected]
 

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

Map org.jgraph.graph.GraphLayoutCache.mapping = new Hashtable() [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.movesChildrenOnExpand = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.movesParentsOnCollapse = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.partial = false [protected]
 

Only portions of the model are visible.

PortView [] org.jgraph.graph.GraphLayoutCache.ports [protected]
 

Cached array of all ports for the view.

boolean org.jgraph.graph.GraphLayoutCache.reconnectsEdgesToVisibleParent = false [protected]
 

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

Deprecated:
edges are moved to parent view and back automatically

boolean org.jgraph.graph.GraphLayoutCache.remembersCellViews = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.resizesParentsOnCollapse = false [protected]
 

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.

List org.jgraph.graph.GraphLayoutCache.roots = new ArrayList() [protected]
 

Ordered list of roots for the view.

boolean org.jgraph.graph.GraphLayoutCache.selectsAllInsertedCells = true [protected]
 

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.

boolean org.jgraph.graph.GraphLayoutCache.selectsLocalInsertedCells = true [protected]
 

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.

boolean org.jgraph.graph.GraphLayoutCache.showsChangedConnections = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.showsExistingConnections = true [protected]
 

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.

boolean org.jgraph.graph.GraphLayoutCache.showsInsertedCells = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.showsInsertedConnections = true [protected]
 

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

boolean org.jgraph.graph.GraphLayoutCache.showsInvisibleEditedCells = true [protected]
 

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

Set org.jgraph.graph.GraphLayoutCache.visibleSet = new HashSet() [protected]
 

The set of visible cells.


The documentation for this class was generated from the following file:
Generated on Sun May 28 19:13:16 2006 for Digimod by  doxygen 1.4.6-NO