com.sun.webui.jsf.component
Class Button

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UICommand
              extended by com.sun.webui.jsf.component.WebuiCommand
                  extended by com.sun.webui.jsf.component.Button
All Implemented Interfaces:
com.sun.webui.jsf.component.ComplexComponent, javax.faces.component.ActionSource, javax.faces.component.ActionSource2, javax.faces.component.StateHolder

public class Button
extends WebuiCommand
implements com.sun.webui.jsf.component.ComplexComponent

The Button component is used to display an input button.


Field Summary
static java.lang.String CONTENTS_ID
          The component id for button contents.
 
Fields inherited from class javax.faces.component.UICommand
COMPONENT_FAMILY, COMPONENT_TYPE
 
Constructor Summary
Button()
          Default constructor.
 
Method Summary
 java.lang.String getAlt()
          Alternative textual description of the image rendered by this component.
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.String getFocusElementId(javax.faces.context.FacesContext context)
          Returns the id of an HTML element suitable to receive the focus.
 java.lang.String getHtmlTemplate()
          Get alternative HTML template to be used by this component.
 java.lang.String getIcon()
          The identifier key of a theme image to be used for the button.
 java.lang.String getImageURL()
          Resource path of an image to be displayed to create the visual appearance of this button instead of the standard button image.
 javax.faces.component.UIComponent getIndicatorComponent(javax.faces.context.FacesContext context, Label label)
          Return a component instance that can be referenced by a Label in order to evaluate the required and valid states of this component.
 java.lang.String getLabeledElementId(javax.faces.context.FacesContext context)
          Returns the absolute ID of an HTML element suitable for use as the value of an HTML LABEL element's for attribute.
 java.lang.String getOnBlur()
          Scripting code executed when this element loses focus.
 java.lang.String getOnClick()
          Scripting code executed when a mouse click occurs over this component.
 java.lang.String getOnDblClick()
          Scripting code executed when a mouse double click occurs over this component.
 java.lang.String getOnFocus()
          Scripting code executed when this component receives focus.
 java.lang.String getOnKeyDown()
          Scripting code executed when the user presses down on a key while the component has focus.
 java.lang.String getOnKeyPress()
          Scripting code executed when the user presses and releases a key while the component has focus.
 java.lang.String getOnKeyUp()
          Scripting code executed when the user releases a key while the component has focus.
 java.lang.String getOnMouseDown()
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 java.lang.String getOnMouseMove()
          Scripting code executed when the user moves the mouse pointer while over the component.
 java.lang.String getOnMouseOut()
          Scripting code executed when the user moves the mouse pointer off this component.
 java.lang.String getOnMouseOver()
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 java.lang.String getOnMouseUp()
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 java.lang.String getPrimaryElementID(javax.faces.context.FacesContext context)
          Deprecated.  
 java.lang.String getRendererType()
           
 java.lang.String getStyle()
          CSS style(s) to be applied to the outermost HTML element when this component is rendered.
 java.lang.String getStyleClass()
          CSS style class(es) to be applied to the outermost HTML element when this component is rendered.
 int getTabIndex()
          Position of this element in the tabbing order of the current document.
 java.lang.Object getText()
          Text to display on the button.
 java.lang.String getToolTip()
          Sets the value of the title attribute for the HTML element.
 java.lang.Object getValue()
           
 javax.el.ValueExpression getValueExpression(java.lang.String name)
          Return the ValueExpression stored for the specified name (if any), respecting any property aliases.
 boolean isDisabled()
          Indicates that activation of this component by the user is not currently permitted.
 boolean isEscape()
          Escape the html text so it won't be interpreted by the browser as HTML.
 boolean isMini()
          Indicates that the button should be rendered using a different style than normal buttons.
 boolean isNoTextPadding()
          Indicates that padding should not be applied to the button text.
 boolean isPrimary()
          Indicates that the button is the most commonly used button within a group.
 boolean isReset()
          Indicates that the button should be a HTML reset button.
 boolean isVisible()
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setAlt(java.lang.String alt)
          Alternative textual description of the image rendered by this component.
 void setDisabled(boolean disabled)
          Indicates that activation of this component by the user is not currently permitted.
 void setEscape(boolean escape)
          Escape the html text so it won't be interpreted by the browser as HTML.
 void setHtmlTemplate(java.lang.String htmlTemplate)
          Set alternative HTML template to be used by this component.
 void setIcon(java.lang.String icon)
          The identifier key of a theme image to be used for the button.
 void setImageURL(java.lang.String imageURL)
          Resource path of an image to be displayed to create the visual appearance of this button instead of the standard button image.
 void setMini(boolean mini)
          Indicates that the button should be rendered using a different style than normal buttons.
 void setNoTextPadding(boolean noTextPadding)
          Indicates that padding should not be applied to the button text.
 void setOnBlur(java.lang.String onBlur)
          Scripting code executed when this element loses focus.
 void setOnClick(java.lang.String onClick)
          Scripting code executed when a mouse click occurs over this component.
 void setOnDblClick(java.lang.String onDblClick)
          Scripting code executed when a mouse double click occurs over this component.
 void setOnFocus(java.lang.String onFocus)
          Scripting code executed when this component receives focus.
 void setOnKeyDown(java.lang.String onKeyDown)
          Scripting code executed when the user presses down on a key while the component has focus.
 void setOnKeyPress(java.lang.String onKeyPress)
          Scripting code executed when the user presses and releases a key while the component has focus.
 void setOnKeyUp(java.lang.String onKeyUp)
          Scripting code executed when the user releases a key while the component has focus.
 void setOnMouseDown(java.lang.String onMouseDown)
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 void setOnMouseMove(java.lang.String onMouseMove)
          Scripting code executed when the user moves the mouse pointer while over the component.
 void setOnMouseOut(java.lang.String onMouseOut)
          Scripting code executed when the user moves the mouse pointer off this component.
 void setOnMouseOver(java.lang.String onMouseOver)
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 void setOnMouseUp(java.lang.String onMouseUp)
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 void setPrimary(boolean primary)
          Indicates that the button is the most commonly used button within a group.
 void setReset(boolean reset)
          Indicates that the button should be a HTML reset button.
 void setStyle(java.lang.String style)
          CSS style(s) to be applied to the outermost HTML element when this component is rendered.
 void setStyleClass(java.lang.String styleClass)
          CSS style class(es) to be applied to the outermost HTML element when this component is rendered.
 void setTabIndex(int tabIndex)
          Position of this element in the tabbing order of the current document.
 void setText(java.lang.Object text)
          Text to display on the button.
 void setToolTip(java.lang.String toolTip)
          Sets the value of the title attribute for the HTML element.
 void setValueExpression(java.lang.String name, javax.el.ValueExpression binding)
          Set the ValueExpression stored for the specified name (if any), respecting any property aliases.
 void setVisible(boolean visible)
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 
Methods inherited from class com.sun.webui.jsf.component.WebuiCommand
broadcast, getAction, getActionExpression, getActionListener, getActionListenerExpression, processDecodes, processUpdates, processValidators, setActionListenerExpression, setId, setImmediate, setRendered
 
