JSF-Spring

de.mindmatters.faces.component.html
Class HtmlForm

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIForm
              extended by javax.faces.component.html.HtmlForm
                  extended by de.mindmatters.faces.component.html.HtmlForm
All Implemented Interfaces:
ActionSource, NamingContainer, StateHolder

public class HtmlForm
extends HtmlForm
implements ActionSource

Represents an HTML form element. HtmlForm implements ActionSource - therefore it is possible to define an action and an action listener attribute. Methodbindings declared as action listener will be invoked on every form submit before action listeners of any nested UICommand will be executed. Futhermore this form supports stateless action listeners as direct children and the immediate attribute.

HtmlForm supports the "method" attribute. Supported methods are 'POST' (default method) and 'GET'. 'GET' is only supported if an appropriate ViewBuilder is configured as ViewHandler.

By default, the rendererType property must be set to "de.mindmatters.faces.Form". This value can be changed by calling the setRendererType() method.

Author:
Andreas Kuhrwahl

Field Summary
static java.lang.String COMPONENT_FAMILY
          The standard component type for this component.
static java.lang.String COMPONENT_TYPE
          The standard component type for this component.
static java.lang.String RENDERER_TYPE
          The standard renderer type for this component.
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
HtmlForm()
          The standard constructor.
 
Method Summary
 void addActionListener(ActionListener listener)
          
 void broadcast(FacesEvent event)
          Invoke any listeners attached to this object which are listening for an event whose type matches the specified event's runtime type.
 MethodBinding getAction()
          
 MethodBinding getActionListener()
          
 ActionListener[] getActionListeners()
          
 java.lang.String getMethod()
          Returns the method of this form - supports 'POST' or 'GET'.
 boolean isImmediate()
          
 boolean isTransient()
          
 void queueEvent(FacesEvent e)
          
 void removeActionListener(ActionListener listener)
          
 void restoreState(FacesContext context, java.lang.Object state)
          Invoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.
 java.lang.Object saveState(FacesContext context)
          Invoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.
 void setAction(MethodBinding action)
          
 void setActionListener(MethodBinding actionListener)
          
 void setId(java.lang.String id)
          Set an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component.
 void setImmediate(boolean immediate)
          
 void setMethod(java.lang.String method)
          Sets the method of this form - supports 'POST' or 'GET'.
 void setTransient(boolean transientFlag)
          
 
Methods inherited from class javax.faces.component.html.HtmlForm
getAccept, getAcceptcharset, getDir, getEnctype, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnreset, getOnsubmit, getStyle, getStyleClass, getTarget, getTitle, setAccept, setAcceptcharset, setDir, setEnctype, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnreset, setOnsubmit, setStyle, setStyleClass, setTarget, setTitle
 
Methods inherited from class javax.faces.component.UIForm
getFamily, isSubmitted, processDecodes, processUpdates, processValidators, setSubmitted
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendered, setRendererType, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERER_TYPE

public static final java.lang.String RENDERER_TYPE
The standard renderer type for this component.

See Also:
Constant Field Values

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
The standard component type for this component.

See Also:
Constant Field Values

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY
The standard component type for this component.

See Also:
Constant Field Values
Constructor Detail

HtmlForm

public HtmlForm()
The standard constructor.

Method Detail

getAction

public MethodBinding getAction()

Specified by:
getAction in interface ActionSource

setAction

public void setAction(MethodBinding action)

Specified by:
setAction in interface ActionSource

getActionListener

public MethodBinding getActionListener()

Specified by:
getActionListener in interface ActionSource

setActionListener

public void setActionListener(MethodBinding actionListener)

Specified by:
setActionListener in interface ActionSource

addActionListener

public void addActionListener(ActionListener listener)

Specified by:
addActionListener in interface ActionSource

getActionListeners

public ActionListener[] getActionListeners()

Specified by:
getActionListeners in interface ActionSource

removeActionListener

public void removeActionListener(ActionListener listener)

Specified by:
removeActionListener in interface ActionSource

setImmediate

public void setImmediate(boolean immediate)

Specified by:
setImmediate in interface ActionSource

isImmediate

public boolean isImmediate()

Specified by:
isImmediate in interface ActionSource

getMethod

public java.lang.String getMethod()
Returns the method of this form - supports 'POST' or 'GET'.

Returns:
The method of this form or null if not set

setMethod

public void setMethod(java.lang.String method)
Sets the method of this form - supports 'POST' or 'GET'.

Parameters:
method - The method 'POST' or 'GET'

saveState

public java.lang.Object saveState(FacesContext context)
Invoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.

Specified by:
saveState in interface StateHolder
Overrides:
saveState in class HtmlForm

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)
Invoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.

Specified by:
restoreState in interface StateHolder
Overrides:
restoreState in class HtmlForm
state - is an object previously returned by the saveState method of this class.

queueEvent

public void queueEvent(FacesEvent e)

Overrides:
queueEvent in class UIComponentBase

broadcast

public void broadcast(FacesEvent event)
Invoke any listeners attached to this object which are listening for an event whose type matches the specified event's runtime type.

This method does not propagate the event up to parent components, ie listeners attached to parent components don't automatically get called.

If any of the listeners throws AbortProcessingException then that exception will prevent any further listener callbacks from occurring, and the exception propagates out of this method without alteration.

ActionEvent events are typically queued by the renderer associated with this component in its decode method; ValueChangeEvent events by the component's validate method. In either case the event's source property references a component. At some later time the UIViewRoot component iterates over its queued events and invokes the broadcast method on each event's source object.

Overrides:
broadcast in class UIComponentBase
Parameters:
event - must not be null.

setId

public final void setId(java.lang.String id)
Set an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component. The id is not necessarily unique across all components in the current view.

The id must start with an underscore if it is generated by the JSF framework, and must not start with an underscore if it has been specified by the user (eg in a JSP tag).

The first character of the id must be an underscore or letter. Following characters may be letters, digits, underscores or dashes.

Null is allowed as a parameter, and will reset the id to null.

The clientId of this component is reset by this method; see getClientId for more info.

Overrides:
setId in class UIComponentBase

isTransient

public final boolean isTransient()

Specified by:
isTransient in interface StateHolder
Overrides:
isTransient in class UIComponentBase

setTransient

public final void setTransient(boolean transientFlag)

Specified by:
setTransient in interface StateHolder
Overrides:
setTransient in class UIComponentBase

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG