org.eclipse.birt.report.model.api
Class ElementFactory

java.lang.Object
  extended byorg.eclipse.birt.report.model.api.ElementFactory

public class ElementFactory
extends java.lang.Object

Creates a new report elements and returns handles to it. Use this to create elements. After creating an element, add it to the design using the add method in the SlotHandleclass. Obtain an instance of this class by calling the getElementFactory method on any element handle.

See Also:
SlotHandle

Field Summary
protected  org.eclipse.birt.report.model.core.Module module
          The module.
 
Constructor Summary
ElementFactory(org.eclipse.birt.report.model.core.Module module)
          Constructs a element factory with the given module.
 
Method Summary
 CascadingParameterGroupHandle newCascadingParameterGroup(java.lang.String name)
          Creates a new parameter group element.
 CellHandle newCell()
          Creates a new cell element.
 DataItemHandle newDataItem(java.lang.String name)
          Creates a new data item.
 DesignElementHandle newElement(java.lang.String elementTypeName, java.lang.String name)
          Creates a design element specified by the element type name.
 DesignElementHandle newElementFrom(DesignElementHandle baseElement, java.lang.String name)
          Creates one new element based on the given element.
 ExtendedItemHandle newExtendedItem(java.lang.String name, java.lang.String extensionName)
          Creates a new extended item.
 FreeFormHandle newFreeForm(java.lang.String name)
          Creates a new free-form item.
 GraphicMasterPageHandle newGraphicMasterPage(java.lang.String name)
          Creates a new graphic master page element.
 GridHandle newGridItem(java.lang.String name)
          Creates a new grid item.
 GridHandle newGridItem(java.lang.String name, int columnNum, int rowNum)
          Creates a new grid item with pre-defined columns and rows.
 ImageHandle newImage(java.lang.String name)
          Creates a new image item.
 LabelHandle newLabel(java.lang.String name)
          Creates a new label item.
 LineHandle newLineItem(java.lang.String name)
          Creates a new line item.
 ListHandle newList(java.lang.String name)
          Creates a new list item.
 ListGroupHandle newListGroup()
          Creates a new list group element.
 OdaDataSetHandle newOdaDataSet(java.lang.String name)
          Deprecated. see newOdaDataSet( String name, String extensionID )
 OdaDataSetHandle newOdaDataSet(java.lang.String name, java.lang.String extensionID)
          Creates a new oda data set.
 OdaDataSourceHandle newOdaDataSource(java.lang.String name)
          Deprecated. see newOdaDataSource( String name, String extensionID )
 OdaDataSourceHandle newOdaDataSource(java.lang.String name, java.lang.String extensionID)
          Creates a new oda data source.
 ParameterGroupHandle newParameterGroup(java.lang.String name)
          Creates a new parameter group element.
 RectangleHandle newRectangle(java.lang.String name)
          Creates a new rectangle.
 ScalarParameterHandle newScalarParameter(java.lang.String name)
          Creates a new scalar parameter element.
 ScriptDataSetHandle newScriptDataSet(java.lang.String name)
          Creates a new script data set.
 ScriptDataSourceHandle newScriptDataSource(java.lang.String name)
          Creates a new script data source.
 SimpleMasterPageHandle newSimpleMasterPage(java.lang.String name)
          Creates a new simple master page element.
 SharedStyleHandle newStyle(java.lang.String name)
          Creates a new style element.
 ColumnHandle newTableColumn()
          Creates a new column element.
 TableGroupHandle newTableGroup()
          Creates a new table group element.
 TableHandle newTableItem(java.lang.String name)
          Creates a new table item.
 TableHandle newTableItem(java.lang.String name, int columnNum)
          Creates a new table item with the given name and given column number.
 TableHandle newTableItem(java.lang.String name, int columnNum, int headerRow, int detailRow, int footerRow)
          Creates a new table item with the given name and given column number.
 RowHandle newTableRow()
          Creates a new row element.
 RowHandle newTableRow(int cellNum)
          Creates a new table row, filled the row with the given number of cells.
 TextDataHandle newTextData(java.lang.String name)
          Creates a new multi line data item.
 TextItemHandle newTextItem(java.lang.String name)
          Creates a new text item.
 ThemeHandle newTheme(java.lang.String name)
          Creates a new theme element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

protected final org.eclipse.birt.report.model.core.Module module
The module.

Constructor Detail

ElementFactory

public ElementFactory(org.eclipse.birt.report.model.core.Module module)
Constructs a element factory with the given module.

