org.richfaces.renderkit.html
Class BaseGradient

java.lang.Object
  extended by org.ajax4jsf.resource.InternetResourceBase
      extended by org.ajax4jsf.resource.Java2Dresource
          extended by org.richfaces.renderkit.html.BaseGradient
All Implemented Interfaces:
org.ajax4jsf.resource.InternetResource
Direct Known Subclasses:
Base2WayGradient, BaseControlBackgroundImage, ComboBoxButtonPressGradient, GradientA, SpinnerButtonGradient, SpinnerFieldGradient

public class BaseGradient
extends Java2Dresource

Author:
Nick Belaevski - nbelaevski@exadel.com created 02.02.2007

Nested Class Summary
protected static class BaseGradient.Data
           
 
Field Summary
 
Fields inherited from interface org.ajax4jsf.resource.InternetResource
CODEC_ATTR, DATA_SEPARATOR, DEFAULT_EXPIRE, DEFAULT_EXPITE_PARAMETER, ENCODE_PASS_PARAMETER, ENCODE_URI_PARAMETER, RESOURCE_PROTOCOL, RESOURCE_URI_PREFIX, RESOURCE_URI_PREFIX_LENGTH
 
Constructor Summary
BaseGradient()
           
BaseGradient(boolean horizontal)
           
BaseGradient(int width, int height)
           
BaseGradient(int width, int height, boolean horizontal)
           
BaseGradient(int width, int height, int gradientHeight)
           
BaseGradient(int width, int height, int gradientHeight, boolean horizontal)
           
BaseGradient(int width, int height, int gradientHeight, java.lang.String baseColor, java.lang.String gradientColor)
           
BaseGradient(int width, int height, int gradientHeight, java.lang.String baseColor, java.lang.String gradientColor, boolean horizontal)
           
BaseGradient(int width, int height, java.lang.String baseColor, java.lang.String gradientColor)
           
BaseGradient(int width, int height, java.lang.String baseColor, java.lang.String gradientColor, boolean horizontal)
           
BaseGradient(java.lang.String baseColor, java.lang.String gradientColor)
           
BaseGradient(java.lang.String baseColor, java.lang.String gradientColor, boolean horizontal)
           
 
Method Summary
protected  BaseGradient.Data createData()
           
protected  java.lang.Object deserializeData(byte[] objectArray)
          Deserialize parameters object from byte array.
protected  void drawGradient(java.awt.Graphics2D g2d, java.awt.Shape shape, GradientType.BiColor colors, int height)
           
protected  java.lang.String getBaseColor()
           
protected  java.lang.Integer getColorValueParameter(javax.faces.context.FacesContext context, java.lang.String name, boolean useDefault)
           
protected  java.lang.Object getDataToStore(javax.faces.context.FacesContext context, java.lang.Object data)
          Template method to construct resource-specific data ( to store in resource URI ).
 java.awt.Dimension getDimensions(javax.faces.context.FacesContext facesContext, java.lang.Object data)
          Primary calculation of image dimensions - used when HTML code is generated to render IMG's width and height Subclasses should override this method to provide correct sizes of rendered images
protected  java.awt.Dimension getDimensions(org.ajax4jsf.resource.ResourceContext resourceContext)
          Secondary calculation is used basically by getImage method
protected  java.lang.String getGradientColor()
           
protected  int getGradientHeight()
           
protected  java.lang.String getValueParameter(javax.faces.context.FacesContext context, java.lang.String name)
           
 boolean isCacheable()
           
protected  boolean isHorizontal()
           
protected  void paint(org.ajax4jsf.resource.ResourceContext resourceContext, java.awt.Graphics2D g2d)
          Template method for create image as Applet-like paint.
protected  void paintGradient(java.awt.Graphics2D g2d, BaseGradient.Data data)
           
protected  void restoreData(BaseGradient.Data data, Zipper2 zipper2)
           
protected  void saveData(javax.faces.context.FacesContext context, BaseGradient.Data data, java.lang.Object parameterData)
           
 
Methods inherited from class org.ajax4jsf.resource.Java2Dresource
getImage, getResourceAsStream, send
 
Methods inherited from class org.ajax4jsf.resource.InternetResourceBase
encode, encode, encodeBegin, encodeEnd, getContentLength, getContentType, getExpired, getKey, getLastModified, getProperty, getRenderer, getUri, isCacheable, isSessionAware, requireFacesContext, restoreData, sendHeaders, setCacheable, setContentLength, setExpired, setKey, setLastModified, setProperty, setRenderer, setSessionAware
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGradient

public BaseGradient(int width,
                    int height,
                    int gradientHeight,
                    java.lang.String baseColor,
                    java.lang.String gradientColor,
                    boolean horizontal)

BaseGradient

public BaseGradient(int width,
                    int height,
                    int gradientHeight)

BaseGradient

public BaseGradient(int width,
                    int height,
                    int gradientHeight,
                    java.lang.String baseColor,
                    java.lang.String gradientColor)

BaseGradient

public BaseGradient(int width,
                    int height)

BaseGradient

public BaseGradient(int width,
                    int height,
                    java.lang.String baseColor,
                    java.lang.String gradientColor)

BaseGradient

public BaseGradient()

BaseGradient

public BaseGradient(java.lang.String baseColor,
                    java.lang.String gradientColor)

BaseGradient

public BaseGradient(int width,
                    int height,
                    int gradientHeight,
                    boolean horizontal)

BaseGradient

public BaseGradient(int width,
                    int height,
                    boolean horizontal)

BaseGradient

public BaseGradient(int width,
                    int height,
                    java.lang.String baseColor,
                    java.lang.String gradientColor,
                    boolean horizontal)

BaseGradient

public BaseGradient(boolean horizontal)

BaseGradient

public BaseGradient(java.lang.String baseColor,
                    java.lang.String gradientColor,
                    boolean horizontal)
Method Detail

getDimensions

public java.awt.Dimension getDimensions(javax.faces.context.FacesContext facesContext,
                                        java.lang.Object data)
Description copied from class: Java2Dresource
Primary calculation of image dimensions - used when HTML code is generated to render IMG's width and height Subclasses should override this method to provide correct sizes of rendered images

Overrides:
getDimensions in class Java2Dresource
Returns:
dimensions of the image to be displayed on page

getDimensions

protected java.awt.Dimension getDimensions(org.ajax4jsf.resource.ResourceContext resourceContext)
Description copied from class: Java2Dresource
Secondary calculation is used basically by getImage method

Overrides:
getDimensions in class Java2Dresource
Returns:

getGradientHeight

protected int getGradientHeight()
Returns:
the gradientHeight

getBaseColor

protected java.lang.String getBaseColor()
Returns:
the baseColor

getGradientColor

protected java.lang.String getGradientColor()
Returns:
the gradientColor

isHorizontal

protected boolean isHorizontal()
Returns:
the horizontal

drawGradient

protected void drawGradient(java.awt.Graphics2D g2d,
                            java.awt.Shape shape,
                            GradientType.BiColor colors,
                            int height)

paint

protected void paint(org.ajax4jsf.resource.ResourceContext resourceContext,
                     java.awt.Graphics2D g2d)
Description copied from class: Java2Dresource
Template method for create image as Applet-like paint.

Overrides:
paint in class Java2Dresource
Parameters:
resourceContext - - current resource context.
g2d - - graphics to paint.

paintGradient

protected void paintGradient(java.awt.Graphics2D g2d,
                             BaseGradient.Data data)
Parameters:
g2d -
data -

restoreData

protected void restoreData(BaseGradient.Data data,
                           Zipper2 zipper2)

deserializeData

protected java.lang.Object deserializeData(byte[] objectArray)
Description copied from class: InternetResourceBase
Deserialize parameters object from byte array. By default, used Java de-serialisation from ObjectOutputStream , but implementations can override this method ( togewer with getDataToStore ) for implement short version.

Overrides:
deserializeData in class InternetResourceBase
Returns:

createData

protected BaseGradient.Data createData()

saveData

protected void saveData(javax.faces.context.FacesContext context,
                        BaseGradient.Data data,
                        java.lang.Object parameterData)

getDataToStore

protected java.lang.Object getDataToStore(javax.faces.context.FacesContext context,
                                          java.lang.Object data)
Description copied from class: InternetResourceBase
Template method to construct resource-specific data ( to store in resource URI ). If resource must store any data in session or other cache, it must be done here. Since lightweight realisation, information for restore such data muct be returned by this method.

Overrides:
getDataToStore in class InternetResourceBase
Parameters:
context - - current faces context.
data - - data for build information, usually current UIComponent
Returns:
- any Serializable object, or null.

isCacheable

public boolean isCacheable()

getValueParameter

protected java.lang.String getValueParameter(javax.faces.context.FacesContext context,
                                             java.lang.String name)

getColorValueParameter

protected java.lang.Integer getColorValueParameter(javax.faces.context.FacesContext context,
                                                   java.lang.String name,
                                                   boolean useDefault)


Copyright © 2010. All Rights Reserved.