com.sun.webui.jsf.component
Class Field

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by com.sun.webui.jsf.component.WebuiInput
                      extended by com.sun.webui.jsf.component.HiddenField
                          extended by com.sun.webui.jsf.component.Field
All Implemented Interfaces:
com.sun.webui.jsf.component.ComplexComponent, javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
PasswordField, TextField, Upload

public class Field
extends HiddenField
implements com.sun.webui.jsf.component.ComplexComponent, javax.faces.component.NamingContainer

Represents an input field whose content will be included when the surrounding form is submitted.


Field Summary
static java.lang.String INPUT_ID
           
static java.lang.String LABEL_FACET
           
static java.lang.String LABEL_ID
           
static java.lang.String READONLY_FACET
           
static java.lang.String READONLY_ID
           
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
Field()
          Creates a new instance of FieldBase
 
Method Summary
 int getColumns()
          Number of character columns used to render this field.
 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.
 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 getLabel()
          If set, a label is rendered adjacent to the component with the value of this attribute as the label text.
 javax.faces.component.UIComponent getLabelComponent(javax.faces.context.FacesContext context, java.lang.String style)
          Return a component that implements a label for this Field.
 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.
 int getLabelLevel()
          Sets the style level for the generated label, provided the label attribute has been set.
 int getMaxLength()
          The maximum number of characters that can be entered for this field.
 java.lang.String getOnBlur()
          Scripting code executed when this element loses focus.
 java.lang.String getOnChange()
          Scripting code executed when the element value of this component is changed.
 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 a mouse out movement occurs over 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 getOnSelect()
          Scripting code executed when some text in this component value is selected.
 java.lang.String getPrimaryElementID(javax.faces.context.FacesContext context)
          Deprecated.  
 javax.faces.component.UIComponent getReadOnlyComponent(javax.faces.context.FacesContext context)
          Return a component that implements a read only version of of this Field.
 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()
          Literal value to be rendered in this input field.
 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()
          Flag indicating that the user is not permitted to activate this component, and that the component's value will not be submitted with the form.
 boolean isReadOnly()
          Flag indicating that modification of this component by the user is not currently permitted, but that it will be included when the form is submitted.
 boolean isRequired()
          Flag indicating that an input value for this field is mandatory, and failure to provide one will trigger a validation error.
 boolean isTrim()
          Flag indicating that any leading and trailing blanks will be trimmed prior to conversion to the destination data type.
 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 setColumns(int columns)
          Number of character columns used to render this field.
 void setDisabled(boolean disabled)
          Flag indicating that the user is not permitted to activate this component, and that the component's value will not be submitted with the form.
 void setLabel(java.lang.String label)
          If set, a label is rendered adjacent to the component with the value of this attribute as the label text.
 void setLabelLevel(int labelLevel)
          Sets the style level for the generated label, provided the label attribute has been set.
 void setMaxLength(int maxLength)
          The maximum number of characters that can be entered for this field.
 void setOnBlur(java.lang.String onBlur)
          Scripting code executed when this element loses focus.
 void setOnChange(java.lang.String onChange)
          Scripting code executed when the element value of this component is changed.
 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 a mouse out movement occurs over 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 setOnSelect(java.lang.String onSelect)
          Scripting code executed when some text in this component value is selected.
 void setReadOnly(boolean readOnly)
          Flag indicating that modification of this component by the user is not currently permitted, but that it will be included when the form is submitted.
 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)
          Literal value to be rendered in this input field.
 void setToolTip(java.lang.String toolTip)
          Sets the value of the title attribute for the HTML element.
 void setTrim(boolean trim)
          Flag indicating that any leading and trailing blanks will be trimmed prior to conversion to the destination data type.
 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.HiddenField
getHtmlTemplate, getReadOnlyValueString, getRendererType, getValueAsString, setHtmlTemplate
 
Methods inherited from class com.sun.webui.jsf.component.WebuiInput
broadcast, getValidator, getValidatorExpression, getValueChangeListener, getValueChangeListenerExpression, processDecodes, processUpdates, processValidators, setConverter, setId, setImmediate, setRendered, setRequired, setValidatorExpression, setValueChangeListenerExpression
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, decode, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidatorMessage, getValidators, getValueChangeListeners, isImmediate, isLocalValueSet, isValid, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setLocalValueSet, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue
 
Methods inherited from class javax.faces.component.UIComponentBase
encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, 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
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue
 

Field Detail

READONLY_ID

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

LABEL_ID

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

INPUT_ID

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

READONLY_FACET

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

LABEL_FACET

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

Field

public Field()
Creates a new instance of FieldBase

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

Overrides:
getFamily in class HiddenField

getLabelComponent

public javax.faces.component.UIComponent getLabelComponent(javax.faces.context.FacesContext context,
                                                           java.lang.String style)
Return a component that implements a label for this Field. If a facet named label is found that component is returned.
If a facet is not found a Label component instance is created and returned with the id
getId() + "_label". The Label instance is intialized with the following values

If a facet is not defined then the returned Label component is created every time this method is called.

Returns:
- label facet or a Label instance

getReadOnlyComponent

public javax.faces.component.UIComponent getReadOnlyComponent(javax.faces.context.FacesContext context)
Return a component that implements a read only version of of this Field. If a facet named readOnly is found that component is returned.
If a facet is not found a StaticText component instance is created and returned with the id
getId() + "_alertImage". The StaticText instance is intialized with the component's value as a String.

If a facet is not defined then the returned StaticText component is created every time this method is called.

Returns:
- alertImage facet or an Icon instance

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.

If isReadOnly returns true, then the getReadOnlyComponent method is called. If the component instance returned is a ComplexComponent then getLabeledElementId is called on it and the value returned, else its client id is returned.

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 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.

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)

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 HiddenField
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 HiddenField
Parameters:
name - Name of value binding to set
binding - ValueExpression to set, or null to remove

isRequired

public boolean isRequired()
Flag indicating that an input value for this field is mandatory, and failure to provide one will trigger a validation error.

Specified by:
isRequired in interface javax.faces.component.EditableValueHolder
Overrides:
isRequired in class HiddenField

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface javax.faces.component.ValueHolder
Overrides:
getValue in class HiddenField

getColumns

public int getColumns()

Number of character columns used to render this field. The default value is based on resource string in theme/messages#textInput.defaultColumns
If resource string is not found there, the default columns are set to 20


setColumns

public void setColumns(int columns)

Number of character columns used to render this field. The default is 20.

See Also:
getColumns()

isDisabled

public boolean isDisabled()

Flag indicating that the user is not permitted to activate this component, and that the component's value will not be submitted with the form.

Overrides:
isDisabled in class HiddenField

setDisabled

public void setDisabled(boolean disabled)

Flag indicating that the user is not permitted to activate this component, and that the component's value will not be submitted with the form.

Overrides:
setDisabled in class HiddenField
See Also:
isDisabled()

getLabel

public java.lang.String getLabel()

If set, a label is rendered adjacent to the component with the value of this attribute as the label text.


setLabel

public void setLabel(java.lang.String label)

If set, a label is rendered adjacent to the component with the value of this attribute as the label text.

See Also:
getLabel()

getLabelLevel

public int getLabelLevel()

Sets the style level for the generated label, provided the label attribute has been set. Valid values are 1 (largest), 2 and 3 (smallest). The default value is 2.


setLabelLevel

public void setLabelLevel(int labelLevel)

Sets the style level for the generated label, provided the label attribute has been set. Valid values are 1 (largest), 2 and 3 (smallest). The default value is 2.

See Also:
getLabelLevel()

getMaxLength

public int getMaxLength()

The maximum number of characters that can be entered for this field.


setMaxLength

public void setMaxLength(int maxLength)

The maximum number of characters that can be entered for this field.

See Also:
getMaxLength()

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()

getOnChange

public java.lang.String getOnChange()

Scripting code executed when the element value of this component is changed.


setOnChange

public void setOnChange(java.lang.String onChange)

Scripting code executed when the element value of this component is changed.

See Also:
getOnChange()

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 a mouse out movement occurs over this component.


setOnMouseOut

public void setOnMouseOut(java.lang.String onMouseOut)

Scripting code executed when a mouse out movement occurs over 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()

getOnSelect

public java.lang.String getOnSelect()

Scripting code executed when some text in this component value is selected.


setOnSelect

public void setOnSelect(java.lang.String onSelect)

Scripting code executed when some text in this component value is selected.

See Also:
getOnSelect()

isReadOnly

public boolean isReadOnly()

Flag indicating that modification of this component by the user is not currently permitted, but that it will be included when the form is submitted.


setReadOnly

public void setReadOnly(boolean readOnly)

Flag indicating that modification of this component by the user is not currently permitted, but that it will be included when the form is submitted.

See Also:
isReadOnly()

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()

Literal value to be rendered in this input field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds.

Overrides:
getText in class HiddenField

setText

public void setText(java.lang.Object text)

Literal value to be rendered in this input field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds.

Overrides:
setText in class HiddenField
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()

isTrim

public boolean isTrim()

Flag indicating that any leading and trailing blanks will be trimmed prior to conversion to the destination data type. Default value is true.


setTrim

public void setTrim(boolean trim)

Flag indicating that any leading and trailing blanks will be trimmed prior to conversion to the destination data type. Default value is true.

See Also:
isTrim()

isVisible

public boolean isVisible()

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.


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.

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 HiddenField

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 HiddenField


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