com.sun.rave.web.ui.renderer
Class ButtonRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by com.sun.rave.web.ui.renderer.AbstractRenderer
          extended by com.sun.rave.web.ui.renderer.ButtonRenderer

public class ButtonRenderer
extends AbstractRenderer

Renderer for a Button component.


Field Summary
 
Fields inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer
BUNDLE, EVENTS_ATTRIBUTES, I18N_ATTRIBUTES
 
Constructor Summary
ButtonRenderer()
           
 
Method Summary
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Determine if this was the component that submitted the form.
protected  java.lang.String getJavascript(java.lang.String value, java.lang.String jsmethod)
          Helper method to set style classes during Javascript events such as onblur, onfocus, onmouseover, and onmouseout.
protected  java.lang.String getOnBlurStyle(Button button, Theme theme)
          Get onblur style class.
protected  java.lang.String getOnFocusStyle(Button button, Theme theme)
          Get onfocus style class.
protected  java.lang.String getOnMouseOutStyle(Button button, Theme theme)
          Get onmouseout style class.
protected  java.lang.String getOnMouseOverStyle(Button button, Theme theme)
          Get onmouseover style class.
protected  java.lang.String getStyle(Button button, Theme theme)
          Get style class.
protected  void renderAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the appropriate element attributes depending on the value of the imageURL attribute.
protected  void renderEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the appropriate element end, depending on the value of the type property.
protected  void renderIconAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, java.lang.String url)
          Render the appropriate element attributes for an icon button.
protected  void renderStart(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the appropriate element start, depending on the value of the type property.
protected  void renderTextAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the appropriate element attributes for a text button.
 
Methods inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer
addBooleanAttributes, addCoreAttributes, addIntegerAttributes, addStringAttributes, encodeBegin, encodeChildren, encodeEnd, getApplication, getAsObject, getAsString, getExternalContext, getFacesContext, getSubmittedValue, isDisabled, isPortlet, isReadOnly, renderMarkup, setSubmittedValue
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, getConvertedValue, getRendersChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonRenderer

public ButtonRenderer()
Method Detail

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)

Determine if this was the component that submitted the form.

Overrides:
decode in class AbstractRenderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be decoded
Throws:
java.lang.NullPointerException - if context or component is null

renderStart

protected void renderStart(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component,
                           javax.faces.context.ResponseWriter writer)
                    throws java.io.IOException

Render the appropriate element start, depending on the value of the type property.

Overrides:
renderStart in class AbstractRenderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be rendered
writer - ResponseWriter to which the element start should be rendered
Throws:
java.io.IOException - if an input/output error occurs

renderAttributes

protected void renderAttributes(javax.faces.context.FacesContext context,
                                javax.faces.component.UIComponent component,
                                javax.faces.context.ResponseWriter writer)
                         throws java.io.IOException

Render the appropriate element attributes depending on the value of the imageURL attribute.

Overrides:
renderAttributes in class AbstractRenderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be rendered
writer - ResponseWriter to which the element attributes should be rendered
Throws:
java.io.IOException - if an input/output error occurs

renderEnd

protected void renderEnd(javax.faces.context.FacesContext context,
                         javax.faces.component.UIComponent component,
                         javax.faces.context.ResponseWriter writer)
                  throws java.io.IOException

Render the appropriate element end, depending on the value of the type property.

Overrides:
renderEnd in class AbstractRenderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be rendered
writer - ResponseWriter to which the element end should be rendered
Throws:
java.io.IOException - if an input/output error occurs

renderIconAttributes

protected void renderIconAttributes(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    javax.faces.context.ResponseWriter writer,
                                    java.lang.String url)
                             throws java.io.IOException

Render the appropriate element attributes for an icon button.

Parameters:
context - FacesContext for the current request
component - UIComponent to be rendered
writer - ResponseWriter to which the element attributes should be rendered
url - The image URL
Throws:
java.io.IOException - if an input/output error occurs

renderTextAttributes

protected void renderTextAttributes(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    javax.faces.context.ResponseWriter writer)
                             throws java.io.IOException

Render the appropriate element attributes for a text button.

Parameters:
context - FacesContext for the current request
component - UIComponent to be rendered
writer - ResponseWriter to which the element attributes should be rendered
Throws:
java.io.IOException - if an input/output error occurs

getOnBlurStyle

protected java.lang.String getOnBlurStyle(Button button,
                                          Theme theme)
Get onblur style class.

Parameters:
button - Button to be rendered
theme - Theme for the component

getOnFocusStyle

protected java.lang.String getOnFocusStyle(Button button,
                                           Theme theme)
Get onfocus style class.

Parameters:
button - Button to be rendered
theme - Theme for the component

getOnMouseOverStyle

protected java.lang.String getOnMouseOverStyle(Button button,
                                               Theme theme)
Get onmouseover style class.

Parameters:
button - Button to be rendered
theme - Theme for the component

getOnMouseOutStyle

protected java.lang.String getOnMouseOutStyle(Button button,
                                              Theme theme)
Get onmouseout style class.

Parameters:
button - Button to be rendered
theme - Theme for the component

getStyle

protected java.lang.String getStyle(Button button,
                                    Theme theme)
Get style class.

Parameters:
button - Button to be rendered
theme - Theme for the component

getJavascript

protected java.lang.String getJavascript(java.lang.String value,
                                         java.lang.String jsmethod)
Helper method to set style classes during Javascript events such as onblur, onfocus, onmouseover, and onmouseout.

Parameters:
value - The existing attribute value to append Javascript to.
jsmethod - The JS event to invoke.