|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.print.Report
public class Report
A generic report.
Can be used as Printable or Pageable. If used as Pageable the number of
pages will be determined in dummy pass first and then printed in a second pass.
If used as a Printable there is only one pass.
The report is implemented as a statemachine and gets its data
from a ReportSource.
| Field Summary | |
|---|---|
static int |
CENTER
center panel |
static int |
EAST
align right |
static int |
NORTH
align top |
static int |
NORTHEAST
align top right |
static int |
NORTHWEST
align top left (default) |
static int |
SCALE_FIXED
fixed scaling (default = 1.0) |
static int |
SCALE_IF_WIDER
scale (make smaller) to fit if wider than paper |
static int |
SCALE_TO_FIT
scale to paper-width (enlarge or shrink) |
static int |
SOUTH
align bottom |
static int |
SOUTHEAST
align bottom right |
static int |
SOUTHWEST
align bottom left |
static int |
WEST
align left |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.print.Pageable |
|---|
UNKNOWN_NUMBER_OF_PAGES |
| Constructor Summary | |
|---|---|
Report(ReportSource source,
PageFormat pageFormat)
Creates a standard report which honors the imageable size and has no sublevels. |
|
Report(ReportSource source,
PageFormat pageFormat,
boolean imageable,
int subLevels)
Creates a report. |
|
| Method Summary | |
|---|---|
int |
currentPage()
Get the current page-number. |
int |
currentState()
Gets the current state. |
int |
getAdvance()
Gets last returned code. |
int |
getAutoScale()
Gets the autoscale mode. |
int |
getLevel()
Get the current logical group level. |
int |
getMoveAfter()
Gets the pending pixels to move after printing the next panel. |
int |
getMoveBefore()
Gets the pending pixels to move before printing the next panel. |
int |
getNumberOfPages()
Determines the number of pages *before* running the report. |
PageFormat |
getPageFormat(int pageIndex)
Returns the PageFormat of the page specified by
pageIndex. |
Printable |
getPrintable(int pageIndex)
Returns the Printable instance responsible for
rendering the page specified by pageIndex. |
Runnable |
getRunAfter()
Gets therunnable to be executed once after printing the next panel |
Runnable |
getRunBefore()
Gets the runnable to be executed once before printing the next panel. |
double |
getScale()
Gets the current scaling |
int |
getYMax()
Retrieves the maximum printed y position so far for current page. |
int |
getYOffset()
Retrieves the maximum printed y offset so far for current page. |
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
Runs the report. This implements the interface Printable. |
void |
setAutoScale(int autoScale)
Sets the automatic scaling. |
void |
setFooter(PrintPanel footer)
Sets the footer panel. |
void |
setFooterAlignment(int align)
Sets the aligment of the footer. |
void |
setFooterSize(Dimension size)
Optionally sets the size of the footer if not derived from the print panel. |
void |
setHeader(PrintPanel header)
Sets the header panel. |
void |
setHeaderAlignment(int align)
Sets the aligment of the header. |
void |
setHeaderSize(Dimension size)
Optionally sets the size of the header if not derived from the print panel. |
void |
setIntro(PrintPanel intro)
Sets the intro panel. |
void |
setIntroAlignment(int align)
Sets the aligment of the intro. |
void |
setIntroSize(Dimension size)
Optionally sets the size of the intro if not derived from the print panel. |
void |
setLine(PrintPanel line)
Sets the panel for printing the data line. |
void |
setLineAlignment(int align)
Sets the aligment of the data line. |
void |
setLineSize(Dimension size)
Optionally sets the size of the data line if not derived from the print panel. |
void |
setMoveAfter(int moveAfter)
Sets the pixels to move after printing the next panel. The attribute will be cleared when used. |
void |
setMoveBefore(int moveBefore)
Sets the pixels to move before printing the next panel. The attribute will be cleared when used. |
void |
setRunAfter(Runnable runAfter)
Sets a runnable to be executed once after printing the next panel |
void |
setRunBefore(Runnable runBefore)
Sets a runnable to be executed once before printing the next panel. |
void |
setScale(double scale)
Sets the scaling. |
void |
setSubFooter(PrintPanel[] subFooter)
Sets the subfooters. |
void |
setSubFooterAlignment(int[] align)
Sets the aligment of the subfooters. |
void |
setSubFooterSize(Dimension[] sizes)
Optionally sets the size of the subfooters if not derived from the print panel. |
void |
setSubHeader(PrintPanel[] subHeader)
Sets the subheaders. |
void |
setSubHeaderAlignment(int[] align)
Sets the aligment of the subheaders. |
void |
setSubHeaderSize(Dimension[] sizes)
Optionally sets the size of the subheaders if not derived from the print panel. |
void |
setTrailer(PrintPanel trailer)
Sets the trailer panel. |
void |
setTrailerAlignment(int align)
Sets the aligment of the trailer. |
void |
setTrailerSize(Dimension size)
Optionally sets the size of the trailer if not derived from the print panel. |
void |
triggerPrintAgain()
Triggers the last panel to be printed again. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NORTHWEST
public static final int NORTHEAST
public static final int SOUTHWEST
public static final int SOUTHEAST
public static final int CENTER
public static final int EAST
public static final int WEST
public static final int SOUTH
public static final int NORTH
public static final int SCALE_FIXED
public static final int SCALE_IF_WIDER
public static final int SCALE_TO_FIT
| Constructor Detail |
|---|
public Report(ReportSource source,
PageFormat pageFormat,
boolean imageable,
int subLevels)
source - the data source for this reportpageFormat - the pageformatimageable - true if honor the imageable size, else full page sizesubLevels - number of sublevels, default is 0 (no groups)
public Report(ReportSource source,
PageFormat pageFormat)
source - the data source for this reportpageFormat - the pageformat| Method Detail |
|---|
public void setIntro(PrintPanel intro)
throws PrinterException
intro - the intro panel, null for none (i.e. print header instead)
PrinterException
public void setTrailer(PrintPanel trailer)
throws PrinterException
trailer - the trailer panel, null for none (i.e. print footer instead)
PrinterException
public void setHeader(PrintPanel header)
throws PrinterException
header - the header panel, null for none.
PrinterException
public void setFooter(PrintPanel footer)
throws PrinterException
footer - the footer panel, null for none.
PrinterException
public void setLine(PrintPanel line)
throws PrinterException
line - the line panel, null if none
PrinterException
public void setSubHeader(PrintPanel[] subHeader)
throws PrinterException
subHeader - the array of subheaders (size must match levels)
PrinterException
public void setSubFooter(PrintPanel[] subFooter)
throws PrinterException
subFooter - the array of subfooter (size must match levels)
PrinterException
public void setIntroAlignment(int align)
throws PrinterException
align - the alignment
PrinterException
public void setTrailerAlignment(int align)
throws PrinterException
align - the alignment
PrinterException
public void setHeaderAlignment(int align)
throws PrinterException
align - the alignment
PrinterException
public void setFooterAlignment(int align)
throws PrinterException
align - the alignment
PrinterException
public void setLineAlignment(int align)
throws PrinterException
align - the alignment
PrinterException
public void setSubHeaderAlignment(int[] align)
throws PrinterException
align - the array of alignments (size must match levels)
PrinterException
public void setSubFooterAlignment(int[] align)
throws PrinterException
align - the array of alignments (size must match levels)
PrinterException
public void setIntroSize(Dimension size)
throws PrinterException
size - the dimension
PrinterException
public void setTrailerSize(Dimension size)
throws PrinterException
size - the dimension
PrinterException
public void setHeaderSize(Dimension size)
throws PrinterException
size - the dimension
PrinterException
public void setFooterSize(Dimension size)
throws PrinterException
size - the dimension
PrinterException
public void setLineSize(Dimension size)
throws PrinterException
size - the dimension
PrinterException
public void setSubHeaderSize(Dimension[] sizes)
throws PrinterException
sizes - the array of dimensions (must match levels)
PrinterException
public void setSubFooterSize(Dimension[] sizes)
throws PrinterException
sizes - the array of dimensions (must match levels)
PrinterExceptionpublic int getLevel()
public int currentState()
ReportSource.advance(org.tentackle.print.Report)public int currentPage()
public void setScale(double scale)
scale - the scalingpublic double getScale()
public void setAutoScale(int autoScale)
autoScale - the scale modepublic int getAutoScale()
public void setMoveBefore(int moveBefore)
moveBefore - the number of pixels (> 0 to move down)public int getMoveBefore()
public void setMoveAfter(int moveAfter)
moveAfter - the number of pixels (> 0 to move down)public int getMoveAfter()
public void setRunBefore(Runnable runBefore)
runBefore - the runnablepublic Runnable getRunBefore()
public void setRunAfter(Runnable runAfter)
runAfter - the runnablepublic Runnable getRunAfter()
public void triggerPrintAgain()
public int getYMax()
public int getYOffset()
public int getAdvance()
ReportSource.advance(org.tentackle.print.Report)public int getNumberOfPages()
getNumberOfPages in interface PageablePageable.
public int print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
throws PrinterException
Printable.
print in interface Printablegraphics - the context into which the page is drawnpageFormat - the size and orientation of the page being drawnpageIndex - the zero based index of the page to be drawn
pageIndex specifies a
non-existent page.
PrinterException - thrown when the print job is terminated.
public PageFormat getPageFormat(int pageIndex)
throws IndexOutOfBoundsException
java.awt.print.PageablePageFormat of the page specified by
pageIndex.
getPageFormat in interface PageablepageIndex - the zero based index of the page whose
PageFormat is being requested
PageFormat describing the size and
orientation.
IndexOutOfBoundsException - if
the Pageable does not contain the requested
page.
public Printable getPrintable(int pageIndex)
throws IndexOutOfBoundsException
java.awt.print.PageablePrintable instance responsible for
rendering the page specified by pageIndex.
getPrintable in interface PageablepageIndex - the zero based index of the page whose
Printable is being requested
Printable that renders the page.
IndexOutOfBoundsException - if
the Pageable does not contain the requested
page.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||