Package org.apache.tapestry5.services
Interface FormSupport
-
- All Superinterfaces:
ClientElement
- All Known Subinterfaces:
InternalFormSupport
- All Known Implementing Classes:
FormSupportAdapter
,FormSupportImpl
public interface FormSupport extends ClientElement
Services provided by an enclosing Form control component to the various form element components it encloses. ImplementsClientElement
, to share the id of the enclosing form.- See Also:
Field
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addValidation(Field field, java.lang.String validationName, java.lang.String message, java.lang.Object constraint)
Deprecated.Deprecated in 5.4 with no exact replacement; this default implementation now does nothing.java.lang.String
allocateControlName(java.lang.String id)
Allocates a unique (within the form) control name for some enclosed component, based on the component's id.void
defer(java.lang.Runnable command)
Defers a command until the end of the form submission.java.lang.String
getFormComponentId()
Returns the complete id of the underlying Form component.java.lang.String
getFormValidationId()
Id used as a prefix when searchingMessages
for validation messages and constraints.boolean
isClientValidationEnabled()
Return true if client validation is enabled for this form, false otherwise.void
setEncodingType(java.lang.String encodingType)
Sets the encoding type for the Form.<T> void
store(T component, ComponentAction<T> action)
Stores an action for execution during a later request.<T> void
storeAndExecute(T component, ComponentAction<T> action)
As withstore(Object, org.apache.tapestry5.ComponentAction)
}, but the action is also invoked immediately.<T> void
storeCancel(T component, ComponentAction<T> action)
Stores an action for execution in a later request when the containing form is canceled.-
Methods inherited from interface org.apache.tapestry5.ClientElement
getClientId
-
-
-
-
Method Detail
-
allocateControlName
java.lang.String allocateControlName(java.lang.String id)
Allocates a unique (within the form) control name for some enclosed component, based on the component's id.- Parameters:
id
- the component's id- Returns:
- a unique string, usually the component's id, but sometime extended with a unique number or string
-
store
<T> void store(T component, ComponentAction<T> action)
Stores an action for execution during a later request. If the action contains any mutable state, it should be in its final state before invoking this method and its internal state should not be changed subsequently.
-
storeCancel
<T> void storeCancel(T component, ComponentAction<T> action)
Stores an action for execution in a later request when the containing form is canceled. Cancel actions are triggered before the form fires itsEventConstants.CANCELED
event.- Since:
- 5.4
-
storeAndExecute
<T> void storeAndExecute(T component, ComponentAction<T> action)
As withstore(Object, org.apache.tapestry5.ComponentAction)
}, but the action is also invoked immediately. This is useful for defining an action that should occur symmetrically in both the render request and the form submission's action request.- Parameters:
component
- component against which to trigger the actionaction
- the action that will be triggered (and passed the component)
-
defer
void defer(java.lang.Runnable command)
Defers a command until the end of the form submission. The command will be executed before the Form's validate notification, but after all other submit actions for the form have been processed. This is used, primarily, to coordinate validations or other operations that involve multiple components, when the order of the components can not be determined. During a form render, runnables are executed after the body of the form has rendered.- Parameters:
command
- to be executed
-
setEncodingType
void setEncodingType(java.lang.String encodingType)
Sets the encoding type for the Form. This should only be set once, and if- Parameters:
encodingType
- MIME type indicating type of encoding for the form- Throws:
java.lang.IllegalStateException
- if the encoding type has already been set to a value different than the supplied
-
addValidation
void addValidation(Field field, java.lang.String validationName, java.lang.String message, java.lang.Object constraint)
Deprecated.Deprecated in 5.4 with no exact replacement; this default implementation now does nothing. InvokeisClientValidationEnabled()
, and (if true), useJavaScriptSupport
to add necessary modules, and add triggering and configuring attributes to the field'sElement
.Collects field validation information. A Form may turn off client-side validation, in which case these calls will be ignored.- Parameters:
field
- for which validation is being generatedvalidationName
- name of validation method (see Tapestry.Validation in tapestry.js)message
- the error message to display if the field is invalidconstraint
- additional constraint value, or null for validations that don't require a constraint
-
isClientValidationEnabled
boolean isClientValidationEnabled()
Return true if client validation is enabled for this form, false otherwise.
-
getFormComponentId
java.lang.String getFormComponentId()
Returns the complete id of the underlying Form component.
-
getFormValidationId
java.lang.String getFormValidationId()
Id used as a prefix when searchingMessages
for validation messages and constraints. This is normally the simple id of the form.- Returns:
- validation id string
- See Also:
FieldTranslatorSource
,FieldValidatorSource
-
-