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

# Class ReportItem

java.lang.Object
org.eclipse.birt.report.model.api.extension.ReportItem

All Implemented Interfaces:
  `Cloneable`, `ICompatibleReportItem`, `IReportItem`

public class ReportItem extends Object implements IReportItem, ICompatibleReportItem, Cloneable
Extension adapter class for the IReportItem. By default, the report item will have no model. Therefore, it has no model properties and all the related method will do nothing or return null.

## Constructor Summary

Constructors
Constructor
Description
`ReportItem()`

## Method Summary

Modifier and Type
Method
Description
`Iterator`
`availableBindings()`
Gets the iterator of all available bindings.
`boolean`
`canExport()`
Indicates whether the report item can be allowed to export to library.
`CompatibilityStatus`
`checkCompatibility()`
Checks the parser compatibilities for this report item and return the status.
`void`
`checkProperty(String propName, Object value)`
Checks the value of a property prior to setting it.
`IReportItem`
`copy()`
Creates deep copy of the IReportItem and return the new element.
`void`
`deserialize(String propName, ByteArrayInputStream data)`
Deserializes the model.
`IPropertyDefinition[]`
`getMethods()`
Returns the method definition list of extension elements.
`IMethodInfo[]`
`getMethods(String methodName)`
Returns the method info list of extension elements.
`List`
`getPredefinedStyles()`
Gets list of the predefined styles.
`Object`
`getProperty(String propName)`
Returns the value of a public property.
`IPropertyDefinition[]`
`getPropertyDefinitions()`
Gets the list of all the property definitions that the extended element model has.
`StyleHandle[]`
`getReferencedStyle()`
`List`
`getRowExpressions()`
Returns a list containing the possible JavaScript expressions.
`IPropertyDefinition`
`getScriptPropertyDefinition()`
Gets the script property definition of this report item.
`IReportItem`
`getSimpleElement()`
Returns the interface for script operations.
`void`
`handleCompatibilityIssue()`
handle the compatibility issue
`boolean`
`hasFixedSize()`
Indicates whether the report item has fixed size.
`boolean`
`refreshPropertyDefinition()`
Justifies whether the property list of the extended element is changed.
`ByteArrayOutputStream`
`serialize(String propName)`
Serializes the model given the property name.
`void`
`setHandle(ExtendedItemHandle handle)`
Sets the handle of this report item.
`void`
`setProperty(String propName, Object value)`
Sets the value of a property.
`void`
`updateRowExpressions(Map newExpressions)`
Updates existed expression with the given expressions.
`void`
`updateStyleReference(Map<String,String> styleMap)`
`List<SemanticException>`
`validate()`
Performs a semantic check on the report item.

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

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

## Constructor Details

### ReportItem

public ReportItem()

## Method Details

### serialize

public ByteArrayOutputStream serialize(String propName)
Description copied from interface: `IReportItem`
Serializes the model given the property name. The property is visible to BIRT and its type is `XMLPropertyType`. The serialized data must be Unicode text. XML is preferred, but any text format is legal. If the model is binary, then one solution is to serialize the model as Base64 encoded data.

Specified by:
  `serialize` in interface `IReportItem`
Parameters:
  `propName` - the model property name to serialize
Returns:
  a byte array that represents the serialized extended element model.

### deserialize

public void deserialize(String propName, ByteArrayInputStream data) throws ExtendedElementException
Description copied from interface: `IReportItem`
Deserializes the model. The property is visible to BIRT and its type is `XMLPropertyType`. The data provided will be that created by the `serialize` method. A well-written extension will handle two exceptional cases. First, it will handle all previous versions of this same extension. Second, it will handle erroneous input, perhaps created when a human editied the saved state by hand.

Specified by:
  `deserialize` in interface `IReportItem`
Parameters:
  `propName` - the model property name to deserialize
  `data` - a byte array stream containing the serialized data