Methods inherited from class javax.faces.component.UICommand
addActionListener, getActionListeners, isImmediate, queueEvent, removeActionListener, setAction, setActionExpression, setActionListener, setValue
 
Methods inherited from class javax.faces.component.UIComponentBase
decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENTS_ID

public static final java.lang.String CONTENTS_ID
The component id for button contents.

See Also:
Constant Field Values
Constructor Detail

Button

public Button()
Default constructor.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

Overrides:
getFamily in class javax.faces.component.UICommand

getRendererType

public java.lang.String getRendererType()
Overrides:
getRendererType in class javax.faces.component.UIComponentBase

getLabeledElementId

public java.lang.String getLabeledElementId(javax.faces.context.FacesContext context)
Returns the absolute ID of an HTML element suitable for use as the value of an HTML LABEL element's for attribute. If the ComplexComponent has sub-compoents, and one of the sub-components is the target of a label, if that sub-component is a ComplexComponent, then getLabeledElementId must called on the sub-component and the value returned. The value returned by this method call may or may not resolve to a component instance.

Specified by:
getLabeledElementId in interface com.sun.webui.jsf.component.ComplexComponent
Parameters:
context - The FacesContext used for the request
Returns:
An abolute id suitable for the value of an HTML LABEL element's for attribute.

