Style Intelligence v12.0

inetsoft.report.lens
Class ElementContainer

java.lang.Object
  extended by inetsoft.report.lens.ElementContainer
All Implemented Interfaces:
CompositeLens, Serializable, Cloneable

public class ElementContainer
extends Object
implements CompositeLens, Serializable

A container can be added to a report template in report designer. The container can later be populated with elements dynamically. This provides an easy way to combine static templates with dynamically created report contents.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface inetsoft.report.CompositeLens
CompositeLens.Separator, CompositeLens.Space, CompositeLens.Tab
 
Field Summary
protected  ReportSheet parent
           
 
Fields inherited from interface inetsoft.report.CompositeLens
AREA_BREAK, BREAK, NEWLINE, PAGE_BREAK
 
Constructor Summary
ElementContainer(ReportSheet parent)
           
 
Method Summary
 String addAreaBreak()
          Add a area break to the document.
 String addBean(String name)
          Add a bean to the report.
 String addBreak()
          Add a break to the document.
 String addBullet()
          Add a bullet to the document.
 String addBullet(Image icon)
          Add a bullet with user specified image as bullet icon.
 void addButton(String form, String name, String text)
          Add a form button to the report.
 void addButton(String form, String name, String script, String text)
          Add a form button to the report.
 String addChart(DataSet chart)
          Add a chart to the report.
 String addChart(DataSet chart, double winch, double hinch)
          This is same as addChart() exception an explicit size of the chart area is specified.
 void addCheckBox(String form, String name, String text, boolean selected)
          Add a checkbox to the report.
 void addCheckBox(String form, String name, String script, String text, boolean selected)
          Add a checkbox to the report.
 void addChoiceElement(String form, String name, String selected, String[] choices)
          Add a choice field to the report.
 void addChoiceElement(String form, String name, String script, String selected, String[] choices)
          Add a choice field to the report.
 String addComponent(Component comp)
          Add an AWT component to the document.
 String addComponent(Component component, double winch, double hinch)
          This is same as addComponent() exception an explicit size of the painter area is specified.
 String addConditionalPageBreak(double inch)
          Add a conditional page break.
 String addConditionalPageBreak(int min)
          Add a conditional page break.
 void addDateCombo(String form, String name, Date date)
          Add a datecombo to a report.
 void addDateCombo(String form, String name, String script, Date date)
          Add a datecombo to a report.
 String addElement(ReportElement e)
          Add an element to the document.
 String addForm(FormLens form)
          Add a form to the document.
 String addImage(Image image)
          Add an image to the document.
 String addImage(Image image, double winch, double hinch)
          This is same as addImage() exception an explicit size of the painter area is specified.
 String addImage(URL image)
          Add an image to the document.
 void addImageButton(String form, String name, String resource)
          Add a form image button to the report.
 void addImageButton(String form, String name, String script, String resource)
          Add a form image button to the report.
 void addListElement(String form, String name, String[] selected, String[] choices)
          Add a list field to the report.
 void addListElement(String form, String name, String script, String[] selected, String[] choices)
          Add a list field to the report.
 String addNewline(int n)
          Add one or more newline to the document.
 String addPageBreak()
          Add a page break to the document.
 String addPainter(Painter area)
          Add a painter element to the document.
 String addPainter(Painter area, double winch, double hinch)
          This is same as addPainter() except an explicit size of the painter area is specified.
 void addRadioButton(String form, String name, String text, boolean selected, String group)
          Add a radio button to the report.
 void addRadioButton(String form, String name, String script, String text, boolean selected, String group)
          Add a radio button to the report.
 String addSeparator(int style)
          Add a separator.
 String addSpace(int pixels)
          Add horizontal space to the document.
 String addTab(int fill)
          Add a tab.
 String addTable(TableLens table)
          Add a table to the document.
 String addText(String text)
          Add a text element to the document.
 String addText(TextLens text)
          Add a text element to the document.
 void addTextArea(String form, String name, String text, int rows, int cols)
          Add a textarea to a report.
 void addTextArea(String form, String name, String script, String text, int rows, int cols)
          Add a textarea to a report.
 String addTextBox(String text, int border, double winch, double hinch, int textalign)
          Add a text box to the document.
 String addTextBox(TextLens text)
          Add a text box to the document.
 String addTextBox(TextLens text, int border, double winch, double hinch, int textalign)
          Add a text box to the document.
 void addTextField(String form, String name, String text, int cols)
          Add a textfield to a report.
 void addTextField(String form, String name, String script, String text, int cols)
          Add a textfield to a report.
 String addTOC(TOC toc)
          Add a table of contents section to the report.
 ReportElement getElement(int idx)
          Get the specified element.
 ReportElement getElement(String id)
          Get an element by element ID.
 int getElementCount()
          Return the number of elements in the document.
 Object nextElement(Context context)
          Get the next element in the composite lens.
 void removeAllElements()
          Remove all elements.
 void removeElement(int idx)
          Remove the specified element.
 void reset()
          Reset the enumerator to the start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected ReportSheet parent
Constructor Detail

ElementContainer

public ElementContainer(ReportSheet parent)
Method Detail

addText

public String addText(String text)
Add a text element to the document. The text string can be a simple string, or contains multiple lines separated by the newline character.

Parameters:
text - text string.
Returns:
element id.

addText

public String addText(TextLens text)
Add a text element to the document. The TextLens provides an extra level of indirection. For example, it can be used to refer to a TextField on a GUI screen, the most up-to-date value in the text field will be used when printing the document. This way a ReportSheet can be created once, and don't need to be modified when the text contents change.

The inetsoft.report.lens package also contains a StreamTextLens, which allows retrieving text from a file, URL, or any input stream.

Parameters:
text - text content lens.
Returns:
element id.

addTextBox

public String addTextBox(TextLens text)
Add a text box to the document. A text box is a standalone area on the document that contains a text string. It has a border around by default. The text box element is similar to the painter elements in that they both use the painter layout and wrapping options. The current setting of the painter layout and wrapping are used by the text box elements as well.

Parameters:
text - text content.
Returns:
element id.

addTextBox

public String addTextBox(TextLens text,
                         int border,
                         double winch,
                         double hinch,
                         int textalign)
Add a text box to the document. A text box is a standalone area on the document that contains a text string. It has a border around by default. The text box element is similar to the painter elements in that they both use the painter layout and wrapping options. The current setting of the painter layout and wrapping are used by the text box elements as well.

Parameters:
text - text content.
border - border line style. One of the line styles defined in the StyleConstants class.
winch - area width in inches. Pass 0 to use default.
hinch - area height in inches. Pass 0 to use default.
textalign - text alignment within the box.
Returns:
element id.

addTextBox

public String addTextBox(String text,
                         int border,
                         double winch,
                         double hinch,
                         int textalign)
Add a text box to the document. A text box is a standalone area on the document that contains a text string. It has a border around by default. The text box element is similar to the painter elements in that they both use the painter layout and wrapping options. The current setting of the painter layout and wrapping are used by the text box elements as well.

Parameters:
text - text content.
border - border line style. One of the line styles defined in the StyleConstants class.
winch - area width in inches. Pass 0 to use default.
hinch - area height in inches. Pass 0 to use default.
textalign - text alignment within the box.
Returns:
element id.

addPainter

public String addPainter(Painter area)
Add a painter element to the document. A painter is a self contained object that can paint a document area. It can be used to add any content to the document, through which the program has full control on exact presentation on the document. Painter is the general mechanism used to support some of the more common data types. For example, Component and Image are handled internally by a painter object. The program is free to define its own painter.

Parameters:
area - the painter element.
Returns:
element id.

addPainter

public String addPainter(Painter area,
                         double winch,
                         double hinch)
This is same as addPainter() except an explicit size of the painter area is specified. The specified size (in inches) is the preferred size of this painter on paper, where as the preferred size of the Painter object is treated as the preferred pixels of the area. The pixels in the specified area may be different depending on the resolution of the output media. The image is scaled from the pixel size (returned by Painter.getPreferredSize) to the area defined.

Parameters:
area - the painter element.
winch - area width in inches.
hinch - area height in inches.
Returns:
element id.

addChart

public String addChart(DataSet chart)
Add a chart to the report. The chart behaves like a painter. It reserves an area and paints a chart on the area. The current PainterLayout value is also applied to the chart.

Parameters:
chart - chart data model.
Returns:
element id.

addChart

public String addChart(DataSet chart,
                       double winch,
                       double hinch)
This is same as addChart() exception an explicit size of the chart area is specified. The specified size (in inches) is the preferred size of this chart on paper, where as the preferred size of the Chart object is treated as the preferred pixels of the area. The pixels in the specified area may be different depending on the resolution of the output media. The image is scaled from the pixel size (returned by Chart.getPreferredSize) to the area defined.

Parameters:
chart - the chart data set.
winch - area width in inches.
hinch - area height in inches.
Returns:
element id.

addComponent

public String addComponent(Component comp)
Add an AWT component to the document. The onscreen image of the component is 'copied' on to the document.

Parameters:
comp - component.
Returns:
element id.

