|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.form.FormSupportImpl
Encapsulates most of the behavior of a Form component.
Field Summary | |
static java.lang.String |
FIELD_FOCUS_ATTRIBUTE
Attribute set to true when a field has been focused; used to prevent conflicting JavaScript for field focusing from being emitted. |
static java.lang.String |
FORM_IDS
Name of query parameter storing the ids alloocated while rendering the form, as a comma seperated list. |
static java.lang.String |
RESERVED_FORM_IDS
Names of additional ids that were pre-reserved, as a comma-sepereated list. |
static java.lang.String |
SCRIPT
|
static java.lang.String |
SUBMIT_MODE
Indicates why the form was submitted: whether for normal ("submit"), refresh, or because the form was canceled. |
Constructor Summary | |
FormSupportImpl(IMarkupWriter writer,
IRequestCycle cycle,
IForm form)
|
Method Summary | |
void |
addDeferredRunnable(java.lang.Runnable runnable)
Adds a deferred runnable, an object to be executed either before the </form> tag is rendered (when rendering), or before the form's listener is invoked (when rewinding). |
void |
addEventHandler(FormEventType type,
java.lang.String functionName)
Adds an event handler for the form, of the given type. |
void |
addHiddenValue(java.lang.String name,
java.lang.String value)
Adds a hidden field value to be stored in the form. |
void |
addHiddenValue(java.lang.String name,
java.lang.String id,
java.lang.String value)
Adds a hidden field value to be stored in the form. |
protected void |
emitEventManagerInitialization(java.lang.String formId)
Pre-renders the form, setting up some client-side form support. |
java.lang.String |
getElementId(IFormComponent component)
Constructs a unique identifier (within the Form). |
java.lang.String |
getElementId(IFormComponent component,
java.lang.String baseId)
Constructs a unique identifier (within the Form). |
boolean |
isRewinding()
Returns true if the form is rewinding (meaning, the form was the subject of the request cycle). |
void |
prerenderField(IMarkupWriter writer,
IComponent field,
org.apache.hivemind.Location location)
Pre-renders the specified field, buffering the result for later use by wasPrerendered(IMarkupWriter, IComponent) . |
void |
registerForFocus(IFormComponent field,
int priority)
Registers a field for automatic focus. |
void |
render(java.lang.String method,
IRender informalParametersRenderer,
ILink link,
java.lang.String scheme)
Old interface left around for backwards compatibility. |
void |
render(java.lang.String method,
IRender informalParametersRenderer,
ILink link,
java.lang.String scheme,
java.lang.Integer port)
Invoked when the form is rendering. |
java.lang.String |
rewind()
Invoked to rewind the form, which renders the body of the form, allowing form element components to pull data from the request and update page properties. |
void |
setEncodingType(java.lang.String encodingType)
May be invoked by a component to force the encoding type of the form to a particular value. |
boolean |
wasPrerendered(IMarkupWriter writer,
IComponent field)
Invoked by a form control component (a field) that may have been pre-rendered. |
protected void |
writeHiddenField(IMarkupWriter writer,
java.lang.String name,
java.lang.String id,
java.lang.String value)
Overwridden by GoFormSupportImpl (WML). |
protected void |
writeHiddenFieldList()
Writes out all hidden values previously added by addHiddenValue(String, String, String) , plus the allocated id list. |
protected void |
writeHiddenFields()
Writes out all hidden values previously added by addHiddenValue(String, String, String) . |
protected void |
writeTag(IMarkupWriter writer,
java.lang.String method,
java.lang.String url)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String FORM_IDS
public static final java.lang.String RESERVED_FORM_IDS
public static final java.lang.String SUBMIT_MODE
public static final java.lang.String SCRIPT
public static final java.lang.String FIELD_FOCUS_ATTRIBUTE
Constructor Detail |
public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, IForm form)
Method Detail |
public void addEventHandler(FormEventType type, java.lang.String functionName)
addEventHandler
in interface FormBehavior
public void addHiddenValue(java.lang.String name, java.lang.String value)
FormBehavior
It is acceptible to add multiple hidden fields with the same name. They will be written in the order they are received.
addHiddenValue
in interface FormBehavior
public void addHiddenValue(java.lang.String name, java.lang.String id, java.lang.String value)
FormBehavior
It is acceptible to add multiple hidden fields with the same name. They will be written in the order they are received.
addHiddenValue
in interface FormBehavior
public java.lang.String getElementId(IFormComponent component)
Simply invokes
getElementId(org.apache.tapestry.form.IFormComponent, java.lang.String)
with the
component's id.
getElementId
in interface FormBehavior
public java.lang.String getElementId(IFormComponent component, java.lang.String baseId)
Simply invokes
getElementId(org.apache.tapestry.form.IFormComponent, java.lang.String)
with the
component's id.
getElementId
in interface FormBehavior
public boolean isRewinding()
FormBehavior
isRewinding
in interface FormBehavior
public void render(java.lang.String method, IRender informalParametersRenderer, ILink link, java.lang.String scheme)
FormSupport
render
in interface FormSupport
method
- the HTTP method ("get" or "post")informalParametersRenderer
- object that will render informal parameterslink
- The link to which the form will submit (encapsulating the URL and the query
parameters)scheme
- the desired scheme for the generated URL, typically "http" or "https". If
non-null, and the scheme does not match the current request's scheme, then an
absolute URL with the specified scheme will be generated, rather than a URI.public void render(java.lang.String method, IRender informalParametersRenderer, ILink link, java.lang.String scheme, java.lang.Integer port)
FormSupport
Form
component.
render
in interface FormSupport
method
- the HTTP method ("get" or "post")informalParametersRenderer
- object that will render informal parameterslink
- The link to which the form will submit (encapsulating the URL and the query
parameters)scheme
- the desired scheme for the generated URL, typically "http" or "https". If
non-null, and the scheme does not match the current request's scheme, then an
absolute URL with the specified scheme will be generated, rather than a URI.port
- the desired port for the generated URL, typically "80", "443". If
non-null, and the port does not match the current request's port, then an
absolute URL with the specified port will be generated, rather than a URI.protected void emitEventManagerInitialization(java.lang.String formId)
public java.lang.String rewind()
FormSupport
Form
component.
rewind
in interface FormSupport
FormConstants.SUBMIT_NORMAL
,
FormConstants.SUBMIT_CANCEL
or FormConstants.SUBMIT_REFRESH
.public void setEncodingType(java.lang.String encodingType)
FormBehavior
setEncodingType
in interface FormBehavior
Upload
protected void writeHiddenField(IMarkupWriter writer, java.lang.String name, java.lang.String id, java.lang.String value)
GoFormSupportImpl
(WML).
protected void writeHiddenFields()
addHiddenValue(String, String, String)
. Writes a <div> tag around
writeHiddenFieldList()
. Overriden by
GoFormSupportImpl
.
protected void writeHiddenFieldList()
addHiddenValue(String, String, String)
, plus the allocated id list.
protected void writeTag(IMarkupWriter writer, java.lang.String method, java.lang.String url)
public void prerenderField(IMarkupWriter writer, IComponent field, org.apache.hivemind.Location location)
FormBehavior
FormBehavior.wasPrerendered(IMarkupWriter, IComponent)
. Typically, it is a
FieldLabel
component that pre-renders an associated
field. This little dance is necessary to properly support field labels inside loops, and to
handle the portlet action/render request cycle.
prerenderField
in interface FormBehavior
writer
- the markup writer (from which a nested markup writer is obtained)field
- the field to pre-render. The field is responsible for invoking
FormBehavior.wasPrerendered(IMarkupWriter, IComponent)
.location
- an optional location (of the FieldLabel component) used when reporting errors.public boolean wasPrerendered(IMarkupWriter writer, IComponent field)
FormBehavior
wasPrerendered
in interface FormBehavior
public void addDeferredRunnable(java.lang.Runnable runnable)
FormBehavior
addDeferredRunnable
in interface FormBehavior
runnable
- the object to execute (which may not be null)public void registerForFocus(IFormComponent field, int priority)
FormBehavior
registerForFocus
in interface FormBehavior
field
- the field requesting focuspriority
- a priority level used to determine whether the registered field becomes the focus
field. Constants for this purpose are defined in ValidationConstants
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |