Chapter 6. Modeling Rules

Table of Contents

Tutorial At A Glance
Running The Tutorial Example
Graph Rule Definition
NodeRule Definition
EdgeRule Definition
RuleRegistry Population
Rule Association
Summary

This tutorial provides Java Application Programmers exposure to critical configuration and runtime features of the Tensegrity Graph Framework. Here we give you detailed instructions on how to redefine a graph's runtime behavioral rules. These are the rules which support and restrict users while creating and manipulating visual graphs.

A rule in the Tensegrity Graph Framework makes sure that a model or a view remain well-defined according to that rule. Cardinality, association and insertion rules are just a few of the many rules programmers can take advantage of. Although we cover these topics in much greater detail in the Elements chapter inside the Framework Manual, we shall provide you with some of the key rules concepts in this chapter as well.

Tutorial At A Glance

The table below gives you some important information about this tutorial.

Table 6.1. Tutorial Aspects

Tutorial AspectTutorial Description
Approximate Duration45 Minutes
Expected Outcome An application showing a graph document view containing selectable and dragable nodes and edges. This example gives the Java Application Programmer an initial exposure to modeling rules that are specified in XML and loaded at application start-up.
Source FilesThe tutorial examples come with two source packages containing the java and configuration files needed to compile and run them. These are “com.tensegrity.firststeps.rules” and “com.tensegrity.firststeps.swt.rules” respectively for the AWT/Swing-based and SWT-based examples.
Creating FilesNot applicable in this tutorial
Modifying Filesrules.xml