JGraph 5.6

Expand/Collapse Functionality

The expand and collapse functionlity has been improved in the GraphLayoutCache. When a group is collapsed, edges connecting to vertices that have been hidden are shown to attach to the perimeter point of their first visible parent view. Note that no model changes are made. When the group is expanded again the edges are shown connected to their original vertices.

There is a new method in GraphLayoutCache, setCollapsedState that accepts arrays of the cells to be collapsed and those to be expanded, so the two operations can be performed at the same time.

A new attribute, groupOpaque, was added. This enables transparent groups which are opaque when collapsed, i.e. the group cell is not visible if it is expanded but is visible if it is collapsed.

The showsChangedConnections switch was added to the GraphLayoutCache. This indicates whether connections should be made visible when reconnected and their source and target ports (or one of their parents) are visible.

Adds getPerimeterPoint to CellView interface

This method was previously in VertexView, this change enables edge to edge connections. The method also now requires an EdgeView parameter of the edge connecting with the perimeter of the vertex. null will work correctly for this parameter initially. The old method has been deprecated.

Moves getCenterPoint as static method to AbstractCellView

The old method in VertexView is deprecated. vertex.getCenterPoint() needs to be changed to AbstractCellView.getCenterPoint(vertex);

Adds getCells to GraphLayoutCache

This new helper methods allows to get cells based on their type and current state in the layout cache. For example, to get all vertices (ie. all cells for which model.isEdge(cell) and model.isPort(cell) returns null and that appear as leafs in the layout cache), the following code may be used:

graph.getGraphLayoutCache().getCells(false, true, false, false);

In order to find all selected edges, the following code is used (using the new getSelectionCells(Object[]) in JGraph):

graph.getSelectionCells(
  graph.getGraphLayoutCache().getCells(false, false, false, true));

Other Changes

  • getSelectionCells(Object[] cells) was added to the JGraph class. This returns an Object array with cells that are selected from the Object array parameter passed in.

  • The type of extra edge labels in GraphConstants was changed to a Point2D. This was a bug, please update your types accordingly.

  • The moves cells out of groups functionality was changed so that the cell is judged to have left the group with there is no intersection between its bounds and the group bounds. Previously, this was worked out from the mouse position, which was a bug.

  • Bean properties for gridColor, (locked)handleColor and handleSize have been added.