Coverage Report - org.apache.tapestry.annotations.EventListener
 
Classes in this File Line Coverage Branch Coverage Complexity
EventListener
N/A
N/A
0
 
 1  
 // Copyright May 14, 2006 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 // http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 package org.apache.tapestry.annotations;
 15  
 
 16  
 import org.apache.tapestry.IComponent;
 17  
 
 18  
 import java.lang.annotation.*;
 19  
 
 20  
 /**
 21  
  * Annotation used to connect an event on a component / page with a particular listener method. This
 22  
  * is currently intended to be used to connect client side events to listener methods but may have
 23  
  * uses elsewhere.
 24  
  * 
 25  
  */
 26  
 @Target( { ElementType.METHOD })
 27  
 @Retention(RetentionPolicy.RUNTIME)
 28  
 @Documented
 29  
 public @interface EventListener
 30  
 {
 31  
 
 32  
     /**
 33  
      * The unique {@link IComponent} ids of the targeted sources that this listener will be
 34  
      * listening to events on.
 35  
      */
 36  
     String[] targets() default {};
 37  
 
 38  
     /**
 39  
      * The unique html element ids to listen to the events on.
 40  
      */
 41  
     String[] elements() default {};
 42  
 
 43  
     /**
 44  
      * The list of events that should cause this listener to invoke. Ie
 45  
      * <code>events = {"onClick", "onOptionSelect"}</code> etc..
 46  
      */
 47  
     String[] events();
 48  
 
 49  
     /**
 50  
      * The form id of the form that should have its data submitted when one of the specified events
 51  
      * is triggered.
 52  
      * 
 53  
      * @return The form name (or id of component) to submit when event is triggered.
 54  
      */
 55  
     String submitForm() default "";
 56  
 
 57  
     /**
 58  
      * When any of the components targeted for an event is an instance of {@link org.apache.tapestry.form.IFormComponent} this
 59  
      * setting can allow the form to be automatically discovered when wiring this listener up to the event such that it is
 60  
      * submitted for you automatically without having to specify a {@link #submitForm()} parameter. The default is true.
 61  
      *
 62  
      * @return True if {@link org.apache.tapestry.form.IFormComponent}s should submit their containing forms by default, false otherwise.
 63  
      */
 64  
     boolean autoSubmit() default true;
 65  
 
 66  
     /**
 67  
      * Whether or not to perform form validation if the {@link #submitForm()} parameter has been set.
 68  
      * Default is false.
 69  
      * 
 70  
      * @return Whether or not to validate the form.
 71  
      */
 72  
     boolean validateForm() default false;
 73  
     
 74  
     /**
 75  
      * Controls whether or not any forms being submitted as part of this event will request focus 
 76  
      * as per normal form semantics. The default is false.
 77  
      * 
 78  
      * @return True if the form should get focus, false otherwise. The default is false.
 79  
      */
 80  
     boolean focus() default false;
 81  
     
 82  
     /**
 83  
      * If used in conjunction with {@link #submitForm()} <i>(or just targeting a {@link org.apache.tapestry.form.IFormComponent})</i>,
 84  
      * will either submit the form normally or asynchronously. Default is asyncrhonous.
 85  
      * 
 86  
      * @return True if form should be submitted asynchronously, false otherwise.
 87  
      */
 88  
     boolean async() default true;
 89  
 }