|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FormBehavior
Common interface extended by IForm
and
FormSupport
.
Method Summary | |
---|---|
void |
addDeferredRunnable(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,
String functionName)
Deprecated. Wiring of form event handlers is now managed on the client side. This method may be removed in Tapestry 4.1.2. |
void |
addHiddenValue(String name,
String value)
Adds a hidden field value to be stored in the form. |
void |
addHiddenValue(String name,
String id,
String value)
Adds a hidden field value to be stored in the form. |
String |
getElementId(IFormComponent component)
Constructs a unique identifier (within the Form). |
String |
getElementId(IFormComponent component,
String baseId)
Constructs a unique identifier from the base id. |
JSONObject |
getProfile()
The javascript object profile being built by this context to validate/translate form values. |
boolean |
isFormFieldUpdating()
Checks to see if a form field has been updated. |
boolean |
isRewinding()
Returns true if the form is rewinding (meaning, the form was the subject of the request cycle). |
String |
peekClientId(IFormComponent component)
Used internally to "peek" at what the next generated client id will be for the given component when it renders. |
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 |
setEncodingType(String encodingType)
May be invoked by a component to force the encoding type of the form to a particular value. |
void |
setFormFieldUpdating(boolean value)
Sets a flag denoting whether or not an IFormComponent field has been
updated according to the logic defined in
ResponseBuilder.updateComponent(String) . |
boolean |
wasPrerendered(IComponent field)
Invoked to check if a particular component has been pre-rendered. |
boolean |
wasPrerendered(IMarkupWriter writer,
IComponent field)
Invoked by a form control component (a field) that may have been pre-rendered. |
Method Detail |
---|
void addEventHandler(FormEventType type, String functionName)
FormEventType.SUBMIT
is most typical.
type
- Type of event to add.functionName
- Name of the javascript function being added.void addHiddenValue(String name, String value)
It is acceptible to add multiple hidden fields with the same name. They will be written in the order they are received.
name
- The name of the hidden input.value
- The value to store in the hidden field.void addHiddenValue(String name, String id, String value)
It is acceptible to add multiple hidden fields with the same name. They will be written in the order they are received.
name
- The name of the hidden input.id
- The id of the hidden input - should almost always be the same as the name.value
- The value to store in the hidden field.String getElementId(IFormComponent component)
Simply invokes getElementId(IFormComponent, String)
with the component's id.
Note: yes, some confusion on naming here. This is the form element id, which should be (for
Tapestry purposes) unique within the rendered form. The IFormComponent.getClientId()
is different, and should be unique within the rendered page.
component
- The component to get the unique id of.
String getElementId(IFormComponent component, String baseId)
This method is provided simply so that some components (
ImageSubmit
) have more specific control over their names.
Invokes IFormComponent.setName(String)
with the result, as well as returning it.
component
- The component to generate an element id for.baseId
- The basic id of the component.
StaleLinkException
- if, when the form itself is rewinding, the element id allocated does not match
the expected id (as allocated when the form rendered). This indicates that the
state of the application has changed between the time the form renderred and the
time it was submitted.String peekClientId(IFormComponent component)
IRequestCycle.peekUniqueId(String)
.
component
- The component to determine the next client id for.
boolean isRewinding()
void setEncodingType(String encodingType)
encodingType
- The encoding type to set.
org.apache.hivemind.ApplicationRuntimeException
- if the current encoding type is not null and doesn't match the provided encoding
typeUpload
void prerenderField(IMarkupWriter writer, IComponent field, org.apache.hivemind.Location location)
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.
writer
- the markup writer (from which a nested markup writer is obtained)field
- the field to pre-render. The field is responsible for invoking
wasPrerendered(IMarkupWriter, IComponent)
.location
- an optional location (of the FieldLabel component) used when reporting errors.boolean wasPrerendered(IMarkupWriter writer, IComponent field)
writer
- The markup writer to render with. (may be ignored during dynamic requests)field
- The component to check for pre-rendering.
boolean wasPrerendered(IComponent field)
field
- The component to check for pre-rendering. (Such as is done by FieldLabel
.
void addDeferredRunnable(Runnable runnable)
runnable
- the object to execute (which may not be null)void registerForFocus(IFormComponent field, int priority)
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
.JSONObject getProfile()
JSONObject
profile.void setFormFieldUpdating(boolean value)
IFormComponent
field has been
updated according to the logic defined in
ResponseBuilder.updateComponent(String)
.
Currently this flag is used during ajax/json responses so that cooperating
ResponseBuilder
s can be worked with to ensure form state is properly
updated on the client. Specifically, that the hidden form input fields and
any associated validation profiles are updated.
value
- The value to set.boolean isFormFieldUpdating()
setFormFieldUpdating(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |