Package org.eclipse.birt.chart.device

# Interface IDisplayServer

All Known Implementing Classes:
  `DisplayAdapter`

public interface IDisplayServer
Provides generic services to a device renderer for computing metrics and centralized creation of device specific resources. This class is analogus to an X server interface associated with a device.

## 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.
`Locale`
`getLocale()`
Deprecated.
use `getULocale()` instead.
`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
`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 o)`
Log creation of a resource for which leaks are to be tracked
`void`
`setDpiResolution(int dpi)`
Sets the dpi resolution.
`void`
`setGraphicsContext(Object graphicsContext)`
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
`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.

## Method Details

### debug

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. Once this method is invoked, all entries written into the log should be flushed.

### logCreation

void logCreation(Object o)
Log creation of a resource for which leaks are to be tracked

Parameters:
  `o` - A device-specific object being created

### createFont

Object createFont(FontDefinition fd)
Attempts to create a new font resource associated with a specific device for use in rendering or computations

Parameters:
  `fd` - An font description for which a device specific resource is being requested
Returns:
  A device specific font

### getColor

Object getColor(ColorDefinition cd)
Attempts to create a new color resource associated with a specific device

Parameters:
  `cd` - A color description for which a device specific resource is being requested
Returns:
  A device specific color

### getDpiResolution

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.

Returns:
  The integral dots per inch associated with the device

### setDpiResolution

void setDpiResolution(int dpi)
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.

Parameters:
  `dpi` - The number of dots per inch

### loadImage

Object loadImage(URL url) throws ChartException
Attempts to use device specific libraries to load an image for use with the device renderer

Parameters:
  `url` - The URL associated with the image location
Returns:
  An instance of an image associated with the specified URL
Throws:
  `ChartException`

### getSize

Size getSize(Object oImage)
Returns the size(width, height) of the device specific image that was previously loaded by the `loadImage(URL)` method

Parameters:
  `oImage` - The image for which the size is being requested
Returns:
  The size of the image

### getObserver

Object getObserver()
An observer is typically associated with certain device types to aid in image loading and image metadata retrieval.

Returns:
  An image observer associated with a specific device renderer

### getTextMetrics

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

Parameters:
  `la` - The Label instance for which text metrics are being requested
Returns:
  Text metrics associated with the specified Label instance

### getTextMetrics

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

Parameters:
  `la` - The Label instance for which text metrics are being requested
  `autoReuse` -
Returns:
  Text metrics associated with the specified Label instance

### getLocale

@Deprecated Locale getLocale()
Deprecated.
use `getULocale()` instead.
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.

Returns:
  locale

### getULocale

com.ibm.icu.util.ULocale getULocale()
Provides the locale to display server implementations as needed to retrieve localized resources for presentation.

Returns:
  ulocale
Since:
  2.1

### dispose

void dispose()
A notification sent to the device to free all allocated system resources.

Since:
  2.2

### setGraphicsContext

void setGraphicsContext(Object graphicsContext)
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

Parameters:
  `graphicContext` -
Since:
  2.3

### setResourceFinder

void setResourceFinder(IResourceFinder resourceFinder)
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.

Parameters:
  `resourceFinder` -

### setLocale

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

Parameters:
  `lcl` - The locale to be set