Package org.eclipse.birt.report.model.api

# Class ElementFactory

java.lang.Object
org.eclipse.birt.report.model.api.ElementFactory

public class ElementFactory extends 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 `SlotHandle`class. Obtain an instance of this class by calling the `getElementFactory` method on any element handle.

See Also:
  - `SlotHandle`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final org.eclipse.birt.report.model.core.Module`
`module`
The module.

## Constructor Summary

Constructors
Constructor
Description
`ElementFactory(org.eclipse.birt.report.model.core.Module module)`
Constructs a element factory with the given module.

## Method Summary

Modifier and Type
Method
Description
`protected DesignElementHandle`
`createElementFrom(String name, DesignElementHandle baseElement)`
Creates one new element based on the given element.
`AccessControlHandle`
`newAccessControl()`
Deprecated.
`AutoTextHandle`
`newAutoText(String name)`
Creates a new specialfield item.
`CascadingParameterGroupHandle`
`newCascadingParameterGroup(String name)`
Creates a new parameter group element.
`CellHandle`
`newCell()`
Creates a new cell element.
`DataGroupHandle`
`newDataGroup()`
Creates a data group element.
`DataItemHandle`
`newDataItem(String name)`
Creates a new data item.
`DerivedDataSetHandle`
`newDerivedDataSet(String name, String extensionID)`
Creates a new derived data set.
`DynamicFilterParameterHandle`
`newDynamicFilterParameter(String name)`
Creates a new dynamic filter parameter element.
`DesignElementHandle`
`newElement(String elementTypeName, String name)`
Creates a design element specified by the element type name.
`DesignElementHandle`
`newElementFrom(DesignElementHandle baseElement, String name)`
Creates one new element based on the given element.
`ExtendedItemHandle`
`newExtendedItem(String name, String extensionName)`
Creates a new extended item.
`FilterConditionElementHandle`
`newFilterConditionElement()`
Creates a filter condition element handle.
`FreeFormHandle`
`newFreeForm(String name)`
Creates a new free-form item.
`GraphicMasterPageHandle`
`newGraphicMasterPage(String name)`
Creates a new graphic master page element.
`GridHandle`
`newGridItem(String name)`
Creates a new grid item.
`GridHandle`
`newGridItem(String name, int columnNum, int rowNum)`
Creates a new grid item with pre-defined columns and rows.
`ImageHandle`
`newImage(String name)`
Creates a new image item.
`JointDataSetHandle`
`newJointDataSet(String name)`
Creates a new joint data set.
`LabelHandle`
`newLabel(String name)`
Creates a new label item.
`LineHandle`
`newLineItem(String name)`
Creates a new line item.
`ListHandle`
`newList(String name)`
Creates a new list item.
`ListGroupHandle`
`newListGroup()`
Creates a new list group element.
`MemberValueHandle`
`newMemberValue()`
Creates a member value handle.
`MultiViewsHandle`
`newMultiView()`
Creates a multiple view element handle.
`OdaCubeHandle`
`newOdaCube(String name)`
Creates a new cube element.
`OdaDataSetHandle`
`newOdaDataSet(String name)`
Deprecated.
see `newOdaDataSet( String name, String extensionID )`
`OdaDataSetHandle`
`newOdaDataSet(String name, String extensionID)`
Creates a new oda data set.
`OdaDataSourceHandle`
`newOdaDataSource(String name)`
Deprecated.
see `newOdaDataSource( String name, String extensionID )`
`OdaDataSourceHandle`
`newOdaDataSource(String name, String extensionID)`
Creates a new oda data source.
`OdaDimensionHandle`
`newOdaDimension(String name)`
Creates a new dimension element.
`OdaHierarchyHandle`
`newOdaHierarchy(String name)`
Creates a new hierarchy element.
`OdaLevelHandle`
`newOdaLevel(String name)`
Deprecated.
replaced by `newOdaLevel(org.eclipse.birt.report.model.api.olap.DimensionHandle, String)`
`OdaLevelHandle`
`newOdaLevel(DimensionHandle dimensionHandle, String name)`
Creates a new oda level handle.
`OdaMeasureHandle`
`newOdaMeasure(String name)`
Creates a new measure element.
`OdaMeasureGroupHandle`
`newOdaMeasureGroup(String name)`
Creates a new measure group.
`ParameterGroupHandle`
`newParameterGroup(String name)`
Creates a new parameter group element.
`RectangleHandle`
`newRectangle(String name)`
Creates a new rectangle.
`ReportItemThemeHandle`
`newReportItemTheme(String name)`
Creates a new report item theme element.
`ScalarParameterHandle`
`newScalarParameter(String name)`
Creates a new scalar parameter element.
`ScriptDataSetHandle`
`newScriptDataSet(String name)`
Creates a new script data set.
`ScriptDataSourceHandle`
`newScriptDataSource(String name)`
Creates a new script data source.
`SimpleMasterPageHandle`
`newSimpleMasterPage(String name)`
Creates a new simple master page element.
`SortElementHandle`
`newSortElement()`
Creates a sort element handle.
`SharedStyleHandle`
`newStyle(String name)`
Creates a new style element.
`SharedStyleHandle`
`newStyle(AbstractThemeHandle theme, String name)`
Creates a new style element, and the style element is supposed to be adding to some theme in Library.
`ColumnHandle`
`newTableColumn()`
Creates a new column element.
`TableGroupHandle`
`newTableGroup()`
Creates a new table group element.
`TableHandle`
`newTableItem(String name)`
Creates a new table item.
`TableHandle`
`newTableItem(String name, int columnNum)`
Creates a new table item with the given name and given column number.
`TableHandle`
`newTableItem(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.
`TabularCubeHandle`
`newTabularCube(String name)`
Creates a new cube element.
`TabularDimensionHandle`
`newTabularDimension(String name)`
Creates a new dimension element.
`TabularHierarchyHandle`
`newTabularHierarchy(String name)`
Creates a new hierarchy element.
`TabularLevelHandle`
`newTabularLevel(String name)`
Deprecated.
replaced by `newTabularLevel(org.eclipse.birt.report.model.api.olap.DimensionHandle, String)`
`TabularLevelHandle`
`newTabularLevel(DimensionHandle dimensionHandle, String name)`
Creates a new level element within the given dimension handle.
`TabularMeasureHandle`
`newTabularMeasure(String name)`
Creates a new measure element.
`TabularMeasureGroupHandle`
`newTabularMeasureGroup(String name)`
Creates a new measure group.
`TextDataHandle`
`newTextData(String name)`
Creates a new multi line data item.
`TextItemHandle`
`newTextItem(String name)`
Creates a new text item.
`ThemeHandle`
`newTheme(String name)`
Creates a new theme element.
`ValueAccessControlHandle`
`newValueAccessControl()`
Deprecated.
`VariableElementHandle`
`newVariableElement()`
Deprecated.
replaced by newVariableElement( String variableName )
`VariableElementHandle`
`newVariableElement(String variableName)`
Creates a variable element and set the variable name.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### module

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

## Constructor Details

### ElementFactory

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

Parameters:
  `module` - the module

## Method Details

### newElement

public DesignElementHandle newElement(String elementTypeName, 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(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(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(String name)
Creates a new label item.

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

### newAutoText

public AutoTextHandle newAutoText(String name)
Creates a new specialfield item.

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

### newImage

public ImageHandle newImage(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(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(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(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(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(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(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

### newDynamicFilterParameter

public DynamicFilterParameterHandle newDynamicFilterParameter(String name)
Creates a new dynamic filter parameter element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the required dynamic filter parameter name
Returns:
  a handle to the dynamic filter parameter

### newStyle

public SharedStyleHandle newStyle(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

### newStyle

public SharedStyleHandle newStyle(AbstractThemeHandle theme, String name)
Creates a new style element, and the style element is supposed to be adding to some theme in Library. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `theme` - the theme to add the style
  `name` - the required style name
Returns:
  a handle to the style

### newTextItem

public TextItemHandle newTextItem(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(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(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(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(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(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(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(String name)
Creates a new rectangle.

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

### newTextData

public TextDataHandle newTextData(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(String name, 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(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(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

@Deprecated public OdaDataSourceHandle newOdaDataSource(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(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.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

@Deprecated public OdaDataSetHandle newOdaDataSet(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

### newJointDataSet

public JointDataSetHandle newJointDataSet(String name)
Creates a new joint data set. The name is required. If the `name` is null, we will make a unique name for it.

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

### newOdaDataSet

public OdaDataSetHandle 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. 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

### newDerivedDataSet

public DerivedDataSetHandle newDerivedDataSet(String name, String extensionID)
Creates a new derived data set. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the required derived data set name.
  `extensionID` - extension id
Returns:
  a handle to derived data set

### newElementFrom

public DesignElementHandle newElementFrom(DesignElementHandle baseElement, 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

### createElementFrom

protected DesignElementHandle createElementFrom(String name, DesignElementHandle baseElement) 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:
  `name` - the optional new element name
  `baseElement` - the base element
Returns:
  the handle to the new element.
Throws:
  `ExtendsException` - if the "extends" relationship is illegal

### newTheme

public ThemeHandle newTheme(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

### newReportItemTheme

public ReportItemThemeHandle newReportItemTheme(String name)
Creates a new report item theme element. The name is required. If the `name` is null, we will make a unique name for it.

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

### newTabularCube

public TabularCubeHandle newTabularCube(String name)
Creates a new cube element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the cube element name.
Returns:
  a handle to the cube element

### newTabularDimension

public TabularDimensionHandle newTabularDimension(String name)
Creates a new dimension element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the dimension name
Returns:
  a handle to the dimension element

### newTabularHierarchy

public TabularHierarchyHandle newTabularHierarchy(String name)
Creates a new hierarchy element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - hierarchy name
Returns:
  a handle to the hierarchy element

### newTabularLevel

@Deprecated public TabularLevelHandle newTabularLevel(String name)
Deprecated.
replaced by `newTabularLevel(org.eclipse.birt.report.model.api.olap.DimensionHandle, String)`
Creates a new level element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the level name
Returns:
  a handle to the level element

### newTabularLevel

public TabularLevelHandle newTabularLevel(DimensionHandle dimensionHandle, String name)
Creates a new level element within the given dimension handle. The name is required. If the `name` is null, we will make a unique name with the given dimension scope for it.

Parameters:
  `dimensionHandle` - the dimension handle where the level will be inserted
  `name` - the level name
Returns:
  a handle to the level element

### newTabularMeasure

public TabularMeasureHandle newTabularMeasure(String name)
Creates a new measure element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the measure name
Returns:
  a handle to the measure element

### newTabularMeasureGroup

public TabularMeasureGroupHandle newTabularMeasureGroup(String name)
Creates a new measure group.

Parameters:
  `name` - the optional measure group name.
Returns:
  the measure group element

### newAccessControl

@Deprecated public AccessControlHandle newAccessControl()
Deprecated.
Creates an access control element.

Returns:
  the access control element

### newValueAccessControl

@Deprecated public ValueAccessControlHandle newValueAccessControl()
Deprecated.
Creates a value access control element.

Returns:
  the value access control element

### newOdaCube

public OdaCubeHandle newOdaCube(String name)
Creates a new cube element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the cube element name.
Returns:
  a handle to the cube element

### newOdaDimension

public OdaDimensionHandle newOdaDimension(String name)
Creates a new dimension element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the dimension name
Returns:
  a handle to the dimension element

### newOdaHierarchy

public OdaHierarchyHandle newOdaHierarchy(String name)
Creates a new hierarchy element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - hierarchy name
Returns:
  a handle to the hierarchy element

### newOdaLevel

@Deprecated public OdaLevelHandle newOdaLevel(String name)
Deprecated.
replaced by `newOdaLevel(org.eclipse.birt.report.model.api.olap.DimensionHandle, String)`
Creates a new level element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the level name
Returns:
  a handle to the level element

### newOdaLevel

public OdaLevelHandle newOdaLevel(DimensionHandle dimensionHandle, String name)
Creates a new oda level handle. The name is required. If given name is null, we will make a unique name within the dimension scope for it.

Parameters:
  `dimensionHandle` - the dimension handle where the level will be inserted
  `name` - the level name
Returns:
  a handle to the level element

### newOdaMeasure

public OdaMeasureHandle newOdaMeasure(String name)
Creates a new measure element. The name is required. If the `name` is null, we will make a unique name for it.

Parameters:
  `name` - the measure name
Returns:
  a handle to the measure element

### newOdaMeasureGroup

public OdaMeasureGroupHandle newOdaMeasureGroup(String name)
Creates a new measure group.

Parameters:
  `name` - the optional measure group name.
Returns:
  the measure group element

### newMemberValue

public MemberValueHandle newMemberValue()
Creates a member value handle.

Returns:
  a handle to the member value

### newSortElement

public SortElementHandle newSortElement()
Creates a sort element handle.

Returns:
  a handle to the sort element

### newFilterConditionElement

public FilterConditionElementHandle newFilterConditionElement()
Creates a filter condition element handle.

Returns:
  a handle to the filter condition element

### newMultiView

public MultiViewsHandle newMultiView()
Creates a multiple view element handle.

Returns:
  a handle to the multiple view element

### newVariableElement

@Deprecated public VariableElementHandle newVariableElement()
Deprecated.
replaced by newVariableElement( String variableName )
Creates a variable element.

Returns:
  the variable element

### newVariableElement

public VariableElementHandle newVariableElement(String variableName)
Creates a variable element and set the variable name.

Parameters:
  `variableName` - the variable name.
Returns:
  the variable element handle.

### newDataGroup

public DataGroupHandle newDataGroup()
Creates a data group element.

Returns:
  the generated data group element