Release Notes for JHotDraw 7
Important: JHotDraw 7 is currently in a premature state.
Review the framework before you start using it. Don't blame yourself when
something isn't working as expected – the problem ist most likely due to
the issues in the framework. All constructive feedback is highly appreciated.
The API is not stable yet: Expect major
incompatible changes in the org.jhotdraw.app
package in
upcoming releases. Expect many minor incompatible changes in all other packages.
Note: This version requires J2SE 5.
JHotDraw 7 is a major departure from previous versions of JHotDraw – only
the cornerstones of the original architecture remain. The API and almost
every
part of the implementation have been reworked to take advantage of the Java
2 SE 5.0 platform.
JHotDraw 7 is not backwards compatible with previous versions
of the JHotDraw framework.
Summary of major changes:
Architectural changes:
- The package structure of the framework has been revised – the number
of packages has been considerably reduced.
- The framework complies now to the JavaBeans setter and getter
idioms.
- The drawing code takes now advantage
of Java2D. It uses double precision coordinates for all drawings.
- Java 5 typesafe collections are used now instead of Java 1.1 collections.
- Undo/Redo is implemented based on the Swing undo package.
- Cut, Copy and
Paste clipboard operations are supported.
- Commands are now based on Swing Action objects.
- ConnectionFigures support layouting using a layout strategy object (the
'Liner').
- The application framework has been replaced by a new framework supporting
single document interface (SDI), multi document interface (MDI) and the
Mac OS X document interface.
Functionality changes:
- The usability of the drawing tools has been improved – less mouse clicks
are needed for many of the drawing operations.
- A drawing can be shown and edited in multiple windows with different
scale factors.
- XML is used as the default external storage format and for clipboard
operations.
- Support for lines, and complex shapes is now based on bézier paths instead
of on polygons.
- Figures support multiple detail levels of Handles.
Release Notes for JHotDraw Version 6
Pending. This release has not yet been made.
Release Notes for JHotDraw Version 5.2
Note: This version requires Swing/JFC 1.1
The purpose of this release is to:
- Use Swing/JFC GUI elements instead of AWT (where possible)
- Support for special Swing/FC features:
- Support for Multiple Document Interface (MDI) applications with several
internal frames has been added. org.jhotdraw.contrib.MDI_DrawApplicationis
the base class which must be subclasses to takeadvantage of managing
internal frames. All examples are now derived from this class.
- Support for applications with splitted editor windows by deriving the
drawing application from org.jhotdraw.contrib.SplitPaneDrawApplication
- Drawing windows have scrollbars
- Popup menus are available for additional functionality and control
over graphical figures when using org.jhotdraw.contrib.CustomSelectionTool
- Toolbars can have different tools depending on the context of the currently
selected figure and tool
- A new composite figure is available which delegates its graphical representation
and figure attributes to another figure. Moreover, it canbe configured
with an external layout algorithm that contains the logic forhow to lay
out the child elements of the composite figure. The new compositefigure
is org.jhotdraw.contrib.GraphicalCompositeFigure and can be configuredby
a class implementing org.jhotdraw.contrib.FigureLayoutStrategy such asorg.jhotdraw.contrib.StandardFigureLayoutStrategy.
- New org.jhotdraw.util.StorageFormats that allow to add new file formats
for storing and restoring drawings (e.g. using XML)
- Build configuration for Ant ,
which can be used to compile all standard JHotDraw classes, to packagethem
into a jar file and to generate javadoc information. Some instruction how
to compile and build JHotDraw can be found here .
- Some minor bug fixes
Release Notes JHotDraw 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 containerwas eliminated. A figure now onlyhas listeners.
There is a new support class FigureChangeEventMulticasterto manage the
listeners. Using listeners is more consistent with the AWT/JFCevent handling
style.CompositeFigure, Decorator, ConnectionFigure, and Drawingare now
FigureChangeListeners.
- StandardDrawing is a CompositeFigure. It is possible to inserta StandardDrawing
as a figure into a drawing. This change does notimpact the framework package.
The Drawing interface is independentof CompositeFigure.
- Tools no longer receive the DrawingView as an argument, but storeit in
an instance variable. Existing Tools have to be adapted accordingly.
- SelectionTool is more open for customization. The trackers to be used
for thedifferent 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 customizedby overridding
createSelectionTool in DrawApplication/DrawApplet.JavaDrawApp illustrates
how to use a customized selection tool thatcan handle double clicks on figures.
- DrawApplication supports keyboard short cuts for the common operations.
Release Notes JHotDraw 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 morespecific events. Returning
a boolean to indicate the consumptionof an event was removed.
Serialization
This version supports to use of serialization to make adrawing persistent.
org.jhotdraw.applet.DrawApplet andorg.jhotdraw.application.DrawApplicationsupport
both the oldstorable and the serializable format. Support for thestorable formatwill
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 thepackage hierarchy.
IconKit could be decoupled from DrawingEditor and was moved fromorg.jhotdraw.standard
to org.jhotdraw.util.Refer to the sample applications for how toload and
access resources like images.
Various UI Features
- Tools support to use tool specific cursors.
- org.jhotdraw.application shows the DrawingView by default in a ScrollPane.
There is a new method createContents that can be overridden to customizethe
default arrangement. The default size of the view can be customized byoverriding
getDrawingViewSize().
- org.jhotdraw.application supports to print a drawing.
Packaging
The packaging was changed to separate the framework interfacesfrom default
implementations.
The framework package defines the coreinterfaces 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
upto be natural and logic evolution.
The implementation of the framework interfaces comes in two flavors.Abstract
classes like AbstractFigure, provide default implementationbut still need
to be subclassed. Standard classeslike StandardDrawing implement aframework
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 packageprovides
a kit of standard figures and their related handle andtool classes.
There is a new package contrib that contains classes contributedby others.
Connectivity
Connectors were introduced to define connections between figures.A figure can
have one or more connectors. A figure creates aconnector for a specific location
connectorAt(int x, int y).A connector knows how to findthe connection point.
A connection figure keeps track of aconnector for its start and end
point.
Figure.chop() is no longer needed and was removed. Its functionalityis subsumed
by Connectors.
A set of standard connectors is provided in the standard and figurepackages.
- BoxChopConnector: finds a connection point by chopping the connection
at the figure's bounding box.
- LocatorConnector: uses a locator to find the connection point.Thisenables
to define connections at specific semantic points ona figure. Referto the
NetApp sample for an example of using them.
- ShortestDistanceConnector: finds the connection points based on the shortest
distancebetween 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 ConnectionToolto highlight
connection points when the mouse moves over a figure.
TextFigures can be attached to other figures. The ConnectedTextToolsupports
to create a connected TextFigure. Try it out in JavaDraw.The text figureis
connected to the Figure that is clicked when thetool is active. To position
a connected TextFigure figures can overridethe method connectedTextLocator
to return a locator.
Various Changes
- FigureEnumeration extends Enumeration to enable to iterate overfigures
without having to do a down casted in client code. Itprovides an additional
method nextFigure to get the next Figure.
- AbstractFigure was split. AbstractFigure no longer keeps track ofthe
FigureAttributes dictionary. The dictionary is now maintainedin its derived
class AttributeFigure. This change enables tocreate Figure subclasses without
having to use theFigureAttributes implementation.
- Trackers are gone. Trackerfunctionality is implemented in the Handles
themselves. In contrastto Locators they did not turn out to be reusable
for different handles.The class BoxHandleKit hides the different Handle
implementation classesfrom the API.
- BoxHandleKit provides factory methods to create Handles forcommon 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 resurrectingthe serialized
figure.
- Image handling was simplified and the preLoadRegisteredImagesis nolonger
necessary.
- Commands know whether they are executable ornot. 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 callsdrawBackground()
and drawFrame(). Subclasses should overridethese 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/appletthat can be used
as the starting point for your own applications.
- NetApp is a simple editor with nodes and connections. Itillustrates
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 fromevent 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 serial version stuff to your figure classes.