View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2003-2006 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.plugin.jiffie.tags;
20  
21  import net.sf.jameleon.plugin.jiffie.IEFunctionTag;
22  import net.sf.jameleon.util.StateStorer;
23  
24  /***
25   * Takes a snapshot of the currently displayed page.
26   * 
27   * Some example uses might be:
28   * 
29   * While on a given page, you want to save a snapshot with the name "test.html"
30   * <pre><source>
31   *  &lt;ie-snap-shot functionId="Take a snapshot of the current page and save it as 'test.html'" 
32   *       fileNameToStore="test"/&gt;
33   * </source></pre>
34   * @jameleon.function name="ie-snap-shot" type="action"
35   */
36  public class IESnapShotTag extends IEFunctionTag{
37  
38      /***
39       * The file name minus the .html extension.
40       * @jameleon.attribute required="true"
41       */
42      protected String fileNameToStore;
43  
44      public void testBlock(){
45          state.eventOccured(StateStorer.ON_COMMAND_EVENT);
46      }
47  
48      /***
49       * Gets the filename to store the state of the application to. 
50       * @param event - the StateStorer Event
51       * @return the appropriate filename which starts with ERROR- if the StateStorer Event was an Error
52       */
53      public String getStoreToFileName(int event){
54          return fileNameToStore;
55      }
56  
57  }