com.sun.webui.jsf.component
Class Form

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIForm
              extended by com.sun.webui.jsf.component.Form
All Implemented Interfaces:
javax.faces.component.NamingContainer, javax.faces.component.StateHolder

public class Form
extends javax.faces.component.UIForm

The Form component is used to create a form element.


Nested Class Summary
static class Form.VirtualFormDescriptor
           
 
Field Summary
static char ID_WILD_CHAR
           
 
Fields inherited from class javax.faces.component.UIForm
COMPONENT_FAMILY, COMPONENT_TYPE
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
Form()
          Default constructor.
 
Method Summary
 void addInternalVirtualForm(Form.VirtualFormDescriptor descriptor)
          Add a VirtualFormDescriptor to the internal virtual forms.
 void discardSubmittedValue(javax.faces.component.EditableValueHolder inputField)
          Ensure that the supplied EditableValueHolder component will discard (rather than retain) its submitted value when a virtual form is submitted in which the component does not participate.
 void discardSubmittedValues(java.lang.String virtualFormName)
          Ensure that the participants in the supplied virtual form will discard (rather than retain) their submitted values when a different virtual form is submitted.
 javax.faces.component.UIComponent findComponentById(java.lang.String id)
          Given a bare, partially qualified, or fully qualified id, find the component.
static boolean fullyQualifiedIdMatchesPattern(java.lang.String fqId, java.lang.String pattern)
          Determine if the fully qualified id provided matches the supplied pattern.
static Form.VirtualFormDescriptor[] generateVirtualForms(java.lang.String configStr)
          Generate an array of VirtualFormDescriptors based on a virtual form configuration String.
static java.lang.String generateVirtualFormsConfig(Form.VirtualFormDescriptor[] descriptors)
          Generate a virtual form configuration String based on an array of VirtualFormDescriptors.
 java.lang.String getEnctype()
           
 java.lang.String getFamily()
          Return the family for this component.
static java.lang.String getFullyQualifiedId(javax.faces.component.UIComponent component)
          Obtain the virtual form compatible fully-qualified id for the supplied component.
 Form.VirtualFormDescriptor[] getInternalVirtualForms()
           
 java.lang.String getOnClick()
           
 java.lang.String getOnDblClick()
           
 java.lang.String getOnKeyDown()
           
 java.lang.String getOnKeyPress()
           
 java.lang.String getOnKeyUp()
           
 java.lang.String getOnMouseDown()
           
 java.lang.String getOnMouseMove()
           
 java.lang.String getOnMouseOut()
           
 java.lang.String getOnMouseOver()
           
 java.lang.String getOnMouseUp()
           
 java.lang.String getOnReset()
           
 java.lang.String getOnSubmit()
           
 java.lang.String getStyle()
           
 java.lang.String getStyleClass()
           
 java.lang.String getTarget()
           
 Form.VirtualFormDescriptor getVirtualFormComponentSubmits(java.lang.String id)
          Get the virtual form submitted by the component whose id is provided or null if the component does not submit a virtual form.
 Form.VirtualFormDescriptor[] getVirtualForms()
           
 java.lang.String getVirtualFormsConfig()
           
 boolean isAutoComplete()
           
static boolean isValidFullyQualifiedId(java.lang.String id)
          Determine if the id provided is non-null and exhibits the traits of a fully qualified id.
 boolean isVisible()
           
 void processDecodes(javax.faces.context.FacesContext context)
          Override UIForm.processDecodes(FacesContext) to ensure correct virtual form processing.
 void queueEvent(javax.faces.event.FacesEvent event)
           
 void restoreNonParticipatingSubmittedValues()
          Restore the submitted values erased by the virtual form mechanism where appropriate.
 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 setAutoComplete(boolean autoComplete)
          Use this non-XHTML compliant boolean attribute to turn off autocompletion feature of Internet Explorer and Firefox browsers.
 void setEnctype(java.lang.String enctype)
          Use this attribute to set the content-type of the HTTP request generated by this form.
 void setId(java.lang.String id)
          The component identifier for this component.
 void setInternalVirtualForms(Form.VirtualFormDescriptor[] internalVirtualForms)
          The virtual forms used "internally" by components (such as Table).
 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 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 setOnReset(java.lang.String onReset)
          Scripting code executed when this form is reset.
 void setOnSubmit(java.lang.String onSubmit)
          Scripting code executed when this form is submitted.
 void setRendered(boolean rendered)
          Use the rendered attribute to indicate whether the HTML code for the component should be included in the rendered HTML page.
 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 setSubmittedVirtualForm(Form.VirtualFormDescriptor vfd)
           
 void setTarget(java.lang.String target)
          Use this attribute to set the target of the XHTML form tag.
 void setVirtualForms(Form.VirtualFormDescriptor[] vfds)
           
 void setVirtualFormsConfig(java.lang.String configStr)
           
 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 javax.faces.component.UIForm
