Author: dolander Date: Sat Jan 15 11:38:56 2005 New Revision: 125293 URL: http://svn.apache.org/viewcvs?view=rev&rev=125293 Log: Add a facet parameter to the IUrlParams.addParameter method to allow tags to support creating multiple URLs. Document the IUrlParams interface Fix the Label tag so it qualifies the 'for' attribute so it matches the scoping of the tagId Add DRTs for the tagId support in the Label and a base test inside a scriptContainer.
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtLabelBase.xml incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapLabel.xml Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java 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/html/IUrlParams.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java (original) +++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AnchorColumn.java Sat Jan 15 11:38:56 2005 @@ -78,7 +78,7 @@ _anchorCellModel.setAction((action)); } - public void addParameter(String name, Object value) + public void addParameter(String name, Object value, String facet) throws JspException { ParamHelper.addParam(_anchorCellModel.getParams(), name, value); Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java Sat Jan 15 11:38:56 2005 @@ -260,9 +260,12 @@ * Adds a URL parameter to the generated hyperlink. * @param name - the name of the parameter to be added. * @param value - the value of the parameter to be added (a String or String[]). + * @param facet */ - public void addParameter(String name, Object value) throws JspException + public void addParameter(String name, Object value, String facet) throws JspException { + assert(name != null) : "Parameter 'name' must not be null"; + if (_params == null) { _params = new HashMap(); } Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java Sat Jan 15 11:38:56 2005 @@ -189,10 +189,13 @@ * Adds a URL parameter to the generated hyperlink. * @param name - the name of the parameter to be added. * @param value - the value of the parameter to be added (a String or String[]). + * @param facet */ - public void addParameter(String name, Object value) + public void addParameter(String name, Object value, String facet) throws JspException { + assert(name != null) : "Parameter 'name' must not be null"; + if (_params == null) { _params = new HashMap(); } 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=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java&r2=125293 ============================================================================== --- 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 Sat Jan 15 11:38:56 2005 @@ -527,9 +527,12 @@ * Adds a URL parameter to the generated hyperlink. * @param name - the name of the parameter to be added. * @param value - the value of the parameter to be added (a String or String[]). + * @param facet */ - public void addParameter(String name, Object value) throws JspException + public void addParameter(String name, Object value, String facet) throws JspException { + assert(name != null) : "Parameter 'name' must not be null"; + if (_params == null) { _params = new HashMap(); } Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/IUrlParams.java Sat Jan 15 11:38:56 2005 @@ -19,9 +19,21 @@ import javax.servlet.jsp.JspException; -// @todo: should this be rename to IURLParams? - +/** + * This interfaces defines the contract allowing tags to add parameters which will + * be added to URLs which they generate. The Parameter and ParameterMap tags both + * use this method to add parameters to ancestor tags. + */ public interface IUrlParams { - public void addParameter(String name, Object value) throws JspException; + /** + * This method will allow a tag that produces one or more Urls to have parameters set + * on the tag. The name and value should be required. The facet is optional, and + * allows tags producing more than one URL to have parameters set on different URLs. + * @param name The name of the parameter to be added to the URL. + * @param value The value of the parameter. + * @param facet The name of a facet for which the parameter should be added. + * @throws JspException + */ + public void addParameter(String name, Object value, String facet) throws JspException; } Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Image.java Sat Jan 15 11:38:56 2005 @@ -271,9 +271,12 @@ * Adds a URL parameter to the generated hyperlink. * @param name - the name of the parameter to be added. * @param value - the value of the parameter to be added (a String or String[]). + * @param facet */ - public void addParameter(String name, Object value) throws JspException + public void addParameter(String name, Object value, String facet) throws JspException { + assert(name != null) : "Parameter 'name' must not be null"; + if (_params == null) { _params = new HashMap(); } Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Label.java Sat Jan 15 11:38:56 2005 @@ -47,7 +47,7 @@ */ public String getTagName() { - return "FormLabel"; + return "Label"; } /** @@ -69,7 +69,6 @@ */ public void setFor(String forAttr) { - // @todo: this needs to be have the name qualitification done. _state.forAttr = forAttr; } @@ -121,6 +120,12 @@ if (hasErrors()) return reportAndExit(EVAL_PAGE); + + // fully qualify the for attribute if it exists + if (_state.forAttr != null) { + _state.forAttr = getIdForTagId(_state.forAttr); + + } WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.LABEL_TAG, req); Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Parameter.java Sat Jan 15 11:38:56 2005 @@ -109,7 +109,7 @@ } else { IUrlParams parent = (IUrlParams) parentTag; - parent.addParameter(_name, _value); + parent.addParameter(_name, _value, null); } localRelease(); return SKIP_BODY; Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java?view=diff&rev=125293&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java&r1=125292&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java&r2=125293 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ParameterMap.java Sat Jan 15 11:38:56 2005 @@ -107,14 +107,12 @@ Tag parentTag = findAncestorWithClass(this, IUrlParams.class); if (parentTag != null) { // this map shouldn't be null because the attribute is required. - // @todo: when Asserts are on, we should assert this instead of this conditional - if (_map != null) { - IUrlParams parent = (IUrlParams) parentTag; - Iterator it = _map.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry key = (Map.Entry) it.next(); - parent.addParameter(key.getKey().toString(), key.getValue().toString()); - } + assert(_map != null); + IUrlParams parent = (IUrlParams) parentTag; + Iterator it = _map.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry key = (Map.Entry) it.next(); + parent.addParameter(key.getKey().toString(), key.getValue().toString(), null); } } else { Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/Controller.jpf?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/Controller.jpf Sat Jan 15 11:38:56 2005 @@ -0,0 +1,139 @@ +package coretags.label.base; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + private String[] _selectOptions = {"Option 1", "Option 2", "Option 3", "Option 4"}; + private Bean _bean = new Bean(); + + public Bean getBean() { + return _bean; + } + + public String[] getSelectOptions() { + return _selectOptions; + } + + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + return new Forward("index"); + } + + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } + + + @Jpf.Action(forwards = { + @Jpf.Forward(name = "success", + path = "index.jsp") + }) + protected Forward postForm(Bean form) + { + _bean = form; + Forward forward = new Forward("success"); + return forward; + } + + public static class Bean extends FormData + { + private String text1; + + private String text2; + + private String text3; + + private boolean check1; + + private boolean check2; + + public String getText1() + { + return text1; + } + + public void setText1(String value) + { + text1 = value; + } + + public String getText2() + { + return text2; + } + + public void setText2(String value) + { + text2 = value; + } + + public String getText3() + { + return text3; + } + + public void setText3(String value) + { + text3 = value; + } + + public boolean isCheck1() + { + return check1; + } + + public void setCheck1(boolean value) + { + check1 = value; + } + + public boolean isCheck2() + { + return check2; + } + + public void setCheck2(boolean value) + { + check2 = value; + } + } +} + [EMAIL PROTECTED](value= {"<!-- This data is auto-generated. Hand-editing this section is not recommended. -->", +"<view-properties>", +"<pageflow-object id='pageflow:/idmap/simple/Controller.jpf'/>", +"<pageflow-object id='page:index.jsp'><property value='220' name='x'/><property value='100' name='y'/></pageflow-object>", +"<pageflow-object id='formbean:Bean'/>", +"<pageflow-object id='action:postForm.do#idmap.simple.Controller.Bean'><property name='x' value='340'/><property name='y' value='100'/></pageflow-object>", +"<pageflow-object id='forward:[EMAIL PROTECTED]:postForm.do#idmap.simple.Controller.Bean@'/>", +"<pageflow-object id='action-call:@page:[EMAIL PROTECTED]@action:postForm.do#idmap.simple.Controller.Bean@'><property name='elbowsX' value='256,280,280,304'/><property name='elbowsY' value='92,92,92,92'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>", +"<pageflow-object id='action:begin.do'><property value='80' name='x'/><property value='100' name='y'/></pageflow-object>", +"<pageflow-object id='forward:[EMAIL PROTECTED]:begin.do@'><property value='116,140,140,164' name='elbowsX'/><property value='92,92,92,92' name='elbowsY'/><property value='East_1' name='fromPort'/><property value='West_1' name='toPort'/><property value='index' name='label'/></pageflow-object>", +"</view-properties>" +}) +interface VIEW_PROPERTIES { } Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/index.jsp?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/label/base/index.jsp Sat Jan 15 11:38:56 2005 @@ -0,0 +1,57 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> + +<netui:html generateScopeId="true"> + <head> + <netui:base/> + </head> + <netui:body> + <p style="color: green">This test verifies the base behavior of the + label. The label uses the for attribute as an IDREF to map the + label to an HTML control ID attribute. This requires that the + for attribute be encoded to in the same way the tagId is encoded. + </p> + <netui:form tagId="form" action="postForm"> + <table> + <tr valign="top"> + <td><netui:label for="textbox" value="TextBox:" /></td> + <td> + <netui:textBox tagId="textbox" + dataSource="actionForm.text1" /> + </td> + </tr> + <tr valign="top"> + <td><netui:label for="select" value="Select:" /></td> + <td> + <netui:select tagId="select" dataSource="actionForm.text2" + optionsDataSource="${pageFlow.selectOptions}" /> + </td> + </tr> + <tr valign="top"> + <td><netui:label for="textArea" value="TextArea:" /></td> + <td> + <netui:textArea tagId="textArea" + dataSource="actionForm.text3" /> + </td> + </tr> + <tr valign="top"> + <td><netui:label for="check1" value="Check One:" /></td> + <td> + <netui:checkBox tagId="check1" + dataSource="actionForm.check1" /> + </td> + </tr> + <tr valign="top"> + <td><netui:label for="check2" value="Check Two:" /></td> + <td> + <netui:checkBox tagId="check2" dataSource="actionForm.check2" /> + </td> + </table> + <br> + + <netui:button type="submit" value="postForm"/> + </netui:form> + </netui:body> +</netui:html> + + \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/Controller.jpf?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/Controller.jpf Sat Jan 15 11:38:56 2005 @@ -0,0 +1,139 @@ +package idmap.label; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + private String[] _selectOptions = {"Option 1", "Option 2", "Option 3", "Option 4"}; + private Bean _bean = new Bean(); + + public Bean getBean() { + return _bean; + } + + public String[] getSelectOptions() { + return _selectOptions; + } + + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + return new Forward("index"); + } + + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } + + + @Jpf.Action(forwards = { + @Jpf.Forward(name = "success", + path = "index.jsp") + }) + protected Forward postForm(Bean form) + { + _bean = form; + Forward forward = new Forward("success"); + return forward; + } + + public static class Bean extends FormData + { + private String text1; + + private String text2; + + private String text3; + + private boolean check1; + + private boolean check2; + + public String getText1() + { + return text1; + } + + public void setText1(String value) + { + text1 = value; + } + + public String getText2() + { + return text2; + } + + public void setText2(String value) + { + text2 = value; + } + + public String getText3() + { + return text3; + } + + public void setText3(String value) + { + text3 = value; + } + + public boolean isCheck1() + { + return check1; + } + + public void setCheck1(boolean value) + { + check1 = value; + } + + public boolean isCheck2() + { + return check2; + } + + public void setCheck2(boolean value) + { + check2 = value; + } + } +} + [EMAIL PROTECTED](value= {"<!-- This data is auto-generated. Hand-editing this section is not recommended. -->", +"<view-properties>", +"<pageflow-object id='pageflow:/idmap/simple/Controller.jpf'/>", +"<pageflow-object id='page:index.jsp'><property value='220' name='x'/><property value='100' name='y'/></pageflow-object>", +"<pageflow-object id='formbean:Bean'/>", +"<pageflow-object id='action:postForm.do#idmap.simple.Controller.Bean'><property name='x' value='340'/><property name='y' value='100'/></pageflow-object>", +"<pageflow-object id='forward:[EMAIL PROTECTED]:postForm.do#idmap.simple.Controller.Bean@'/>", +"<pageflow-object id='action-call:@page:[EMAIL PROTECTED]@action:postForm.do#idmap.simple.Controller.Bean@'><property name='elbowsX' value='256,280,280,304'/><property name='elbowsY' value='92,92,92,92'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>", +"<pageflow-object id='action:begin.do'><property value='80' name='x'/><property value='100' name='y'/></pageflow-object>", +"<pageflow-object id='forward:[EMAIL PROTECTED]:begin.do@'><property value='116,140,140,164' name='elbowsX'/><property value='92,92,92,92' name='elbowsY'/><property value='East_1' name='fromPort'/><property value='West_1' name='toPort'/><property value='index' name='label'/></pageflow-object>", +"</view-properties>" +}) +interface VIEW_PROPERTIES { } Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/index.jsp?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/label/index.jsp Sat Jan 15 11:38:56 2005 @@ -0,0 +1,60 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> + +<netui:html generateScopeId="true"> + <head> + <netui:base/> + </head> + <netui:body> + <p style="color: green">This tests the use of tagid on the Label. + This is a JavaScript test of the mapping between tagid and the + real id. + </p> + <netui:form action="postForm"> + <span id="scopeOneSpan" /> + <table> + <tr valign="top"> + <td><netui:label tagId="cb1Label" for="checkbox1" value="Check One:" /></td> + <td> + <netui:checkBox tagId="checkbox1" dataSource="actionForm.check1" /> + </td> + </tr> + <tr valign="top"> + <td><netui:label tagId="cb2Label" for="checkbox1" value="Check Two:" /></td> + <td> + <netui:checkBox tagId="checkbox2" dataSource="actionForm.check2" /> + </td> + </tr> + </table> + <br> + + <netui:button type="submit" value="postForm"/> + </netui:form> + <hr> + <p style="color: green">This section will use the JavaScript routines + to lookup both the checkboxes and the labels associated with them. + </p> + <p id="javaOut"></p> + </netui:body> + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var s = document.getElementById("scopeOneSpan"); + + + var val = "<b>Document Access</b><br>"; + + val = val + "CheckBox 1 by id is null: <b>" + + (document.getElementById(lookupIdByTagId("checkbox1",s)) == null) + "</b><br>"; + val = val + "CheckBox 1 Label by id is null: <b>" + + (document.getElementById(lookupIdByTagId("cb1Label",s)) == null) + "</b><br>"; + val = val + "CheckBox 2 by id is null: <b>" + + (document.getElementById(lookupIdByTagId("checkbox2",s)) == null) + "</b><br>"; + val = val + "CheckBox 2 Label by id is null: <b>" + + (document.getElementById(lookupIdByTagId("cb2Label",s)) == null) + "</b><br>"; + + p.innerHTML = val; + </script> +</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=125293&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=125292&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=125293 ============================================================================== --- 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 Sat Jan 15 11:38:56 2005 @@ -2247,6 +2247,20 @@ </features> </test> <test> + <name>CtLabelBase</name> + <description>Base test of the Label, verify that the label for attribute is encoded</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>tags</category> + </categories> + <features> + <feature>Label</feature> + <feature>tagId</feature> + <feature>for</feature> + </features> + </test> + <test> <name>CtScScopeId</name> <description>Test of nesting scope id</description> <webapp>coreWeb</webapp> @@ -3165,6 +3179,19 @@ <features> <feature>JavaScript</feature> <feature>tagid</feature> + </features> + </test> + <test> + <name>IdMapLabel</name> + <description>Verify the lookup of the tagId on a Label.</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>tags</category> + </categories> + <features> + <feature>JavaScript</feature> + <feature>Label</feature> </features> </test> <test> Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtLabelBase.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtLabelBase.xml?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtLabelBase.xml Sat Jan 15 11:38:56 2005 @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>CtLabelBase</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>15 Jan 2005, 12:12:25.578 PM MST</ses:startDate> + <ses:description>Verify the base behavior of the Label and the for attribute.</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/coretags/label/base/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>273D63806F6974B80F6A83B373747F50</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <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-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=273D63806F6974B80F6A83B373747F50</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><!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en" netui:scopeId="n0"> + + <head> + <base href="http://localhost:8080/coreWeb/coretags/label/base/index.jsp"> + </head> + <body> + <p style="color: green">This test verifies the base behavior of the + label. The label uses the for attribute as an IDREF to map the + label to an HTML control ID attribute. This requires that the + for attribute be encoded to in the same way the tagId is encoded. + </p> + <form name="bean" id="n0.form" action="/coreWeb/coretags/label/base/postForm.do" method="post"> + <table> + <tr valign="top"> + <td><label for="n0.textbox">TextBox:</label></td> + <td> + <input type="text" name="{actionForm.text1}" id="n0.textbox"> + </td> + </tr> + <tr valign="top"> + <td><label for="n0.select">Select:</label></td> + <td> + <input type="hidden" name="wlw-select_key:{actionForm.text2}OldValue" value="true"> +<select name="wlw-select_key:{actionForm.text2}" id="n0.select"> +<option value="Option 1">Option 1</option> +<option value="Option 2">Option 2</option> +<option value="Option 3">Option 3</option> +<option value="Option 4">Option 4</option></select> + </td> + </tr> + <tr valign="top"> + <td><label for="n0.textArea">TextArea:</label></td> + <td> + <textarea name="{actionForm.text3}" id="n0.textArea"></textarea> + </td> + </tr> + <tr valign="top"> + <td><label for="n0.check1">Check One:</label></td> + <td> + <input type="hidden" name="wlw-checkbox_key:{actionForm.check1}OldValue" value="false"><input type="checkbox" name="wlw-checkbox_key:{actionForm.check1}" id="n0.check1"> + </td> + </tr> + <tr valign="top"> + <td><label for="n0.check2">Check Two:</label></td> + <td> + <input type="hidden" name="wlw-checkbox_key:{actionForm.check2}OldValue" value="false"><input type="checkbox" name="wlw-checkbox_key:{actionForm.check2}" id="n0.check2"> + </td> + </table> + <br> + &nbsp; + <input type="submit" value="postForm"> + </form> + + +<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.n0__check1="wlw-checkbox_key:{actionForm.check1}" +netui_names.n0__textbox="{actionForm.text1}" +netui_names.n0__form="n0.form" +netui_names.n0__check2="wlw-checkbox_key:{actionForm.check2}" +netui_names.n0__textArea="{actionForm.text3}" +netui_names.n0__select="wlw-select_key:{actionForm.text2}" + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_tagIdNameMap == null) + var netui_tagIdNameMap = new Object(); +netui_tagIdNameMap.n0___check1="wlw-checkbox_key:{actionForm.check1}" +netui_tagIdNameMap.n0___textbox="{actionForm.text1}" +netui_tagIdNameMap.n0___form="bean" +netui_tagIdNameMap.n0___check2="wlw-checkbox_key:{actionForm.check2}" +netui_tagIdNameMap.n0___textArea="{actionForm.text3}" +netui_tagIdNameMap.n0___select="wlw-select_key:{actionForm.text2}" + + +// **** 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 scopeId for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var scopeId = getScopeId(tag); + if (scopeId == "") + return netui_names[id]; + else + return netui_names[scopeId + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a scopeId. +// The first scopeId found will be returned or the empty string if a scopeId is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +// lookup by tagId to "real name" +function lookupNameByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"_"); + if (scopeId == "") + return netui_tagIdNameMap[id]; + else + return netui_tagIdNameMap[scopeId + "__" + id]; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + +</body> +</div> +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>15 Jan 2005, 12:12:41.250 PM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapLabel.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapLabel.xml?view=auto&rev=125293 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapLabel.xml Sat Jan 15 11:38:56 2005 @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>IdMapLabel</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>15 Jan 2005, 12:13:06.968 PM MST</ses:startDate> + <ses:description>Verify the tagId on the Label</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/idmap/label/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>273D63806F6974B80F6A83B373747F50</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <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-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=273D63806F6974B80F6A83B373747F50</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><!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en" netui:scopeId="n0"> + + <head> + <base href="http://localhost:8080/coreWeb/idmap/label/index.jsp"> + </head> + <body> + <p style="color: green">This tests the use of tagid on the Label. + This is a JavaScript test of the mapping between tagid and the + real id. + </p> + <form name="bean" action="/coreWeb/idmap/label/postForm.do" method="post"> + <span id="scopeOneSpan" /> + <table> + <tr valign="top"> + <td><label id="n0.cb1Label" for="n0.checkbox1">Check One:</label></td> + <td> + <input type="hidden" name="wlw-checkbox_key:{actionForm.check1}OldValue" value="false"><input type="checkbox" name="wlw-checkbox_key:{actionForm.check1}" id="n0.checkbox1"> + </td> + </tr> + <tr valign="top"> + <td><label id="n0.cb2Label" for="n0.checkbox1">Check Two:</label></td> + <td> + <input type="hidden" name="wlw-checkbox_key:{actionForm.check2}OldValue" value="false"><input type="checkbox" name="wlw-checkbox_key:{actionForm.check2}" id="n0.checkbox2"> + </td> + </tr> + </table> + <br> + &nbsp; + <input type="submit" value="postForm"> + </form> + <hr> + <p style="color: green">This section will use the JavaScript routines + to lookup both the checkboxes and the labels associated with them. + </p> + <p id="javaOut"></p> + + +<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.n0__checkbox1="wlw-checkbox_key:{actionForm.check1}" +netui_names.n0__cb1Label="n0.cb1Label" +netui_names.n0__cb2Label="n0.cb2Label" +netui_names.n0__checkbox2="wlw-checkbox_key:{actionForm.check2}" + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_tagIdNameMap == null) + var netui_tagIdNameMap = new Object(); +netui_tagIdNameMap.n0___checkbox1="wlw-checkbox_key:{actionForm.check1}" +netui_tagIdNameMap.n0___checkbox2="wlw-checkbox_key:{actionForm.check2}" + + +// **** 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 scopeId for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var scopeId = getScopeId(tag); + if (scopeId == "") + return netui_names[id]; + else + return netui_names[scopeId + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a scopeId. +// The first scopeId found will be returned or the empty string if a scopeId is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +// lookup by tagId to "real name" +function lookupNameByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"_"); + if (scopeId == "") + return netui_tagIdNameMap[id]; + else + return netui_tagIdNameMap[scopeId + "__" + id]; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + +</body> + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var s = document.getElementById("scopeOneSpan"); + + + var val = "<b>Document Access</b><br>"; + + val = val + "CheckBox 1 by id is null: <b>" + + (document.getElementById(lookupIdByTagId("checkbox1",s)) == null) + "</b><br>"; + val = val + "CheckBox 1 Label by id is null: <b>" + + (document.getElementById(lookupIdByTagId("cb1Label",s)) == null) + "</b><br>"; + val = val + "CheckBox 2 by id is null: <b>" + + (document.getElementById(lookupIdByTagId("checkbox2",s)) == null) + "</b><br>"; + val = val + "CheckBox 2 Label by id is null: <b>" + + (document.getElementById(lookupIdByTagId("cb2Label",s)) == null) + "</b><br>"; + + p.innerHTML = val; + </script> +</div> +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>15 Jan 2005, 12:13:16.531 PM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file
