There are two GraphController implementations supplied with the Tensegrity API. Each implementation
manages a special type of communication between a Graph model and its views.
The interface GraphController defines the behavior for classes
responsible for notifying Graph and VisualGraphView
objects about changes that have taken place in both a model and in a view.
A GraphController therefore manages the views that are attached
to a given graph.
The class ClientServerGraphController manages a typical (simple)
client and server scenario, where there is one privileged master view (server)
and one to many client views. The client views are read-only and simply reflect
the current state of the master view. These client views are often distributed
on different computers and need to synchronize their output with the output of
the master view. This controller propagates user commands directly to a view.
Class ModelBasedGraphController manages a typical model-based
scenario in which changes to the model are automatically reflected by specific
predefined visual operations. This controller is also responsible for automatically
inserting visual elements into a view whenever model elements are created and inserted
into a Graph. This controller propagates user
commands directly to a model and is also responsible for notifying views about
model changes that have occured.
The pertinent methods specified in interface GraphController are the following:
void addVisualGraph(VisualGraphView)
Adds a VisualGraphView to the list of controlled views.
Graph getGraph()
Returns the graph model instance that is being controlled.
void removeVisualGraph(VisualGraphView)
Removes a VisualGraphView from the list of controlled views.
Please note that the methods addVisualGraph and
removeVisualGraph are used to register and unregister
views in a controller instance. Different controller instances may coexist
at runtime which implement deviant registration behaviors.
© 2004, 2005 Tensegrity Software GmbH