Author: dolander
Date: Thu Feb 10 18:23:27 2005
New Revision: 153321

URL: http://svn.apache.org/viewcvs?view=rev&rev=153321
Log:
Rename the Form.scope, Form.name and Form.type to Form.beanScope, Form.beanName
and Form.beanType.

Make TreeRenderState serializable


Modified:
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderState.java
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/bean/index.jsp
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/beanerror/index.jsp
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/nullbinding/index.jsp
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/sessionBean/jsp1.jsp

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
 Thu Feb 10 18:23:27 2005
@@ -222,6 +222,7 @@
     private String _location = null;               // The location hash to 
append to the url.
     private String _scope = null;                  // The scope (request or 
session) under which our associated bean is stored
     private String _text = null;                   // The body content of this 
tag (if any).
+    private String _name = null;
     private String _beanName = null;               // The name of the form 
bean to (create and) use.
     private String _beanType = null;               // The type of the form 
bean to (create and) use.
     private String _beanScope = null;              // The scope of the form 
bean to (create and) use.
@@ -401,11 +402,12 @@
      * This Form Bean is found in the scope defined by the scope attribute."
      * @netui.tldx:attribute category="misc"
      */
-    public void setName(String name)
+    public void setBeanName(String name)
             throws JspException
     {
+        _name = setRequiredValueAttribute(name, "name");
         // @todo: we need to verify what happens if this is null and type is 
set.
-        _state.name = setRequiredValueAttribute(name, "name");
+        //_state.name =
     }
 
     /**
@@ -471,7 +473,7 @@
      * the Form Bean used."
      * @netui.tldx:attribute category="misc"
      */
