Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 179   Methods: 5
NCLOC: 38   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JTabbedPaneMouseEventDataTagHandler.java - 100% 100% 100%
coverage
 1   
 package junit.extensions.jfcunit.eventdata;
 2   
 
 3   
 import junit.extensions.xml.IXMLTestCase;
 4   
 import junit.extensions.xml.XMLException;
 5   
 
 6   
 import org.w3c.dom.Element;
 7   
 
 8   
 import javax.swing.JTabbedPane;
 9   
 
 10   
 
 11   
 /**
 12   
  * This is a extension of the click and drag elements. Where the
 13   
  * type specified is JTabbedMouseEventData.
 14   
  *
 15   
  * <h3>Description</h3>
 16   
  * <p>
 17   
  *   Nothing is invoked directly by this tag handler. The click and drag elements
 18   
  *   use this tag handler to customize the data specificly for the type specified.
 19   
  * </p>
 20   
  *
 21   
  * <h3>Parameters</h3>
 22   
  * <table border="1" cellpadding="2" cellspacing="0">
 23   
  *   <tr>
 24   
  *     <td valign="top"><b>Attribute</b></td>
 25   
  *     <td valign="top"><b>Description</b></td>
 26   
  *     <td align="center" valign="top"><b>Required</b></td>
 27   
  *     <td valign="top"><b>Default</b></td>
 28   
  *     <td valign="top"><b>Values</b></td>
 29   
  *   </tr>
 30   
  *   <tr>
 31   
  *     <td valign="top">type</td>
 32   
  *     <td valign="top">For this element the type must be set to JTabbedPaneMouseEventData</td>
 33   
  *     <td valign="top" align="center">Yes</td>
 34   
  *     <td valign="top">N/A</td>
 35   
  *     <td valign="top">N/A</td>
 36   
  *   </tr>
 37   
  *   <tr>
 38   
  *     <td valign="top">refid</td>
 39   
  *     <td valign="top">Id of a object reference which has been previously found.</td>
 40   
  *     <td valign="top" align="center">Yes</td>
 41   
  *     <td valign="top">N/A</td>
 42   
  *     <td valign="top">N/A</td>
 43   
  *   </tr>
 44   
  *   <tr>
 45   
  *     <td valign="top">title</td>
 46   
  *     <td valign="top">The title of the tab.</td>
 47   
  *     <td valign="top" align="center">No</td>
 48   
  *     <td valign="top">null</td>
 49   
  *     <td valign="top">Text of the tab.</td>
 50   
  *   </tr>
 51   
  *   <tr>
 52   
  *     <td valign="top">index</td>
 53   
  *     <td valign="top">The index of the tab</td>
 54   
  *     <td valign="top" align="center">No</td>
 55   
  *     <td valign="top">-1</td>
 56   
  *     <td valign="top">Zero based index of the tab.</td>
 57   
  *   </tr>
 58   
  *   <tr>
 59   
  *     <td valign="top">clicks</td>
 60   
  *     <td valign="top">The number of clicks to be executed.</td>
 61   
  *     <td valign="top" align="center">No</td>
 62   
  *     <td valign="top">1</td>
 63   
  *     <td valign="top">Positive Integer</td>
 64   
  *   </tr>
 65   
  *   <tr>
 66   
  *     <td valign="top">modifiers</td>
 67   
  *     <td valign="top">The modifiers to be used for this event.</td>
 68   
  *     <td valign="top" align="center">No</td>
 69   
  *     <td valign="top">Button1 if popup is false otherwise Button3</td>
 70   
  *     <td valign="top">alt altgr control meta shift button1 button2 button3</td>
 71   
  *   </tr>
 72   
  *   <tr>
 73   
  *     <td valign="top">popup</td>
 74   
  *     <td valign="top">True if this is event is using the popup button.</td>
 75   
  *     <td valign="top" align="center">No</td>
 76   
  *     <td valign="top">false</td>
 77   
  *     <td valign="top">true false</td>
 78   
  *   </tr>
 79   
  *   <tr>
 80   
  *     <td valign="top">sleeptime</td>
 81   
  *     <td valign="top">Maximum sleep time</td>
 82   
  *     <td valign="top" align="center">No</td>
 83   
  *     <td valign="top">500</td>
 84   
  *     <td valign="top">Positive Integer representing the milli-seconds</td>
 85   
  *   </tr>
 86   
  *   <tr>
 87   
  *     <td valign="top">position</td>
 88   
  *     <td valign="top">Positioning of the mouse within the bounds of the component.</td>
 89   
  *     <td valign="top" align="center">No</td>
 90   
  *     <td valign="top">center</td>
 91   
  *     <td valign="top">center north northeast east southeast south southwest west northwest custom percentage</td>
 92   
  *   </tr>
 93   
  *   <tr>
 94   
  *     <td valign="top">reference</td>
 95   
  *     <td valign="top">Reference point or number for position calculation.</td>
 96   
  *     <td valign="top" align="center">No</td>
 97   
  *     <td valign="top">null</td>
 98   
  *     <td valign="top">integers &quot;x,y&quot;</td>
 99   
  *   </tr>
 100   
  *
 101   
  * </table>
 102   
  * <h3>Example</h3>
 103   
  * <blockquote><pre>
 104   
  * &lt;click
 105   
  *    type=&quot;JTabbedMouseEventData&quot;
 106   
  *    refid=&quot;TabbedPane&quot;
 107   
  *    title="First Tab"
 108   
  * /&gt;
 109   
  * </pre></blockquote>
 110   
  * <p>
 111   
  * The above clicks once on the center of the tab containing
 112   
  * the title "First Tab" in the JTabbedPane component identified by
 113   
  * TabbedPane.
 114   
  * </p>
 115   
  * @see junit.extensions.jfcunit.eventdata.JTabbedPaneMouseEventData
 116   
  * @author Kevin Wilson
 117   
  */
 118   
 public class JTabbedPaneMouseEventDataTagHandler extends BaseEventDataTagHandler {
 119   
     /**
 120   
      * Constructor for JTabbedPaneMouseEventDataTagHandler.
 121   
      *
 122   
      * @param element     The element to be processed
 123   
      * @param testCase    The IXMLTestCase that uses this element
 124   
      */
 125  71
     public JTabbedPaneMouseEventDataTagHandler(final Element element,
 126   
         final IXMLTestCase testCase) {
 127  71
         super(element, testCase);
 128   
     }
 129   
 
 130   
     /**
 131   
      * @see junit.extensions.xml.elements.AbstractTagHandler#processElement()
 132   
      */
 133  71
     public void processElement() throws XMLException {
 134  71
         validateElement();
 135   
 
 136  71
         setEventData(
 137   
             new JTabbedPaneMouseEventData(
 138   
                 getJFCTestCase(),
 139   
                 (JTabbedPane) getComponent(),
 140   
                 getIndex(),
 141   
                 getTitle(),
 142   
                 getClicks(),
 143   
                 getModifiers(),
 144   
                 getPopupTrigger(),
 145   
                 getSleepTime(),
 146   
                 getPosition(),
 147   
                 getReference()));
 148   
     }
 149   
 
 150   
     /**
 151   
      * @see junit.extensions.xml.elements.AbstractTagHandler#validateElement()
 152   
      */
 153  71
     public void validateElement() throws XMLException {
 154   
         // do the default validations from the super class
 155  71
         super.validateElement();
 156   
 
 157  71
         checkOneRequiredAttribute(
 158   
             getElement(),
 159   
             new String[] {TITLE, INDEX});
 160   
     }
 161   
 
 162   
     /**
 163   
      * Returns the value of the INDEX attribute for this element. Defaults to -1 if not found.
 164   
      * @return int  The value of the parsed INDEX attribute, -1 if not found.
 165   
      */
 166  71
     private int getIndex() {
 167   
         // default value in this class for index is -1
 168  71
         return getInt(INDEX, -1);
 169   
     }
 170   
 
 171   
     /**
 172   
      * Returns the value of the TITLE attribute for this element.
 173   
      * @return String  The value of the TITLE attribute.
 174   
      */
 175  71
     private String getTitle() {
 176  71
         return getString(TITLE);
 177   
     }
 178   
 }
 179