Package org.eclipse.birt.chart.device

# Class DisplayAdapter

java.lang.Object
org.eclipse.birt.chart.device.DisplayAdapter

All Implemented Interfaces:
  `IDisplayServer`

public class DisplayAdapter extends Object implements IDisplayServer
A no-op adapter implementation for the `IDisplayServer`interface definition.

## Constructor Summary

Constructors
Constructor
Description
`DisplayAdapter()`

## Method Summary

Modifier and Type
Method
Description
`Object`
`createFont(FontDefinition fd)`
Attempts to create a new font resource associated with a specific device for use in rendering or computations
`void`
`debug()`
Lists out all resources that were previously logged explicitly by the `logCreation(Object)` method or those internally created by each of the resource creation methods.
`void`
`dispose()`
A notification sent to the device to free all allocated system resources.
`Object`
`getColor(ColorDefinition cd)`
Attempts to create a new color resource associated with a specific device
`int`
`getDpiResolution()`
Returns the resolution of the device in dots per inch As an example, for a display screen, the dots correspond to pixels and a typical value for a Win32 OS is 96 DPI.
`final Locale`
`getLocale()`
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.
`Object`
`getObserver()`
An observer is typically associated with certain device types to aid in image loading and image metadata retrieval.
`Size`
`getSize(Object oImage)`
Returns the size(width, height) of the device specific image that was previously loaded by the `loadImage(URL)` method
`ITextMetrics`
`getTextMetrics(Label la)`
An instance of a text metrics computation class capable of providing text metric information associated with a given Label to aid in typically computing the size of rendered text
`ITextMetrics`
`getTextMetrics(Label la, boolean autoReuse)`
An instance of a text metrics computation class capable of providing text metric information associated with a given Label to aid in typically computing the size of rendered text
`final com.ibm.icu.util.ULocale`
`getULocale()`
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.
`Object`
`loadImage(URL url)`
Attempts to use device specific libraries to load an image for use with the device renderer
`void`
`logCreation(Object oMisc)`
Log creation of a resource for which leaks are to be tracked
`void`
`setDpiResolution(int dpi)`
Sets the dpi resolution.
`void`
`setGraphicsContext(Object graphicContext)`
Set the graphic context on the device renderer, which is required for font computations (SWT uses org.eclipse.swt.graphics.GC and Swing uses java.awt.Graphics2D) It is the responsibility of the caller to dispose the Graphics Context
`final void`
`setLocale(com.ibm.icu.util.ULocale lcl)`
A convenience method provided to associate a locale with a display server
`void`
`setResourceFinder(IResourceFinder resourceFinder)`
Set the resource finder, which will be used by loading image.

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

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

## Constructor Details

### DisplayAdapter

public DisplayAdapter()

## Method Details

### debug

public void debug()
Description copied from interface: `IDisplayServer`
Lists out all resources that were previously logged explicitly by the `logCreation(Object)` method or those internally created by each of the resource creation methods. Once this method is invoked, all entries written into the log should be flushed.

Specified by:
  `debug` in interface `IDisplayServer`

### logCreation

public void logCreation(Object oMisc)
Description copied from interface: `IDisplayServer`
Log creation of a resource for which leaks are to be tracked

Specified by:
  `logCreation` in interface `IDisplayServer`
Parameters:
  `oMisc` - A device-specific object being created

### createFont

public Object createFont(FontDefinition fd)
Description copied from interface: `IDisplayServer`
Attempts to create a new font resource associated with a specific device for use in rendering or computations

Specified by:
  `createFont` in interface `IDisplayServer`
Parameters:
  `fd` - An font description for which a device specific resource is being requested
Returns:
  A device specific font

### getColor

public Object getColor(ColorDefinition cd)
Description copied from interface: `IDisplayServer`
Attempts to create a new color resource associated with a specific device

Specified by:
  `getColor` in interface `IDisplayServer`
Parameters:
  `cd` - A color description for which a device specific resource is being requested
Returns:
  A device specific color

### getDpiResolution

public int getDpiResolution()
Description copied from interface: `IDisplayServer`
Returns the resolution of the device in dots per inch As an example, for a display screen, the dots correspond to pixels and a typical value for a Win32 OS is 96 DPI.