Parameters:
module - the module
Method Detail

newElement

public DesignElementHandle newElement(java.lang.String elementTypeName,
                                      java.lang.String name)
Creates a design element specified by the element type name. Element type names are defined in rom.def or extension elements. They are managed by the meta-data system.

Parameters:
elementTypeName - the element type name
name - the optional element name
Returns:
design element, null returned if the element definition name is not a valid element type name.

newFreeForm

public FreeFormHandle newFreeForm(java.lang.String name)
Creates a new free-form item.

Parameters:
name - the optional free-form name. Can be null.
Returns:
a handle to the free-form

newDataItem

public DataItemHandle newDataItem(java.lang.String name)
Creates a new data item.

Parameters:
name - the optional data item name. Can be null.
Returns:
a handle to the data item

newLabel

public LabelHandle newLabel(java.lang.String name)
Creates a new label item.

Parameters:
name - the optional label name. Can be null.
Returns:
a handle to the label

newImage

public ImageHandle newImage(java.lang.String name)
Creates a new image item.

Parameters:
name - the optional image name. Can be null.
Returns:
a handle to the image

newListGroup

public ListGroupHandle newListGroup()
Creates a new list group element. List groups cannot have a name.

Returns:
a handle to the list group

newList

public ListHandle newList(java.lang.String name)
Creates a new list item.

Parameters:
name - the optional list name. Can be null.
Returns:
a handle to the list

newGraphicMasterPage

public GraphicMasterPageHandle newGraphicMasterPage(java.lang.String name)
Creates a new graphic master page element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required graphic master page name
Returns:
a handle to the graphic master page

newSimpleMasterPage

public SimpleMasterPageHandle newSimpleMasterPage(java.lang.String name)
Creates a new simple master page element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the requirement simple master page name
Returns:
a handle to the simple master page.

newParameterGroup

public ParameterGroupHandle newParameterGroup(java.lang.String name)
Creates a new parameter group element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the optional parameter group name. Can be null.
Returns:
a handle to the parameter group

newCascadingParameterGroup

public CascadingParameterGroupHandle newCascadingParameterGroup(java.lang.String name)
Creates a new parameter group element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the optional parameter group name. Can be null.
Returns:
a handle to the parameter group

newScalarParameter

public ScalarParameterHandle newScalarParameter(java.lang.String name)
Creates a new scalar parameter element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required scalar parameter name
Returns:
a handle to the scalar parameter

newStyle

public SharedStyleHandle newStyle(java.lang.String name)
Creates a new style element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required style name
Returns:
a handle to the style

newTextItem

public TextItemHandle newTextItem(java.lang.String name)
Creates a new text item.

Parameters:
name - the optional text item name. Can be null.
Returns:
a handle to the text item

newTableItem

public TableHandle newTableItem(java.lang.String name)
Creates a new table item.

Parameters:
name - the optional table item name. Can be null.
Returns:
a handle to the table item

newTableItem

public TableHandle newTableItem(java.lang.String name,
                                int columnNum)
Creates a new table item with the given name and given column number. The table will have one row for each band(header, footer, detail). Each row in band will be filled with cells, number of cells is equal to the specified column number.

It has the same effect by calling: newTableItem( name, columnNum, 1, 1, 1 ).

Parameters:
name - the optional table item name
columnNum - column number of the table, if it is less than 0, then column won't be defined for the table at this stage.
Returns:
A handle to the table item.
See Also:
newTableItem(String, int, int, int, int)

newTableItem

public TableHandle newTableItem(java.lang.String name,
                                int columnNum,
                                int headerRow,
                                int detailRow,
                                int footerRow)
Creates a new table item with the given name and given column number. The table will have given number of rows for each band(header, footer, detail). Each row in band will be filled with cells, number of cells is equal to the specified column number.

Parameters:
name - the optional table item name
columnNum - column number of the table, if it is less than 0, then column won't be defined for the table at this stage.
headerRow - number of rows that will be added for header band. If it is less than 0, none row will be added to header band.
detailRow - number of rows that will be added for detail band. If it is less than 0, none row will be added to detail band.
footerRow - number of rows that will be added for footer band. If it is less than 0, none row will be added to footer band.
Returns:
A handle to the table item.

newTableGroup

public TableGroupHandle newTableGroup()
Creates a new table group element. Table groups cannot have a name.

Returns:
a handle to the table group

newTableColumn

public ColumnHandle newTableColumn()
Creates a new column element. Columns cannot have a name.

