Package org.apache.wicket.validation
Class CompoundValidator<T>
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.validation.CompoundValidator<T>
-
- Type Parameters:
T- type of validatable
- All Implemented Interfaces:
java.io.Serializable,IComponentAwareEventSink,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable,IValidator<T>
public class CompoundValidator<T> extends Behavior implements IValidator<T>
A compoundIValidator. Once an error is reported against theIValidatablebeing checked, the rest of the validator chain is ignored.- Since:
- 1.2.6
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CompoundValidator()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompoundValidator<T>add(IValidator<T> validator)Adds anIValidatorto the chain of validators.voidafterRender(Component component)Called when a component that has this behavior coupled was rendered.voidbeforeRender(Component component)Called when a component is about to render.voidbind(Component component)Bind this handler to the given component.voiddetach(Component component)Allows the behavior to detach any state it has attached during request processing.booleangetStatelessHint(Component component)This method returns false if the behavior generates a callback url (for example ajax behaviors)java.util.List<IValidator<T>>getValidators()Gets an unmodifiable list of the registered validators.voidonComponentTag(Component component, ComponentTag tag)Called any time a component that has this behavior registered is rendering the component tag.voidonConfigure(Component component)Called immediately after the onConfigure method in a component.voidonEvent(Component component, IEvent<?> event)Called to notify the behavior about any events sent to the componentvoidonException(Component component, java.lang.RuntimeException exception)In case an unexpected exception happened anywhere between Behavior.onComponentTag(org.apache.wicket.Component, org.apache.wicket.markup.ComponentTag) and Behavior.afterRender(org.apache.wicket.Component), onException() will be called for any behavior.voidonRemove(Component component)Called to notify that the component is being removed from its parentvoidrenderHead(Component component, IHeaderResponse response)Render to the web response whatever the component wants to contribute to the head section.voidunbind(Component component)Notifies the behavior it is removed from the specified componentvoidvalidate(IValidatable<T> validatable)Validates theIValidatableinstance.-
Methods inherited from class org.apache.wicket.behavior.Behavior
canCallListener, isEnabled, isTemporary, onAttribute, onTag
-
-
-
-
Method Detail
-
add
public final CompoundValidator<T> add(IValidator<T> validator)
Adds anIValidatorto the chain of validators.- Parameters:
validator- anIValidatorto be added- Returns:
- this
ValidationErrorfor chaining purposes
-
validate
public final void validate(IValidatable<T> validatable)
Description copied from interface:IValidatorValidates theIValidatableinstance. Validation errors should be reported using theIValidatable.error(IValidationError)method.- Specified by:
validatein interfaceIValidator<T>- Parameters:
validatable- theIValidatableinstance being validated- See Also:
IValidator.validate(IValidatable)
-
getValidators
public final java.util.List<IValidator<T>> getValidators()
Gets an unmodifiable list of the registered validators.- Returns:
- unmodifiable list of delegate
IValidators inside this one
-
beforeRender
public void beforeRender(Component component)
Description copied from class:BehaviorCalled when a component is about to render.- Overrides:
beforeRenderin classBehavior- Parameters:
component- the component that has this behavior coupled
-
afterRender
public void afterRender(Component component)
Description copied from class:BehaviorCalled when a component that has this behavior coupled was rendered.- Overrides:
afterRenderin classBehavior- Parameters:
component- the component that has this behavior coupled
-
bind
public void bind(Component component)
Description copied from class:BehaviorBind this handler to the given component. This method is called by the host component immediately after this behavior is added to it. This method is useful if you need to do initialization based on the component it is attached and you can't wait to do it at render time. Keep in mind that if you decide to keep a reference to the host component, it is not thread safe anymore, and should thus only be used in situations where you do not reuse the behavior for multiple components.
-
unbind
public void unbind(Component component)
Description copied from class:BehaviorNotifies the behavior it is removed from the specified component
-
detach
public void detach(Component component)
Description copied from class:BehaviorAllows the behavior to detach any state it has attached during request processing.
-
onException
public void onException(Component component, java.lang.RuntimeException exception)
Description copied from class:BehaviorIn case an unexpected exception happened anywhere between Behavior.onComponentTag(org.apache.wicket.Component, org.apache.wicket.markup.ComponentTag) and Behavior.afterRender(org.apache.wicket.Component), onException() will be called for any behavior. Typically, if you clean up resources inBehavior.afterRender(Component), you should do the same in the implementation of this method.- Overrides:
onExceptionin classBehavior- Parameters:
component- the component that has a reference to this behavior and during which processing the exception occurredexception- the unexpected exception
-
getStatelessHint
public boolean getStatelessHint(Component component)
Description copied from class:BehaviorThis method returns false if the behavior generates a callback url (for example ajax behaviors)- Overrides:
getStatelessHintin classBehavior- Parameters:
component- the component that has this behavior coupled.- Returns:
- boolean true or false.
-
onComponentTag
public void onComponentTag(Component component, ComponentTag tag)
Description copied from class:BehaviorCalled any time a component that has this behavior registered is rendering the component tag.- Overrides:
onComponentTagin classBehavior- Parameters:
component- the component that renders this tag currentlytag- the tag that is rendered
-
renderHead
public void renderHead(Component component, IHeaderResponse response)
Description copied from class:BehaviorRender to the web response whatever the component wants to contribute to the head section.- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classBehavior- Parameters:
component- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse- Response object
-
onConfigure
public void onConfigure(Component component)
Description copied from class:BehaviorCalled immediately after the onConfigure method in a component. Since this is before the rendering cycle has begun, the behavior can modify the configuration of the component (i.e. setVisible(false))- Overrides:
onConfigurein classBehavior- Parameters:
component- the component being configured
-
onEvent
public void onEvent(Component component, IEvent<?> event)
Description copied from class:BehaviorCalled to notify the behavior about any events sent to the component- Specified by:
onEventin interfaceIComponentAwareEventSink- Overrides:
onEventin classBehavior- Parameters:
component- component that owns this sink. For example, if the implementation of this interface is aBehaviorthen component parameter will contain the component to which the behavior is attached.- See Also:
IComponentAwareEventSink.onEvent(org.apache.wicket.Component, org.apache.wicket.event.IEvent)
-
-