JHotDraw 7.5.1

org.jhotdraw.draw.decoration
Class AbstractLineDecoration

java.lang.Object
  extended by org.jhotdraw.draw.decoration.AbstractLineDecoration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, LineDecoration
Direct Known Subclasses:
ArrowTip, GeneralPathTip, PerpendicularBar

public abstract class AbstractLineDecoration
extends java.lang.Object
implements LineDecoration

This abstract class can be extended to implement a LineDecoration.

Version:
$Id: AbstractLineDecoration.java -1 $
Author:
Werner Randelshofer
See Also:
Serialized Form

Constructor Summary
AbstractLineDecoration(boolean isFilled, boolean isStroked, boolean isSolid)
          Constructs an arrow tip with the given angle and radius.
 
Method Summary
 void draw(java.awt.Graphics2D g, Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
          Draws the arrow tip in the direction specified by the given two Points.
 double getDecorationRadius(Figure f)
          Returns the radius of the decorator.
protected abstract  java.awt.geom.Path2D.Double getDecoratorPath(Figure f)
          Hook method to calculate the path of the decorator.
protected abstract  double getDecoratorPathRadius(Figure f)
          Hook method to calculate the radius of the decorator path.
 java.awt.geom.Rectangle2D.Double getDrawingArea(Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
          Returns the drawing area of the decorator.
protected  boolean isFilled()
           
protected  boolean isSolid()
           
protected  boolean isStroked()
           
protected  void setFilled(boolean b)
           
protected  void setSolid(boolean b)
           
protected  void setStroked(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLineDecoration

public AbstractLineDecoration(boolean isFilled,
                              boolean isStroked,
                              boolean isSolid)
Constructs an arrow tip with the given angle and radius.

Method Detail

isFilled

protected boolean isFilled()

isStroked

protected boolean isStroked()

isSolid

protected boolean isSolid()

draw

public void draw(java.awt.Graphics2D g,
                 Figure f,
                 java.awt.geom.Point2D.Double p1,
                 java.awt.geom.Point2D.Double p2)
Draws the arrow tip in the direction specified by the given two Points. (template method)

Specified by:
draw in interface LineDecoration

getDrawingArea

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

Specified by:
getDrawingArea in interface LineDecoration

getDecorationRadius

public double getDecorationRadius(Figure f)
Description copied from interface: LineDecoration
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.

Specified by:
getDecorationRadius in interface LineDecoration

setFilled

protected void setFilled(boolean b)

setStroked

protected void setStroked(boolean b)

setSolid

protected void setSolid(boolean b)

getDecoratorPath

protected abstract java.awt.geom.Path2D.Double getDecoratorPath(Figure f)
Hook method to calculate the path of the decorator.


getDecoratorPathRadius

protected abstract double getDecoratorPathRadius(Figure f)
Hook method to calculate the radius of the decorator path.


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