Style Intelligence v12.0

inetsoft.report
Class StylePage

java.lang.Object
  extended by inetsoft.report.StylePage
All Implemented Interfaces:
Serializable, Cloneable

public class StylePage
extends Object
implements Serializable, Cloneable

A StylePage is created for each page to be printed. The StylePage object contains the information on how to print a page. It is used to provide an abstraction of a page, and allows more sophisticated printing and better effeciency.

See Also:
Serialized Form

Constructor Summary
StylePage(Dimension size)
          Create a page with the specified size and resolution.
StylePage(Dimension size, int resolution)
          Deprecated. 4.4, resolution in Java is fixed at 72.
 
Method Summary
 void addInfo(String info)
          Add a warning information to this style page.
 void addPaintable(Paintable pt)
          Add a paintable area to the page.
 void clearCache()
          Clear cache.
 Object clone()
          Make a copy of this page.
 void complete()
          This method is called after a page is fully printed.
 void completeInfo()
          Complete all the warning informations.
 Object getBackground()
          Get the page background.
 int getBackgroundLayout()
          Get the page background layout.
 Dimension getBackgroundSize()
          Get the page background layout.
 Map getBoundsMap()
          Get the map contains warning information and its bounds.
 Font getFont()
          Get the page default font.
 Color getForeground()
          Get the page default foreground color.
 Margin getMargin()
          Get the page margin.
 int getOrientation()
          Get the orientation of current page.
 Dimension getPageDimension()
          Returns the dimensions of the page in pixels.
 PageLayout getPageLayout()
          Get the page layout defined for this page.
 Paintable getPaintable(int idx)
          Get the specified paintable object.
 int getPaintableCount()
          Get the number of paintable objects in this style page.
 Object getProperty(String name)
          Get a property value.
 void insertPaintable(int idx, Paintable pt)
          Insert a paintable at the specified location.
 boolean isBatchWaiting()
          Check if the paintable on this page needs to wait for report to finish processing before printed.
 boolean isSwapped()
          Tell if swap file has already been outputed
protected  void load(ObjectInputStream s, boolean full, boolean swap)
          Loaded page contents from a file.
 void paintBg(Graphics g, double xratio, double yratio)
          Paint the page background on to the graphics.
 void parseXML(Element elem)
          read the xml file and generate a style page
 void print(Graphics g)
          Print the page on to the graphics.
 void removeAllPaintables()
          Remove all paintables.
 void removePaintable(int idx)
          Remove the specified paintable object.
 void reset()
          Clear all the paintable areas in the page.
 void reset(boolean removal)
          Clear all the paintable areas in the page.
 boolean restore(ObjectInputStream inp, boolean removal)
          Restore a swapped page.
protected  boolean save(ObjectOutputStream stream, boolean completed, boolean swap)
          Write the page to a file.
 void setBackground(Object bg)
          Set the background of this page.
 void setBackgroundLayout(int lay)
          Set the background layout of this page.
 void setBackgroundSize(Dimension d)
          Set the background layout of this page.
 void setFont(Font font)
          Set the default font of this page.
 void setForeground(Color color)
          Set the page default foreground color.
 void setMargin(Margin margin)
          Set the page margin.
 void setOrientation(int orient)
          Set the orientation of the report page.
 void setPageDimension(Dimension size)
          Set the page dimension in pixels.
 void setPageLayout(PageLayout layout)
          Set the page layout for this page.
 void setPaintable(int idx, Paintable pt)
          Set a paintable at the specified location.
 void setProperties(Map props)
          Set the page properties.
 void setProperty(String name, Object val)
          Set a property.
 boolean swap(ObjectOutputStream output, boolean completed)
          Write the page to a file.
 void writeXML(PrintWriter writer)
          write the style page into xml
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StylePage

public StylePage(Dimension size)
Create a page with the specified size and resolution.

Parameters:
size - page size in pixels.

StylePage

public StylePage(Dimension size,
                 int resolution)
Deprecated. 4.4, resolution in Java is fixed at 72.

Create a page with the specified size and resolution.

Parameters:
size - page size in pixels.
resolution - dots per inch.
Method Detail

print

public void print(Graphics g)
Print the page on to the graphics.


paintBg

public void paintBg(Graphics g,
                    double xratio,
                    double yratio)
Paint the page background on to the graphics.


addInfo

public void addInfo(String info)
Add a warning information to this style page.


completeInfo

public void completeInfo()
Complete all the warning informations. They will be added to this style page as printables.


addPaintable

public void addPaintable(Paintable pt)
Add a paintable area to the page.


insertPaintable

public void insertPaintable(int idx,
                            Paintable pt)
Insert a paintable at the specified location.


setPaintable

public void setPaintable(int idx,
                         Paintable pt)
Set a paintable at the specified location.


removeAllPaintables

public void removeAllPaintables()
Remove all paintables.


getPaintableCount

