JHotDraw 7.4.1

org.jhotdraw.draw.decoration
Interface LineDecoration

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Implementing Classes:
AbstractLineDecoration, ArrowTip, CompositeLineDecoration, GeneralPathTip, PerpendicularBar

public interface LineDecoration
extends java.lang.Cloneable, java.io.Serializable

A line decoration can be used to draw a decoration at the start or end of a line.

Typically a line decoration is set as an attribute value to a BezierFigure using the attribute keys org.jhotdraw.draw.AttributeKeys.START_DECORATION and org.jhotdraw.draw.AttributeKeys.END_DECORATION.


Design Patterns

Decorator
The start and end point of a BezierFigure can be decorated with a line decoration.
Component: BezierFigure; Decorator: LineDecoration.


Version:
$Id: LineDecoration.java -1 $
Author:
Werner Randelshofer

Method Summary
 void draw(java.awt.Graphics2D g, Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
          Draws the decoration in the direction specified by the two Points.
 double getDecorationRadius(Figure f)
          Returns the radius of the decorator.
 java.awt.geom.Rectangle2D.Double getDrawingArea(Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
          Returns the drawing bounds of the decorator.
 

Method Detail

draw

void draw(java.awt.Graphics2D g,
          Figure f,
          java.awt.geom.Point2D.Double p1,
          java.awt.geom.Point2D.Double p2)
Draws the decoration in the direction specified by the two Points.


getDecorationRadius

double getDecorationRadius(Figure f)
Returns the radius of the decorator. This is used to crop the end of the line, to prevent it from being drawn over the decorator.


getDrawingArea

java.awt.geom.Rectangle2D.Double getDrawingArea(Figure f,
                                                java.awt.geom.Point2D.Double p1,
                                                java.awt.geom.Point2D.Double p2)
Returns the drawing bounds of the decorator.


Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.