Editing is coordinated by a DrawingEditor. A DrawingEditor has one or multiple DrawingViews and a current Tool that receives input events from the DrawingViews and changes the Drawing and its Figures accordingly.

The current Tool of a DrawingEditor can be changed using additional user interface elements, e.g. using a JToolBar. There can be different types of specialized Tools that can interpret the same keyboard strokes and mouse gestures in different ways.

There can be a CreationTool, that creates a new Figure, when the user drags the mouse over an area of the DrawingView while keeping the mouse button pressed. There can be a SelectionTool, that selects existing Figures when the user does the same mouse gesture. Selections are maintained by the DrawingViews.

Handles are used to manipulate existing Figure. When Figures are selected in a DrawingView, the DrawingView requests the Handles from the selected Figures and displays them on the screen. The SelectionTool forwards input events to Handles if the mouse has been pressed over a Handle.

There can be Handles to change the dimensions and orientation of a Figure, to change the position of points on the outline of a Figure, and to change attributes of a Figure.

The DelegationSelectionTool allows Figures to change the current Tool of the DrawingEditor on a double click on a Figure. Double clicking a TextFigure when the DelegationSelectionTool is active, replaces the current Tool of the DrawingEditor with a TextTool, which then opens a text editor for the TextFigure.

Editing a Drawing

JHotDraw 7