chapter 2
11. Each cell has an attribute map used to describe its appearance and behaviors. Using the insert(), edit() and remove() methods on the GraphLayoutCache we can change cells in a way that the graph model is updated, the screen is repainted properly, an undo of the change is added to the undo history and all listeners to the model are informed of it changing. There currently exists no method in the GraphModel interface that perform a compound of 3 editing methods to enable insertion, attribute editing and removal in one atomic, undoable operation.
12. Creating and Configuring the JGraph Class:
1) The simplest method of instantiating a JGraph is:

This will create a DefaultGraphModel and GraphLayoutCache for you and set up the reference in the GraphLayoutCache to point at the new model.
2) using your own graph model:


The GraphLayoutCache will be set up correctly for you in the same way as before.
3) next, your own GraphLayoutCache:




13. When creating your JGraph instance and associated objects, it is important to get the order of object creation correct and to ensure that the objects correctly reference each other where appropriate. The JGraph holds references to the current GraphModel and GraphLayoutCache, and the GraphLayoutCache needs to have a reference to the GraphModel. Another area where references need to be kept correct is when either the model or the layout cache are changed after the JGraph has been constructed.
If you wanted to keep the current odel associated with the JGraph instance you should create the new layout cache and pass the current model to its constructor before passing hte layout cache to jgraph.setGraphLayoutCache().
14. some methods of JGraph Class:
1) setAntiAliased(boolean) : Anti-aliasing technique, to blur sharp, jagged lines using color gradients.
15. The insert(), edit() and remove() methods on GraphModel perform the corresponding function that their GraphLayoutCache methods perform, though their parameters look rather more complex. inserting, editing and removing directly into the model means that all views based on that model will receive the same changes.
16. for the HelloWorld example, roots: vertex, edge, child node : port. Roots in DefaultGraphModel is an Arraylist, by default, enabling this method( getRootAt(int) ) to complete in constant time.
17. It should be remembered that the GraphModel interface should always be used to access the graph data model structure. The interface provides the means to obtain the necessary information about roots and the type checking is purposefully weak, cells are always passed as Objects, to allow complete flexibility in the way cells are designed.
18. edges implicitly have a direction in JGraph. Avoiding the use of arrowheads on edges is all that is required to visually make any graph look undirected.
19. edges(Object port): return an Interator of edges connected to the port. Although the parameter is named 'port' , the GraphModel interface does not enforce that only Ports may be connected to edges. However, DefaultGraphModel, for example, does enforce this rule.
20. It is advised not to share cells between graph models, this is a trait shared with JTreeModels.
21. for the navigation between elements in the graph model data structure, as in trees, all children may only have one parent, and the parent may have no or many children.