Contributed by Dan Hall, Systems Engineer
The Tom Sawyer visualization model integrates easily with the InfiniteGraph data model and APIs.
Developing applications to query InfiniteGraph databases and then display the results using Tom Sawyer is pretty straightforward. A simple approach to building an application would include the following steps:
1. Build a Java Swing user interface with all of the desired query capabilities needed to support querying the data in your InfiniteGraph database.
2. Leave room in your Swing interface for a JPanel that will serve as the home for the Tom Sawyer visualization.
3. Use the Tom Sawyer Perspectives Designer to define the visualization.
4. Modify the Swing user interface program to include a Tom Sawyer visualization object in the JPanel defined in step 2.
5. Modify your query results handling code to populate the Tom Sawyer visualization model with the results that come back from queries.
The mapping between the InfiniteGraph query results and the Tom Sawyer visualization model is the magic that renders the graph on the screen for users.
The Tom Sawyer API has a tremendous number of capabilities that can be used to create different types of visualizations. It supports multiple user-defined event handlers which allow you to write custom code to handle user interactions with the graph. For example, you can write a custom node expander and register it with the Tom Sawyer graph engine. When the user selects one or more nodes and clicks an expand icon within the Tom Sawyer panel, your nodeExpander method will get called and you can invoke the necessary InfiniteGraph operations to query those nodes to be expanded and add them to the Tom Sawyer model. Adding them to the model makes them appear in the graph.
Tom Sawyer integration into InfiniteGraph