The decorators package

Package:

diva.canvas.decorators

Status:

0.1. Preliminary. Published to ptdesign. 05/05/98.

Last updated:

May 5th, 1998.

See also:

The Diva canvas
Copyright

Contents

Overview

Typically, interactive editing programs need to draw additional objects on the screen, such as highlighting, grab handles, and similar paraphernalia. These items, while not directly part of the drawing, still need to be created and managed. This package provides the interfaces and classes needed for a typical useful set.

Interfaces

interface Highlighter

The interface implemented by objects that know how to "highlight" figures. By "highlight," we mean any operation that creates some additional drawing on the screen that is attached to a given figure.

void highlight ( Figure )
Highlight the figure. Typically, this operation will create one or more new figures, add them to the parent figure just before the highlighted figure, and add a component listener to the figure so that it can move the highlight appropriately.

void rehighlight ( Figure )
Re-highlight the figure. This operation is typically called if a figure is already highlighted, but has changed in some way that requires change in the highlights.

void unhighlight ( Figure )
Remove highlighting from the given figure.

interface GrabHandle extends Figure

The interface implemented by objects that are used as grab-handles. A grab-handle is notionally attached to a feature of a glyph.

void deselect ( )
Change the appearance of the grab-handle to make it look deselected.

Feature getFeature ( )
Get the feature to which this grab-handle is attached.

void select ( )
Change the appearance of the grab-handle to make it look selected.

void setGrabBehavior ( GrabBehavior )
Set the behavior of this grab handle when it is moued on.

interface GrabBehavior extends DragListener

When a grab-handle is moved, it typically reshapes the glyph to which it is attached by asking the glyph to move the corresponding feature. Sometimes, however, more complex behavior is needed -- for example, grab handles attached to a rectangle also need to cause other grab-handles to move. This interface provides a way for glyphs to tailor the behavior of their grab-handles. Classes that implement this interface are assumed to create immutable objects.

void ? ( )
?

interface GrabHandleFactory

The interface implemented by objects that produce grab-handles.

GrabHandle create ( Feature )
Create a new grab-handle on the given feature. The grab-handle is created visible and inserted in a suitable place in the figure hierarchy.

Classes

class BasicHighlighter implements Highlighter

The basic highlighter highlights a figure by drawing a colored shape just behind the figure.

BasicHighlighter ( Paint )
Construct a basic highlighter with the given paint.

static BasicHighlighter getInstance ( )
Get the default highlighter instance.

class BasicGrabHandle implements GrabHandle

The basic grabhandle is a basic rectangle that is unfilled when deselected and filled when selected.

BasicGrabHandle ( Feature )
Construct a basic grab-handle on the given feature.

class BasicGrabHandleFactory implements GrabHandleFactory

The basic grab-handle factory produces basic grab-handles.

BasicGrabHandleFactory ( int )
Construct a factory that produces basic grab-handles of the given size.