Throws:
  `ExtendedElementException` - if the serialized model is invalid

### getPropertyDefinitions

public IPropertyDefinition[] getPropertyDefinitions()
Description copied from interface: `IReportItem`
Gets the list of all the property definitions that the extended element model has.

Specified by:
  `getPropertyDefinitions` in interface `IReportItem`
Returns:
  the dynamic property list of the extended element model

### getProperty

public Object getProperty(String propName)
Description copied from interface: `IReportItem`
Returns the value of a public property. Returns null if the property is not defined. If the `IReportItemFactory` class defines a property, then this method must accept that property name.

Property names can be separated with dots and can include array indexes. For example: barColors[1].pattern. This will occur if a property is defined as a list or structure.

If the report element support styles or inheritance, then a return value of `null` means that the value should be inherited. BIRT will use its normal inheritance mechanisms to locate the value. If the extended element does not support inheritance or styles, then this method must return the value of each property, including defaults if the value has not yet been set.

Specified by:
  `getProperty` in interface `IReportItem`
Parameters:
  `propName` - the name of the property to get
Returns:
  the property value as one of the supported BIRT property types: String, Integer, Double, BigDecimal, etc.

### checkProperty

public void checkProperty(String propName, Object value) throws ExtendedElementException
Description copied from interface: `IReportItem`
Checks the value of a property prior to setting it. BIRT calls this operation before setting the value. See the `setProperty` method for details on the process for setting a property value.

Specified by:
  `checkProperty` in interface `IReportItem`
Parameters:
  `propName` - the name of the property to check
  `value` - the new property value as one of the supported BIRT types
Throws:
  `ExtendedElementException` - if the property value is invalid or the property name is invalid
See Also:
  - `IReportItem.getProperty(java.lang.String)`

### setProperty

public void setProperty(String propName, Object value)
Description copied from interface: `IReportItem`
Sets the value of a property. This operation is done in response to a BIRT-defined command. That is, this method call is the result of an application using the BIRT Model API to set a property. BIRT will have validated the property using the `checkProperty` method, and will have created a command to set the property.

If this element supports styles or inheritance, then the value can be `null`, which means to clear the property value so that it will inherit from the base element or the style.

Specified by:
  `setProperty` in interface `IReportItem`
Parameters:
  `propName` - the name of the property to set
  `value` - the new property value as one of the supported BIRT types
See Also:
  - `IReportItem.getProperty(java.lang.String)`
  - `IReportItem.checkProperty(java.lang.String, java.lang.Object)`

### validate

public List<SemanticException> validate()
Description copied from interface: `IReportItem`
Performs a semantic check on the report item. The extended element can use this to validate the values of properties, to ensure that a set of values are consistent, etc.

Specified by:
  `validate` in interface `IReportItem`
Returns:
  List List contains ExtendedElementException.

### copy

public IReportItem copy()
Description copied from interface: `IReportItem`
Creates deep copy of the IReportItem and return the new element.

Specified by:
  `copy` in interface `IReportItem`
Returns:
  the deep copied IReportItem

### refreshPropertyDefinition

public boolean refreshPropertyDefinition()
Description copied from interface: `IReportItem`
Justifies whether the property list of the extended element is changed.

Specified by:
  `refreshPropertyDefinition` in interface `IReportItem`
Returns:
  true if the property list of the extended element is changed, otherwise false

### getMethods

public IPropertyDefinition[] getMethods()
Description copied from interface: `IReportItem`
Returns the method definition list of extension elements. Each object in the list is instance of `IElementPropertyDefn`.

Specified by:
  `getMethods` in interface `IReportItem`
Returns:
  the method definition list.

### getScriptPropertyDefinition

public IPropertyDefinition getScriptPropertyDefinition()
Description copied from interface: `IReportItem`
Gets the script property definition of this report item.

Specified by:
  `getScriptPropertyDefinition` in interface `IReportItem`