Specified by:
  `getDpiResolution` in interface `IDisplayServer`
Returns:
  The integral dots per inch associated with the device

### setDpiResolution

public void setDpiResolution(int dpi)
Description copied from interface: `IDisplayServer`
Sets the dpi resolution. This defines how many dots per inch to use for rendering the chart. This is optional, the display server will compute the default dpi resolution of the display where the chart is rendered. It is mostly intended to be used for creating high resolution images.

Specified by:
  `setDpiResolution` in interface `IDisplayServer`
Parameters:
  `dpi` - The number of dots per inch

### loadImage

public Object loadImage(URL url) throws ChartException
Description copied from interface: `IDisplayServer`
Attempts to use device specific libraries to load an image for use with the device renderer

Specified by:
  `loadImage` in interface `IDisplayServer`
Parameters:
  `url` - The URL associated with the image location
Returns:
  An instance of an image associated with the specified URL
Throws:
  `ChartException`

### getSize

public Size getSize(Object oImage)
Description copied from interface: `IDisplayServer`
Returns the size(width, height) of the device specific image that was previously loaded by the `loadImage(URL)` method

Specified by:
  `getSize` in interface `IDisplayServer`
Parameters:
  `oImage` - The image for which the size is being requested
Returns:
  The size of the image

### getObserver

public Object getObserver()
Description copied from interface: `IDisplayServer`
An observer is typically associated with certain device types to aid in image loading and image metadata retrieval.

Specified by:
  `getObserver` in interface `IDisplayServer`
Returns:
  An image observer associated with a specific device renderer

### getTextMetrics

public ITextMetrics getTextMetrics(Label la)
Description copied from interface: `IDisplayServer`
An instance of a text metrics computation class capable of providing text metric information associated with a given Label to aid in typically computing the size of rendered text

Specified by:
  `getTextMetrics` in interface `IDisplayServer`
Parameters:
  `la` - The Label instance for which text metrics are being requested
Returns:
  Text metrics associated with the specified Label instance

### getLocale

public final Locale getLocale()
Description copied from interface: `IDisplayServer`
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.

Specified by:
  `getLocale` in interface `IDisplayServer`
Returns:
  locale

### getULocale

public final com.ibm.icu.util.ULocale getULocale()
Description copied from interface: `IDisplayServer`
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.

Specified by:
  `getULocale` in interface `IDisplayServer`
Returns:
  ulocale

### setLocale

public final void setLocale(com.ibm.icu.util.ULocale lcl)
A convenience method provided to associate a locale with a display server

Specified by:
  `setLocale` in interface `IDisplayServer`
Parameters:
  `lcl` - The locale to be set

### dispose

public void dispose()
Description copied from interface: `IDisplayServer`
A notification sent to the device to free all allocated system resources.

Specified by:
  `dispose` in interface `IDisplayServer`

### setGraphicsContext

public void setGraphicsContext(Object graphicContext)
Description copied from interface: `IDisplayServer`
Set the graphic context on the device renderer, which is required for font computations (SWT uses org.eclipse.swt.graphics.GC and Swing uses java.awt.Graphics2D) It is the responsibility of the caller to dispose the Graphics Context

Specified by:
  `setGraphicsContext` in interface `IDisplayServer`

### setResourceFinder

public void setResourceFinder(IResourceFinder resourceFinder)
Description copied from interface: `IDisplayServer`
Set the resource finder, which will be used by loading image. If the chart is not running in stand alone mode, the ChartReportItemImpl will be set, which will resuse the find resource of the report engine, and feature like resource folder will be supported.

Specified by:
  `setResourceFinder` in interface `IDisplayServer`
Parameters:
  `resourceFinder` -

### getTextMetrics

public ITextMetrics getTextMetrics(Label la, boolean autoReuse)
Description copied from interface: `IDisplayServer`
An instance of a text metrics computation class capable of providing text metric information associated with a given Label to aid in typically computing the size of rendered text

Specified by:
  `getTextMetrics` in interface `IDisplayServer`
Parameters:
  `la` - The Label instance for which text metrics are being requested
  `autoReuse` -
Returns:
  Text metrics associated with the specified Label instance