com.jrefinery.report.elementfactory
Class StaticShapeElementFactory

java.lang.Object
  |
  +--com.jrefinery.report.elementfactory.ElementFactory
        |
        +--com.jrefinery.report.elementfactory.ShapeElementFactory
              |
              +--com.jrefinery.report.elementfactory.StaticShapeElementFactory

public class StaticShapeElementFactory
extends ShapeElementFactory


Constructor Summary
StaticShapeElementFactory()
           
 
Method Summary
 Element createElement()
           
static ShapeElement createLineShapeElement(java.lang.String name, java.awt.Color paint, java.awt.Stroke stroke, java.awt.geom.Line2D shape)
          Creates a new LineShapeElement.
static ShapeElement createRectangleShapeElement(java.lang.String name, java.awt.Color paint, java.awt.Stroke stroke, java.awt.geom.Rectangle2D shape, boolean shouldDraw, boolean shouldFill)
          Creates a new RectangleShapeElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.Color paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill)
          Creates a new LineShapeElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Color paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill, boolean shouldScale)
          Creates a new ShapeElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Color paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill, boolean shouldScale, boolean keepAspectRatio)
          Creates a new ShapeElement.
 java.awt.Shape getShape()
           
 void setShape(java.awt.Shape shape)
           
 
Methods inherited from class com.jrefinery.report.elementfactory.ShapeElementFactory
getColor, getKeepAspectRatio, getScale, getShouldDraw, getShouldFill, getStroke, setColor, setKeepAspectRatio, setScale, setShouldDraw, setShouldFill, setStroke
 
Methods inherited from class com.jrefinery.report.elementfactory.ElementFactory
getAbsolutePosition, getDynamicHeight, getMaximumSize, getMinimumSize, getName, getPreferredSize, setAbsolutePosition, setDynamicHeight, setMaximumSize, setMinimumSize, setName, setPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticShapeElementFactory

public StaticShapeElementFactory()
Method Detail

getShape

public java.awt.Shape getShape()

setShape

public void setShape(java.awt.Shape shape)

createElement

public Element createElement()
Specified by:
createElement in class ElementFactory

createLineShapeElement

public static ShapeElement createLineShapeElement(java.lang.String name,
                                                  java.awt.Color paint,
                                                  java.awt.Stroke stroke,
                                                  java.awt.geom.Line2D shape)
Creates a new LineShapeElement. The line must not contain negative coordinates, or an IllegalArgumentException will be thrown. If you want to define scaling lines, you will have use one of the createShape methods.

Parameters:
name - the name of the new element
paint - the line color of this element
stroke - the stroke of this shape. For pdf use, restrict to BasicStokes.
shape - the Line2D shape
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.Color paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill)
Creates a new LineShapeElement. This methods extracts the bounds from the shape and correct the shape to start from point (0,0) by using an AffineTransform. Use one of the createShape methods, that allow you to supply separate bounds and shapes, if you want to have full control over the creation process.

Parameters:
name - the name of the new element.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Color paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill,
                                              boolean shouldScale)
Creates a new ShapeElement.

Parameters:
name - the name of the new element.
bounds - the bounds.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
shouldScale - scale the shape?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Color paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill,
                                              boolean shouldScale,
                                              boolean keepAspectRatio)
Creates a new ShapeElement.

Parameters:
name - the name of the new element.
bounds - the bounds.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
shouldScale - scale the shape?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createRectangleShapeElement

public static ShapeElement createRectangleShapeElement(java.lang.String name,
                                                       java.awt.Color paint,
                                                       java.awt.Stroke stroke,
                                                       java.awt.geom.Rectangle2D shape,
                                                       boolean shouldDraw,
                                                       boolean shouldFill)
Creates a new RectangleShapeElement.

Parameters:
name - the name of the new element
paint - the line color of this element
stroke - the stroke of this shape. For pdf use, restrict to BasicStokes.
shape - the Rectangle2D shape
shouldDraw - a flag controlling whether or not the shape outline is drawn.
shouldFill - a flag controlling whether or not the shape interior is filled.
Returns:
a report element for drawing a rectangle.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid