org.sakaiproject.profile2.tool.components
Class ComponentVisualErrorBehaviour

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.apache.wicket.behavior.AbstractAjaxBehavior
          extended by org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
              extended by org.apache.wicket.ajax.AjaxEventBehavior
                  extended by org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
                      extended by org.sakaiproject.profile2.tool.components.ComponentVisualErrorBehaviour
All Implemented Interfaces:
Serializable, org.apache.wicket.behavior.IBehavior, org.apache.wicket.behavior.IBehaviorListener, org.apache.wicket.IClusterable, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.IHeaderContributor

public class ComponentVisualErrorBehaviour
extends org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior

Behavior that checks if a FormComponent is valid. Valid FormComponent objects get the CSS class 'formcomponent valid' and invalid FormComponent objects get the CSS class 'formcomponent invalid'. See AjaxFormComponentUpdatingBehavior for more details over the parent class. You can use this code under Apache 2.0 license, as long as you retain the copyright messages. Tested with Wicket 1.3.4

Author:
Daan, StuQ.nl
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
 
Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener
INTERFACE
 
Constructor Summary
ComponentVisualErrorBehaviour(String event, org.apache.wicket.Component updateComponent)
          Constructor.
 
Method Summary
protected  void onError(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget, RuntimeException e)
          Listener invoked on the ajax request.
protected  void onUpdate(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Listener invoked on the ajax request.
 
Methods inherited from class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
disableFocusOnBlur, getEventHandler, getFormComponent, getUpdateModel, onBind, onCheckEvent, onEvent
 
Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
generateCallbackScript, getEvent, onComponentTag, respond, setThrottleDelay
 
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onRequest, renderHead, throttleScript
 
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
bind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, beforeRender, cleanup, detach, detachModel, exception, isEnabled, isTemporary, onException, rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentVisualErrorBehaviour

public ComponentVisualErrorBehaviour(String event,
                                     org.apache.wicket.Component updateComponent)
Constructor.

Parameters:
event - of type String (for example 'onblur', 'onkeyup', etc.)
updateComponent - is the Component that must be updated (for example the FeedbackLabel containing the error message for this FormComponent)
Method Detail

onError

protected void onError(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget,
                       RuntimeException e)
Listener invoked on the ajax request. This listener is invoked after the Component's model has been updated. Handles the change of a css class when an error has occurred.

Overrides:
onError in class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
Parameters:
ajaxRequestTarget - of type AjaxRequestTarget
e - of type RuntimeException

onUpdate

protected void onUpdate(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Listener invoked on the ajax request. This listener is invoked after the Component's model has been updated. Handles the change of a css class when validation was succesful.

Specified by:
onUpdate in class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
Parameters:
ajaxRequestTarget - of type AjaxRequestTarget


Copyright © 2008-2012 The Sakai Foundation. All Rights Reserved.