org.jfree.report
Class ShapeElement

java.lang.Object
  extended byorg.jfree.report.Element
      extended byorg.jfree.report.ShapeElement
All Implemented Interfaces:
java.lang.Cloneable, DataTarget, java.io.Serializable

public class ShapeElement
extends Element

Used to draw shapes (typically lines and boxes) on a report band. The drawing style of the shapes contained in that element can be controled by using the StyleKeys FILL_SHAPE and DRAW_SHAPE.

Author:
David Gilbert, Thomas Morgner
See Also:
Serialized Form

Field Summary
static java.lang.String CONTENT_TYPE
          A string for the content type.
static java.awt.BasicStroke DEFAULT_STROKE
          The default stroke.
static StyleKey DRAW_SHAPE
          A key for the 'draw-shape' style.
static StyleKey FILL_SHAPE
          A key for the 'fill-shape' style.
 
Fields inherited from class org.jfree.report.Element
ANONYMOUS_ELEMENT_PREFIX
 
Constructor Summary
ShapeElement()
          Constructs a shape element.
 
Method Summary
 java.lang.String getContentType()
          Returns the content type, in this case 'shape/generic'.
static ElementDefaultStyleSheet getDefaultStyle()
          Returns the default style-sheet for shape elements.
 java.awt.Stroke getStroke()
          Returns the stroke.
 boolean isKeepAspectRatio()
          Returns true if the shape's aspect ratio should be preserved, and false otherwise.
 boolean isScale()
          Returns true if the shape should be scaled, and false otherwise.
 boolean isShouldDraw()
          Returns true if the element outline should be drawn, and false otherwise.
 boolean isShouldFill()
          Returns true of the element should be filled, and false otherwise.
 void setKeepAspectRatio(boolean kar)
          Sets a flag that controls whether the shape should be scaled to fit the element bounds.
 void setScale(boolean scale)
          Sets a flag that controls whether the shape should be scaled to fit the element bounds.
 void setShouldDraw(boolean shouldDraw)
          Sets a flag that controls whether or not the outline of the shape is drawn.
 void setShouldFill(boolean shouldFill)
          Sets a flag that controls whether or not the area of the shape is filled.
 void setStroke(java.awt.Stroke stroke)
          Sets the stroke.
 java.lang.String toString()
          Returns a string describing the element.
 
Methods inherited from class org.jfree.report.Element
clone, getDataSource, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getStyle, getStyleSheetCollection, getTreeLock, getValue, handleRegisterStyleSheetCollection, handleUnregisterStyleSheetCollection, isDynamicContent, isLayoutCacheable, isVisible, registerStyleSheetCollection, setDataSource, setDynamicContent, setLayoutCacheable, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setVisible, unregisterStyleSheetCollection, updateStyleSheetCollection
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_STROKE

public static final java.awt.BasicStroke DEFAULT_STROKE
The default stroke.


FILL_SHAPE

public static final StyleKey FILL_SHAPE
A key for the 'fill-shape' style.


DRAW_SHAPE

public static final StyleKey DRAW_SHAPE
A key for the 'draw-shape' style.


CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
A string for the content type.

See Also:
Constant Field Values
Constructor Detail

ShapeElement

public ShapeElement()
Constructs a shape element.

Method Detail

getDefaultStyle

public static ElementDefaultStyleSheet getDefaultStyle()
Returns the default style-sheet for shape elements.

Returns:
a default style sheet that can be shared among shape elements.

toString

public java.lang.String toString()
Returns a string describing the element. Useful for debugging.

Returns:
the string.

isShouldDraw

public boolean isShouldDraw()
Returns true if the element outline should be drawn, and false otherwise.

This is determined by the element's style-sheet.

Returns:
true or false.

isShouldFill

public boolean isShouldFill()
Returns true of the element should be filled, and false otherwise.

This is determined by the element's style-sheet.

Returns:
true or false.

setShouldDraw

public void setShouldDraw(boolean shouldDraw)
Sets a flag that controls whether or not the outline of the shape is drawn.

Parameters:
shouldDraw - the flag.

setShouldFill

public void setShouldFill(boolean shouldFill)
Sets a flag that controls whether or not the area of the shape is filled.

Parameters:
shouldFill - the flag.

isScale

public boolean isScale()
Returns true if the shape should be scaled, and false otherwise.

This is determined by the element's style-sheet.

Returns:
true or false.

setScale

public void setScale(boolean scale)
Sets a flag that controls whether the shape should be scaled to fit the element bounds.

Parameters:
scale - the flag.

isKeepAspectRatio

public boolean isKeepAspectRatio()
Returns true if the shape's aspect ratio should be preserved, and false otherwise.

This is determined by the element's style-sheet.

Returns:
true or false.

setKeepAspectRatio

public void setKeepAspectRatio(boolean kar)
Sets a flag that controls whether the shape should be scaled to fit the element bounds.

Parameters:
kar - the flag.

getContentType

public java.lang.String getContentType()
Returns the content type, in this case 'shape/generic'.

Specified by:
getContentType in class Element
Returns:
the content type.

getStroke

public java.awt.Stroke getStroke()
Returns the stroke.

Returns:
the stroke.

setStroke

public void setStroke(java.awt.Stroke stroke)
Sets the stroke.

Parameters:
stroke - the stroke.