Returns:
  the script property definition of this report item

### getSimpleElement

public IReportItem getSimpleElement()
Description copied from interface: `IReportItem`
Returns the interface for script operations. If the extension element want to provide multi row data function, need to extend simpleapi.IMultiRowItem and extension.MultiRowItem; If not, need to extend simpleapi.IReportItem and extension.SimpleRowItem.

Specified by:
  `getSimpleElement` in interface `IReportItem`
Returns:
  the simple interface

### getPredefinedStyles

public List getPredefinedStyles()
Description copied from interface: `IReportItem`
Gets list of the predefined styles. Each one in the list can be one of the following instance:

<ui>

`String`
`IStyleDeclaration` </ui>

Specified by:
  `getPredefinedStyles` in interface `IReportItem`
Returns:

- ### getMethods

  public IMethodInfo[] getMethods(String methodName)
  Description copied from interface: `IReportItem`
  Returns the method info list of extension elements. Each object in the list is instance of `IMethodInfo`.
  Specified by:
    `getMethods` in interface `IReportItem`
  Parameters:
    `methodName` - the method name
  Returns:
    the method definition list.

- ### checkCompatibility

  public CompatibilityStatus checkCompatibility()
  Description copied from interface: `ICompatibleReportItem`
  Checks the parser compatibilities for this report item and return the status.
  Specified by:
    `checkCompatibility` in interface `ICompatibleReportItem`
  Returns:
    the compatibility status.

- ### getRowExpressions

  public List getRowExpressions()
  Description copied from interface: `ICompatibleReportItem`
  Returns a list containing the possible JavaScript expressions. During parsing the design file, this method is automatically called to add bound data columns so that the design file before BIRT 2.1.0 can be compatible with BIRT 2.1.0 or later.
  Specified by:
    `getRowExpressions` in interface `ICompatibleReportItem`
  Returns:
    a list containing the possible expressions.

- ### updateRowExpressions

  public void updateRowExpressions(Map newExpressions)
  Description copied from interface: `ICompatibleReportItem`
  Updates existed expression with the given expressions. The keys in `newExpressions` are existed expressions, while, the values are the new expressions to replace existed ones.
  Specified by:
    `updateRowExpressions` in interface `ICompatibleReportItem`
  Parameters:
    `newExpressions` - a map containing the updated expressions.

- ### setHandle

  public void setHandle(ExtendedItemHandle handle)
  Description copied from interface: `IReportItem`
  Sets the handle of this report item.
  Specified by:
    `setHandle` in interface `IReportItem`
  Parameters:
    `handle` - extended item handle

- ### canExport

  public boolean canExport()
  Description copied from interface: `IReportItem`
  Indicates whether the report item can be allowed to export to library.
  Specified by:
    `canExport` in interface `IReportItem`
  Returns:
    `true` if the report item can be allowed to export to library; `false` otherwise.

- ### availableBindings

  public Iterator availableBindings()
  Description copied from interface: `IReportItem`
  Gets the iterator of all available bindings.
  Specified by:
    `availableBindings` in interface `IReportItem`
  Returns:
    the iterator

- ### getReferencedStyle

  public StyleHandle[] getReferencedStyle()
  Specified by:
    `getReferencedStyle` in interface `IReportItem`

- ### updateStyleReference

  public void updateStyleReference(Map<String,String> styleMap)
  Specified by:
    `updateStyleReference` in interface `IReportItem`

- ### handleCompatibilityIssue

  public void handleCompatibilityIssue()
  Description copied from interface: `ICompatibleReportItem`
  handle the compatibility issue
  Specified by:
    `handleCompatibilityIssue` in interface `ICompatibleReportItem`

- ### hasFixedSize

  public boolean hasFixedSize()
  Description copied from interface: `IReportItem`
  Indicates whether the report item has fixed size.
  Specified by:
    `hasFixedSize` in interface `IReportItem`
  Returns: