Release Notes Version 5.1
Changes for this release:
-
the delegation based event model is used to track figure changes.
The FigureChangeListener interface supports to observe figure changes.
A FigureChangeListener receives FigureChangeEvents.
The old mechanism based on Observer/Observable and the notion of a container
was eliminated. A figure now only
has listeners. There is a new support class FigureChangeEventMulticaster
to manage the listeners. Using listeners is more consistent with the AWT/JFC
event handling style. CompositeFigure, Decorator, ConnectionFigure, and Drawing
are now FigureChangeListeners.
-
StandardDrawing is a CompositeFigure. It is possible to insert
a StandardDrawing as a figure into a drawing. This change does not
impact the framework package. The Drawing interface is independent
of CompositeFigure.
-
Tools no longer receive the DrawingView as an argument, but store
it in an instance variable. Existing Tools have to be adapted accordingly.
-
SelectionTool is more open for customization. The trackers to be used for the
different selection modes can be overridden by the factory methods
createHandleTracker, createDragTracker, createAreaTracker. The MouseTracker
class was merged into AbstractTool and could be eliminated.
The selection tool to be used in an application can be customized
by overridding createSelectionTool in DrawApplication/DrawApplet.
JavaDrawApp illustrates how to use a customized selection tool that
can handle double clicks on figures.
-
DrawApplication supports keyboard short cuts for the common operations.
Release Notes Version 5.0
Note:This version requires JDK 1.1.
The purpose of this release is to:
-
use JDK1.1 features: event model, access to resources, serialization,
scrolling, printing, cursors etc.
-
improve the packaging structure.
-
improve the support for connectivity.
-
implement several minor improvements.
JDK1.1 features
Event Model
All event handling related classes use the JDK1.1 event model.
This required to change some method signatures to refer to more
specific events. Returning a boolean to indicate the consumption
of an event was removed.
Serialization
This version supports to use of serialization to make a
drawing persistent. CH.ifa.draw.applet.DrawApplet and
CH.ifa.draw.application.DrawApplication support both the old
storable and the serializable format. Support for the storable format
will be removed in the next version.
Serialization is used in the default implementation of Figure.clone().
StandardDrawingView supports serialization.
Resource Access
Thanks to 1.1 the access to resources could be drastically simplified.
All the resources are now accessed relative to classes.
The images directory with standard images is therefore part of the
package hierarchy.
IconKit could be decoupled from DrawingEditor and was moved from
CH.ifa.draw.standard to CH.ifa.draw.util.
Refer to the sample applications for how to
load and access resources like images.
Various UI Features
-
Tools support to use tool specific cursors.
-
CH.ifa.draw.application shows the DrawingView by default in a ScrollPane.
There is a new method createContents that can be overridden to customize
the default arrangement. The default size of the view can be customized by
overriding getDrawingViewSize().
-
CH.ifa.draw.application supports to print a drawing.
Packaging
The packaging was changed to separate the framework interfaces
from default implementations.
The framework package defines the core
interfaces and leaves default implementations to the standard package.
All key abstractions of the framework are now defined as interfaces.
Ward Cunningham has suggested this some time ago and it ended up
to be natural and logic evolution.
The implementation of the framework interfaces comes in two flavors.
Abstract classes like AbstractFigure, provide default implementation
but still need to be subclassed. Standard classes
like StandardDrawing implement a
framework interface and can be used as is.
The framework package was renamed to "framework" the old "fw"
was due to a temprorary bug in the used IDE:
A figures package was forked of the standard package. This package
provides a kit of standard figures and their related handle and
tool classes.
There is a new package contrib that contains classes contributed
by others.
Connectivity
Connectors were introduced to define connections between figures.
A figure can have one or more connectors. A figure creates a
connector for a specific location connectorAt(int x, int y).
A connector knows how to find
the connection point. A connection figure keeps track of a
connector for its start and end point.
Figure.chop() is no longer needed and was removed. Its functionality
is subsumed by Connectors.
A set of standard connectors is provided in the standard and figure
packages.
-
BoxChopConnector: finds a connection point by chopping the connection
at the figure's bounding box.
-
LocatorConnector: uses a locator to find the connection point.
This enables to define connections at specific semantic points on
a figure. Refer to the NetApp sample for an example of using them.
-
ShortestDistanceConnector: finds the connection points based on the shortest distance
between figures.
-
EllipseChopConnector: finds a connection point by chopping the connection
at the ellipse defined by the figure's bounding box.
Connectors are optionally visible and Figure has a method connectorVisibility
to turn their visibility on and off. This is used by the ConnectionTool
to highlight connection points when the mouse moves over a figure.
TextFigures can be attached to other figures. The ConnectedTextTool
supports to create a connected TextFigure. Try it out in JavaDraw.
The text figure is connected to the Figure that is clicked when the
tool is active. To position a connected TextFigure figures can override
the method connectedTextLocator to return a locator.
Various Changes
-
FigureEnumeration extends Enumeration to enable to iterate over
figures without having to do a down casted in client code. It
provides an additional method nextFigure to get the next Figure.
-
AbstractFigure was split. AbstractFigure no longer keeps track of
the FigureAttributes dictionary. The dictionary is now maintained
in its derived class AttributeFigure. This change enables to
create Figure subclasses without having to use the
FigureAttributes implementation.
-
Trackers are gone. Tracker
functionality is implemented in the Handles themselves. In contrast
to Locators they did not turn out to be reusable for different handles.
The class BoxHandleKit hides the different Handle implementation classes
from the API.
-
BoxHandleKit provides factory methods to create Handles for
common locations on a figure.
-
DrawingView is now an interface with a standard implementation, i.e.,
StandardDrawingView.
-
Figure.clone() is implemented in a generic way in AbstractFigure.
The figure is serialized and the clone is created by resurrecting
the serialized figure.
-
Image handling was simplified and the preLoadRegisteredImages
is no longer necessary.
-
Commands know whether they are executable or
not. They provide an isExecutable operation to check their state.
-
Name changes: ObserverFigure -> ConnectionFigure, LineConnectionFigure ->
LineConnection.
-
There is support for transparent fill colors for AttributeFigures.
-
AttributeFigre.draw() is a now a template method that calls
drawBackground() and drawFrame(). Subclasses should override
these methods instead of draw().
-
The signature of Handle.invokeStep() and Handle.invokeEnd() was changed to:
public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) {
public void invokeEnd (int x, int y, int anchorX, int anchorY, DrawingView view) {
The passed arguments correspond to the current point and the anchor point
of the interaction.
The old signature are still supported but deprecated.
-
Doug Lea implemented a nice PolygonFigure with its corresponding Handles
and Tools. Check it out in JavaDrawApp.
-
ElbowHandles support to adjust elbow connections.
Samples
-
the samples are now located in subpackages of samples.
-
there are two new samples:
-
Nothing implements a minimal application/applet
that can be used as the starting point for your own applications.
-
NetApp is a simple editor with nodes and connections. It
illustrates LocatorConnectors.
Converting
-
If you derived classes from Handle, Tool, Locator you have to change
them to inherit from their corresponding Abstract class.
-
Change your tool classes to no longer return a boolean from
event handling methods.
-
Change the event handling method to use a specific event, typically
a MouseEvent.
-
Import the figures package if you use figures provided by this version.
-
Tools should call editor().toolDone() instead of editor().setDefaultTool.
-
Add the serival version stuff to your figure classes.