voji.report
Class ReportComponent

java.lang.Object
  |
  +--voji.report.ReportComponent
All Implemented Interfaces:
javax.swing.SwingConstants
Direct Known Subclasses:
ReportColor, ReportFrame, ReportImage, ReportList, ReportSpace, ReportTable, ReportText

public class ReportComponent
extends java.lang.Object
implements javax.swing.SwingConstants

This is the common base class of all components which can be part of a report.


Field Summary
 int position
          The vertical position of the component.
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
ReportComponent()
          Constructs a new empty ReportComponent instance
 
Method Summary
 void add(ReportComponent component)
          Adds a new component
 void add(ReportComponent component, int position)
          Adds a new component and sets its vertical position
protected  void draw(PageGraphics g)
          Draws this component.
 void draw(PageGraphics g, int height)
          Draws this component
 int getHeight(PageGraphics g)
          Returns the total height of this component.
protected  int getOwnHeight(PageGraphics g)
          Returns the local height of this component.
 java.util.Iterator iterator()
          Returns an iterator of all sub components
 void remove(ReportComponent component)
          Removes a component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

public int position
The vertical position of the component. It's either TOP, BOTTOM or CENTER. Default is TOP.

Constructor Detail

ReportComponent

public ReportComponent()
Constructs a new empty ReportComponent instance

Method Detail

add

public void add(ReportComponent component)
Adds a new component

Parameters:
component - the component to add

add

public void add(ReportComponent component,
                int position)
Adds a new component and sets its vertical position

Parameters:
component - the component to add
position - the vertical position of component

remove

public void remove(ReportComponent component)
Removes a component

Parameters:
component - the component to remove from this container

iterator

public java.util.Iterator iterator()
Returns an iterator of all sub components


getHeight

public int getHeight(PageGraphics g)
Returns the total height of this component. That means the maximum of this component's own height and its sub components' total heights.

Parameters:
g - the graphical context where the height has to refer to
See Also:
getOwnHeight(PageGraphics), draw(PageGraphics)

getOwnHeight

protected int getOwnHeight(PageGraphics g)
Returns the local height of this component. Overwrite this if your component really draws something.

Parameters:
g - a graphical context for you to determine font sizes etc.
See Also:
getHeight(PageGraphics)

draw

public void draw(PageGraphics g,
                 int height)
Draws this component

Parameters:
g - the graphical context where to draw to
height - the height of the surrounding component

draw

protected void draw(PageGraphics g)
Draws this component. Per default, this method just draws all sub components.

Parameters:
g - the graphical context where to draw to
See Also:
getHeight(PageGraphics)