Drawlets User's Guide
The best way to understand and use Drawlets is to:
- Follow the examples (com.rolemodelsoft.drawlet.examples.*)
- Read Patterns for Drawlets.
- Read Patterns for Building an Unusually Adaptable Java Framework to understand the philosophy behind the design (note: Drawlets was previously named HotDraw).
- Study the Design Overview
- Once you've done these, look through the code.
Although there are over 100 classes in the Drawlets framework, you can get a pretty solid understanding of the entire framework by understanding the fundamental roles played by the various classes, plus a few non-obvious design features.
Fundamental Roles
First we'll explain the basic relationships between the most prominent fundamental roles that the classes in Drawlets may play: You may wish to study Figure 1 as you read the following:

Figure 1: Class Diagram for intended use of Drawlets fundamental roles
Common Roles
In addition to the several Fundamental Roles, there are a few prominent Common Roles:
- Many things can be a FigureHolder.
- Some Locators are associated in some way with Figures; they are FigureHolders. If a Figure has a Locator which is a FigureHolder, it becomes a RelatedLocationListener on the held Figure. (This is what allows Arrows, LineFigures and TextLabels to follow other Figures around, among other things)
- ComponentHolders are anything that holds a Component (i.e. java.awt.Component). Typically implementors of DrawingCanvas will also be ComponentHolders in order to cooperate with various GUI approaches (e.g. AWT or JFC).
- Text is drawn using StringRenderers.
- Text is often retrieved from Figures that are also StringHolders or LabelHolders.
Existing Classes as Roles
- JDK's Rectangle, Polygon, Graphics, and Vector are prominent
- A DrawingCanvas may be a PropertyChangeListener on a Drawing and its Figures. So can anything else for that matter.
|
Go Back |
Copyright © 2002-03 by RoleModel Software, Inc. All rights reserved.
|