addComponent

public String addComponent(Component component,
                           double winch,
                           double hinch)
This is same as addComponent() exception an explicit size of the painter area is specified. The specified size (in inches) is the preferred size of this painter on paper, where as the preferred size of the Painter object is treated as the preferred pixels of the area. The pixels in the specified area may be different depending on the resolution of the output media. The component is scaled from the pixel size (returned by Painter.getPreferredSize) to the area defined.

Parameters:
component - component to paint.
winch - area width in inches.
hinch - area height in inches.
Returns:
element id.

addImage

public String addImage(Image image)
Add an image to the document.

Parameters:
image - image object.
Returns:
element id.

addImage

public String addImage(Image image,
                       double winch,
                       double hinch)
This is same as addImage() exception an explicit size of the painter area is specified. The specified size (in inches) is the preferred size of this painter on paper, where as the preferred size of the Painter object is treated as the preferred pixels of the area. The pixels in the specified area may be different depending on the resolution of the output media. The image is scaled from the pixel size (returned by Painter.getPreferredSize) to the area defined.

Parameters:
image - image to paint.
winch - area width in inches.
hinch - area height in inches.
Returns:
element id.

addImage

public String addImage(URL image)
Add an image to the document.

Parameters:
image - image URL.
Returns:
element id.

addBullet

public String addBullet()
Add a bullet to the document. A bullet can be used to create a bullet list. The default bullet is a round dot. The bullet has a special layout property. After a bullet is added, a hanging indent is created to just right of the bullet. If a Break is added, the cursor is advanced to the next line at the hanging indent position. If a newline element is added, the hanging indent is reset.

Returns:
element id.

addBullet

public String addBullet(Image icon)
Add a bullet with user specified image as bullet icon. The bullet is otherwise same as the default.

Parameters:
icon - icon to used for bullet.
Returns:
element id.

addSpace

public String addSpace(int pixels)
Add horizontal space to the document. The space is added after the current element.

Parameters:
pixels - space in pixels.
Returns:
element id.

addNewline

public String addNewline(int n)
Add one or more newline to the document.

Parameters:
n - number of newline.
Returns:
element id.

addBreak

public String addBreak()
Add a break to the document. The break is different from a newline in that the break does not reset the hanging indent which is set by a bullet.

Returns:
element id.

addPageBreak

public String addPageBreak()
Add a page break to the document. This causes the print to advance to a new page.

Returns:
element id.

addAreaBreak

public String addAreaBreak()
Add a area break to the document. This causes the print to advance to a new area. In the default case, each page is consisted of one area, so this is same as adding a page break.

Returns:
element id.

addConditionalPageBreak

public String addConditionalPageBreak(int min)
Add a conditional page break. The print advance to a new page if the remaining space in the current page is less than the specified minimum space.

Parameters:
min - minimu space in pixels.
Returns:
element id.

addConditionalPageBreak

public String addConditionalPageBreak(double inch)
Add a conditional page break. The print advance to a new page if the remaining space in the current page is less than the specified minimum space.

Parameters:
inch - minimu space in inches.
Returns:
element id.

addSeparator

public String addSeparator(int style)
Add a separator. A separator is a horizontal line in either 3D or plain mode.

Parameters:
style - the line style (defined in StyleConstants).
Returns:
element id.

addTab

public String addTab(int fill)
Add a tab. The fill specifies a line style to fill the tab space.

Parameters:
fill - a line style defined in StyleConstants.
Returns:
element id.

addTable

public String addTable(TableLens table)
Add a table to the document. The table lens object encapsulate the table attributes and contents. Through the table lens, the print discovers table attributes such as color, border, font, etc.. For more details, refer the TableLens document.

Parameters:
table - table lens.
Returns:
element id.

addForm

public String addForm(FormLens form)
Add a form to the document. A form is a collection of labels and values. With each field consists of a label and a field value. The fields are layed out in rows and columns.

Parameters:
form - form lens.
Returns:
element id.

addTOC

public String addTOC(TOC toc)
Add a table of contents section to the report. The table of contents is built from the heading elements in the report. Heading elements are special text elements that contains a heading level.

Parameters:
toc - table of contents style.
Returns:
element id.

addBean

public String addBean(String name)
Add a bean to the report. The bean is a reference to a report component. The contents of the report component is printed in the place of the bean element.

Parameters:
name - bean name, must be an existing bean in the bean library.
Returns:
element id.

addButton

public void addButton(String form,
                      String name,
                      String text)
Add a form button to the report.

Parameters:
form - form name.
name - field name.
text - button text.

addButton

public void addButton(String form,
                      String name,
                      String script,
                      String text)
