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/09 19:33:50 UTC
svn commit: r153101 - in incubator/beehive/trunk/netui:
src/tags-html/org/apache/beehive/netui/tags/html/
test/webapps/drt/coreWeb/bugs/j159/ test/webapps/drt/testRecorder/config/
test/webapps/drt/testRecorder/tests/
Author: dolander
Date: Wed Feb 9 10:33:48 2005
New Revision: 153101
URL: http://svn.apache.org/viewcvs?view=rev&rev=153101
Log:
Jira 159 -- Added support for tagId to the CheckBoxOption and RadioButtonOption.
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/Controller.jpf
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/checkBoxOption.jsp
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J159.xml
Modified:
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/CheckBoxOption.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RadioButtonOption.java
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/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&r1=153100&r2=153101
==============================================================================
--- 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 Wed Feb 9 10:33:48 2005
@@ -487,8 +487,10 @@
WriteRenderAppender writer = new WriteRenderAppender(pageContext);
// the tagId must be qualified and we need to output the lookup methods
+ // @todo: need to output the Script?
+ // @todo: I don't believe that this works. The id is not encoded correctly
_state.id = getIdForTagId(_state.id);
- renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, null);
+ String script = renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, null);
//set the name so legacy browsers can support this.
_state.name = _state.id;
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxOption.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxOption.java?view=diff&r1=153100&r2=153101
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxOption.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxOption.java Wed Feb 9 10:33:48 2005
@@ -24,6 +24,7 @@
import org.apache.beehive.netui.util.Bundle;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
@@ -50,7 +51,6 @@
* @netui.tldx:tag requiredparent="checkBoxGroup"
* whitespace="indent"
* renderer="workshop.netui.jspdesigner.tldx.CheckboxOptionRenderer"
- * @netui:attribute name="tagId" hide="true"
* description=""
* @netui.tldx:tag
*/
@@ -242,8 +242,17 @@
cr.TR_TD(writer);
}
+
_state.type = INPUT_CHECKBOX;
_state.name = parent.getQualifiedDataSourceName();
+ if (_state.id != null) {
+ String tagId = _state.id;
+ _state.id = getIdForTagId(_state.id);
+ String script = renderDefaultNameAndId((HttpServletRequest) req, _state, tagId, _state.name);
+ if (script != null) {
+ write(script);
+ }
+ }
// Disabled on the option itself will override the parent setting this.
// We check to see if the option actuall had disabled set on it, if not then look
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RadioButtonOption.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RadioButtonOption.java?view=diff&r1=153100&r2=153101
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RadioButtonOption.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/RadioButtonOption.java Wed Feb 9 10:33:48 2005
@@ -22,6 +22,7 @@
import org.apache.beehive.netui.util.Bundle;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
@@ -44,7 +45,6 @@
* @netui.tldx:tag requiredparent="radioButtonGroup td"
* renderer="workshop.netui.jspdesigner.tldx.RadioButtonOptionRenderer"
* whitespace="indent"
- * @netui:attribute name="tagId" hide="true"
*/
public class RadioButtonOption
extends HtmlFocusBaseTag
@@ -210,7 +210,14 @@
}
_state.type = INPUT_RADIO;
_state.name = parent.getQualifiedDataSourceName();
-
+ if (_state.id != null) {
+ String tagId = _state.id;
+ _state.id = getIdForTagId(_state.id);
+ String script = renderDefaultNameAndId((HttpServletRequest) req, _state, tagId, _state.name);
+ if (script != null) {
+ write(script);
+ }
+ }
// @todo: why is this a Boolean?
_state.checked = new Boolean(parent.isMatched(_state.value,null)).booleanValue();
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/Controller.jpf
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/Controller.jpf?view=auto&rev=153101
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/Controller.jpf (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/Controller.jpf Wed Feb 9 10:33:48 2005
@@ -0,0 +1,77 @@
+package bugs.j159;
+
+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;
+import org.apache.beehive.netui.tags.tree.TreeElement;
+
+/**
+ * This is the default controller for a blank web application.
+ */
+@Jpf.Controller
+public class Controller extends PageFlowController
+{
+ private String _action;
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="index", path="checkBoxOption.jsp")
+ }
+ )
+ protected Forward begin()
+ {
+ _action = "begin";
+ return new Forward("index");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="index", path="index.jsp")
+ }
+ )
+ protected Forward post(Bean form)
+ {
+ _action = "post";
+ 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)
+ {
+ }
+
+ public static class Bean extends FormData
+ {
+ private String[] checks;
+ private String radios;
+ public String[] getChecks()
+ {
+ return checks;
+ }
+
+ public void setChecks(String[] value)
+ {
+ checks = value;
+ }
+ public String getRadios()
+ {
+ return radios;
+ }
+
+ public void setRadios(String value)
+ {
+ radios = value;
+ }
+ }
+}
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/checkBoxOption.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/checkBoxOption.jsp?view=auto&rev=153101
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/checkBoxOption.jsp (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j159/checkBoxOption.jsp Wed Feb 9 10:33:48 2005
@@ -0,0 +1,38 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <netui:scriptContainer idScope="one">
+ <netui:form action="post">
+ CheckBoxOption JS Output Test<br/>
+ <netui:checkBoxGroup dataSource="actionForm.checks">
+ <netui:checkBoxOption tagId="cbo1" value="Text1" /><br>
+ <netui:checkBoxOption tagId="cbo2" value="Text2" /><br>
+ </netui:checkBoxGroup>
+ <netui:radioButtonGroup dataSource="actionForm.radios">
+ <netui:radioButtonOption tagId="rbo1" value="Radio 1" /><br>
+ <netui:radioButtonOption tagId="rbo2" value="Radio 2" /><br>
+ </netui:radioButtonGroup>
+ <netui:button value="Submit"/><br>
+ </netui:form>
+ </netui:scriptContainer>
+ <hr>
+ <p id="javaOut"></p>
+ </netui:body>
+
+ <script language="JavaScript" type="text/JavaScript">
+ var p = document.getElementById("javaOut");
+ var val = "<b>Document Access</b><br/>";
+ var cboTag = document.getElementById(lookupIdByTagId("cbo1",document.forms[0]));
+ val = val + "Scope Id: <b>" + lookupIdScope(cboTag,".") + "</b><br/>";
+ val = val + "CheckBoxOption ID: <b>" + lookupIdByTagId("cbo1",cboTag) + "</b><br/>";
+ val = val + "CheckBoxOption Name By Lookup: <b>" + lookupNameByTagId("cbo1",cboTag) + "</b><br/>";
+ val = val + "RadioButtonOption ID: <b>" + lookupIdByTagId("rbo1",cboTag) + "</b><br/>";
+ val = val + "RadioButtonOption Name By Lookup: <b>" + lookupNameByTagId("rbo1",cboTag) + "</b><br/>";
+
+ p.innerHTML = val;
+ </script>
+</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&r1=153100&r2=153101
==============================================================================
--- 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 9 10:33:48 2005
@@ -3798,6 +3798,15 @@
</features>
</test>
<test>
+ <name>J159</name>
+ <description>Verification of tagId on Options.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>jiriBugs</category>
+ </categories>
+ </test>
+ <test>
<name>J160</name>
<description>Verification that an Area can submit a form.</description>
<webapp>coreWeb</webapp>
Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J159.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J159.xml?view=auto&rev=153101
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J159.xml (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J159.xml Wed Feb 9 10:33:48 2005
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+ <ses:sessionName>J159</ses:sessionName>
+ <ses:tester>Daryl</ses:tester>
+ <ses:startDate>09 Feb 2005, 09:51:45.147 AM MST</ses:startDate>
+ <ses:description>Verify TagId on CheckBoxOption and RadioButtonOption</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/bugs/j159/Controller.jpf</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>9280021D1F244AFD080AF32F64206CBF</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=9280021D1F244AFD080AF32F64206CBF</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">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/bugs/j159/checkBoxOption.jsp">
+ </head>
+ <body>
+ <div netui:idScope="one" >
+ <form name="bean" action="/coreWeb/bugs/j159/post.do" method="post">
+ CheckBoxOption JS Output Test<br/>
+ <input type="hidden" name="wlw-checkbox_group_key:{actionForm.checks}OldValue" value="true">
+ <input type="checkbox" name="wlw-checkbox_group_key:{actionForm.checks}" id="one.cbo1" value="Text1"><span>Text1</span><br>
+ <input type="checkbox" name="wlw-checkbox_group_key:{actionForm.checks}" id="one.cbo2" value="Text2"><span>Text2</span><br>
+
+
+ <input type="radio" name="wlw-radio_button_group_key:{actionForm.radios}" id="one.rbo1" value="Radio 1"><span>Radio 1</span><br>
+ <input type="radio" name="wlw-radio_button_group_key:{actionForm.radios}" id="one.rbo2" value="Radio 2"><span>Radio 2</span><br>
+
+ <input type="submit" value="Submit"><br>
+ </form>
+ </div>
+ <hr>
+ <p id="javaOut"></p>
+ <script language="JavaScript" type="text/JavaScript">
+<!--
+
+// **** Start the NetUI Framework Generated JavaScript ****
+
+// 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.one___rbo2="wlw-radio_button_group_key:{actionForm.radios}"
+netui_tagIdNameMap.one___cbo1="wlw-checkbox_group_key:{actionForm.checks}"
+netui_tagIdNameMap.one___rbo1="wlw-radio_button_group_key:{actionForm.radios}"
+netui_tagIdNameMap.one___cbo2="wlw-checkbox_group_key:{actionForm.checks}"
+
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+ var idScope = lookupIdScope(tag,".");
+ return (idScope == "") ? id : idScope + id;
+}
+
+// lookup by tagId to "real name"
+function lookupNameByTagId(id, tag)
+{
+ var idScope = lookupIdScope(tag,"_");
+ if (idScope == "")
+ return netui_tagIdNameMap[id];
+ else
+ return netui_tagIdNameMap[idScope + "__" + id];
+}
+
+//Non-Legacy lookup method creating a fully qualified scope id
+function lookupIdScope(tag,sep)
+{
+ var val = "";
+ if (sep == null) sep = "";
+ while (tag != null && tag.getAttribute != null) {
+ var attrVal = tag.getAttribute("netui:idScope");
+ 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 val = "<b>Document Access</b><br/>";
+ var cboTag = document.getElementById(lookupIdByTagId("cbo1",document.forms[0]));
+ val = val + "Scope Id: <b>" + lookupIdScope(cboTag,".") + "</b><br/>";
+ val = val + "CheckBoxOption ID: <b>" + lookupIdByTagId("cbo1",cboTag) + "</b><br/>";
+ val = val + "CheckBoxOption Name By Lookup: <b>" + lookupNameByTagId("cbo1",cboTag) + "</b><br/>";
+ val = val + "RadioButtonOption ID: <b>" + lookupIdByTagId("rbo1",cboTag) + "</b><br/>";
+ val = val + "RadioButtonOption Name By Lookup: <b>" + lookupNameByTagId("rbo1",cboTag) + "</b><br/>";
+
+ p.innerHTML = val;
+ </script>
+
+</html></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ </ses:tests>
+ <ses:endDate>09 Feb 2005, 09:51:50.675 AM MST</ses:endDate>
+ <ses:testCount>1</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file