org.apache.myfaces.trinidadinternal.image
Class PainterImageRenderer

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.image.AbstractImageRenderer
      extended by org.apache.myfaces.trinidadinternal.image.PainterImageRenderer
All Implemented Interfaces:
java.awt.image.ImageObserver, ImageConstants, ImageRenderer
Direct Known Subclasses:
ButtonImageRenderer, CompositeButtonImageRenderer

public class PainterImageRenderer
extends AbstractImageRenderer
implements ImageConstants

ImageRenderer implementation that uses Painter objects to render an image. Clients must provide a Painter object in the constructor.

The PainterImageRenderer creates a PaintContext object in response to a call to renderImage(). The PaintContext object will obtain all its data about the state of the BufferedImage by using the Map of properties. Clients should set the properties in the Map using the given key constants described below.

Clients can pass custom properties by using their own key objects.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/image/PainterImageRenderer.java#0 $) $Date: 10-nov-2005.19:03:58 $
Author:
The Oracle ADF Faces Team

Field Summary
 
Fields inherited from interface org.apache.myfaces.trinidadinternal.image.ImageConstants
ACCESS_KEY_KEY, BACKGROUND_KEY, BORDER_COLOR_KEY, BUTTON_BOTTOM_BACKGROUND_ICON_KEY, BUTTON_END_ICON_KEY, BUTTON_START_ICON_KEY, BUTTON_TOP_BACKGROUND_ICON_KEY, COLORIZED_ICON_NAME, COMPOSITE_BUTTON_NAME, DARK_ACCENT_COLOR_KEY, DARK_COLOR_KEY, DIRECTION_KEY, DISABLED_BACKGROUND_KEY, DISABLED_FONT_KEY, DISABLED_FOREGROUND_KEY, DISABLED_KEY, ENCODING_TYPE_KEY, END_ROUNDED_KEY, FLIPPED_ICON_NAME, FONT_KEY, FOREGROUND_KEY, HEIGHT_RESPONSE_KEY, IMAGE_MAP_AREAS_RESPONSE_KEY, IMAGE_PROVIDER_PROPERTY, LAF_KEY, LOOK_AND_FEEL_ID_KEY, NAME_KEY, SELECTED_BACKGROUND_KEY, SELECTED_FONT_KEY, SELECTED_FOREGROUND_KEY, SELECTED_KEY, SOURCE_INPUT_STREAM_PROVIDER_KEY, SOURCE_KEY, START_ROUNDED_KEY, SURROUNDING_COLOR_KEY, TABS_KEY, TECATE_NAMESPACE, TEXT_ANTIALIAS_KEY, TEXT_KEY, VERSION_KEY, WIDTH_RESPONSE_KEY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected PainterImageRenderer(Painter painter)
          Create a PainterImageRenderer that uses the given Painter to create a BufferedImage.
 
Method Summary
protected  PaintContext createPaintContext(ImageContext imageContext, java.awt.image.BufferedImage image, java.util.Map<java.lang.Object,java.lang.Object> requestedProperties, java.util.Map<java.lang.Object,java.lang.Object> responseProperties)
           
protected  void disposePaintContext(PaintContext context)
           
protected  java.awt.Color getPaintBackground(ImageContext context, java.util.Map<java.lang.Object,java.lang.Object> d)
          Returns the background color to use when painting an image with the specified Map.
protected  java.lang.Object getPaintData(java.lang.Object key, java.util.Map<java.lang.Object,java.lang.Object> d)
           
 Painter getPainter()
          Get the Painter used to create the image.
protected  Painter getPainter(ImageContext imageContext, java.util.Map<java.lang.Object,java.lang.Object> requestedProperties)
          Returns the Painter to use for the specified request.
protected  java.awt.Font getPaintFont(java.util.Map<java.lang.Object,java.lang.Object> d)
          Returns the font color to use when painting an image with the specified Map.
protected  java.awt.Color getPaintForeground(ImageContext context, java.util.Map<java.lang.Object,java.lang.Object> d)
          Returns the foreground color to use when painting an image with the specified Map.
protected  boolean isRenderable(ImageContext imageContext, java.util.Map<java.lang.Object,java.lang.Object> requestedProperties)
          Tests whether the requested image can be rendered.
 java.awt.Image renderImage(ImageContext imageContext, java.util.Map<java.lang.Object,java.lang.Object> requestedProperties, java.util.Map<java.lang.Object,java.lang.Object> responseProperties)
          Render the image given the Map of properties that describe what to render.
 
Methods inherited from class org.apache.myfaces.trinidadinternal.image.AbstractImageRenderer
createImage, imageUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PainterImageRenderer

protected PainterImageRenderer(Painter painter)
Create a PainterImageRenderer that uses the given Painter to create a BufferedImage.

Method Detail

getPainter

public Painter getPainter()
Get the Painter used to create the image.


renderImage

public java.awt.Image renderImage(ImageContext imageContext,
                                  java.util.Map<java.lang.Object,java.lang.Object> requestedProperties,
                                  java.util.Map<java.lang.Object,java.lang.Object> responseProperties)
Render the image given the Map of properties that describe what to render. A PaintContext object is created using the given Map of properties.

Specified by:
renderImage in interface ImageRenderer
Specified by:
renderImage in class AbstractImageRenderer
Parameters:
imageContext - The rendering context
requestedProperties - Map of requested properties. The keys for this dictionary are the KEY constants defined in ImageConstants.
responseProperties - Map for response properties. The keys for this dictionary are the RESPONSE_KEY constants defined in ImageConstants.
Returns:
an Image containing the rendered results
See Also:
ImageContext, ImageConstants

getPainter

protected Painter getPainter(ImageContext imageContext,
                             java.util.Map<java.lang.Object,java.lang.Object> requestedProperties)
Returns the Painter to use for the specified request.


isRenderable

protected boolean isRenderable(ImageContext imageContext,
                               java.util.Map<java.lang.Object,java.lang.Object> requestedProperties)
Tests whether the requested image can be rendered. The default implementation of isRenderable() returns false if org.apache.myfaces.trinidadinternal.style.util.GraphicsUtils.isGraphicalEnvironment() returns false. Subclasses can override this to verify that all required properties are present in the requested properties Map. All overrides must either call super.isRenderable() or GraphicsUtils.isGraphicalEnvironment() to ensure that a graphical environment is available.


getPaintForeground

protected java.awt.Color getPaintForeground(ImageContext context,
                                            java.util.Map<java.lang.Object,java.lang.Object> d)
Returns the foreground color to use when painting an image with the specified Map.


getPaintBackground

protected java.awt.Color getPaintBackground(ImageContext context,
                                            java.util.Map<java.lang.Object,java.lang.Object> d)
Returns the background color to use when painting an image with the specified Map.


getPaintFont

protected java.awt.Font getPaintFont(java.util.Map<java.lang.Object,java.lang.Object> d)
Returns the font color to use when painting an image with the specified Map.


getPaintData

protected java.lang.Object getPaintData(java.lang.Object key,
                                        java.util.Map<java.lang.Object,java.lang.Object> d)

createPaintContext

protected PaintContext createPaintContext(ImageContext imageContext,
                                          java.awt.image.BufferedImage image,
                                          java.util.Map<java.lang.Object,java.lang.Object> requestedProperties,
                                          java.util.Map<java.lang.Object,java.lang.Object> responseProperties)

disposePaintContext

protected void disposePaintContext(PaintContext context)


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.