Add a form button to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
text - button text.

addImageButton

public void addImageButton(String form,
                           String name,
                           String resource)
Add a form image button to the report.

Parameters:
form - form name.
name - field name.
resource - image resource name.

addImageButton

public void addImageButton(String form,
                           String name,
                           String script,
                           String resource)
Add a form image button to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
resource - image resource name.

addCheckBox

public void addCheckBox(String form,
                        String name,
                        String text,
                        boolean selected)
Add a checkbox to the report.

Parameters:
form - form name.
name - field name.
text - checkbox label.
selected - true if the default is selected.

addCheckBox

public void addCheckBox(String form,
                        String name,
                        String script,
                        String text,
                        boolean selected)
Add a checkbox to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
text - checkbox label.
selected - true if the default is selected.

addRadioButton

public void addRadioButton(String form,
                           String name,
                           String text,
                           boolean selected,
                           String group)
Add a radio button to the report.

Parameters:
form - form name.
name - field name.
text - button label.
selected - true if the default is selected.
group - radio button group name.

addRadioButton

public void addRadioButton(String form,
                           String name,
                           String script,
                           String text,
                           boolean selected,
                           String group)
Add a radio button to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
text - button label.
selected - true if the default is selected.
group - radio button group name.

addChoiceElement

public void addChoiceElement(String form,
                             String name,
                             String selected,
                             String[] choices)
Add a choice field to the report.

Parameters:
form - form name.
name - field name.
selected - the default selected item.
choices - the list of choices.

addChoiceElement

public void addChoiceElement(String form,
                             String name,
                             String script,
                             String selected,
                             String[] choices)
Add a choice field to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
selected - the default selected item.
choices - the list of choices.

addListElement

public void addListElement(String form,
                           String name,
                           String[] selected,
                           String[] choices)
Add a list field to the report.

Parameters:
form - form name.
name - field name.
selected - the default selected item.
choices - the list of choices.

addListElement

public void addListElement(String form,
                           String name,
                           String script,
                           String[] selected,
                           String[] choices)
Add a list field to the report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
selected - the default selected item.
choices - the list of choices.

addDateCombo

public void addDateCombo(String form,
                         String name,
                         Date date)
Add a datecombo to a report.

Parameters:
form - form name.
name - field name.
date - default date.

addDateCombo

public void addDateCombo(String form,
                         String name,
                         String script,
                         Date date)
Add a datecombo to a report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
date - default date.

addTextField

public void addTextField(String form,
                         String name,
                         String text,
                         int cols)
Add a textfield to a report.

Parameters:
form - form name.
name - field name.
text - default text.
cols - number of columns.

addTextField

public void addTextField(String form,
                         String name,
                         String script,
                         String text,
                         int cols)
Add a textfield to a report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
text - default text.
cols - number of columns.

addTextArea

public void addTextArea(String form,
                        String name,
                        String text,
                        int rows,
                        int cols)
Add a textarea to a report.

Parameters:
form - form name.
name - field name.
text - default text.
rows - number of rows.
cols - number of columns.

addTextArea

public void addTextArea(String form,
                        String name,
                        String script,
                        String text,
                        int rows,
                        int cols)
Add a textarea to a report.

Parameters:
form - form name.
name - field name.
script - onSubmit java script.
text - default text.
rows - number of rows.
cols - number of columns.

addElement

public String addElement(ReportElement e)
Add an element to the document. Classes extending the ReportSheet can extend element classes from the Element, and use this method for adding the element to the document.

Parameters:
e - document element.
Returns:
element id.

getElementCount

public int getElementCount()
Return the number of elements in the document.

Returns:
number of elements.

getElement

public ReportElement getElement(int idx)
Get the specified element.

Parameters:
idx - element index.
Returns:
document element.

removeElement

public void removeElement(int idx)
Remove the specified element.

Parameters:
idx - element index.

getElement

public ReportElement getElement(String id)
Get an element by element ID.


removeAllElements

public void removeAllElements()
Remove all elements.


nextElement

public Object nextElement(Context context)
Description copied from interface: CompositeLens
Get the next element in the composite lens. Currently the following types of elements are supported in a composite lens:

The context object can be modified to reflect the layout attributes of the element. The input value for the context is the current current at the point of printing this composite lens.

This method can be implemented to return the elements in the container. Each element must be one of the constants or classes defined in this class.

Specified by:
nextElement in interface CompositeLens

reset

public void reset()
Description copied from interface: CompositeLens
Reset the enumerator to the start. This is called before any nextElement() method is called.

Specified by:
reset in interface CompositeLens

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