com.arsdigita.bebop.parameters
Class CancellableValidationListener

java.lang.Object
  extended bycom.arsdigita.bebop.parameters.CancellableValidationListener
All Implemented Interfaces:
EventListener, ParameterListener

public class CancellableValidationListener
extends Object
implements ParameterListener

A generic validation listener that wraps any parameter listener so that the parameter listener is conditionally run based on the value of a RequestLocal. The constructor takes in a parameter listener and a RequestLocal that returns a Boolean. The request local is lazily evaluated when the validation listener is run. A typical code block for the request local:

     private RequestLocal m_isCancel = new RequestLocal() {
       public Object initialValue(PageState ps) {
           if ( m_submit.isSelected(ps) ) {
                return Boolean.FALSE;
           } else {
               return Boolean.TRUE;
           }
       }};
 
Which only returns false if the main submit button is selected.


Field Summary
 
Fields inherited from interface com.arsdigita.bebop.event.ParameterListener
versionId
 
Constructor Summary
CancellableValidationListener(GlobalizedParameterListener l, RequestLocal isCancel)
           
 
Method Summary
 void validate(ParameterEvent evt)
          Performs a validation check on the data objects associated with a specific parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CancellableValidationListener

public CancellableValidationListener(GlobalizedParameterListener l,
                                     RequestLocal isCancel)
Method Detail

validate

public void validate(ParameterEvent evt)
              throws FormProcessException
Description copied from interface: ParameterListener
Performs a validation check on the data objects associated with a specific parameter. Validate should call ParameterData.addError() with a message regarding the nature of the error.

Specified by:
validate in interface ParameterListener
Throws:
FormProcessException


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC