View Javadoc

1   /*
2       Jiffie Plugin for Jameleon - An Internet Explorer plug-in for Jameleon
3       Copyright (C) 2006 Christian W. Hargraves (engrean@hotmail.com) and
4                          Matthias Marschall (matthias@marschalls.de)
5   
6       This program is free software; you can redistribute it and/or modify
7       it under the terms of the GNU General Public License as published by
8       the Free Software Foundation; either version 2 of the License, or
9       (at your option) any later version.
10  
11      This program is distributed in the hope that it will be useful,
12      but WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14      GNU General Public License for more details.
15  
16      You should have received a copy of the GNU General Public License
17      along with this program; if not, write to the Free Software
18      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20  package net.sf.jameleon.plugin.jiffie.tags;
21  
22  import net.sf.jameleon.plugin.jiffie.IEFunctionTag;
23  
24  import net.sf.jiffie.JiffieUtility;
25  import net.sf.jiffie.JiffieException;
26  
27  /***
28   * A Tag that executes a body of javascript in the context of IE.
29   * Please see the Jiffie javadocs on net.sf.jiffie.JiffieUtility.executeScript
30   * for more information.
31   * 
32   * Some example uses might be:
33   * 
34   * Setting the text field value defined by <input type="text" name="textField1"</a>
35   * inside a form named 'lastForm'
36   * <pre><source>
37   *  &lt;ie-execute-javascript functionId="Set a value of the text field to 'some value'" 
38   *       script="document.forms.lastForm.textField1.value = 'some value'"/&gt;
39   * </source></pre>
40   * In other words, you make up your own complete JavaScript, whether it be one or fifty lines and send
41   * it to the browser.
42   * @jameleon.function name="ie-execute-javascript" type="action"
43   * @jameleon.step Execute Javascript.
44   * @author Alex Eagar
45   */
46  public class IEExecuteJavaScriptTag extends IEFunctionTag {
47    
48    /***
49    * The Javascript body to execute.
50    * @jameleon.attribute required="true"
51    */
52    protected String script;
53      
54    public void testBlock() throws JiffieException {
55        JiffieUtility.executeScript(getDocument(), script);
56    }
57  }