Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/RuntimeCollective/webapps/tag/HtmlInputPostTag.java


1   /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/tag/HtmlInputPostTag.java,v 1.4 2003/09/30 15:13:18 joe Exp $
2    * $Revision: 1.4 $
3    * $Date: 2003/09/30 15:13:18 $
4    *
5    * ====================================================================
6    *
7    * Josephine : http://www.runtime-collective.com/josephine/index.html
8    *
9    * Copyright (C) 2003 Runtime Collective
10   * 
11   * This product includes software developed by the
12   * Apache Software Foundation (http://www.apache.org/).
13   *
14   * This library is free software; you can redistribute it and/or
15   * modify it under the terms of the GNU Lesser General Public
16   * License as published by the Free Software Foundation; either
17   * version 2.1 of the License, or (at your option) any later version.
18   *
19   * This library is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22   * Lesser General Public License for more details.
23   *
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this library; if not, write to the Free Software
26   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27   *
28   */
29  
30  package com.RuntimeCollective.webapps.tag;
31  
32  import com.RuntimeCollective.webapps.RuntimeParameters;
33  import com.RuntimeCollective.webapps.bean.EntityBean;
34  
35  /**
36   * A custom JSP tag that displays a Java applet for WSIWYG editing of HTML - specifically, the gateway of a resource.
37   * <p>
38   * <b>IMPORTANT:</b> This tag must be used inside a form, and the form creation tag must contain <code>onsubmit="return getHTMLEditorAppletValue()"</code>,
39   * for example:<blockquote><code>
40   * &lt;html:form action=&quot;/testHtmlAction&quot; onsubmit=&quot;return getHTMLEditorAppletValue()&quot;&gt;
41   * </code></blockquote>
42   * <p>
43   * Only one HtmlInputTag can be used per HTML page.
44   * <p>
45   * This tag takes the following additional attributes:
46   * <ul>
47   *
48   * saveAction [optional]
49   * entityBean - on the session
50   *
51   * </ul>
52   *
53   * @version $Id: HtmlInputPostTag.java,v 1.4 2003/09/30 15:13:18 joe Exp $
54   */
55  public class HtmlInputPostTag extends HtmlInputTag {
56  
57  
58      // == Properties =================================================== 
59  
60      /** Which action, defined in struts-config.xml, to call on save - defaults to "/htmlInputPost.do" */ 
61      protected String saveAction = "/htmlInputPost.do"; 
62      /** Get which action, defined in struts-config.xml, to call on save */ 
63      public String getSaveAction() { return this.saveAction; } 
64      /** Set which action, defined in struts-config.xml, to call on save */ 
65      public void setSaveAction(String saveAction) { this.saveAction = saveAction; } 
66  
67      /** The class name of the  EntityBean that we're going to update, on the session.
68       */
69      protected String entityBean = ""; 
70      /** Get the class name of the EntityBean that we're going to update */
71      public String getEntityBean() { return this.entityBean; } 
72      /** Set the class name of the EntityBean that we're going to update */
73      public void setEntityBean(String entityBean) { this.entityBean = entityBean; } 
74  
75  
76      /** Get the name of the Applet class to use */
77      public String getAppletClass() {
78    return "com.RuntimeCollective.webapps.applets.HtmlInputPostApplet";
79      }
80  
81      /*
82       * Get extra parameters for passing to the applet, in the style specified by useEmbedStyle
83       * @param useEmbedStyle Return EMBED-style parameters, i.e. theName="theValue"
84       */
85      public String[][] getExtraParameters() {
86  
87  
88    EntityBean saveBean = (EntityBean) pageContext.getSession().getAttribute( getEntityBean() );
89    RuntimeParameters.logDebug(this, "saveBean is: "+saveBean);
90  
91    // We're passing in a whole load of parameters
92    String[][] allParams = new String[][]{
93        new String[]{"pageRoot",RuntimeParameters.get("pageRoot")},
94        new String[]{"resourceURL",RuntimeParameters.get("resourceURL")},
95        new String[]{"saveAction",getSaveAction()},
96        new String[]{"sessionId",pageContext.getSession().getId()},
97        new String[]{"entityName",getEntityBean()},
98        new String[]{"entityId",""+saveBean.getId()},
99        new String[]{"property",getProperty()}
100   };
101 
102   return allParams;
103 
104     }
105 
106 
107 }