getFocusElementId

public java.lang.String getFocusElementId(javax.faces.context.FacesContext context)
Returns the id of an HTML element suitable to receive the focus. If the ComplexComponent has sub-compoents, and one of the sub-components is to reveive the focus, if that sub-component is a ComplexComponent, then getFocusElementId must called on the sub-component and the value returned. The value returned by this method call may or may not resolve to a component instance.

This implementation returns the value of getLabeledElementId.

Specified by:
getFocusElementId in interface com.sun.webui.jsf.component.ComplexComponent
Parameters:
context - The FacesContext used for the request

getIndicatorComponent

public javax.faces.component.UIComponent getIndicatorComponent(javax.faces.context.FacesContext context,
                                                               Label label)
Return a component instance that can be referenced by a Label in order to evaluate the required and valid states of this component. This implementation returns null. Button does not support the required or valid states

Specified by:
getIndicatorComponent in interface com.sun.webui.jsf.component.ComplexComponent
Parameters:
context - The current FacesContext instance
label - The Label that labels this component.
Returns:
a UIComponent in order to evaluate the required and valid states.

getPrimaryElementID

public java.lang.String getPrimaryElementID(javax.faces.context.FacesContext context)
Deprecated. 

Implement this method so that it returns the DOM ID of the HTML element which should receive focus when the component receives focus, and to which a component label should apply. Usually, this is the first element that accepts input.

Specified by:
getPrimaryElementID in interface com.sun.webui.jsf.component.ComplexComponent
Parameters:
context - The FacesContext for the request
Returns:
The client id, also the JavaScript element id
See Also:
getLabeledElementId(javax.faces.context.FacesContext), getFocusElementId(javax.faces.context.FacesContext)

getValue

public java.lang.Object getValue()
Overrides:
getValue in class javax.faces.component.UICommand

getValueExpression

public javax.el.ValueExpression getValueExpression(java.lang.String name)

Return the ValueExpression stored for the specified name (if any), respecting any property aliases.

Overrides:
getValueExpression in class javax.faces.component.UIComponentBase
Parameters:
name - Name of value binding expression to retrieve

setValueExpression

public void setValueExpression(java.lang.String name,
                               javax.el.ValueExpression binding)

Set the ValueExpression stored for the specified name (if any), respecting any property aliases.

Overrides:
setValueExpression in class javax.faces.component.UIComponentBase
Parameters:
name - Name of value binding to set
binding - ValueExpression to set, or null to remove

getAlt

public java.lang.String getAlt()

Alternative textual description of the image rendered by this component. The alt text can be used by screen readers and in tool tips, and when image display is turned off in the web browser.


setAlt

public void setAlt(java.lang.String alt)

Alternative textual description of the image rendered by this component. The alt text can be used by screen readers and in tool tips, and when image display is turned off in the web browser.

See Also:
getAlt()

isDisabled

public boolean isDisabled()

Indicates that activation of this component by the user is not currently permitted. In this component library, the disabled attribute also causes the button to be renderered using a particular style.


setDisabled

public void setDisabled(boolean disabled)

Indicates that activation of this component by the user is not currently permitted. In this component library, the disabled attribute also causes the button to be renderered using a particular style.

See Also:
isDisabled()

isEscape

public boolean isEscape()

Escape the html text so it won't be interpreted by the browser as HTML. When the escape value is set to false, an HTML button element is rendered, instead of an HTML input element. And the alt attribute does not apply.


