JHotDraw 7.5.1

org.jhotdraw.draw.decoration
Class CompositeLineDecoration

java.lang.Object
  extended by org.jhotdraw.draw.decoration.CompositeLineDecoration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, LineDecoration, DOMStorable

public class CompositeLineDecoration
extends java.lang.Object
implements LineDecoration, DOMStorable

A LineDecoration which can compose multiple individual line decorations.

An composite implementation of a line decoration. It allows more than one line decoration shape to be rotated and moved to the end of the line. The shape is scaled by the stroke width.

Author:
Huw Jones
See Also:
Serialized Form

Constructor Summary
CompositeLineDecoration()
          Constructs a composite line decoration with no decorations.
CompositeLineDecoration(LineDecoration decoration1, LineDecoration decoration2)
          Constructs a composite line decoration with the two supplied decorations.
 
Method Summary
 void addDecoration(LineDecoration decoration)
          Add another line decoration into the composite line decoration.
 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.
 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.
 void read(DOMInput in)
           
 void write(DOMOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeLineDecoration

public CompositeLineDecoration()
Constructs a composite line decoration with no decorations.


CompositeLineDecoration

public CompositeLineDecoration(LineDecoration decoration1,
                               LineDecoration decoration2)
Constructs a composite line decoration with the two supplied decorations.

Method Detail

addDecoration

public void addDecoration(LineDecoration decoration)
Add another line decoration into the composite line decoration. The new decoration will be appended to the existing decorations and is also the last drawn.


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)
Returns the radius of the decorator. This is used to crop the end of the line, to prevent it from being drawn it over the decorator.

Specified by:
getDecorationRadius in interface LineDecoration

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Throws:
java.io.IOException

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