Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 81   Methods: 3
NCLOC: 20   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
FormEventType.java - 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 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   
 
 15   
 package org.apache.tapestry.form;
 16   
 
 17   
 import org.apache.commons.lang.enum.Enum;
 18   
 
 19   
 /**
 20   
  *  Lists different types of JavaScript events that can be associated
 21   
  *  with a {@link Form} via {@link Form#addEventHandler(FormEventType, String)}.
 22   
  *
 23   
  *  @author Howard Lewis Ship
 24   
  *  @since 1.0.2
 25   
  **/
 26   
 
 27   
 public class FormEventType extends Enum
 28   
 {
 29   
     /**
 30   
      *  Form event triggered when the form is submitted.  Allows an event handler
 31   
      *  to perform any final changes before the results are posted to the server.
 32   
      *
 33   
      *  <p>The JavaScript method should return <code>true</code> or
 34   
      * <code>false</code>.  If there are multiple event handlers for the form
 35   
      * they will be combined using the binary and operator (<code>&amp;&amp;</code>).
 36   
      *
 37   
      **/
 38   
 
 39   
     public static final FormEventType SUBMIT = new FormEventType("SUBMIT", "onsubmit");
 40   
 
 41   
     /**
 42   
      *  Form event triggered when the form is reset; this allows an event handler
 43   
      *  to deal with any special cases related to resetting.
 44   
      *
 45   
      **/
 46   
 
 47   
     public static final FormEventType RESET = new FormEventType("RESET", "onreset");
 48   
 
 49   
     private String _propertyName;
 50   
 
 51  2
     private FormEventType(String name, String propertyName)
 52   
     {
 53  2
         super(name);
 54   
 
 55  2
         _propertyName = propertyName;
 56   
     }
 57   
 
 58   
     /** 
 59   
      *  Returns the DOM property corresponding to event type (used when generating
 60   
      *  client-side scripting).
 61   
      *
 62   
      **/
 63   
 
 64  5
     public String getPropertyName()
 65   
     {
 66  5
         return _propertyName;
 67   
     }
 68   
 
 69   
     /**
 70   
      *  Returns true if multiple functions should be combined
 71   
      *  with the <code>&amp;&amp;</code> operator.  Otherwise,
 72   
      *  the event handler functions are simply invoked
 73   
      *  sequentially (as a series of JavaScript statements).
 74   
      *
 75   
      **/
 76   
 
 77  4
     public boolean getCombineUsingAnd()
 78   
     {
 79  4
         return this == FormEventType.SUBMIT;
 80   
     }
 81   
 }