com.java4less.rreport
Class RReport

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--com.java4less.rreport.RReport
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
RReportImp

public class RReport
extends java.awt.Panel
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

Report to be previewed , printed and/or exported. It contains one or more areas that can be printed one or more times. Each area will contains several RObjects.

See Also:
Serialized Form

Field Summary
 java.awt.Cursor actionCursor
          this cursor will be activated when the cursor is over an object that has an associated action.
 boolean activateActions
          activate actions
 boolean activateTips
          activate tooltips
 int bufferedImageType
          parameter used to created a bufferedImage for previews.
 java.lang.String exportDirectory
          directory where the images that will be exported for the html report
 java.lang.String exportImagesFormat
          format of the images that will be exported for the html report
 java.lang.String imagesHTMLPrefix
          the prefix is added to the image url when the DHTML is created.
static double javaVersion
           
 double marginBottom
          margin of the page in centimeters.
 double marginLeft
          margin of the page in centimeters.
 double marginRight
          margin of the page in centimeters.
 double marginTop
          margin of the page in centimeters.
 double mPageHeightCM
          size of the page in centimeter.
 double mPageWidthCM
          size of the page in centimeter.
static int ORIENTATION_HORIZONTAL
          landscape layout
static int ORIENTATION_VERTICAL
          portrait layout
static int POSITION_NEXT
          not used.
static int POSITION_RIGHT
          not used.
static int POSITION_UNDER
          not used.
 boolean printingCancelled
          true if the user cancelled the printing in the printer dialog
 int scaleAlgorithm
          algorithm used for the preview zoom, only jdk 1.1
 RObjectInstance selectedObject
          the cursor is over this object
 boolean showPageDialog
          set it to false in order to hide the page format dialog (API Java 2)
 boolean showPrintDialog
          set it to false in order to hide the printer dialog
 boolean showProgressWindow
          show progress window while printing?
 java.awt.Color tipBack
          background of the box used to displayed tips.
 java.awt.Color tipBorder
          color of the border of the box used to displayed tips.
 java.awt.Color tipColor
          color of the border of the box used to displayed tips.
 int tipDelay
          specifies the number of milliseconds the tree will wait before showing a tip for the current node.
 java.awt.Font tipFont
          Font used to display tips.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RReport(java.awt.Frame Owner)
          constructor: Owner: must be a visible Frame or NULL
RReport(java.awt.Frame Owner, int reso)
          constructor:
- Owner: must be a visible Frame or NULL.
- reso: resolution used for the preview (in CM).
 