getContainerClientId, isPrependId, isSubmitted, processUpdates, processValidators, setPrependId, setSubmitted
 
Methods inherited from class javax.faces.component.UIComponentBase
broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendererType, getRendersChildren, getValueBinding, getValueExpression, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, setValueBinding, setValueExpression
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_WILD_CHAR

public static final char ID_WILD_CHAR
See Also:
Constant Field Values
Constructor Detail

Form

public Form()
Default constructor.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

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

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)

Override UIForm.processDecodes(FacesContext) to ensure correct virtual form processing.

Overrides:
processDecodes in class javax.faces.component.UIForm
Parameters:
context - FacesContext for the current request
Throws:
java.lang.NullPointerException - Thrown when context is null

queueEvent

public void queueEvent(javax.faces.event.FacesEvent event)
Overrides:
queueEvent in class javax.faces.component.UIComponentBase

setSubmittedVirtualForm

public void setSubmittedVirtualForm(Form.VirtualFormDescriptor vfd)

setVirtualForms

public void setVirtualForms(Form.VirtualFormDescriptor[] vfds)

setVirtualFormsConfig

public void setVirtualFormsConfig(java.lang.String configStr)

getVirtualFormComponentSubmits

public Form.VirtualFormDescriptor getVirtualFormComponentSubmits(java.lang.String id)
Get the virtual form submitted by the component whose id is provided or null if the component does not submit a virtual form.


findComponentById

public javax.faces.component.UIComponent findComponentById(java.lang.String id)
Given a bare, partially qualified, or fully qualified id, find the component. Unlike the inherited findComponent method, this method does recursively search NamingContainers.


generateVirtualForms

public static Form.VirtualFormDescriptor[] generateVirtualForms(java.lang.String configStr)

Generate an array of VirtualFormDescriptors based on a virtual form configuration String.


generateVirtualFormsConfig

public static java.lang.String generateVirtualFormsConfig(Form.VirtualFormDescriptor[] descriptors)

Generate a virtual form configuration String based on an array of VirtualFormDescriptors.


getFullyQualifiedId

public static java.lang.String getFullyQualifiedId(javax.faces.component.UIComponent component)
Obtain the virtual form compatible fully-qualified id for the supplied component. A fully-qualified id begins with the NamingContainer.SEPARATOR_CHAR (representing the Form itself), contains component ids of the component's ancestors separated by NamingContainer.SEPARATOR_CHAR, and ends with the component's id.


isValidFullyQualifiedId

public static boolean isValidFullyQualifiedId(java.lang.String id)
Determine if the id provided is non-null and exhibits the traits of a fully qualified id. This includes beginning with NamingContainer.SEPARATOR_CHAR, not ending with that character unless it is the only character, not ending in Form.ID_WILD_CHAR, and not containing spaces.


fullyQualifiedIdMatchesPattern

public static boolean fullyQualifiedIdMatchesPattern(java.lang.String fqId,
                                                     java.lang.String pattern)
Determine if the fully qualified id provided matches the supplied pattern. The pattern may be a bare, partially qualified, or fully qualified id. The pattern may also end with the NamingContainer.SEPARATOR_CHAR followed by the Form.ID_WILD_CHAR, in which case the children of the component indicated by the pattern will be considered a match.


addInternalVirtualForm

public void addInternalVirtualForm(Form.VirtualFormDescriptor descriptor)
Add a VirtualFormDescriptor to the internal virtual forms. If an existing VirtualFormDescriptor object is found with the same name, the object is replaced.

Parameters:
descriptor - The VirtualFormDescriptor to add.

restoreNonParticipatingSubmittedValues

public void restoreNonParticipatingSubmittedValues()

Restore the submitted values erased by the virtual form mechanism where appropriate. This method is called in FormRenderer.renderStart. It should not be called by developer code.