Returns:
a handle to the column

newTableRow

public RowHandle newTableRow()
Creates a new row element. Rows cannot have a name.

Returns:
a handle to the row

newTableRow

public RowHandle newTableRow(int cellNum)
Creates a new table row, filled the row with the given number of cells.

Parameters:
cellNum - Number of cells to be added to the row.
Returns:
a new table row.

newCell

public CellHandle newCell()
Creates a new cell element. Cells cannot have a name.

Returns:
a handle to the cell

newGridItem

public GridHandle newGridItem(java.lang.String name)
Creates a new grid item.

Parameters:
name - the optional grid item name. Can be null.
Returns:
a handle to the grid item

newGridItem

public GridHandle newGridItem(java.lang.String name,
                              int columnNum,
                              int rowNum)
Creates a new grid item with pre-defined columns and rows.

Parameters:
name - the optional grid item name.
columnNum - column number of the grid. If it is less than 0, none column will be added.
rowNum - row number of the grid. If it is less than 0, none row will be added.
Returns:
a handle to the grid item

newLineItem

public LineHandle newLineItem(java.lang.String name)
Creates a new line item.

Parameters:
name - the optional line item name. Can be null.
Returns:
a handle to the line item

newRectangle

public RectangleHandle newRectangle(java.lang.String name)
Creates a new rectangle.

Parameters:
name - the optional rectangle name. Can be null.
Returns:
a handle to rectangle

newTextData

public TextDataHandle newTextData(java.lang.String name)
Creates a new multi line data item.

Parameters:
name - the optional multi line data name. Can be null.
Returns:
a handle to multi line data item

newExtendedItem

public ExtendedItemHandle newExtendedItem(java.lang.String name,
                                          java.lang.String extensionName)
Creates a new extended item.

Parameters:
name - the optional extended item name. Can be null.
extensionName - the required extension name
Returns:
a handle to extended item, return null if the definition with the given extension name is not found

newScriptDataSource

public ScriptDataSourceHandle newScriptDataSource(java.lang.String name)
Creates a new script data source.

Parameters:
name - the required script data source name.
Returns:
a handle to script data source

newScriptDataSet

public ScriptDataSetHandle newScriptDataSet(java.lang.String name)
Creates a new script data set. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required script data set name.
Returns:
a handle to script data set

newOdaDataSource

public OdaDataSourceHandle newOdaDataSource(java.lang.String name)
Deprecated. see newOdaDataSource( String name, String extensionID )

Creates a new oda data source. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required oda data source name.
Returns:
a handle to oda data source

newOdaDataSource

public OdaDataSourceHandle newOdaDataSource(java.lang.String name,
                                            java.lang.String extensionID)
Creates a new oda data source. The name is required. If the name is null, we will make a unique name for it.The extensionID is used to find the extension definition.If the extension ID is not given, the oda data source will be created without extension. If the unknown extension ID is given, null will be returned.

Parameters:
name - the required oda data source name.
extensionID - the extension ID
Returns:
a handle to oda data source

newOdaDataSet

public OdaDataSetHandle newOdaDataSet(java.lang.String name)
Deprecated. see newOdaDataSet( String name, String extensionID )

Creates a new oda data set. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the required oda data set name.
Returns:
a handle to oda data set

newOdaDataSet

public OdaDataSetHandle newOdaDataSet(java.lang.String name,
                                      java.lang.String extensionID)
Creates a new oda data set. The name is required. If the name is null, we will make a unique name for it. The extensionID is used to find the extension definition.If the extension ID is not given, the oda data source will be created without extension. If the unknown extension ID is given, null will be returned.

Parameters:
name - the required oda data set name.
extensionID - the extension ID
Returns:
a handle to oda data set

newElementFrom

public DesignElementHandle newElementFrom(DesignElementHandle baseElement,
                                          java.lang.String name)
                                   throws ExtendsException
Creates one new element based on the given element. The new element will extends the given one. The element must be extendable.

Parameters:
baseElement - the base element.
name - the optional new element name
Returns:
the handle to the new element.
Throws:
ExtendsException - if the the base element is in a library that is not included in this module, or if the "extends" relationship is illegal

newTheme

public ThemeHandle newTheme(java.lang.String name)
Creates a new theme element. The name is required. If the name is null, we will make a unique name for it.

Parameters:
name - the theme item name.
Returns:
a handle to the theme item


Copyright © 2005 Actuate Corp. All rights reserved.