Properties Implementation Design and Details
Introduction
Properties are a convenient way to associate additional information
with edges and vertices. For example, one might want to have all edges
contain a weight. A single property can be displayed inside a
vertex which will resize appropriately or next to an edge. No
properties need be displayed.
Structure
There are 4 main components to the Properties structure:
-
Prop
The Prop Class is simply a container object consisting of the
property's name and value.
-
PropVector
The PropVector extends a regular Vector. It is a sorted list of
Properties (by name). A simple insertion sort is used. This is not
particularly efficient, but since properties will not be getting much
larger than 2 or 3 items, it should not become an issue. PropVector
also includes a method to merge two PropVectors (reconcile).
-
PropMan
This is the actual property manager. Every Vertex and Edge contains a
PropMan. The PropMan contains the PropVector of properties for this
property, keeps track of the current property to display (if any), and
makes sure that the property window (PropWin) stays in a consistant
state. Any time a property is added, deleted, or changed, the PropMan
closes the PropWin. This is to avoid past problems with Property
Windows that stop responding when updated in place. Hopefully, this
is a bug in the current AWT and windows can be kept open in later
versions of Zarbiff.
-
PropWin
This is the Property Window. When displayed it looks like:
You can directly alter the values of the properties from this window
by editing the text fields. You can also set which property (perhaps
none) to display using the check boxes along the left edge. Clicking
"DONE" will save the state of the Property. Anytime the window is
forced closed, it will also save the current state. Destroying the
PropWin from the menu, however, will not save the current changes.
PropWin contains the class PropPanel. Inside the physical Property
Window, there is a PropPanel for each Property. The PropPanel is just
a panel containing a label for the peroperty name, and a textfield
that is initialized to the property value.
Before the property window is closed, the PropMan gets a PropVector
containing the current values from the PropWin and makes it it's own.
This vector is generated by the PropWin iterating through each of the
PropPanels, getting their respective Props. At closing time, the
PropMan also gets the value of the current selected property.
Adding/Deleteing
All of the adding and deleting of properties is done in filters which
act on the set of highlighted vertices/edges. There are also filters
for seting and selecting the highlighted. In the case in which
properties are inconsistant (i.e. two selected vertices have different
properties) the two are merged for displaying purposes, but the actual
property lists are not altered. For example, if you try to select a
property that doesn't exist in all vertices, the property will be
selected in the vertices that have it and the others will be
unchanged.
Undo
The PropMan includes a link to the Undo Manager.
Adding, deleting, and selecting are fully undoable. At this time
setting the value of a property is not undoable.