Class FormSupportAdapter
- java.lang.Object
-
- org.apache.tapestry5.corelib.internal.FormSupportAdapter
-
- All Implemented Interfaces:
ClientElement,FormSupport
public class FormSupportAdapter extends java.lang.Object implements FormSupport
An implementation ofFormSupportthat delegates all behavior to another instance of FormSupport. This allows some of the behavior to be overridden easily.
-
-
Constructor Summary
Constructors Constructor Description FormSupportAdapter(FormSupport delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValidation(Field field, java.lang.String validationName, java.lang.String message, java.lang.Object constraint)Collects field validation information.java.lang.StringallocateControlName(java.lang.String id)Allocates a unique (within the form) control name for some enclosed component, based on the component's id.voiddefer(java.lang.Runnable command)Defers a command until the end of the form submission.java.lang.StringgetClientId()java.lang.StringgetFormComponentId()Returns the complete id of the underlying Form component.java.lang.StringgetFormValidationId()Id used as a prefix when searchingMessagesfor validation messages and constraints.booleanisClientValidationEnabled()Return true if client validation is enabled for this form, false otherwise.voidsetEncodingType(java.lang.String encodingType)Sets the encoding type for the Form.<T> voidstore(T component, ComponentAction<T> action)Stores an action for execution during a later request.<T> voidstoreAndExecute(T component, ComponentAction<T> action)As withFormSupport.store(Object, org.apache.tapestry5.ComponentAction)}, but the action is also invoked immediately.<T> voidstoreCancel(T component, ComponentAction<T> action)Stores an action for execution in a later request when the containing form is canceled.
-
-
-
Constructor Detail
-
FormSupportAdapter
public FormSupportAdapter(FormSupport delegate)
-
-
Method Detail
-
allocateControlName
public java.lang.String allocateControlName(java.lang.String id)
Description copied from interface:FormSupportAllocates a unique (within the form) control name for some enclosed component, based on the component's id.- Specified by:
allocateControlNamein interfaceFormSupport- 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
public <T> void store(T component, ComponentAction<T> action)
Description copied from interface:FormSupportStores 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.- Specified by:
storein interfaceFormSupport
-
storeAndExecute
public <T> void storeAndExecute(T component, ComponentAction<T> action)
Description copied from interface:FormSupportAs withFormSupport.store(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.- Specified by:
storeAndExecutein interfaceFormSupport- Parameters:
component- component against which to trigger the actionaction- the action that will be triggered (and passed the component)
-
defer
public void defer(java.lang.Runnable command)
Description copied from interface:FormSupportDefers 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.- Specified by:
deferin interfaceFormSupport- Parameters:
command- to be executed
-
setEncodingType
public void setEncodingType(java.lang.String encodingType)
Description copied from interface:FormSupportSets the encoding type for the Form. This should only be set once, and if- Specified by:
setEncodingTypein interfaceFormSupport- Parameters:
encodingType- MIME type indicating type of encoding for the form
-
addValidation
public void addValidation(Field field, java.lang.String validationName, java.lang.String message, java.lang.Object constraint)
Description copied from interface:FormSupportCollects field validation information. A Form may turn off client-side validation, in which case these calls will be ignored.- Specified by:
addValidationin interfaceFormSupport- 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
-
getClientId
public java.lang.String getClientId()
- Specified by:
getClientIdin interfaceClientElement- Returns:
- a unique id for the element. This value will be unique for any given rendering of a page. This value is intended for use as the id attribute of the client-side element, and will be used with any DHTML/Ajax related JavaScript.
-
isClientValidationEnabled
public boolean isClientValidationEnabled()
Description copied from interface:FormSupportReturn true if client validation is enabled for this form, false otherwise.- Specified by:
isClientValidationEnabledin interfaceFormSupport
-
getFormComponentId
public java.lang.String getFormComponentId()
Description copied from interface:FormSupportReturns the complete id of the underlying Form component.- Specified by:
getFormComponentIdin interfaceFormSupport
-
getFormValidationId
public java.lang.String getFormValidationId()
Description copied from interface:FormSupportId used as a prefix when searchingMessagesfor validation messages and constraints. This is normally the simple id of the form.- Specified by:
getFormValidationIdin interfaceFormSupport- Returns:
- validation id string
- See Also:
FieldTranslatorSource,FieldValidatorSource
-
storeCancel
public <T> void storeCancel(T component, ComponentAction<T> action)
Description copied from interface:FormSupportStores an action for execution in a later request when the containing form is canceled. Cancel actions are triggered before the form fires itsEventConstants.CANCELEDevent.- Specified by:
storeCancelin interfaceFormSupport
-
-