Method Summary
 void addArea(RArea a)
          Add an area to the report.
 void disablePrinting(boolean b)
          if true, the report will not be printed.
 void endReport()
          Run this method to end your report.
 RArea getAreaAt(int i)
          gets area by position
 RArea getAreaByName(java.lang.String name)
          gets area by name
 int getAreaCount()
          get number of area in report
 java.lang.String getDateFormat()
          gets date format for [Date] system variable.
 java.sql.Connection getDBCon()
          get current connection to database.
 java.lang.String getDBDriver()
          gets driver.
 java.lang.String getDBPsw()
          gets database password.
 java.lang.String getDBUrl()
          gets database url.
 java.lang.String getDBUser()
          gets database user.
 boolean getDHTMLActive()
          Specifies that the HTML version should be created.
 java.lang.String getHTML()
          Returns the HTML version of the report if HTMLPages is deactivated.
 boolean getHTMLActive()
          Specifies that the HTML version should be created.
 java.lang.String getHTMLPage(int p)
          returns a page of the HTML version of the report.
 int getMaxPages()
          returns number of pages of the report.
 int getOrientation()
          sets report orientation (RReport.ORIENTATION_HORIZONTAL or RReport.ORIENTATION_VERTICAL)
 java.awt.Color getPageBackground()
          background color of the page.
 RArea getPageBackgroundArea()
          This area will be printed in the background of each page
 RPicture getPageBackgroundImage()
          This image will be printed in the background of each page
 RArea getPageFooter()
          This area will be printed at the bottom of each page.
 double getPageFrameHorizontalMargin()
          page frame left/right margin (in CM) if 0 it will be calculated as leftMargin/3 and rightMargin/3
 RLineStyle getPageFrameStyle()
          sets the frame style for the pages of the report.
 double getPageFrameVerticalMargin()
          page frame top/bottom margin (in CM) if 0 it will be calculated as topMargin/3 and bottomMargin/3
 RArea getPageHeader()
          This area will be printed at the top of each page.
 int getPageNumber()
          returns current page number during preview.
 int getPageWidthPixels()
          page width, pixels
 java.lang.String getPDFFile()
          gets the file name for PDF output.
 RPrintSetup getPrintSetup()
          gets the RPrintSetup object used to configurate the printer.
 RArea getReportFooter()
          This area will be printed when you call endReport().
 RArea getReportHeader()
          This area will be printed when you call prepare().
 int getResolution()
          resolution of the report (pixels/CM).
 double getScale()
          returns current zoom value.
 double getScalePages()
          returns scale of the pages being display in the preview window. (
 int getShowPages()
          returns the number of pages to be displayed in the preview.
 java.lang.String getTitle()
          Title of the report.
 void importLine(java.lang.String key, java.lang.String val)
          internal use.
 boolean importReport(java.lang.String f)
          Import *.rep file.
 boolean isPrintingDisabled()
          if true, the report will not be printed.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 boolean openDB()
          connect to database.
 boolean prepare()
          starts a report.
 void printArea(RArea a)
          prints an area.
 boolean printPreview(int[] PagesToPrint, int Count)
          Call this method if you want to make a preview.
 void removeAllAreas()
          remove areas from report
 void removeAreaAt(int i)
          remove one area from report
 void setDateFormat(java.lang.String s)
          sets date format for [Date] system variable.
 void setDBCon(java.sql.Connection c)
          sets current connection to database.
 void setDBDriver(java.lang.String s)
          sets driver.
 void setDBPsw(java.lang.String s)
          sets database password.
 void setDBUrl(java.lang.String s)
          sets database url.
 void setDBUser(java.lang.String s)
          sets database user.
 void setDefaultPageSize(double w, double h)
          sets date format for [Date] system variable.
 void setDHTMLActive(boolean activate)
          Specifies that the HTML version should be created.
 void setHTMLActive(boolean activate)
          Specifies that the HTML version should be created.
 void setHTMLPages(boolean b)
          if this is false, the HTML report will be printed in just one file (page).
 void setImageFile(java.lang.String f, java.lang.String imageF)
          sets the file name for Image output.
 void setObjectListener(RObjectListener l)
          this listener is called when an object is clicked
 void setOrientation(int o)
          sets report orientation (RReport.ORIENTATION_HORIZONTAL or RReport.ORIENTATION_VERTICAL)
 void setPageBackground(java.awt.Color c)
          background color of the page.
 void setPageBackgroundArea(RArea a)
          This area will be printed in the background of each page
 void setPageBackgroundImage(RPicture p)
          This image will be printed in the background of each page
 void setPageFooter(RArea area)
          This area will be printed at the bottom of each page.
 void setPageFrameHorizontalMargin(double d)
          page frame left/right margin (in CM) if 0 it will be calculated as leftMargin/3 and rightMargin/3
 void setPageFrameStyle(RLineStyle fStyle)
          sets the frame style for the pages of the report.
 void setPageFrameVerticalMargin(double d)
          page frame top/bottom margin (in CM) if 0 it will be calculated as topMargin/3 and bottomMargin/3
 void setPageHeader(RArea area)
          This area will be printed at the top of each page.
 boolean setPageNumber(int p)
          set page to show in the preview
 void setPDFFile(java.lang.String f)
          sets the file name for PDF output.
 void setPDFStream(java.io.OutputStream f)
          sets the stream for PDF output.
 void setPreview(boolean b)
          used by the Preview Window to tell RReport it is being previewed.
 void setPrintSetup(RPrintSetup ps)
          Sets the RPrintSetup object used to configurate the printer.
 void setReportFooter(RArea area)
          This area will be printed when you call endReport().
 void setReportHeader(RArea area)
          This area will be printed when you call prepare().
 void setResolution(int r)
          resolution of the report (pixels/CM).
 boolean setScale(double s)
          set scale during preview.
 void setShowPages(int p)
          sets the number of pages to be displayed in the preview.
 void setTitle(java.lang.String t)
          Title of the report.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tipDelay

public int tipDelay
specifies the number of milliseconds the tree will wait before showing a tip for the current node.

activateTips

public boolean activateTips
activate tooltips

activateActions

public boolean activateActions
activate actions

tipFont

public java.awt.Font tipFont
Font used to display tips.

tipColor

public java.awt.Color tipColor
color of the border of the box used to displayed tips.

tipBorder

public java.awt.Color tipBorder
color of the border of the box used to displayed tips.

tipBack

public java.awt.Color tipBack
background of the box used to displayed tips.

exportDirectory

public java.lang.String exportDirectory
directory where the images that will be exported for the html report

imagesHTMLPrefix

public java.lang.String imagesHTMLPrefix
the prefix is added to the image url when the DHTML is created. For example, if your image is images/a.gif and prefix is /examples/, the final url in the HTML code will be /examples/images/a.gif.

exportImagesFormat

public java.lang.String exportImagesFormat
format of the images that will be exported for the html report

POSITION_NEXT

public static final int POSITION_NEXT
not used.

POSITION_UNDER

public static final int POSITION_UNDER
not used.

POSITION_RIGHT

public static final int POSITION_RIGHT
not used.

showProgressWindow

public boolean showProgressWindow
show progress window while printing? only used by RReportJ2

ORIENTATION_VERTICAL

public static final int ORIENTATION_VERTICAL
portrait layout

ORIENTATION_HORIZONTAL

public static final int ORIENTATION_HORIZONTAL
landscape layout

actionCursor

public java.awt.Cursor actionCursor
this cursor will be activated when the cursor is over an object that has an associated action.

selectedObject

public RObjectInstance selectedObject
the cursor is over this object

showPrintDialog

public boolean showPrintDialog
set it to false in order to hide the printer dialog

showPageDialog

public boolean showPageDialog
set it to false in order to hide the page format dialog (API Java 2)

bufferedImageType

public int bufferedImageType
parameter used to created a bufferedImage for previews. Default is java.awt.image.BufferedImage.TYPE_INT_RGB

scaleAlgorithm

public int scaleAlgorithm
algorithm used for the preview zoom, only jdk 1.1

printingCancelled

public boolean printingCancelled
true if the user cancelled the printing in the printer dialog

marginLeft

public double marginLeft
margin of the page in centimeters.

marginRight

public double marginRight
margin of the page in centimeters.

marginBottom

public double marginBottom
margin of the page in centimeters. You will need to increase the bottom margin if you increase the size of the page footer.

marginTop

public double marginTop
margin of the page in centimeters.

mPageWidthCM

public double mPageWidthCM
size of the page in centimeter.

mPageHeightCM

public double mPageHeightCM
size of the page in centimeter.

javaVersion

public static double javaVersion
Constructor Detail

RReport

public RReport(java.awt.Frame Owner)
constructor: Owner: must be a visible Frame or NULL

RReport

public RReport(java.awt.Frame Owner,
               int reso)
constructor:
- Owner: must be a visible Frame or NULL.
- reso: resolution used for the preview (in CM). The default is the screen resolution.
Method Detail

setObjectListener

public void setObjectListener(RObjectListener l)
this listener is called when an object is clicked

getDBUrl

public java.lang.String getDBUrl()
gets database url.

getDBUser

public java.lang.String getDBUser()
gets database user.

getDBPsw

public java.lang.String getDBPsw()
gets database password.

getDBDriver

public java.lang.String getDBDriver()
gets driver.

setDBUrl

public void setDBUrl(java.lang.String s)
sets database url.

setDBUser

public void setDBUser(java.lang.String s)
sets database user.

setDBPsw

public void setDBPsw(java.lang.String s)
sets database password.

setDBDriver

public void setDBDriver(java.lang.String s)
sets driver.

setPrintSetup

public void setPrintSetup(RPrintSetup ps)
Sets the RPrintSetup object used to configurate the printer. The default is the jdk 1.1 compatible RPrintSetup.

getPrintSetup

public RPrintSetup getPrintSetup()
gets the RPrintSetup object used to configurate the printer. The default is the jdk 1.1 compatible RPrintSetup.

disablePrinting

public void disablePrinting(boolean b)
if true, the report will not be printed. This is usefull if you just want to create HTML or PDF output.

isPrintingDisabled

public boolean isPrintingDisabled()
if true, the report will not be printed. This is usefull if you just want to create HTML or PDF output.

getPDFFile

public java.lang.String getPDFFile()
gets the file name for PDF output.

setPDFFile

public void setPDFFile(java.lang.String f)
sets the file name for PDF output.

setPDFStream

public void setPDFStream(java.io.OutputStream f)
sets the stream for PDF output.

setImageFile

public void setImageFile(java.lang.String f,
                         java.lang.String imageF)
sets the file name for Image output.

getPageFrameVerticalMargin

public double getPageFrameVerticalMargin()
page frame top/bottom margin (in CM) if 0 it will be calculated as topMargin/3 and bottomMargin/3

setPageFrameVerticalMargin

public void setPageFrameVerticalMargin(double d)
page frame top/bottom margin (in CM) if 0 it will be calculated as topMargin/3 and bottomMargin/3

getPageFrameHorizontalMargin

public double getPageFrameHorizontalMargin()
page frame left/right margin (in CM) if 0 it will be calculated as leftMargin/3 and rightMargin/3

setPageFrameHorizontalMargin

public void setPageFrameHorizontalMargin(double d)
page frame left/right margin (in CM) if 0 it will be calculated as leftMargin/3 and rightMargin/3

removeAllAreas

public void removeAllAreas()
remove areas from report

removeAreaAt

public void removeAreaAt(int i)
remove one area from report

getDateFormat

public java.lang.String getDateFormat()
gets date format for [Date] system variable. The default is "dd MMM yyyy". See documentation of SimpleDateFormat if you need to change the format.

setDateFormat

public void setDateFormat(java.lang.String s)
sets date format for [Date] system variable. The default is "dd MMM yyyy". See documentation of SimpleDateFormat if you need to change the format.

getAreaByName

public RArea getAreaByName(java.lang.String name)
gets area by name

getPageWidthPixels

public int getPageWidthPixels()
page width, pixels

getAreaAt

public RArea getAreaAt(int i)
gets area by position

getAreaCount

public int getAreaCount()
get number of area in report

getDBCon

public java.sql.Connection getDBCon()
get current connection to database. Will be automatically set if DBActive=true in *.rep file.

setDBCon

public void setDBCon(java.sql.Connection c)
sets current connection to database.

openDB

public boolean openDB()
connect to database. Will be automatically executed if DBActive=true in *.rep file.

importReport

public boolean importReport(java.lang.String f)
Import *.rep file. Only implemented in RReportImp and RReportJ2.

importLine

public void importLine(java.lang.String key,
                       java.lang.String val)
internal use. Process line read from *.rep file.

setPageBackgroundImage

public void setPageBackgroundImage(RPicture p)
This image will be printed in the background of each page

getPageBackgroundImage

public RPicture getPageBackgroundImage()
This image will be printed in the background of each page

setPageBackground

public void setPageBackground(java.awt.Color c)
background color of the page.

getPageBackground

public java.awt.Color getPageBackground()
background color of the page.

setPageBackgroundArea

public void setPageBackgroundArea(RArea a)
This area will be printed in the background of each page

getPageBackgroundArea

public RArea getPageBackgroundArea()
This area will be printed in the background of each page

setPageFrameStyle

public void setPageFrameStyle(RLineStyle fStyle)
sets the frame style for the pages of the report.

getPageFrameStyle

public RLineStyle getPageFrameStyle()
sets the frame style for the pages of the report.

setHTMLActive

public void setHTMLActive(boolean activate)
Specifies that the HTML version should be created.

getHTMLActive

public boolean getHTMLActive()
Specifies that the HTML version should be created.

setDHTMLActive

public void setDHTMLActive(boolean activate)
Specifies that the HTML version should be created.

getDHTMLActive

public boolean getDHTMLActive()
Specifies that the HTML version should be created.

setTitle

public void setTitle(java.lang.String t)
Title of the report.

getTitle

public java.lang.String getTitle()
Title of the report.

getScalePages

public double getScalePages()
returns scale of the pages being display in the preview window. (1 is 100%)

setDefaultPageSize

public void setDefaultPageSize(double w,
                               double h)
sets date format for [Date] system variable. The default is "dd MMM yyyy". See documentation of SimpleDateFormat if you need to change the format.

getResolution

public int getResolution()
resolution of the report (pixels/CM). This should be the resolution used by the printer. Default is 29 (72 dpi)

setResolution

public void setResolution(int r)
resolution of the report (pixels/CM). This should be the resolution used by the printer. Default is 29 (72 dpi)

getOrientation

public int getOrientation()
sets report orientation (RReport.ORIENTATION_HORIZONTAL or RReport.ORIENTATION_VERTICAL)

setOrientation

public void setOrientation(int o)
sets report orientation (RReport.ORIENTATION_HORIZONTAL or RReport.ORIENTATION_VERTICAL)

getPageNumber

public int getPageNumber()
returns current page number during preview.

getMaxPages

public int getMaxPages()
returns number of pages of the report.

setPageNumber

public boolean setPageNumber(int p)
set page to show in the preview

addArea

public void addArea(RArea a)
Add an area to the report. The area will be added after the last one.

setShowPages

public void setShowPages(int p)
sets the number of pages to be displayed in the preview. To be used by the preview window.

getShowPages

public int getShowPages()
returns the number of pages to be displayed in the preview. To be used by the preview window.

printArea

public void printArea(RArea a)
prints an area. Before you print an area you must either provide a data souce (RSource) or set the values of the fields yourself (Rarea.setObjectValue()).

getHTML

public java.lang.String getHTML()
Returns the HTML version of the report if HTMLPages is deactivated.

setHTMLPages

public void setHTMLPages(boolean b)
if this is false, the HTML report will be printed in just one file (page). If not, the HTML version will consist of many pages (files). Depending of this value you must use getHTML() or getHTMLPage(int page).

getHTMLPage

public java.lang.String getHTMLPage(int p)
returns a page of the HTML version of the report. Only is setHTMLPages() was set to True.

endReport

public void endReport()
Run this method to end your report. It performs additional tasks like printing the report footer etc...

setScale

public boolean setScale(double s)
set scale during preview. A value of 0.5 means zoom 50%.

getScale

public double getScale()
returns current zoom value.

printPreview

public boolean printPreview(int[] PagesToPrint,
                            int Count)
Call this method if you want to make a preview. In this case you must add the RReport (RReport is a panel) to your preview window.

setPreview

public void setPreview(boolean b)
used by the Preview Window to tell RReport it is being previewed.

prepare

public boolean prepare()
starts a report. Perform tasks like print the report header and all its related areas. Call this method before you call any printArea().

setPageHeader

public void setPageHeader(RArea area)
This area will be printed at the top of each page.

setPageFooter

public void setPageFooter(RArea area)
This area will be printed at the bottom of each page.

setReportHeader

public void setReportHeader(RArea area)
This area will be printed when you call prepare().

setReportFooter

public void setReportFooter(RArea area)
This area will be printed when you call endReport().

getPageHeader

public RArea getPageHeader()
This area will be printed at the top of each page.

getPageFooter

public RArea getPageFooter()
This area will be printed at the bottom of each page.

getReportHeader

public RArea getReportHeader()
This area will be printed when you call prepare().

getReportFooter

public RArea getReportFooter()
This area will be printed when you call endReport().

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener