Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 1 (11.1.1.7.0)

E12063-08

oracle.dss.gauge
Class LEDStyleCallback

java.lang.Object
  extended by oracle.dss.gauge.LEDStyleCallback
Direct Known Subclasses:
KPIStyleCallback

public abstract class LEDStyleCallback
extends java.lang.Object

This abstract class should be implemented by Gauge bean consumers to provide customized LED image support. It is responsible for loading the images (if loading is required from image paths) and maintaining a single copy of the list of those images. The Gauge bean should control only a single instance of this implementation to optimize image loading and performance. Loading of images is deferred until the Gauge needs to render the gauges.

Since:
11.0

Field Summary
static int SOURCE_IMAGE
          Constant to indicate images should be loaded from Image objects.
static int SOURCE_PATH
          Constant to indicate images should be loaded from image paths.
 
Constructor Summary
LEDStyleCallback(int method)
          Constructor providing an indication of the method by which images will be loaded.
 
Method Summary
 java.lang.String getBaseImageURI()
          Gets the base image URI from which image paths are loaded.
 int getLEDCount()
          Gets the number of LED images this implementation should plan on loading.
abstract  java.awt.Image getLEDImage(int index)
          Called when an instance of java.awt.Image is needed by a Gauge and this callback instance has been initialized to require Image objects.
 java.awt.Image getLEDImage(int index, ErrorHandler handler)
           
abstract  java.lang.String getLEDImagePath(int index)
          Called when a relative path to an LED image is needed by a Gauge and this callback instance has been initialized to require Image objects.
 int getMethod()
          Gets the method by which images should be loaded.
 void setLEDCount(int count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_PATH

public static int SOURCE_PATH
Constant to indicate images should be loaded from image paths.


SOURCE_IMAGE

public static int SOURCE_IMAGE
Constant to indicate images should be loaded from Image objects.

Constructor Detail

LEDStyleCallback

public LEDStyleCallback(int method)
Constructor providing an indication of the method by which images will be loaded.

Parameters:
method - Integer; can be either SOURCE_IMAGE or SOURCE_PATH
Method Detail

getMethod

public int getMethod()
Gets the method by which images should be loaded.

Returns:
Integer; will be either SOURCE_IMAGE or SOURCE_PATH

getLEDImage

public abstract java.awt.Image getLEDImage(int index)
Called when an instance of java.awt.Image is needed by a Gauge and this callback instance has been initialized to require Image objects. The number of threshold LEDs required by the gauge for which this implementation runs can be retrieved with the get

Parameters:
index - Index of the threshold for which to load the image
Returns:
Instance of Image

getLEDImagePath

public abstract java.lang.String getLEDImagePath(int index)
Called when a relative path to an LED image is needed by a Gauge and this callback instance has been initialized to require Image objects. Image paths are stored in a list of strings.

The relative path returned from this method is appended to the BaseImageURI to construct the full path to the image. The full path may specify a URL or a resource on the classpath.

For example, the relative path to an image may be "images/myImage.gif". If no BaseImageURI is set, then this method attempts to load the image from the classpath, on the specified path relative to the Gauge class, which would be "/oracle/dss/gauge/images/myImage.gif".

If BaseImageURI is "/myPackage/myComponent/", then this method attempts to load the image from the classpath on the specified absolute path, "/myPackage/myComponent/images/myImage.gif".

If BaseImageURI is "http://my.server.com/", then this method attempts to load the image at the given URL, "http://my.server.com/images/myImage.gif".

If an image cannot be loaded, a special "not loaded" image will be used instead.

Parameters:
index - The threshold index, which is always one greater than the number of thresholds determined by the DataSpecification object.
See Also:
Gauge, DataSpecification

getBaseImageURI

public java.lang.String getBaseImageURI()
Gets the base image URI from which image paths are loaded. This default implementation specifies no base URI, so implementations of this class must override this method to provide a base image URI if one is needed.

Returns:
String representing the base image URI

getLEDCount

public int getLEDCount()
Gets the number of LED images this implementation should plan on loading.

Returns:
Number of LEDs required by this Gauge

setLEDCount

public void setLEDCount(int count)
For internal use only. Application developers should not use this
Sets the number of LED images to be required of this LED image callback implementation. This is called by the Gauge engine during drawable object preparation.

getLEDImage

public java.awt.Image getLEDImage(int index,
                                  ErrorHandler handler)
Parameters:
index - Index of LED image to get.
handler - Instance of ErrorHandler
Returns:
Instance of List containing loaded images.
For internal use only. Application developers should not use this
Uses the abstract methods on this implementation to load the images and return them in a List.

Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 1 (11.1.1.7.0)

E12063-08

Copyright © 1997, 2013, Oracle. All rights reserved.