org.apache.myfaces.custom.graphicimagedynamic
Class GraphicImageDynamic

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIGraphic
              extended by javax.faces.component.html.HtmlGraphicImage
                  extended by org.apache.myfaces.component.html.ext.AbstractHtmlGraphicImage
                      extended by org.apache.myfaces.component.html.ext.HtmlGraphicImage
                          extended by org.apache.myfaces.custom.graphicimagedynamic.GraphicImageDynamic
All Implemented Interfaces:
javax.faces.component.StateHolder, org.apache.myfaces.component.AlignProperty, org.apache.myfaces.component.ForceIdAware, org.apache.myfaces.component.UserRoleAware

public class GraphicImageDynamic
extends org.apache.myfaces.component.html.ext.HtmlGraphicImage

Extends standard graphicImage.

This tag renders a html img tag and can be used to render dynamic images.

Embedding images into html pages requires a second request to get the binary data stream of the image. The result is that the state of the view including the state of request scoped beans will not be available when the image is requested.

The image data is written by an image renderer which can be defined by the imageRendererClass attribute.

This component is able to use nested f:param elements to pass parameters to the image renderer.

Version:
$Revision: 673833 $ $Date: 2005-05-11 19:57:24 +0200 (Wed, 11 May 2005) $ Warning, this component is far from ready. It's more a proof of concept right now. TODO : Remove the need to include .get for the last part of the method expressions : getBytesMethod="#{graphicImageDynamicBean.upImage.getBytes}" TODO : Make a similar download component to download files TODO : Use shorter URLs
Author:
Sylvain Vieujot (latest modification by $Author: skitching $)

Field Summary
static java.lang.String COMPONENT_FAMILY
           
static java.lang.String COMPONENT_TYPE
           
static java.lang.String HEIGHT_PARAM
           
static java.lang.String RENDERER_PARAM
           
static java.lang.String VALUE_PARAM
           
static java.lang.String WIDTH_PARAM
           
 
Fields inherited from interface org.apache.myfaces.component.UserRoleAware
ENABLED_ON_USER_ROLE_ATTR, VISIBLE_ON_USER_ROLE_ATTR
 
Constructor Summary
GraphicImageDynamic()
           
 
Method Summary
 java.lang.Class getImageRendererClass()
           
 java.lang.Object getValue()
          A value binding which will be called to get the instance of an org.apache.myfaces.custom.graphicimagedynamic.ImageRenderer.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setImageRendererClass(java.lang.Class imageRendererClass)
          The class which implements org.apache.myfaces.custom.graphicimagedynamic.ImageRenderer.
 
Methods inherited from class org.apache.myfaces.component.html.ext.HtmlGraphicImage
getAlign, getBorder, getEnabledOnUserRole, getFamily, getHspace, getVisibleOnUserRole, getVspace, isForceId, isForceIdIndex, setAlign, setBorder, setEnabledOnUserRole, setForceId, setForceIdIndex, setHspace, setVisibleOnUserRole, setVspace
 
Methods inherited from class org.apache.myfaces.component.html.ext.AbstractHtmlGraphicImage
getClientId, isRendered
 
Methods inherited from class javax.faces.component.html.HtmlGraphicImage
getAlt, getDir, getHeight, getLang, getLongdesc, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getStyle, getStyleClass, getTitle, getUsemap, getWidth, isIsmap, setAlt, setDir, setHeight, setIsmap, setLang, setLongdesc, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setStyle, setStyleClass, setTitle, setUsemap, setWidth
 
Methods inherited from class javax.faces.component.UIGraphic
getUrl, getValueBinding, setUrl, setValue, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY
See Also:
Constant Field Values

RENDERER_PARAM

public static final java.lang.String RENDERER_PARAM
See Also:
Constant Field Values

VALUE_PARAM

public static final java.lang.String VALUE_PARAM
See Also:
Constant Field Values

WIDTH_PARAM

public static final java.lang.String WIDTH_PARAM
See Also:
Constant Field Values

HEIGHT_PARAM

public static final java.lang.String HEIGHT_PARAM
See Also:
Constant Field Values
Constructor Detail

GraphicImageDynamic

public GraphicImageDynamic()
Method Detail

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class org.apache.myfaces.component.html.ext.HtmlGraphicImage

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class org.apache.myfaces.component.html.ext.HtmlGraphicImage

setImageRendererClass

public void setImageRendererClass(java.lang.Class imageRendererClass)
The class which implements org.apache.myfaces.custom.graphicimagedynamic.ImageRenderer. The image renderer is responsible for loading the image. The class must have a default constructor. Any request scoped attribute or managed bean is not available when this image renderer is instantiated and used. The image renderer must render the binary data for the image by using the parameters passed by nested f:param elements and/or using session or application scoped beans.


getImageRendererClass

public java.lang.Class getImageRendererClass()

getValue

public java.lang.Object getValue()
A value binding which will be called to get the instance of an org.apache.myfaces.custom.graphicimagedynamic.ImageRenderer.

Overrides:
getValue in class javax.faces.component.UIGraphic


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.