The GraphLayoutCache does no longer implement the Observable interface, it now has a full-featured event notification mechanism. The listener should implement the GraphLayoutCacheListener interface and add the instance using the addGraphLayoutCacheListener method on the layout cache. The layout cache delivers GraphLayoutCacheEvents from which you can retrieve the new and the previous attributes. (Note: This will be required to optimize repaint upon changes.) The getInserted and getRemoved methods return the cells that have been shown or hidden.
This fundamental change has the following advantages:
No custom storage map injection at cell creation time, i.e. so no setAttributeMap() call required
Graphcells must no longer keep the user object and the attribute map in sync
No double-referencing of the same user object from graphcell and attribute map
On the downside this adds another control attribute, in other words: You can not use attributes with the name value in a storage map.
If you are using custom user objects then you should have implemented a custom attribute map with at least a valueChanged and clone method to take care of your custom user objects. If the attribute map only contains these two methods it is no longer required. Instead, you should create or use the custom graph model and override the following two methods:
public class GPGraphModel extends DefaultGraphModel { protected Object cloneUserObject(Object userObject) { ... } protected Object valueForCellChanged(Object cell, Object newValue) { ... } }
If the attribute map is no longer required then all calls to cell.setAttributes that were used to inject the map may also be removed. (See GPGraphModel in the JGraphpad project for an example.)
3 useful static helper methods have been added to the DefaultGraphModel:
DefaultGraphModel.setSource/Target: Sets the source or target of an edge
DefaultGraphModel.getUserObject: Gets the user object from a graph cell
In the GraphModelChange the getConnectionSet and getParentMap methods have been added.
3 new attributes are available to control cell behaviour, 1 attribute has been renamed:
selectable/childrenSelectable: Enable/disable selection of cells and children
constrained: Forces constrained sizing on a cell
groupBorder attribute is now called inset
The JGraph.convertValueToString method has been changed to no longer map the cell. Instead, it uses the cell's toString method to determine the value. The method still handles view-local values though. See source code and javadocs for more details on the implementation.