setEscape

public void setEscape(boolean escape)

Escape the html text so it won't be interpreted by the browser as HTML. When the escape value is set to false, an HTML button element is rendered, instead of an HTML input element. And the alt attribute does not apply.

See Also:
isEscape()

getHtmlTemplate

public java.lang.String getHtmlTemplate()
Get alternative HTML template to be used by this component.


setHtmlTemplate

public void setHtmlTemplate(java.lang.String htmlTemplate)
Set alternative HTML template to be used by this component.


getIcon

public java.lang.String getIcon()

The identifier key of a theme image to be used for the button.


setIcon

public void setIcon(java.lang.String icon)

The identifier key of a theme image to be used for the button.

See Also:
getIcon()

getImageURL

public java.lang.String getImageURL()

Resource path of an image to be displayed to create the visual appearance of this button instead of the standard button image. Either the imageURL or text attributes must be specified. When an imageURL value is given, the button type is set to image.


setImageURL

public void setImageURL(java.lang.String imageURL)

Resource path of an image to be displayed to create the visual appearance of this button instead of the standard button image. Either the imageURL or text attributes must be specified. When an imageURL value is given, the button type is set to image.

See Also:
getImageURL()

isMini

public boolean isMini()
Indicates that the button should be rendered using a different style than normal buttons. By default, a button that specifies the mini attribute looks the same as a normal button. You must set your own CSS style to render a mini button.


setMini

public void setMini(boolean mini)
Indicates that the button should be rendered using a different style than normal buttons. By default, a button that specifies the mini attribute looks the same as a normal button. You must set your own CSS style to render a mini button.

See Also:
isMini()

isNoTextPadding

public boolean isNoTextPadding()

Indicates that padding should not be applied to the button text. By default, whitespace characters are padded to button text greater than or equal to 4 characters in length. If the value is set to true, no padding is applied.


setNoTextPadding

public void setNoTextPadding(boolean noTextPadding)

Indicates that padding should not be applied to the button text. By default, whitespace characters are padded to button text greater than or equal to 4 characters in length. If the value is set to true, no padding is applied.

See Also:
isNoTextPadding()

getOnBlur

public java.lang.String getOnBlur()

Scripting code executed when this element loses focus.


setOnBlur

public void setOnBlur(java.lang.String onBlur)

Scripting code executed when this element loses focus.

See Also:
getOnBlur()

getOnClick

public java.lang.String getOnClick()

Scripting code executed when a mouse click occurs over this component.


setOnClick

public void setOnClick(java.lang.String onClick)

Scripting code executed when a mouse click occurs over this component.

See Also:
getOnClick()

getOnDblClick

public java.lang.String getOnDblClick()

Scripting code executed when a mouse double click occurs over this component.


setOnDblClick

public void setOnDblClick(java.lang.String onDblClick)

Scripting code executed when a mouse double click occurs over this component.

See Also:
getOnDblClick()

getOnFocus

public java.lang.String getOnFocus()

Scripting code executed when this component receives focus. An element receives focus when the user selects the element by pressing the tab key or clicking the mouse.


setOnFocus

public void setOnFocus(java.lang.String onFocus)

Scripting code executed when this component receives focus. An element receives focus when the user selects the element by pressing the tab key or clicking the mouse.

See Also:
getOnFocus()

getOnKeyDown

public java.lang.String getOnKeyDown()

Scripting code executed when the user presses down on a key while the component has focus.


setOnKeyDown

public void setOnKeyDown(java.lang.String onKeyDown)

Scripting code executed when the user presses down on a key while the component has focus.

See Also:
getOnKeyDown()

getOnKeyPress

public java.lang.String getOnKeyPress()

Scripting code executed when the user presses and releases a key while the component has focus.


setOnKeyPress

public void setOnKeyPress(java.lang.String onKeyPress)

Scripting code executed when the user presses and releases a key while the component has focus.

See Also:
getOnKeyPress()

