Author: dolander Date: Tue Jan 25 14:40:56 2005 New Revision: 126438 URL: http://svn.apache.org/viewcvs?view=rev&rev=126438 Log: Cleanup some dead code in the tree Error reporting in the DivPanel BVT test verifying error reporting.
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DivPanelNoScript.xml Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.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/testRecorder/config/testRecorder-tests.xml Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java?view=diff&rev=126438&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java&r1=126437&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java&r2=126438 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java Tue Jan 25 14:40:56 2005 @@ -167,10 +167,12 @@ } } + // verify hat we are in a container with run at client on... IScriptReporter sr = getScriptReporter(); - if (!sr.isRunAtClient()) { - System.err.println("Script Reporter Not Run At Client"); - // @Todo: this needs to verify it is inside a script container that is run at client enabled. + if (sr == null || !sr.isRunAtClient()) { + String s = Bundle.getString("Tags_DivPanelHtmlRunAtClient", null); + registerTagError(s, null); + reportAndExit(SKIP_BODY); } sr.addInitMethod(JAVASCRIPT_CLASS); 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=126438&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java&r1=126437&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java&r2=126438 ============================================================================== --- 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 Tue Jan 25 14:40:56 2005 @@ -121,8 +121,6 @@ private String _dataSource = null; // The name of the tree. private String _tagId; // tag that should uniquely indentify a tree. Required for multiple tree using auto expand - //@todo: delete - //private String[] _expanded = null; private boolean _runAtClient = false; // run at client private boolean _escapeContent = false; // esapce the content of labels private boolean _outputJavaScript = false; // cause the base javascript support to be output @@ -665,8 +663,6 @@ } // check for the nodes that are expanded... - //@todo: delete - //_expanded = request.getParameterValues("tree-state"); // Add the script support for the tree. if (_runAtClient) { @@ -678,7 +674,6 @@ return; } sr.addInitMethod(TreeElement.TREE_JAVASCRIPT_CLASS); - //sr.addAnchorPostRewriter(TreeElement.TREE_JAVASCRIPT_CLASS); } // create a containing tree level <div> and place the tree level styles on it. @@ -997,9 +992,6 @@ if (_runAtClient) { String action = node.getClientAction(); if (action != null) { - // @todo: delete - //action = "NetUIAnchorRewriter(this);"; - //else { action = HtmlUtils.escapeEscapes(action); action = JavaScriptUtils.getString("netuiAction", new Object[]{action}); } @@ -1151,13 +1143,6 @@ TreeElement node, String encodedNodeName) { if (!node.isLeaf()) { - // @todo: delete - //boolean expanded = nodeIsExpanded(node, encodedNodeName); - //if (node.isExpanded() != expanded) { - // node.onExpand(); - // node.setExpanded(expanded); - //} - boolean expanded = node.isExpanded(); _anchorState.clear(); _anchorState.href = ""; @@ -1172,23 +1157,6 @@ } return false; } - - /** - * @param node - * @param nodeName - * @return - */ - //@todo: delete - //private boolean nodeIsExpanded(TreeElement node, String nodeName) - //{ - // if (_expanded == null) - // return node.isExpanded(); - // for (int i = 0; i < _expanded.length; i++) { - // if (nodeName.equals(_expanded[i])) - // return true; - // } - // return false; - //} /** * Replace any occurrence of the specified placeholder in the specified 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=126438&p1=incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties&r1=126437&p2=incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties&r2=126438 ============================================================================== --- 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 Tue Jan 25 14:40:56 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 setting runAtClient on a ScriptContainer and a <netui:scriptHeader> included in the ScriptContainer before the Tree. +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. Tags_AttributeFacetNotSupported=The facet "<b>{0}</b>" is not supported by this tag. Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/Controller.jpf?view=auto&rev=126438 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/Controller.jpf Tue Jan 25 14:40:56 2005 @@ -0,0 +1,42 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package template.divPanelNoScript; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.annotations.Jpf; + [EMAIL PROTECTED]( + ) +public class Controller extends PageFlowController +{ + /** + * This method represents the point of entry into the pageflow + * @jpf:action + * @jpf:forward name="success" path="index.jsp" + */ + @Jpf.Action( + forwards = { + @Jpf.Forward( + name = "success", + path = "index.jsp") + }) + protected Forward begin() + { + return new Forward("success"); + } +} Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/index.jsp?view=auto&rev=126438 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/template/divPanelNoScript/index.jsp Tue Jan 25 14:40:56 2005 @@ -0,0 +1,43 @@ +<%@ 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> + Basic DivPanel Without RunAtClient container + </title> + </head> + <netui:body> + <h4>Basic DivPanel</h4> + <p style="color:green">This test verifies that a DivPanel must be found inside + a ScriptContainer that has runAtClient on. + </p> + <netui:divPanel tagId="divPanel"> + <netui-template:section name="page1"> + <table><tr> + <td colspan="2" align="center">Page 1</td> + </tr><tr> + <td width="100pt"> </td> + <td width="100pt"><netui:anchor clientAction='divPanel.showPage("page2");'>Next</netui:anchor></td> + </tr></table> + </netui-template:section> + <netui-template:section name="page2"> + <table><tr> + <td colspan="2" align="center">Page 2</td> + </tr><tr> + <td width="100pt"><netui:anchor clientAction='divPanel.showPage("page1");'>Previous</netui:anchor></td> + <td width="100pt"><netui:anchor clientAction='divPanel.showPage("page3");'>Next</netui:anchor></td> + </tr></table> + </netui-template:section> + <netui-template:section name="page3"> + <table><tr> + <td colspan="2" align="center">Page 3</td> + </tr><tr> + <td width="100pt"><netui:anchor clientAction='divPanel.showPage("page2");'>Previous</netui:anchor></td> + <td width="100pt"> </td> + </tr></table> + </netui-template:section> + </netui:divPanel> + </netui:body> +</netui: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&rev=126438&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=126437&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=126438 ============================================================================== --- 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 Tue Jan 25 14:40:56 2005 @@ -2031,20 +2031,6 @@ </features> </test> <test> - <name>CtCheckboxNullBinding</name> - <description>Binding to null in the Checkbox tags attributes</description> - <webapp>coreWeb</webapp> - <categories> - <category>bvt</category> - <category>bvt.struts11</category> - <category>tags</category> - </categories> - <features> - <feature>Checkbox</feature> - <feature>Binding</feature> - </features> - </test> - <test> <name>CtContentNullBinding</name> <description>Binding to null in the Content tag attributes</description> <webapp>coreWeb</webapp> @@ -2966,6 +2952,19 @@ <test> <name>DivPanel</name> <description>Basic test of the DivPanel</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>bvt.struts11</category> + <category>templates</category> + </categories> + <features> + <feature>DivPanel</feature> + </features> + </test> + <test> + <name>DivPanelNoScript</name> + <description>DivPanel reports an error when runAtClient doesn't appear in a script container</description> <webapp>coreWeb</webapp> <categories> <category>bvt</category> Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DivPanelNoScript.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DivPanelNoScript.xml?view=auto&rev=126438 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/DivPanelNoScript.xml Tue Jan 25 14:40:56 2005 @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>DivPanelNoScript</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>25 Jan 2005, 03:25:26.762 PM MST</ses:startDate> + <ses:description>Verify that a DivPanel reports errors when no in a script container with runAtClient true.</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/template/divPanelNoScript/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>28ADF4AAA185B5EF4051E3D2495C5345</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=28ADF4AAA185B5EF4051E3D2495C5345</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> + Basic DivPanel Without RunAtClient container + </title> + </head> + <body> + <h4>Basic DivPanel</h4> + <p style="color:green">This test verifies that a DivPanel must be found inside + a ScriptContainer that has runAtClient on. + </p> + <span style="color:red;background-color:white"> + [<b>Tag Error:1</b>, Found in tag <b>DivPanel</b>]</span><div netui-div-panel="true"> + <div id="page1"> + <table><tr> + <td colspan="2" align="center">Page 1</td> + </tr><tr> + <td width="100pt"> </td> + <td width="100pt"><a href="">Next</a></td> + </tr></table> + </div> + <div id="page2"> + <table><tr> + <td colspan="2" align="center">Page 2</td> + </tr><tr> + <td width="100pt"><a href="">Previous</a></td> + <td width="100pt"><a href="">Next</a></td> + </tr></table> + </div> + <div id="page3"> + <table><tr> + <td colspan="2" align="center">Page 3</td> + </tr><tr> + <td width="100pt"><a href="">Previous</a></td> + <td width="100pt"> </td> + </tr></table> + </div> + </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>DivPanel</th><th>Message</th><td>A DivPanel requires setting runAtClient on a ScriptContainer and a <netui:scriptHeader> included in the ScriptContainer before the DivPanel.</td></tr> +</table></div> + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.page2="page2" +netui_names.page3="page3" +netui_names.page1="page1" + + +// **** This section contains functions typically run as events **** + + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the idScope for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var idScope = getScopeId(tag); + if (idScope == "") + return netui_names[id]; + else + return netui_names[idScope + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a idScope. +// The first idScope found will be returned or the empty string if a idScope is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} +--> +</script> + +</body> + +</html>]]></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>25 Jan 2005, 03:25:33.712 PM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file