public int getPaintableCount()
Get the number of paintable objects in this style page.

Returns:
number of paintables.

getPaintable

public Paintable getPaintable(int idx)
Get the specified paintable object.

Parameters:
idx - paintable index.
Returns:
paintable object at the index.

removePaintable

public void removePaintable(int idx)
Remove the specified paintable object.

Parameters:
idx - paintable index.

reset

public void reset()
Clear all the paintable areas in the page.


reset

public void reset(boolean removal)
Clear all the paintable areas in the page.


clearCache

public void clearCache()
Clear cache.


isSwapped

public boolean isSwapped()
Tell if swap file has already been outputed


complete

public void complete()
This method is called after a page is fully printed.


getPageDimension

public Dimension getPageDimension()
Returns the dimensions of the page in pixels. The resolution of the page is chosen so that it is similar to the screen resolution.


setPageDimension

public void setPageDimension(Dimension size)
Set the page dimension in pixels.

Parameters:
size - page size.

getOrientation

public int getOrientation()
Get the orientation of current page.


setOrientation

public void setOrientation(int orient)
Set the orientation of the report page.


getMargin

public Margin getMargin()
Get the page margin.


setMargin

public void setMargin(Margin margin)
Set the page margin. This is for information only and the actual margin used for printing should be set through the ReportSheet or TabularSheet.


getFont

public Font getFont()
Get the page default font.

Returns:
page font.

setFont

public void setFont(Font font)
Set the default font of this page.

Parameters:
font - default font.

getForeground

public Color getForeground()
Get the page default foreground color.

Returns:
page foreground color.

setForeground

public void setForeground(Color color)
Set the page default foreground color.

Parameters:
color - foreground color.

getBackground

public Object getBackground()
Get the page background.


setBackground

public void setBackground(Object bg)
Set the background of this page. The background can be either a Color or an Image object.

Parameters:
bg - page background.

getBackgroundLayout

public int getBackgroundLayout()
Get the page background layout.


setBackgroundLayout

public void setBackgroundLayout(int lay)
Set the background layout of this page.

Parameters:
lay - page background layout.

getBackgroundSize

public Dimension getBackgroundSize()
Get the page background layout.


setBackgroundSize

public void setBackgroundSize(Dimension d)
Set the background layout of this page.

Parameters:
d - page background layout.

getPageLayout

public PageLayout getPageLayout()
Get the page layout defined for this page.


setPageLayout

public void setPageLayout(PageLayout layout)
Set the page layout for this page. The page area setting does not change the rendering of the page content. It is information only, and can be used by other classes to retrieve the page areas setting.


getProperty

public Object getProperty(String name)
Get a property value.

Parameters:
name - property name.
Returns:
property value.

setProperty

public void setProperty(String name,
                        Object val)
Set a property.

Parameters:
name - property name.
val - property value.

setProperties

public void setProperties(Map props)
Set the page properties.


writeXML

public void writeXML(PrintWriter writer)
write the style page into xml


parseXML

public void parseXML(Element elem)
              throws Exception
read the xml file and generate a style page

Throws:
Exception

swap

public boolean swap(ObjectOutputStream output,
                    boolean completed)
             throws IOException
Write the page to a file. If processing of the report is not completed, this could be a partial save of the page data. This function is used together with restore() to swap page in and out of memory to conserve space. After this function is called, this page can not be used until a load is called.

Parameters:
output - output stream to save the page.
completed - true if the processing of report has completed.
Returns:
true if the page is fully saved, false if it is partially saved.
Throws:
IOException

restore

public boolean restore(ObjectInputStream inp,
                       boolean removal)
                throws IOException,
                       ClassNotFoundException
Restore a swapped page.

Returns:
true if the data is read in, or false if the data is skipped.
Throws:
IOException
ClassNotFoundException

isBatchWaiting

public boolean isBatchWaiting()
Check if the paintable on this page needs to wait for report to finish processing before printed.


save

protected boolean save(ObjectOutputStream stream,
                       boolean completed,
                       boolean swap)
                throws IOException
Write the page to a file. If processing of the report is not completed, this could be a partial save of the page data.

Parameters:
stream - output stream to save the page.
completed - true if the processing of report has completed.
swap - if true, free the objects that have been saved.
Returns:
true if the page is fully saved, false if it is partially saved.
Throws:
IOException

getBoundsMap

public Map getBoundsMap()
Get the map contains warning information and its bounds.


load

protected void load(ObjectInputStream s,
                    boolean full,
                    boolean swap)
             throws IOException,
                    ClassNotFoundException
Loaded page contents from a file. The file should be created by a corresponding save() call.

Parameters:
s - saved data file.
full - true if restoring from a fully (not partial) swapped file.
swap - true if the saved file is swapped.
Throws:
IOException
ClassNotFoundException

clone

public Object clone()
Make a copy of this page.

Overrides:
clone in class Object

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.