You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/02 17:22:39 UTC

svn commit: r149528 [1/3] - in incubator/beehive/trunk/netui: src/tags-html/org/apache/beehive/netui/tags/tree/ src/util/org/apache/beehive/netui/util/ test/webapps/drt/coreWeb/richTree/ test/webapps/drt/testRecorder/config/ test/webapps/drt/testRecorder/tests/

Author: dolander
Date: Wed Feb  2 08:22:35 2005
New Revision: 149528

URL: http://svn.apache.org/viewcvs?view=rev&rev=149528
Log:
Fixed a bug where if you had a runAtClient tree that appeared outside of a
ScriptContainer following a runAtClient tree inside a ScriptContainer then
the second tree didn't work because it was not initialized.

Added a couple of BVTs that tested the bug and a version that should work.


Added:
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSC3.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSCError.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeSC3.xml
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/RichTreeSCError.xml
Modified:
    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/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&r1=149527&r2=149528
==============================================================================
--- 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 Feb  2 08:22:35 2005
@@ -658,6 +658,13 @@
         // Add the script support for the tree.
         if (_trs.runAtClient) {
             IScriptReporter sr = getScriptReporter();
+            if (sr == null) {
+                String s = Bundle.getString("Tags_TreeRunAtClientSC", null);
+                registerTagError(s, null);
+                reportErrors();
+                return;
+            }
+
             ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request);
             if (!srs.isFeatureWritten(CoreScriptFeature.DYNAMIC_INIT)) {
                 String s = Bundle.getString("Tags_TreeHtmlRunAtClient", null);

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&r1=149527&r2=149528
==============================================================================
--- 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 Feb  2 08:22:35 2005
@@ -76,6 +76,7 @@
 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 a <netui:scriptHeader> included before the Tree.
+Tags_TreeRunAtClientSC=A runAtClient tree must appear inside ScriptContainer.
 Tags_DivPanelHtmlRunAtClient=A DivPanel requires setting runAtClient on a ScriptContainer and a <netui:scriptHeader> included in the ScriptContainer before the DivPanel.
 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.

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&r1=149527&r2=149528
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf Wed Feb  2 08:22:35 2005
@@ -61,6 +61,10 @@
     private TreeElement _tree27;
     private TreeElement _tree28;
     private TreeElement _tree29;
+    private TreeElement _tree30;
+    private TreeElement _tree31;
+    private TreeElement _tree32;
+    private TreeElement _tree33;
 
     private String _expand = "&nbsp;";
     private String _node = "&nbsp;";
@@ -295,6 +299,38 @@
     public void setTree29(TreeElement tn) {
         _tree29 = tn;
     }
+
+    public TreeElement getTree30() {
+        return _tree30;
+    }
+
+    public void setTree30(TreeElement tn) {
+        _tree30 = tn;
+    }
+
+    public TreeElement getTree31() {
+        return _tree31;
+    }
+
+    public void setTree31(TreeElement tn) {
+        _tree31 = tn;
+    }
+
+    public TreeElement getTree32() {
+        return _tree32;
+    }
+
+    public void setTree32(TreeElement tn) {
+        _tree32 = tn;
+    }
+
+    public TreeElement getTree33() {
+        return _tree33;
+    }
+
+    public void setTree33(TreeElement tn) {
+        _tree33 = tn;
+    }
     
     //************************************************************************
     
@@ -543,6 +579,10 @@
         _tree27 = null;
         _tree28 = null;
         _tree29 = null;
+        _tree30 = null;
+        _tree31 = null;
+        _tree32 = null;
+        _tree33 = null;
 
         buildTrees();
         return forward;
@@ -833,6 +873,27 @@
         return forward;
     }
 