Note: Restoring of submitted values works on TableRowGroup components, but does not work on the standard faces data table component. This is because in UIData.encodeBegin, the table's per-row saved state is typically discarded. The result is that upon exiting FormRenderer.renderStart, the submitted values will be restored; however, they will subsequently be discarded. Nonetheless, we still cache and restore those submitted values, in case a third-party component extends UIData and, unlike UIData, does not discard its saved state during rendering.


discardSubmittedValue

public void discardSubmittedValue(javax.faces.component.EditableValueHolder inputField)

Ensure that the supplied EditableValueHolder component will discard (rather than retain) its submitted value when a virtual form is submitted in which the component does not participate.

Parameters:
inputField - An EditableValueHolder component that is not a participant in the virtual form that was submitted on this request.
Throws:
java.lang.IllegalArgumentException - if inputField is null.
java.lang.IllegalArgumentException - if a virtual form has been submitted and the supplied inputField participates in it.

discardSubmittedValues

public void discardSubmittedValues(java.lang.String virtualFormName)

Ensure that the participants in the supplied virtual form will discard (rather than retain) their submitted values when a different virtual form is submitted.

Parameters:
virtualFormName - The name of a virtual form on this page which has not been submitted.
Throws:
java.lang.IllegalArgumentException - if no virtual form exists with the supplied name.
java.lang.IllegalArgumentException - if the supplied virtual form has been submitted on this request.

getEnctype

public java.lang.String getEnctype()

setId

public void setId(java.lang.String id)
The component identifier for this component. This value must be unique within the closest parent component that is a naming container.

Overrides:
setId in class javax.faces.component.UIComponentBase

setRendered

public void setRendered(boolean rendered)
Use the rendered attribute to indicate whether the HTML code for the component should be included in the rendered HTML page. If set to false, the rendered HTML page does not include the HTML for the component. If the component is not rendered, it is also not processed on any subsequent form submission.

Overrides:
setRendered in class javax.faces.component.UIComponentBase

isAutoComplete

public boolean isAutoComplete()

setAutoComplete

public void setAutoComplete(boolean autoComplete)

Use this non-XHTML compliant boolean attribute to turn off autocompletion feature of Internet Explorer and Firefox browsers. Set to "false" to turn off completion. The default is "true".

See Also:
isAutoComplete()

setEnctype

public void setEnctype(java.lang.String enctype)

Use this attribute to set the content-type of the HTTP request generated by this form. You do not normally need to set this attribute. Its default value is application/x-www-form-urlencoded. If there is an upload tag inside the form, the upload tag will modify the form's enctype attribute to multipart/form-data.

See Also:
getEnctype()

getInternalVirtualForms

public Form.VirtualFormDescriptor[] getInternalVirtualForms()

setInternalVirtualForms

public void setInternalVirtualForms(Form.VirtualFormDescriptor[] internalVirtualForms)

The virtual forms used "internally" by components (such as Table). Component authors can manipulate this set of virtual forms independent of the set exposed to developers. This set is only consulted after the set exposed to developers is consulted. A participating or submitting id can end in ":*" to indicate descendants. For example, table1:* can be used as a participating or submitting id to indicate all the descendants of table1.

See Also:
getInternalVirtualForms()

getOnClick

public java.lang.String getOnClick()

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

setOnDblClick

public void setOnDblClick(java.lang.String onDblClick)

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

See Also:
getOnDblClick()

getOnKeyDown

public java.lang.String getOnKeyDown()

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

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

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

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

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

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

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

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

getOnReset

public java.lang.String getOnReset()

setOnReset

public void setOnReset(java.lang.String onReset)

Scripting code executed when this form is reset.

See Also:
getOnReset()

getOnSubmit

public java.lang.String getOnSubmit()

setOnSubmit

public void setOnSubmit(java.lang.String onSubmit)

Scripting code executed when this form is submitted.

See Also:
getOnSubmit()

getStyle

public java.lang.String getStyle()

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

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

getTarget

public java.lang.String getTarget()

setTarget

public void setTarget(java.lang.String target)

Use this attribute to set the target of the XHTML form tag.

See Also:
getTarget()

getVirtualForms

public Form.VirtualFormDescriptor[] getVirtualForms()

getVirtualFormsConfig

public java.lang.String getVirtualFormsConfig()

isVisible

public boolean isVisible()

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 javax.faces.component.UIComponentBase

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 javax.faces.component.UIComponentBase


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