View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: HelpTag.java,v $
31   * Revision 1.2  2005/04/09 18:04:20  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.1  2005/01/06 23:10:05  colinmacleod
35   * Moved up a version number.
36   * Changed copyright notices to 2005.
37   * Updated the documentation:
38   *   - started working on multiproject:site docu.
39   *   - changed the logo.
40   * Added checkstyle and fixed LOADS of style issues.
41   * Added separate thirdparty subproject.
42   * Added struts (in web), util and webgui (in webtheme) from ivata op.
43   *
44   * Revision 1.6  2004/12/31 18:18:49  colinmacleod
45   * Changed current version number from 0.9.1 to 0.10.
46   *
47   * Revision 1.5  2004/11/04 10:46:26  colinmacleod
48   * Commented out help tag - v0.10 will not include help.
49   *
50   * Revision 1.4  2004/11/03 16:12:09  colinmacleod
51   * Changed fieldPath to resourceFieldPath.
52   *
53   * Revision 1.3  2004/07/13 19:48:10  colinmacleod
54   * Moved project to POJOs from EJBs.
55   * Applied PicoContainer to services layer (replacing session EJBs).
56   * Applied Hibernate to persistence layer (replacing entity EJBs).
57   *
58   * Revision 1.2  2004/03/21 21:16:35  colinmacleod
59   * Shortened name to ivata op.
60   *
61   * Revision 1.1.1.1  2004/01/27 20:59:38  colinmacleod
62   * Moved ivata op to SourceForge.
63   *
64   * Revision 1.2  2003/10/16 15:43:03  jano
65   * Fixes problems with building and some problems with splitting to subprojects
66   *
67   * Revision 1.1.1.1  2003/10/13 20:49:24  colin
68   * Restructured portal into subprojects
69   *
70   * Revision 1.6  2003/04/14 07:11:24  peter
71   * the key is taken from 1-key, 2-form helpKey, 3-default
72   *
73   * Revision 1.5  2003/03/25 09:24:52  peter
74   * remmed out again...
75   *
76   * Revision 1.4  2003/03/18 15:26:06  peter
77   * uncommented so help works again
78   *
79   * Revision 1.3  2003/03/04 15:32:06  colin
80   * remmed out for 1.2
81   *
82   * Revision 1.2  2003/03/03 16:57:12  colin
83   * converted localization to automatic paths
84   * added labels
85   * added mandatory fieldName attribute
86   *
87   * Revision 1.1  2003/02/24 19:33:33  colin
88   * Moved to new subproject.
89   *
90   * Revision 1.2  2003/01/27 08:26:21  colin
91   * SSLEXT & i18n changes
92   *
93   * Revision 1.1  2003/01/18 20:32:08  colin
94   * added html struts override tags and help
95   * -----------------------------------------------------------------------------
96   */
97  package com.ivata.mask.web.tag.html;
98  import javax.servlet.jsp.JspException;
99  import org.apache.struts.taglib.html.BaseHandlerTag;
100 import com.ivata.mask.web.javascript.JavaScriptWindow;
101 /***
102  * <p>
103  * Create a <strong>JavaScript</strong> button which links to window with help
104  * functionality for <strong>ivata op </strong>
105  * </p>
106  *
107  * <p>
108  * This class uses the {@link com.ivata.html.browser.BrowserBrowser class} to
109  * detect whether or not the client browser is capable of displaying <i>Java
110  * Script </i>. If not, the button will not appear.
111  * </p>
112  *
113  * <p>
114  * <b>Tag attributes: </b> <br/><table cellpadding='2' cellspacing='5'
115  * border='0' align='center' width='85%'>
116  * <tr class='TableHeadingColor'>
117  * <th>attribute</th>
118  * <th>reqd.</th>
119  * <th>param. class</th>
120  * <th width='100%'>description</th>
121  * </tr>
122  * <tr>
123  * <td>key</td>
124  * <td>false</td>
125  * <td><code>java.lang.String</code></td>
126  * <td>Specifies a key to use to display the correct page in the help window.
127  * If this parameter is left out, the default welcome help page is displayed.
128  * </td>
129  * </tr>
130  * </table>
131  * </p>
132  *
133  * <p>
134  * <b>Note: </b> all the tag attributes from {@link
135  * org.apache.struts.taglib.BaseHandlerTag BaseHandlerTag} are also included.
136  * </p>
137  *
138  * @since ivata masks 0.4 (2003-01-15)
139  * @author Colin MacLeod
140  * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
141  * @version $Revision: 1.2 $
142  */
143 public class HelpTag extends BaseHandlerTag {
144     /***
145      * <p>
146      * Key of the default help page to display. If <code>null</code>, the
147      * default welcome help page is shown.
148      * </p>
149      */
150     private String key = null;
151     /***
152      * <p>
153      * Generates the JavaScript to display the help window.
154      * </p>
155      */
156     private JavaScriptWindow window = new JavaScriptWindow();
157     /***
158      * <p>
159      * Get the key of the default help page to display. If <code>null</code>,
160      * the default welcome help page is shown.
161      * </p>
162      *
163      * @return the current value of key.
164      */
165     public String getKey() {
166         return key;
167     }
168     /***
169      * <p>
170      * Set the key of the default help page to display. If <code>null</code>,
171      * the default welcome help page is shown.
172      * </p>
173      *
174      * @param keyParam
175      *            the new value of key.
176      */
177     public void setKey(final String keyParam) {
178         this.key = keyParam;
179     }
180     /***
181      * <p>
182      * Overridden to output the JavaScript and input button.
183      * </p>
184      *
185      * @return <code>EVAL_PAGE</code> since we want to evaluate the page after
186      *                   this tag.
187      *
188      * @throws JspException
189      *             if there is an error writing to <code>out.print()</code>
190      */
191     public int doEndTag() throws JspException {
192         //TODO: this version of ivata masks has no help feature
193         return EVAL_PAGE;
194     }
195     /***
196      * <p>
197      * Generates the JavaScript to display the help window.
198      * </p>
199      *
200      * @return the current value of window.
201      */
202     public final JavaScriptWindow getWindow() {
203         return window;
204     }
205     /***
206      * <p>
207      * Generates the JavaScript to display the help window.
208      * </p>
209      *
210      * @param windowParam
211      *            the new value of window.
212      */
213     public final void setWindow(final JavaScriptWindow windowParam) {
214         this.window = windowParam;
215     }
216 }
217