GraphController Association

In this section, you will learn how to associate a GraphController to a VisualGraphView.

Example 4.2. VisualGraphView Creation

// Get a factory instance
GraphViewFactory viewfactory= GraphViewFactory.newInstance();

// Create a new visual graph view using a graph controller
graphView= viewfactory.newVisualGraphView(controller);
graphView.enableUndoRedo();

// Add the view to managed list of views
controller.addVisualGraph(graphView);

In the method above, you can see that a GraphController instance is required to create a new VisualGraphView. Additionally, you are required to manually add the view to the controller once is has been successfully created.