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 java.lang.Object implements IDisplayServer
A no-op adapter implementation for theIDisplayServerinterface definition.
-
-
Constructor Summary
Constructors Constructor Description DisplayAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcreateFont(FontDefinition fd)Attempts to create a new font resource associated with a specific device for use in rendering or computationsvoiddebug()Lists out all resources that were previously logged explicitly by thelogCreation(Object)method or those internally created by each of the resource creation methods.voiddispose()A notification sent to the device to free all allocated system resources.java.lang.ObjectgetColor(ColorDefinition cd)Attempts to create a new color resource associated with a specific deviceintgetDpiResolution()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.java.util.LocalegetLocale()Provides the locale to display server implementations as needed to retrieve localized resources for presentation.java.lang.ObjectgetObserver()An observer is typically associated with certain device types to aid in image loading and image metadata retrieval.SizegetSize(java.lang.Object oImage)Returns the size(width, height) of the device specific image that was previously loaded by theloadImage(URL)methodITextMetricsgetTextMetrics(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 textITextMetricsgetTextMetrics(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 textcom.ibm.icu.util.ULocalegetULocale()Provides the locale to display server implementations as needed to retrieve localized resources for presentation.java.lang.ObjectloadImage(java.net.URL url)Attempts to use device specific libraries to load an image for use with the device renderervoidlogCreation(java.lang.Object oMisc)Log creation of a resource for which leaks are to be trackedvoidsetDpiResolution(int dpi)Sets the dpi resolution.voidsetGraphicsContext(java.lang.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 ContextvoidsetLocale(com.ibm.icu.util.ULocale lcl)A convenience method provided to associate a locale with a display servervoidsetResourceFinder(IResourceFinder resourceFinder)Set the resource finder, which will be used by loading image.
-
-
-
Method Detail
-
debug
public void debug()
Description copied from interface:IDisplayServerLists out all resources that were previously logged explicitly by thelogCreation(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:
debugin interfaceIDisplayServer
-
logCreation
public void logCreation(java.lang.Object oMisc)
Description copied from interface:IDisplayServerLog creation of a resource for which leaks are to be tracked- Specified by:
logCreationin interfaceIDisplayServer- Parameters:
oMisc- A device-specific object being created
-
createFont
public java.lang.Object createFont(FontDefinition fd)
Description copied from interface:IDisplayServerAttempts to create a new font resource associated with a specific device for use in rendering or computations- Specified by:
createFontin interfaceIDisplayServer- Parameters:
fd- An font description for which a device specific resource is being requested- Returns:
- A device specific font
-
getColor
public java.lang.Object getColor(ColorDefinition cd)
Description copied from interface:IDisplayServerAttempts to create a new color resource associated with a specific device- Specified by:
getColorin interfaceIDisplayServer- 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:IDisplayServerReturns 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:
getDpiResolutionin interfaceIDisplayServer- Returns:
- The integral dots per inch associated with the device
-
setDpiResolution
public void setDpiResolution(int dpi)
Description copied from interface:IDisplayServerSets 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:
setDpiResolutionin interfaceIDisplayServer- Parameters:
dpi- The number of dots per inch
-
loadImage
public java.lang.Object loadImage(java.net.URL url) throws ChartExceptionDescription copied from interface:IDisplayServerAttempts to use device specific libraries to load an image for use with the device renderer- Specified by:
loadImagein interfaceIDisplayServer- 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(java.lang.Object oImage)
Description copied from interface:IDisplayServerReturns the size(width, height) of the device specific image that was previously loaded by theloadImage(URL)method- Specified by:
getSizein interfaceIDisplayServer- Parameters:
oImage- The image for which the size is being requested- Returns:
- The size of the image
-
getObserver
public java.lang.Object getObserver()
Description copied from interface:IDisplayServerAn observer is typically associated with certain device types to aid in image loading and image metadata retrieval.- Specified by:
getObserverin interfaceIDisplayServer- Returns:
- An image observer associated with a specific device renderer
-
getTextMetrics
public ITextMetrics getTextMetrics(Label la)
Description copied from interface:IDisplayServerAn 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:
getTextMetricsin interfaceIDisplayServer- Parameters:
la- The Label instance for which text metrics are being requested- Returns:
- Text metrics associated with the specified Label instance
-
getLocale
public final java.util.Locale getLocale()
Description copied from interface:IDisplayServerProvides the locale to display server implementations as needed to retrieve localized resources for presentation.- Specified by:
getLocalein interfaceIDisplayServer- Returns:
- locale
-
getULocale
public final com.ibm.icu.util.ULocale getULocale()
Description copied from interface:IDisplayServerProvides the locale to display server implementations as needed to retrieve localized resources for presentation.- Specified by:
getULocalein interfaceIDisplayServer- 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:
setLocalein interfaceIDisplayServer- Parameters:
lcl- The locale to be set
-
dispose
public void dispose()
Description copied from interface:IDisplayServerA notification sent to the device to free all allocated system resources.- Specified by:
disposein interfaceIDisplayServer
-
setGraphicsContext
public void setGraphicsContext(java.lang.Object graphicContext)
Description copied from interface:IDisplayServerSet 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:
setGraphicsContextin interfaceIDisplayServer
-
setResourceFinder
public void setResourceFinder(IResourceFinder resourceFinder)
Description copied from interface:IDisplayServerSet 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:
setResourceFinderin interfaceIDisplayServer
-
getTextMetrics
public ITextMetrics getTextMetrics(Label la, boolean autoReuse)
Description copied from interface:IDisplayServerAn 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:
getTextMetricsin interfaceIDisplayServer- Parameters:
la- The Label instance for which text metrics are being requested- Returns:
- Text metrics associated with the specified Label instance
-
-