+    @Jpf.Action(forwards = { 
+        @Jpf.Forward(name = "success", path = "treeSC3.jsp")
+})
+    protected Forward goTreeSC3()        {
+        Forward forward = new Forward("success");
+        NameService ns = NameService.instance(getRequest().getSession());
+	ns.debugSetNameIntValue(371);
+        clearExpand();                
+        return forward;
+    }
+
+    @Jpf.Action(forwards = { 
+        @Jpf.Forward(name = "success", path = "treeSCError.jsp")
+})
+    protected Forward goTreeSCError()        {
+        Forward forward = new Forward("success");
+        NameService ns = NameService.instance(getRequest().getSession());
+	ns.debugSetNameIntValue(443);
+        clearExpand();                
+        return forward;
+    }
 
     public static final class FormBean extends FormData
     {

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&r1=149527&r2=149528
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp Wed Feb  2 08:22:35 2005
@@ -78,6 +78,9 @@
     <tr><td><netui:anchor action="goTreeSC2">RichTreeSC2</netui:anchor></td>
 	<td>Running a runAtClient tree in a script container</td><td>goTreeSC2</td><td>treeSC2.jsp</td>
 	<td>tree28 tree29</td></tr>
+    <tr><td><netui:anchor action="goTreeSC3">RichTreeSC3</netui:anchor></td>
+	<td>Running a runAtClient tree in a script container</td><td>goTreeSC3</td><td>treeSC3.jsp</td>
+	<td>tree30 tree31</td></tr>
     <tr><td><netui:anchor action="goRunAtClient2">RichTreeRunAtClient2</netui:anchor></td>
 	<td>Multiple tree controls doing runAtClient</td><td>goRunAtClient2</td><td>runAtClient2.jsp</td>
 	<td>tree25 tree26</td></tr>
@@ -112,6 +115,9 @@
     <tr><td><netui:anchor action="goRunAtClientError">RichTreeRunAtClientError</netui:anchor></td>
 	<td>runAtClient set on the tree, but not on the HTML tag.</td><td>goRunAtClientError</td><td>runAtClientError.jsp</td>
 	<td>tree23</td></tr>
+    <tr><td><netui:anchor action="goTreeSCError">RichTreeSCError</netui:anchor></td>
+	<td>Running a runAtClient tree outside a scriptContainer</td><td>goTreeSCError</td><td>treeSCError.jsp</td>
+	<td>tree32 tree33</td></tr>
     </table>    
     <ul>
     <li>Need to verify a node with both an href and action defined</li>

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSC3.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSC3.jsp?view=auto&rev=149528
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSC3.jsp (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSC3.jsp Wed Feb  2 08:22:35 2005
@@ -0,0 +1,76 @@
+<%@ 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"%>
+<html>
+    <head>
+        <title>treeSC3.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>treeSC3.jsp [goTreeSC3.do] </h4>
+        <!-- Attribute Information -->
+        <div style='float:left;width:300px'>
+        <table cellpadding="2" cellspacing="0" border="1" width="300px">
+        <tr><th>Creation</th><td>Static</td></tr>
+        <tr><th>tree</th><td>{pageFlow.tree30 and 31}</td></tr>
+        <tr><th>runAtClient</th><td>true</td></tr>
+        <tr><th>action</th><td>postback</td></tr>
+        </table>
+        </div>
+        <!-- Postback information -->
+        <div style='float:right;width:250px;border:solid 1pt gray;margin:2 4;'>
+        <p style="font-weight:bold;text-align:center;margin: 0;padding:0;">Tree Postback Information</p>
+        <table cellpadding='0' cellspacing='2' width="100%">
+        <tr><th style="text-align:right" width="100pt">Expand:</th><td><netui:content value="${pageFlow.expand}"/></td></tr>
+        <tr><th style="text-align:right" width="100pt">Selection:</th><td><netui:content value="${pageFlow.node}"/></td></tr>
+        </table>
+        </div>
+        <hr style="clear:left">
+        <div class="content">
+	<table width="100%" border="1" cellspacing="0" cellpadding="0">
+	<tr><td widht="50%" valign="top">
+	<netui:scriptContainer generateIdScope="true">
+        <netui:scriptHeader />
+        <netui:tree dataSource="pageFlow.tree30" selectionAction="postback"
+	        selectionStyle="color:red" unselectStyle="color:blue"
+		tagId="tree" renderJavaScript="true" runAtClient="true">
+            <netui:treeItem tagId="Item0" expanded="true" action="postback">
+                <netui:treeLabel>0</netui:treeLabel>
+                <netui:treeItem tagId="item00" expanded="true" action="postback">
+                    <netui:treeLabel>0.0</netui:treeLabel>
+                </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>
+	</netui:scriptContainer>
+	</td><td width="50%" valign="top">
+	<netui:scriptContainer generateIdScope="true">
+        <netui:tree dataSource="pageFlow.tree31" selectionAction="postback"
+	        selectionStyle="color:red" unselectStyle="color:blue"
+		tagId="tree" renderJavaScript="true" runAtClient="true">
+            <netui:treeItem tagId="Item0" expanded="true" action="postback">
+                <netui:treeLabel>0</netui:treeLabel>
+                <netui:treeItem tagId="item00" expanded="true" action="postback">
+                    <netui:treeLabel>0.0</netui:treeLabel>
+                </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>
+	</netui:scriptContainer>
+	</td></tr>
+	</table>
+        </div>
+    </netui:body>
+<html>

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSCError.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSCError.jsp?view=auto&rev=149528
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSCError.jsp (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/treeSCError.jsp Wed Feb  2 08:22:35 2005
@@ -0,0 +1,77 @@
+<%@ 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"%>
+<html>
+    <head>
+        <title>treeSCError.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>treeSCError.jsp [goTreeSCError.do] </h4>
+        <!-- Attribute Information -->
+        <div style='float:left;width:300px'>
+        <table cellpadding="2" cellspacing="0" border="1" width="300px">
+        <tr><th>Creation</th><td>Static</td></tr>
+        <tr><th>tree</th><td>{pageFlow.tree32 and 33}</td></tr>
+        <tr><th>runAtClient</th><td>true</td></tr>
+        <tr><th>action</th><td>postback</td></tr>
+        </table>
+        </div>
+        <!-- Postback information -->
+        <div style='float:right;width:250px;border:solid 1pt gray;margin:2 4;'>
+        <p style="font-weight:bold;text-align:center;margin: 0;padding:0;">Tree Postback Information</p>
+        <table cellpadding='0' cellspacing='2' width="100%">
+        <tr><th style="text-align:right" width="100pt">Expand:</th><td><netui:content value="${pageFlow.expand}"/></td></tr>
+        <tr><th style="text-align:right" width="100pt">Selection:</th><td><netui:content value="${pageFlow.node}"/></td></tr>
+        </table>
+        </div>
+	In this test, the second tree doesn't appear inside a ScriptContainer
+	which is an error because the proper initialization code is written
+	out by the container.
+        <hr style="clear:left">
+        <div class="content">
+	<table width="100%" border="1" cellspacing="0" cellpadding="0">
+	<tr><td widht="50%" valign="top">
+	<netui:scriptContainer generateIdScope="true">
+        <netui:scriptHeader />
+        <netui:tree dataSource="pageFlow.tree32" selectionAction="postback"
+	        selectionStyle="color:red" unselectStyle="color:blue"
+		tagId="tree" renderJavaScript="true" runAtClient="true">
+            <netui:treeItem tagId="Item0" expanded="true" action="postback">
+                <netui:treeLabel>0</netui:treeLabel>
+                <netui:treeItem tagId="item00" expanded="true" action="postback">
+                    <netui:treeLabel>0.0</netui:treeLabel>
+                </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>
+	</netui:scriptContainer>
+	</td><td width="50%" valign="top">
+        <netui:tree dataSource="pageFlow.tree33" selectionAction="postback"
+	        selectionStyle="color:red" unselectStyle="color:blue"
+		tagId="tree" renderJavaScript="true" runAtClient="true">
+            <netui:treeItem tagId="Item0" expanded="true" action="postback">
+                <netui:treeLabel>0</netui:treeLabel>
+                <netui:treeItem tagId="item00" expanded="true" action="postback">
+                    <netui:treeLabel>0.0</netui:treeLabel>
+                </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>
+	</td></tr>
+	</table>
+        </div>
+    </netui:body>
+<html>

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&r1=149527&r2=149528
==============================================================================
--- 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 Feb  2 08:22:35 2005
@@ -5587,6 +5587,34 @@
          </features>
       </test>
       <test>
+         <name>RichTreeSC3</name>
+         <description>[goTreeSC3/treeSC3.jsp] Base test of runAtClient tree in a ScriptContainer</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>bvt.struts11</category>
+            <category>trees</category>
+         </categories>
+         <features>
+            <feature>Tree</feature>
+            <feature>SciptContainer</feature>
+         </features>
+      </test>
+      <test>
+         <name>RichTreeSCError</name>
+         <description>[goTreeSCError/treeSCError.jsp] Two trees where the second doesn't appear inside a ScriptContainer</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>bvt.struts11</category>
+            <category>trees</category>
+         </categories>
+         <features>
+            <feature>Tree</feature>
+            <feature>SciptContainer</feature>
+         </features>
+      </test>
+      <test>
          <name>RichTreeSelectionStyle</name>
          <description>[goSelectStyles/selectStyles.jsp] Tree currently selected item styles</description>
          <webapp>coreWeb</webapp>