com.jrefinery.report.targets.pageable.pagelayout
Class SimplePageLayoutCursor

java.lang.Object
  |
  +--com.jrefinery.report.targets.pageable.pagelayout.SimplePageLayoutCursor
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SimplePageLayoutCursor
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A utility class for keeping track of the current output position on a logical page. Only the vertical location is tracked, it begins at zero (the top of the page) and increases as the cursor moves down the page.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
SimplePageLayoutCursor(float height)
          Constructs a new cursor.
 
Method Summary
 void advance(float amount)
          Adds the specified amount to the y-coordinate.
 void advanceTo(float amount)
          Moves the cursor to the given y-coordinate.
 java.lang.Object clone()
          Clones the cursor.
 float getPageBottom()
          Returns the bottom border position of the printable page area.
 float getPageBottomReserved()
          Returns the y-coordinate for the start of the reserved space at the bottom of the page.
 float getPageTop()
          Returns the space reserved by the page header.
 float getReservedSpace()
          Returns the amount of space reserved at the bottom of the page (usually for the page footer).
 float getY()
          Gets the current y-position for printing the next band.
 boolean isSpaceFor(float height)
          Returns true if there is space for a band with the specified height, and false otherwise.
 void setPageTop(float pageTop)
          Defines the space reserved by the page header.
 void setReservedSpace(float reserve)
          Reserves the given space at the bottom of the page.
 java.lang.String toString()
          Returns a string representing the cursor (useful for debugging).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimplePageLayoutCursor

public SimplePageLayoutCursor(float height)
Constructs a new cursor.

Parameters:
height - the logical page height.
Method Detail

setReservedSpace

public void setReservedSpace(float reserve)
Reserves the given space at the bottom of the page. This space is considered printed and does not get filled by the various bands and elements. This functionality is used to reserve space for the page footer.

Parameters:
reserve - the space (in points) to reserve at the bottom of the page.

getReservedSpace

public float getReservedSpace()
Returns the amount of space reserved at the bottom of the page (usually for the page footer).

Returns:
the reserved space (in Java2D units).

advance

public void advance(float amount)
Adds the specified amount to the y-coordinate.

Parameters:
amount - The amount that the cursor should advance down the page.

advanceTo

public void advanceTo(float amount)
Moves the cursor to the given y-coordinate. All space beween the current position before the move and the new position is considered filled and won't get filled by the generator.

Parameters:
amount - The amount that the cursor should advance down the page.

isSpaceFor

public boolean isSpaceFor(float height)
Returns true if there is space for a band with the specified height, and false otherwise.

Parameters:
height - The height of the proposed band.
Returns:
A flag indicating whether or not there is room to print the band.

getY

public float getY()
Gets the current y-position for printing the next band.

Returns:
the current y-position of this cursor.

getPageBottom

public float getPageBottom()
Returns the bottom border position of the printable page area.

Returns:
the bottom border of the printable area.

getPageBottomReserved

public float getPageBottomReserved()
Returns the y-coordinate for the start of the reserved space at the bottom of the page.

Returns:
the start of the space reserved for the page footer.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the cursor.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this cursor.
Throws:
java.lang.CloneNotSupportedException - n.a.

toString

public java.lang.String toString()
Returns a string representing the cursor (useful for debugging).

Overrides:
toString in class java.lang.Object
Returns:
the string.

getPageTop

public float getPageTop()
Returns the space reserved by the page header.

Returns:
the reserved page header space.

setPageTop

public void setPageTop(float pageTop)
Defines the space reserved by the page header.

Parameters:
pageTop - the reserved page header space.