Package org.eclipse.birt.report.engine.extension

# Interface IReportItemPresentation

public interface IReportItemPresentation
Represents the extended item presentation time extension. The calling sequence in presentation engine might work as follows:

- Design engine creates a new instance of the extended item.
- Presentation engine detects that the element is an extended item. It dynamically creates an object with type IReportItemPresentation.
- The presentation engine calls various setXXX methods to pass initialization parameters to the extension implementation.
- deserialize method restores the generation time state
- Render the extended item through onRowSets method, handled the returned image
- Call finish() for cleanup.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`OUTPUT_AS_CUSTOM`
`static final int`
`OUTPUT_AS_DRAWING`
`static final int`
`OUTPUT_AS_HTML_TEXT`
`static final int`
`OUTPUT_AS_IMAGE`
`static final int`
`OUTPUT_AS_IMAGE_WITH_MAP`
`static final int`
`OUTPUT_AS_TEXT`
`static final int`
`OUTPUT_AS_UNKNOWN`
`static final int`
`OUTPUT_NONE`

## Method Summary

Modifier and Type
Method
Description
`void`
`deserialize(InputStream istream)`
deserializes generation time state information about the extended item
`void`
`finish()`
Performs clean up work
`String`
`getImageMIMEType()`
`int`
`getOutputType()`
returns the output type, which could be IMAGE, TEXT, HTML TEXT, DRAWING, etc.
`IReportItemPresentationInfo`
`getPresentationConfig()`
`org.eclipse.birt.report.engine.extension.Size`
`getSize()`
Get the size of the extended item.
`void`
`init(IReportItemPresentationInfo info)`
`boolean`
`isCacheable()`
Check if can support cache in current situation.
`Object`
`onRowSets(IBaseResultSet[] results)`
Process the extended item.
`Object`
`onRowSets(IRowSet[] rowSets)`
Deprecated.
since BIRT 2.3
`void`
`setActionHandler(IHTMLActionHandler ah)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setApplicationClassLoader(ClassLoader loader)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setDynamicStyle(IStyle style)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setExtendedItemContent(IContent content)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setLocale(Locale locale)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setModelObject(org.eclipse.birt.report.model.api.ExtendedItemHandle modelHandle)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead
`void`
`setOutputFormat(String outputFormat)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setReportQueries(org.eclipse.birt.data.engine.api.IDataQueryDefinition[] queries)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setResolution(int dpi)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setScriptContext(org.eclipse.birt.report.engine.api.script.IReportContext context)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
`void`
`setSupportedImageFormats(String supportedImageFormats)`
Deprecated.
implement #init(IReportItemPresentationInfo) instead.

## Field Details

### OUTPUT_NONE

static final int OUTPUT_NONE

See Also:
  - Constant Field Values

### OUTPUT_AS_IMAGE

static final int OUTPUT_AS_IMAGE

See Also:
  - Constant Field Values

### OUTPUT_AS_TEXT

static final int OUTPUT_AS_TEXT

See Also:
  - Constant Field Values

### OUTPUT_AS_HTML_TEXT

static final int OUTPUT_AS_HTML_TEXT

See Also:
  - Constant Field Values

### OUTPUT_AS_DRAWING

static final int OUTPUT_AS_DRAWING

See Also:
  - Constant Field Values

### OUTPUT_AS_CUSTOM

static final int OUTPUT_AS_CUSTOM

See Also:
  - Constant Field Values

### OUTPUT_AS_IMAGE_WITH_MAP

static final int OUTPUT_AS_IMAGE_WITH_MAP

See Also:
  - Constant Field Values

### OUTPUT_AS_UNKNOWN

static final int OUTPUT_AS_UNKNOWN

See Also:
  - Constant Field Values

## Method Details

### init

void init(IReportItemPresentationInfo info)

Parameters:
  `info` - Presentation info of report item
Since:
  BIRT 2.3

### setModelObject

@Deprecated void setModelObject(org.eclipse.birt.report.model.api.ExtendedItemHandle modelHandle)
Deprecated.
implement #init(IReportItemPresentationInfo) instead
passes a handle to the extended report item model to the extension

Parameters:
  `modelHandle` - a handle to the extended item model object

### setApplicationClassLoader

@Deprecated void setApplicationClassLoader(ClassLoader loader)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
passes the class loader used to load user defined classes.

Parameters:
  `loader` - class loader used to load the classes

### setScriptContext

