Author: dolander
Date: Wed Jan 19 15:14:27 2005
New Revision: 125682

URL: http://svn.apache.org/viewcvs?view=rev&rev=125682
Log:
Report an error when runAtClient is on for a Tree but there isn't a 
ScriptContainer that
also has runAtClient on.



Added:
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/runAtClientError.jsp
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeRunAtClientError.xml
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/Tree.java
   
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml

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&rev=125682&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java&r1=125681&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java&r2=125682
==============================================================================
--- 
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
    Wed Jan 19 15:14:27 2005
@@ -639,10 +639,8 @@
             else {
                 // New and improved - use the values from the action mapping
                 
-                //
                 // First, check to see if this is a page flow-scoped form 
bean.  If so, use the current value
                 // from the member field in the page flow (or shared flow).
-                //
                 if (_flowController != null) {
                     bean = _flowController.getFormBean(_mapping);
                 }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java?view=diff&rev=125682&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java&r1=125681&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java&r2=125682
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
    (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
    Wed Jan 19 15:14:27 2005
@@ -644,6 +644,12 @@
         // Add the script support for the tree.
         if (_runAtClient) {
             IScriptReporter sr = getScriptReporter();
+            if (!sr.isRunAtClient()) {
+                String s = Bundle.getString("Tags_TreeHtmlRunAtClient", null);
+                registerTagError(s, null);
+                reportErrors();
+                return;                
+            }
             sr.addInitMethod(TreeElement.TREE_JAVASCRIPT_CLASS);
             sr.addAnchorPostRewriter(TreeElement.TREE_JAVASCRIPT_CLASS);
         }

Modified: 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties?view=diff&rev=125682&p1=incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties&r1=125681&p2=incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties&r2=125682
==============================================================================
--- 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
       (original)
+++ 
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
       Wed Jan 19 15:14:27 2005
@@ -74,6 +74,7 @@
 Tags_BindingUpdateExpressionError=The expression ''{0}'' does not contains a 
valid expression and cannot be used for update.
 Tags_NoInPageErrorReporting=In-page error reporting is turned off, the 
following error occurred: {1}
 Tags_ClientReqScriptHeader=Setting runAtClient on the <netui:html> tag 
requires a <netui:scriptHeader> in the HTML <head>.
+Tags_TreeHtmlRunAtClient=Setting runAtClient on the <netui:tree> requires 
setting runAtClient on a ScriptContainer.
 Tags_AttributeMayNotBeSet=The attribute "<b>{0}</b>" may not be set through 
the Attribute tag.
 Tags_AttributeNameNotSet=The paramater "<b>name</b>" may not be null or the 
empty string.
 Tags_AttributeFacetNotSupported=The facet "<b>{0}</b>" is not supported by 
this tag.

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf?view=diff&rev=125682&p1=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf&r1=125681&p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf&r2=125682
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf  
    (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf  
    Wed Jan 19 15:14:27 2005
@@ -53,6 +53,7 @@
     private TreeElement _tree20;
     private TreeElement _tree21;
     private TreeElement _tree22;
+    private TreeElement _tree23;
 
     private String _expand = "&nbsp;";
     private String _node = "&nbsp;";
@@ -231,6 +232,14 @@
     public void setTree22(TreeElement tn) {
         _tree22 = tn;
     }
+
+    public TreeElement getTree23() {
+        return _tree23;
+    }
+
+    public void setTree23(TreeElement tn) {
+        _tree23 = tn;
+    }
     
     
     //************************************************************************
@@ -473,6 +482,7 @@
         _tree20 = null;
         _tree21 = null;
         _tree22 = null;
+        _tree23 = null;
 
         buildTrees();
         return forward;
@@ -688,6 +698,15 @@
     @Jpf.Forward(name = "success", path = "clientContentForm.jsp")
 })
     protected Forward goClientContentForm()        {
+        Forward success = new Forward("success");
+        clearExpand();                
+        return success;
+    }
+
+    @Jpf.Action(forwards = { 
+    @Jpf.Forward(name = "success", path = "runAtClientError.jsp")
+})
+    protected Forward goRunAtClientError()        {
         Forward success = new Forward("success");
         clearExpand();                
         return success;

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp?view=diff&rev=125682&p1=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp&r1=125681&p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp&r2=125682
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp   
(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp   
Wed Jan 19 15:14:27 2005
@@ -44,6 +44,7 @@
     <li><netui:anchor action="goEmptyTree">Empty Tree</netui:anchor> -- 
[tree9] Just a Tree tag without backing TreeNode</li>
     <li><netui:anchor action="goTreeBinding">Tree Binding Error</netui:anchor> 
-- [badPageFlowTree - doesn't exist] Invalid Binding a tree.</li>
     <li><netui:anchor action="goWriteTreeError">Write Tree 
Error</netui:anchor> -- [tree7] No property defined to set the tree.</li>
+    <li><netui:anchor action="goRunAtClientError">RunAtClient 
Error</netui:anchor> -- [tree23] runAtClient set on the tree, but not on the 
HTML tag.</li>
     <li>Need to verify a node with both an href and action defined</li>
     </ul>    
     </netui:body>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/runAtClientError.jsp
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/runAtClientError.jsp?view=auto&rev=125682
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/runAtClientError.jsp
        Wed Jan 19 15:14:27 2005
@@ -0,0 +1,48 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="beehive-netui-tags-databinding.tld" prefix="netui-data"%>
+<%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui"%>
+<%@ taglib uri="beehive-netui-tags-template.tld" prefix="netui-template"%>
+<netui:html>
+    <head>
+        <title>runAtClientError.jsp</title>
+        <link href="style.css" rel="stylesheet" type="text/css">
+        <netui:base />
+    </head>
+    <netui:body>
+        <h4 class="title"><netui:anchor action="begin" 
styleClass="homeAnchor">Home</netui:anchor>runAtClientError.jsp 
[goRunAtClientError.do] </h4>
+        <!-- Attribute Information -->
+        <div style='float:left;width:300px'>
+        <table cellpadding="2" cellspacing="0" border="1" width="300px">
+        <tr><th>Creation</th><td>Null TreeNode Root</td></tr>
+        <tr><th>tree</th><td>{pageFlow.tree23}</td></tr>
+        <tr><th>action</th><td>postback</td></tr>
+        <tr><th>runAtClient</th><td>false</td></tr>
+        </table>
+        </div>
+        This binds to a Page Flow variable that is never initialized.  In 
addition, the JSP page does
+        not define &lt;node> elements.  The result is a &lt;tree> that doesn't 
bind to a data Structure.
+        <hr style="clear:left">
+        <div class="content">
+        <netui:tree dataSource="pageFlow.tree23" selectionAction="postback"
+               tagId="tree" runAtClient="true">
+            <netui:treeItem expanded="true" action="postback">
+                <netui:treeLabel>0</netui:treeLabel>
+                <netui:treeItem expanded="true" action="postback">
+                    <netui:treeLabel>0.0</netui:treeLabel>
+                    <netui:treeItem action="postback">
+                        <netui:treeLabel>0.0.0</netui:treeLabel>
+                        <netui:treeItem 
action="postback">0.0.0.0</netui:treeItem>
+                        <netui:treeItem 
action="postback">0.0.0.1</netui:treeItem>
+                    </netui:treeItem>
+                </netui:treeItem>
+                <netui:treeItem expanded="true" action="postback">
+                    <netui:treeLabel>0.1</netui:treeLabel>
+                    <netui:treeItem action="postback">0.1.0</netui:treeItem>
+                    <netui:treeItem action="postback">0.1.1</netui:treeItem>
+                </netui:treeItem>
+                <netui:treeItem expanded="true" 
action="postback">0.2</netui:treeItem>
+           </netui:treeItem>
+       </netui:tree>
+        </div>
+    </netui:body>
+</netui:html>
\ No newline at end of file

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=125682&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=125681&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=125682
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
   (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
   Wed Jan 19 15:14:27 2005
@@ -5200,6 +5200,20 @@
          </features>
       </test>
       <test>
+         <name>RichTreeRunAtClientError</name>
+         <description>Error when runAtClient is set on the tree but no script 
container</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>bvt.struts11</category>
+            <category>trees</category>
+         </categories>
+         <features>
+            <feature>Tree</feature>
+            <feature>RunAtClient</feature>
+         </features>
+      </test>
+      <test>
          <name>RichTreeSelectionStyle</name>
          <description>Tree currently selected item styles</description>
          <webapp>coreWeb</webapp>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeRunAtClientError.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeRunAtClientError.xml?view=auto&rev=125682
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeRunAtClientError.xml
      Wed Jan 19 15:14:27 2005
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>RichTreeRunAtClientError</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>19 Jan 2005, 03:55:32.237 PM MST</ses:startDate>
+   <ses:description>Error report when runAtClient is set on a tree but not on 
a script container</ses:description>
+   <ses:tests>
+      <ses:test>
+         <ses:testNumber>1</ses:testNumber>
+         <ses:request>
+            <ses:protocol>HTTP</ses:protocol>
+            <ses:protocolVersion>1.1</ses:protocolVersion>
+            <ses:host>localhost</ses:host>
+            <ses:port>8080</ses:port>
+            <ses:uri>/coreWeb/richTree/goRunAtClientError.do</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>06A3E92E2FB2DD3F83D996E1F6A8EFA6</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-charset</ses:name>
+                  <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-encoding</ses:name>
+                  <ses:value>gzip,deflate</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-language</ses:name>
+                  <ses:value>en-us,en;q=0.5</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>connection</ses:name>
+                  <ses:value>keep-alive</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>cookie</ses:name>
+                  
<ses:value>JSESSIONID=06A3E92E2FB2DD3F83D996E1F6A8EFA6</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>keep-alive</ses:name>
+                  <ses:value>300</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
4.01 Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+<html lang="en">
+
+    <head>
+        <title>runAtClientError.jsp</title>
+        <link href="style.css" rel="stylesheet" type="text/css">
+        <base 
href="http://localhost:8080/coreWeb/richTree/runAtClientError.jsp";>
+    </head>
+    <body>
+        <h4 class="title"><a href="/coreWeb/richTree/begin.do" 
class="homeAnchor">Home</a>runAtClientError.jsp [goRunAtClientError.do] </h4>
+        <!-- Attribute Information -->
+        <div style='float:left;width:300px'>
+        <table cellpadding="2" cellspacing="0" border="1" width="300px">
+        <tr><th>Creation</th><td>Null TreeNode Root</td></tr>
+        <tr><th>tree</th><td>{pageFlow.tree23}</td></tr>
+        <tr><th>action</th><td>postback</td></tr>
+        <tr><th>runAtClient</th><td>false</td></tr>
+        </table>
+        </div>
+        This binds to a Page Flow variable that is never initialized.  In 
addition, the JSP page does
+        not define &lt;node> elements.  The result is a &lt;tree> that doesn't 
bind to a data Structure.
+        <hr style="clear:left">
+        <div class="content">
+        <span style="color:red;background-color:white">
+ [<b>Tag Error:1</b>, Found in tag <b>Tree</b>]</span>
+        </div>
+    <div> <hr /><table border="1" cellspacing="0" 
style="color:red;background-color:white">
+ <tr><th colspan="6">Page Errors</th></tr>
+ <tr><th>Error Number</th><th>Tag Type</th><th colspan="4">Error</th></tr>
+<tr><th>1</th><th>Tree</th><th>Message</th><td>Setting runAtClient on the 
&lt;netui:tree> requires setting runAtClient on a ScriptContainer.</td></tr>
+</table></div>
+</body>
+
+</html>]]></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>19 Jan 2005, 03:56:07.215 PM MST</ses:endDate>
+   <ses:testCount>1</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file

Reply via email to