View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2005 Christian W. Hargraves (engrean@hotmail.com)
4   
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  package net.sf.jameleon.ui;
20  
21  import java.util.Map;
22  
23  import javax.swing.JFrame;
24  
25  import net.sf.jameleon.data.AbstractDataDrivableTag;
26  import net.sf.jameleon.event.DataDrivableEvent;
27  
28  public class DataDrivableDebugDialog extends DebugDialog{
29  
30      private DataDrivableEvent ddEvent;
31  
32      public DataDrivableDebugDialog(Object source, JFrame rootFrame, TestCaseResultsPane tcrf, String title){
33          super(source, rootFrame, tcrf, title);
34      }
35  
36      /***
37       * Sets the source where the data is pulled and where the data
38       * needs to be changed if any values are changed in the table.
39       * @param source - The tag that represents this debug dialog
40       */
41      protected void setBreakPointSource(Object source){
42          ddEvent = (DataDrivableEvent)source;
43      }
44  
45      /***
46       * Gets the key-value pairs that are set via this tag
47       * @return the key-value pairs that are set via this tag
48       */
49      protected Map getAttributes(){
50          return ddEvent.getRowData();
51      }
52  
53      /***
54       * Gets the description that shows up in the dialog box
55       * @return the description that shows up in the dialog box
56       */
57      protected String getTagDescription(){
58          String tagName = "data-drivable tag";
59          if (ddEvent.getSource() instanceof AbstractDataDrivableTag) {
60              tagName = ((AbstractDataDrivableTag)ddEvent.getSource()).getTagDescription();
61          }
62          return tagName;
63      }
64  
65      /***
66       * Changes the value of the given attribute's name real-time
67       * @param attributeName - The name of the attribute to change
68       * @param newValue - The new value to set the attribute to
69       */
70      protected void setNewAttributeValue(String attributeName, String newValue){
71          getAttributes().put(attributeName, newValue);
72      }
73  
74  }