getOnKeyUp

public java.lang.String getOnKeyUp()

Scripting code executed when the user releases a key while the component has focus.


setOnKeyUp

public void setOnKeyUp(java.lang.String onKeyUp)

Scripting code executed when the user releases a key while the component has focus.

See Also:
getOnKeyUp()

getOnMouseDown

public java.lang.String getOnMouseDown()

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.


setOnMouseDown

public void setOnMouseDown(java.lang.String onMouseDown)

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseDown()

getOnMouseMove

public java.lang.String getOnMouseMove()

Scripting code executed when the user moves the mouse pointer while over the component.


setOnMouseMove

public void setOnMouseMove(java.lang.String onMouseMove)

Scripting code executed when the user moves the mouse pointer while over the component.

See Also:
getOnMouseMove()

getOnMouseOut

public java.lang.String getOnMouseOut()

Scripting code executed when the user moves the mouse pointer off this component.


setOnMouseOut

public void setOnMouseOut(java.lang.String onMouseOut)

Scripting code executed when the user moves the mouse pointer off this component.

See Also:
getOnMouseOut()

getOnMouseOver

public java.lang.String getOnMouseOver()

Scripting code executed when the user moves the mouse pointer into the boundary of this component.


setOnMouseOver

public void setOnMouseOver(java.lang.String onMouseOver)

Scripting code executed when the user moves the mouse pointer into the boundary of this component.

See Also:
getOnMouseOver()

getOnMouseUp

public java.lang.String getOnMouseUp()

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.


setOnMouseUp

public void setOnMouseUp(java.lang.String onMouseUp)

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseUp()

isPrimary

public boolean isPrimary()

Indicates that the button is the most commonly used button within a group.


setPrimary

public void setPrimary(boolean primary)

Indicates that the button is the most commonly used button within a group.

See Also:
isPrimary()

isReset

public boolean isReset()

Indicates that the button should be a HTML reset button. By default, this value is false and the button is created as a submit button. If the value is set to true, no action listener will be invoked.


setReset

public void setReset(boolean reset)

Indicates that the button should be a HTML reset button. By default, this value is false and the button is created as a submit button. If the value is set to true, no action listener will be invoked.

See Also:
isReset()

getStyle

public java.lang.String getStyle()

CSS style(s) to be applied to the outermost HTML element when this component is rendered.


setStyle

public void setStyle(java.lang.String style)

CSS style(s) to be applied to the outermost HTML element when this component is rendered.

See Also:
getStyle()

getStyleClass

public java.lang.String getStyleClass()

CSS style class(es) to be applied to the outermost HTML element when this component is rendered.


setStyleClass

public void setStyleClass(java.lang.String styleClass)

CSS style class(es) to be applied to the outermost HTML element when this component is rendered.

See Also:
getStyleClass()

getTabIndex

public int getTabIndex()

Position of this element in the tabbing order of the current document. Tabbing order determines the sequence in which elements receive focus when the tab key is pressed. The value must be an integer between 0 and 32767.


setTabIndex

public void setTabIndex(int tabIndex)

Position of this element in the tabbing order of the current document. Tabbing order determines the sequence in which elements receive focus when the tab key is pressed. The value must be an integer between 0 and 32767.

See Also:
getTabIndex()

getText

public java.lang.Object getText()

Text to display on the button. Either the imageURL or text attributes must be specified. When an imageURL value is given, the button type is set to image.


setText

public void setText(java.lang.Object text)

Text to display on the button. Either the imageURL or text attributes must be specified. When an imageURL value is given, the button type is set to image.

See Also:
getText()

getToolTip

public java.lang.String getToolTip()

Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element.


setToolTip

public void setToolTip(java.lang.String toolTip)

Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element.

See Also:
getToolTip()

isVisible

public boolean isVisible()

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.


setVisible

public void setVisible(boolean visible)

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.

See Also:
isVisible()

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)

Restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class WebuiCommand

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)

Save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class WebuiCommand


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.