-    public void setScope(String scope)
+    public void setBeanScope(String scope)
             throws JspException
     {
         _scope = setRequiredValueAttribute(scope, "scope");
@@ -505,7 +507,7 @@
      * The Form Bean is then used to populate the form input fields."
      * @netui.tldx:attribute category="misc"
      */
-    public void setType(String type)
+    public void setBeanType(String type)
             throws JspException
     {
         _type = setRequiredValueAttribute(type, "type");
@@ -554,17 +556,6 @@
         _focusMap.put(tagID, name);
     }
 
-    /**
-     * Return the name of the form bean corresponding to this tag. There is
-     * no corresponding setter method; this method exists so that the nested
-     * tag classes can obtain the actual bean name derived from other
-     * attributes of the tag.
-     */
-    public String getBeanName()
-    {
-        return _beanName;
-    }
-
     //********************************************* Do the Work  
*******************************************************
     /**
      * Render the beginning of this form.
@@ -713,7 +704,7 @@
         }
 
         // if tagId is set we need to add a mapping to the 'id'
-        idScript = renderNameAndId(request);
+        idScript = renderNameAndId(request,_id);
 
         // create real form name attribute
         if (_state.id == null && _setRealName)
@@ -745,6 +736,8 @@
 
         WriteRenderAppender writer = new WriteRenderAppender(pageContext);
         TagRenderingBase br = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.FORM_TAG, request);
+        //_state.name="x";
+        //_state.id="x";
         br.doStartTag(writer, _state);
 
         // If the action we're submitting to is checking for double-submits, 
save a token in the session.
@@ -829,10 +822,10 @@
         return EVAL_PAGE;
     }
 
-    private String renderNameAndId(HttpServletRequest request)
+    private String renderNameAndId(HttpServletRequest request,String id)
     {
         // if id is not set then we need to exit
-        if (_id == null)
+        if (id == null)
             return null;
 
         // Legacy Java Script support -- This writes out a single table with 
both the id and names
@@ -841,12 +834,12 @@
         IScriptReporter scriptReporter = getScriptReporter();
         ScriptRequestState srs = 
ScriptRequestState.getScriptRequestState(request);
         if (TagConfig.isLegacyJavaScript()) {
-            idScript = srs.mapLegacyTagId(scriptReporter, _id, _state.id);
+            idScript = srs.mapLegacyTagId(scriptReporter, id, _state.id);
         }
 
         // map the tagId to the real id
         if (TagConfig.isDefaultJavaScript()) {
-            String script = srs.mapTagId(scriptReporter, _id, _state.id, 
_state.name);
+            String script = srs.mapTagId(scriptReporter, id, _state.id, 
_state.name);
 
             // if we wrote out script in legacy mode, we need to make sure we 
preserve it.
             if (idScript != null) {
@@ -1007,20 +1000,19 @@
         assert _mapping != null;
 
         // Were the required values already specified?
-        if (_state.name != null) {
+        if (_name != null) {
             if (_type == null) {
                 registerTagError(Bundle.getString("Tags_FormNameNoType"), 
null);
                 return;
             }
-            _beanName = _state.name;
+            _beanName = _name;
             _beanScope = (_scope == null ? "session" : _scope);
             _beanType = _type;
             return;
         }
 
         // Look up the form bean definition
-        FormBeanConfig formBeanConfig =
-                _appConfig.findFormBeanConfig(_mapping.getName());
+        FormBeanConfig formBeanConfig = 
_appConfig.findFormBeanConfig(_mapping.getName());
         if (formBeanConfig == null) {
             //Ignore - this is okay if binding happens in the pageFlow.
         }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderState.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderState.java?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderState.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeRenderState.java
 Thu Feb 10 18:23:27 2005
@@ -17,7 +17,7 @@
  */
 package org.apache.beehive.netui.tags.tree;
 
-public class TreeRenderState
+public class TreeRenderState implements java.io.Serializable
  {
     public String selectionStyle;      // selection style
     public String selectionClass;      // selection class

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/bean/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/bean/index.jsp?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/bean/index.jsp
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/bean/index.jsp
 Thu Feb 10 18:23:27 2005
@@ -19,7 +19,8 @@
     This is a single page test.  
     </p>
     <hr>
-    <netui:form action="begin" name="ctFormBean" 
type="coretags.form.bean.Controller$FormBean" scope="session">
+    <netui:form action="begin" beanName="ctFormBean"
+       beanType="coretags.form.bean.Controller$FormBean" beanScope="session">
         <p>
             Type: <netui:textBox dataSource="actionForm.type" /><br>
             <netui:button type="submit" value="Submit"></netui:button>

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/beanerror/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/beanerror/index.jsp?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/beanerror/index.jsp
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/beanerror/index.jsp
 Thu Feb 10 18:23:27 2005
@@ -19,21 +19,22 @@
 
     <hr>
     <p>No Type Specified:
-    <netui:form action="begin" name="ctFormBeanError2" scope="session" 
style="display:inline">
+    <netui:form action="begin" beanName="ctFormBeanError2"
+       beanScope="session" style="display:inline">
             Type: <netui:textBox dataSource="actionForm.type" 
/>&nbsp;<netui:button type="submit" value="Submit"></netui:button>
     </netui:form>
     </p>
     <p>Bad Type:
-    <netui:form action="begin" name="ctFormBeanError1" 
type="coretags.form.bean.Controller$BadType" scope="session" 
style="display:inline">
+    <netui:form action="begin" beanName="ctFormBeanError1" 
beanType="coretags.form.bean.Controller$BadType" beanScope="session" 
style="display:inline">
             Type: <netui:textBox dataSource="actionForm.type" 
/>&nbsp;<netui:button type="submit" value="Submit"></netui:button>
     </netui:form>
     </p>
     <p>Non-form Type Specified:
-    <netui:form action="begin" name="ctFormBeanError3" type="java.lang.String" 
scope="session" style="display:inline">
+    <netui:form action="begin" beanName="ctFormBeanError3" 
beanType="java.lang.String" beanScope="session" style="display:inline">
             Type: <netui:textBox dataSource="actionForm.type" 
/>&nbsp;<netui:button type="submit" value="Submit"></netui:button>
     </netui:form>
     <p>No Name Specified:
-    <netui:form action="begin" 
type="coretags.form.beanerror.Controller$FormBean" scope="session" 
style="display:inline">
+    <netui:form action="begin" 
beanType="coretags.form.beanerror.Controller$FormBean" beanScope="session" 
style="display:inline">
             Type: <netui:textBox dataSource="actionForm.type" 
/>&nbsp;<netui:button type="submit" value="Submit"></netui:button>
     </netui:form>
     </p>

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
 Thu Feb 10 18:23:27 2005
@@ -4,8 +4,11 @@
 import org.apache.beehive.netui.pageflow.Forward;
 import org.apache.beehive.netui.pageflow.PageFlowController;
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import java.util.Enumeration;
+
 
 import javax.servlet.http.HttpSession;
+import javax.servlet.ServletRequest;
 
 /**
  * This is the default controller for a blank web application.
@@ -29,7 +32,7 @@
 
     public void setTextPage(String text) {
         _textPage = text;
-
+       _text = text;
     }
 
     public String getTextPage() {
@@ -49,11 +52,20 @@
 
     @Jpf.Action(
             forwards = {
-            @Jpf.Forward(name = "index", path = "index.jsp")
+            @Jpf.Forward(name = "index", path = "html.jsp")
             }
             )
-            protected Forward post(Bean form)
+    protected Forward html()
+    {
+        _action = "html";
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards = { @Jpf.Forward(name = "index", navigateTo = 
Jpf.NavigateTo.currentPage)})
+    protected Forward post(Bean form)
     {
+        dumpRequest();
         _action = "post";
         _text = form.getText();
         form.setText("");
@@ -61,23 +73,19 @@
     }
 
     @Jpf.Action(
-            forwards = {
-            @Jpf.Forward(name = "index", path = "index.jsp")
-            }
-            )
+        forwards = { @Jpf.Forward(name = "index", navigateTo = 
Jpf.NavigateTo.currentPage)})
     protected Forward postNoForm()
     {
+        dumpRequest();
         _action = "postNoForm";
         return new Forward("index");
     }
 
     @Jpf.Action(
-            forwards = {
-            @Jpf.Forward(name = "index", path = "index.jsp")
-            }
-            )
+        forwards = { @Jpf.Forward(name = "index", navigateTo = 
Jpf.NavigateTo.currentPage)})
     protected Forward postOverride(Bean form)
     {
+        dumpRequest();
         _action = "postOverride";
         _text = form.getText();
         form.setText("");
@@ -85,12 +93,10 @@
     }
 
     @Jpf.Action(
-            forwards = {
-            @Jpf.Forward(name = "index", path = "index.jsp")
-            }
-            )
+        forwards = { @Jpf.Forward(name = "index", navigateTo = 
Jpf.NavigateTo.currentPage)})
     protected Forward postOverrideNewForm(BeanTwo form)
     {
+        dumpRequest();
         _action = "postOverrideNewForm";
         _text = form.getText();
         form.setText("");
@@ -102,6 +108,20 @@
      */
     protected void onCreate()
     {
+    }
+
+    private void dumpRequest() {
+        
System.err.println("**************************DUMP**************************");
+        ServletRequest req = getRequest();
+        Enumeration e = req.getParameterNames();
+        while (e.hasMoreElements()) {
+            Object o = e.nextElement();
+            System.err.println("Parameter:" + o);
+            String[] params = req.getParameterValues(o.toString());
+            for (int i=0;i<params.length;i++) {
+                System.err.println("\tValue: '" + params[i] + "'");
+            }
+        }
     }
 
     /**

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp
 Thu Feb 10 18:23:27 2005
@@ -6,6 +6,7 @@
         <netui:base/>
     </head>
     <netui:body>
+        <netui:anchor action="html">html</netui:anchor><br>
         Action: <netui:span value="${pageFlow.action}" /><br>
         Text: <netui:span value="${pageFlow.text}" />
        <table width="100%">

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/nullbinding/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/nullbinding/index.jsp?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/nullbinding/index.jsp
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/nullbinding/index.jsp
 Thu Feb 10 18:23:27 2005
@@ -27,11 +27,11 @@
     <hr>
     <ul>
     <li><netui:form action="begin" style="display:inline" 
method="${pageFlow.nullValue}" ></netui:form><span> -- method</span></li>
-    <li><netui:form action="begin" style="display:inline" 
scope="${pageFlow.nullValue}" ></netui:form><span> -- scope</span></li>
+    <li><netui:form action="begin" style="display:inline" 
beanScope="${pageFlow.nullValue}" ></netui:form><span> -- scope</span></li>
     <li><netui:form action="${pageFlow.nullValue}" 
style="display:inline"></netui:form><span> -- action</span></li>
     <li><netui:form action="begin" style="display:inline" 
tagId="${pageFlow.nullValue}"></netui:form><span> -- tagId</span></li>
-    <li><netui:form action="begin" style="display:inline" 
type="${pageFlow.nullValue}" ></netui:form><span> -- type</span></li>
-    <li><netui:form action="begin" style="display:inline" 
name="${pageFlow.nullValue}" 
type="coretags.form.nullbinding.Controller.$FormBean"></netui:form><span> -- 
name</span></li>
+    <li><netui:form action="begin" style="display:inline" 
beanType="${pageFlow.nullValue}" ></netui:form><span> -- type</span></li>
+    <li><netui:form action="begin" style="display:inline" 
beanName="${pageFlow.nullValue}" 
beanType="coretags.form.nullbinding.Controller.$FormBean"></netui:form><span> 
-- name</span></li>
     </ul>
     
     </netui:body>

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/sessionBean/jsp1.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/sessionBean/jsp1.jsp?view=diff&r1=153320&r2=153321
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/sessionBean/jsp1.jsp
 (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/tags/sessionBean/jsp1.jsp
 Thu Feb 10 18:23:27 2005
@@ -11,7 +11,8 @@
     <body>
         <p>
         Change the Session nameBean.name
-        <netui:form action="Action2" 
type="tags.sessionBean.Controller$NameBean" scope="session" name="nameBean">
+        <netui:form action="Action2" 
beanType="tags.sessionBean.Controller$NameBean"
+               beanScope="session" beanName="nameBean">
             Name: <netui:textBox dataSource="actionForm.name" />
             <netui:button value="Action3"></netui:button>
         </netui:form>


Reply via email to