@Deprecated void setScriptContext(org.eclipse.birt.report.engine.api.script.IReportContext context)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
pass the script context to the report item.

Parameters:
  `context` - report context used by java-based script

### setReportQueries

@Deprecated void setReportQueries(org.eclipse.birt.data.engine.api.IDataQueryDefinition[] queries)
Deprecated.
implement #init(IReportItemPresentationInfo) instead. pass the prepared query definition to extended item implementation, so that it can access data.

### setLocale

@Deprecated void setLocale(Locale locale)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
passes the locale used in the presentation.

Parameters:
  `locale` - locale

### setResolution

@Deprecated void setResolution(int dpi)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
passes the dpi (dot per inch) from the rendering environment to the extension. Mostly used for printing.

Parameters:
  `dpi` - the dpi of the rendering environment

### setOutputFormat

@Deprecated void setOutputFormat(String outputFormat)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
sets the output format, i.e., HTML, PDF, etc.

Parameters:
  `outputFormat` - the output format, i.e., html, pdf, etc.

### setActionHandler

@Deprecated void setActionHandler(IHTMLActionHandler ah)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.

Parameters:
  `ah` - the HTML action handler used to create a URL based on an action

### getImageMIMEType

String getImageMIMEType()

Returns:
  the image MIME type (e.g. "image/svg+xml")

### setSupportedImageFormats

@Deprecated void setSupportedImageFormats(String supportedImageFormats)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
sets the image formats that are supported for this output format. Formats are separated by semi-colon. For example, the argument could be JPG;PNG;BMP;SVG

Parameters:
  `supportedImageFormats` - the image formats that the presentation engine could support.

### deserialize

void deserialize(InputStream istream)
deserializes generation time state information about the extended item

Parameters:
  `istream` - the input stream to deserialize generation time state from

### getOutputType

int getOutputType()
returns the output type, which could be IMAGE, TEXT, HTML TEXT, DRAWING, etc. For now, only Image is supported.

Parameters:
  `mimeType` - an out parameter that returns the MIME type of the output
Returns:
  output type, for now OUTPUT_AS_IMAGE only

### onRowSets

@Deprecated Object onRowSets(IRowSet[] rowSets) throws org.eclipse.birt.core.exception.BirtException
Deprecated.
since BIRT 2.3
processes the extended item in report presentation environment.

Parameters:
  `rowSets` - rowSets an array of row sets that is passed to the extension
Returns:
  the returned value could be different depending on the type of the output. For image, returns an input stream or byte array that the engine could retrieve data from
Throws:
  `org.eclipse.birt.core.exception.BirtException` - throws exception when there is a problem processing the extended item

### onRowSets

Object onRowSets(IBaseResultSet[] results) throws org.eclipse.birt.core.exception.BirtException
Process the extended item. It is called in render time.

Parameters:
  `results` - results is an array of query results which is passed to the extended item. The extended item could retrieve data from those results.
Returns:
  The returned value could be different depending on the type of the output. For image, returns an input stream or byte array.
Throws:
  `org.eclipse.birt.core.exception.BirtException` - Throws exception when there is a problem processing the extended item

### getSize

org.eclipse.birt.report.engine.extension.Size getSize()
Get the size of the extended item. The size is a Dimension object. The width and height can only be in absolute units (inch, mm, etc.) or pixel. It can not be a relative size such as 150% or 1.2em. Notice that an extended item can obtain its design-time size information by querying DE. This function is needed because the actual size may not be the same as the design-time size.

Returns:
  the size of the extended item. Return null if the size does not matter or can not be determined.

### finish

void finish()
Performs clean up work

### setDynamicStyle

@Deprecated void setDynamicStyle(IStyle style)
Deprecated.
implement #init(IReportItemPresentationInfo) instead. Set dynamic style.

### setExtendedItemContent

@Deprecated void setExtendedItemContent(IContent content)
Deprecated.
implement #init(IReportItemPresentationInfo) instead.
Set the content which is transformed from extended item. Extended item can process some properties itself, such as bookmark, style etc.

Parameters:
  `content` - content which is transformed from extended item.

### getPresentationConfig

IReportItemPresentationInfo getPresentationConfig()

### isCacheable

boolean isCacheable()
Check if can support cache in current situation. For example, the chart image is can't cached when export to some format and some property of chart is changed(e.g. by script), such as height, width etc.

Returns:
  true if can support cache, otherwise false