Author: dolander
Date: Sun Jan  9 13:35:08 2005
New Revision: 124739

URL: http://svn.apache.org/viewcvs?view=rev&rev=124739
Log:
Fix the following bugs:
1) The Area tag was not actually writting out an Area tag
2) The Body tag did not add the tagId to the lookup tables

Added two BVTs:
1) Base test of the Area Tag
2) Base test of tagId in all non-HTML Controls


Added:
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/Controller.jpf
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/index.jsp
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/redblue.gif
   (contents, props changed)
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/Controller.jpf
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/alien.gif 
  (contents, props changed)
   
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/index.jsp
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/xhtml/redblue.gif   
(contents, props changed)
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAreaBase.xml
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapNonCtrls.xml
Modified:
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.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/Body.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java?view=diff&rev=124739&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java&r1=124738&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java&r2=124739
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java
    (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Body.java
    Sun Jan  9 13:35:08 2005
@@ -203,6 +203,12 @@
             reportErrors();
         }
 
+        // we assume that tagId will over have override id if both are defined.
+        String scriptId = null;
+        if (_state.id != null) {
+            scriptId = renderNameAndId(_state, null);
+        }
+
         IScriptReporter sr = getScriptReporter();
         if (sr != null) {
             if (!sr.isInitScriptWritten()) {
@@ -218,6 +224,9 @@
                 sr.writeScript(_writer);
             }
         }
+
+        if (scriptId != null)
+            write(scriptId);
 
         _br.doEndTag(_writer);
 

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java?view=diff&rev=124739&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java&r1=124738&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java&r2=124739
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
    (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
    Sun Jan  9 13:35:08 2005
@@ -22,11 +22,12 @@
     {
         assert(sb != null) : "Parameter 'sb' must not be null";
         assert(renderState != null) : "Parameter 'renderState' must not be 
null";
-        assert(renderState instanceof ImageTag.State) : "Paramater 
'renderState' must be an instance of ImageTag.State";
+        assert(renderState instanceof AnchorTag.State) : "Paramater 
'renderState' must be an instance of AnchorTag.State:"
+                + renderState.getClass().getName();
 
         AnchorTag.State state = (AnchorTag.State) renderState;
 
-        renderTag(sb, ANCHOR);
+        renderTag(sb, AREA);
         renderAttribute(sb, ID, state.id);
         renderAttribute(sb, NAME, state.name);
         renderAttribute(sb, HREF, state.href);

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/Controller.jpf
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/Controller.jpf?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/Controller.jpf
    Sun Jan  9 13:35:08 2005
@@ -0,0 +1,67 @@
+package coretags.area.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 _action;
+    public String getAction() {
+       return _action;
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward begin()
+    {
+       _action = "begin";
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward red()
+    {
+       _action = "red";
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward blue()
+    {
+       _action = "blue";
+        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)
+    {
+    }
+}

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/index.jsp
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/index.jsp?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/index.jsp
 Sun Jan  9 13:35:08 2005
@@ -0,0 +1,21 @@
+<%@ 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 tagId="body">
+        <p style="color: green">
+        </p>
+       <netui:image src="redblue.gif" alt="pick a color" usemap="#map1"
+               width="200" height="100"/>
+        <map id="map1" name="map1">
+             <netui:area action="red" shape="rect" coords="10, 10, 90, 90"/>
+             <netui:area action="blue" shape="rect" coords="110, 10, 190, 90"/>
+        </map>
+        <hr>
+       <netui:span value="Action: ${pageFlow.action}"/>
+        </p>
+    </netui:body>
+</netui:html>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/redblue.gif
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/area/base/redblue.gif?view=auto&rev=124739
==============================================================================
Binary file. No diff available.

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/Controller.jpf
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/Controller.jpf?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/Controller.jpf
        Sun Jan  9 13:35:08 2005
@@ -0,0 +1,39 @@
+package idmap.nonCtrls;
+
+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
+{
+    @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)
+    {
+    }
+}

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/alien.gif
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/alien.gif?view=auto&rev=124739
==============================================================================
Binary file. No diff available.

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/index.jsp
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/index.jsp?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/idmap/nonCtrls/index.jsp 
    Sun Jan  9 13:35:08 2005
@@ -0,0 +1,65 @@
+<%@ 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 tagId="body">
+        <p style="color: green">This test sets the tagId on all of the
+       non-HTML Controls.  This we lookup each and verify that we find
+       them based upon the tagId.
+        </p>
+       <netui:anchor tagId="anchor" action="begin">Begin</netui:anchor><br>
+       <netui:area tagId="area" action="begin"/><br>
+        <netui:span tagId="span" value="span" /><br>
+       <netui:image tagId="image" src="alien.gif" /><br>
+       <netui:imageButton tagId="imageButton" src="alien.gif" /><br>
+       <netui:imageAnchor tagId="imageAnchor" action="begin" src="alien.gif" 
/><br>
+        <hr>
+        <p style="color: green">Below we sure for each of the non-HTML Controls
+       using the tagId.  All should be false.  <b>Note:</b> under FireFox
+       the area tag will be reported as true.  This does work under IE.  After
+       the lookups we will dump the IdMap.
+        </p>
+        <p id="javaOut"></p>
+    </netui:body>
+    <script language="JavaScript" type="text/JavaScript">
+
+    var p = document.getElementById("javaOut");
+
+    var val = "<b>Document Access</b><br>";
+
+    val = val + "Body by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("body")) == null) + 
"</b><br>";
+    val = val + "Anchor by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("anchor")) == null) + 
"</b><br>";
+    val = val + "Area by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("area")) == null) + 
"</b><br>";
+    val = val + "Span by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("span")) == null) + 
"</b><br>";
+    val = val + "Image by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("image")) == null) + 
"</b><br>";
+    val = val + "ImageButton by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("imageButton")) == null) + 
"</b><br>";
+    val = val + "ImageAnchor by id is null: <b>" +
+        (document.getElementById(lookupIdByTagId("imageAnchor")) == null) + 
"</b><br>";
+
+    val = val + "<br>";
+    if (typeof(netui_tagIdMap) != "undefined") {
+       val = val + "<b>tagIdMap:</b><br>";
+       for (var x in netui_tagIdMap) {
+           val = val + "Name '" + x + "' value '" + netui_tagIdMap[x] + 
"'<br>";
+       }
+       val = val + "<br>";
+    }
+    else {
+       val = val + "tagIdMap is <b>undefined</b><br>";
+    }
+
+    p.innerHTML = val;
+
+    </script>
+</netui:html>
+
+  
\ No newline at end of file

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/xhtml/redblue.gif
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/xhtml/redblue.gif?view=auto&rev=124739
==============================================================================
Binary file. No diff available.

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=124739&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=124738&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=124739
==============================================================================
--- 
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
   Sun Jan  9 13:35:08 2005
@@ -1858,6 +1858,18 @@
          </features>
       </test>
       <test>
+         <name>CtAreaBase</name>
+         <description>Base test of the Area tag</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>tags</category>
+         </categories>
+         <features>
+            <feature>Area</feature>
+         </features>
+      </test>
+      <test>
          <name>CtAttributeNullBinding</name>
          <description>Binding to null in the Attribute tags 
attributes</description>
          <webapp>coreWeb</webapp>
@@ -3141,6 +3153,19 @@
       <test>
          <name>IdMapId</name>
          <description>Simple test of IdMaps with HTML Controls.</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>tags</category>
+         </categories>
+         <features>
+            <feature>JavaScript</feature>
+            <feature>tagid</feature>
+         </features>
+      </test>
+      <test>
+         <name>IdMapNonCtrls</name>
+         <description>Verify the non-HTML controls produce tagId 
lookup</description>
          <webapp>coreWeb</webapp>
          <categories>
             <category>bvt</category>

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAreaBase.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAreaBase.xml?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAreaBase.xml
    Sun Jan  9 13:35:08 2005
@@ -0,0 +1,445 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>CtAreaBase</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>09 Jan 2005, 01:37:38.531 PM MST</ses:startDate>
+   <ses:description>Base test of the Area tag.</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/area/base/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>715EDADD3B1E0B614FD9BCE9B41011C4</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=715EDADD3B1E0B614FD9BCE9B41011C4</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>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+&lt;html lang="en">
+
+    &lt;head>
+        &lt;base 
href="http://localhost:8080/coreWeb/coretags/area/base/index.jsp";>
+    &lt;/head>
+    &lt;body id="body">
+        &lt;p style="color: green">
+        &lt;/p>
+       &lt;img src="/coreWeb/coretags/area/base/redblue.gif" width="200" 
height="100" usemap="#map1" alt="pick a color">
+        &lt;map id="map1" name="map1">
+             &lt;area href="/coreWeb/coretags/area/base/red.do" shape="rect" 
coords="10, 10, 90, 90">
+             &lt;area href="/coreWeb/coretags/area/base/blue.do" shape="rect" 
coords="110, 10, 190, 90">
+        &lt;/map>
+        &lt;hr>
+       &lt;span>Action: begin&lt;/span>
+        &lt;/p>
+    
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** 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.body="body"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdMap == null)
+   var netui_tagIdMap = new Object();
+netui_tagIdMap.body="body"
+
+
+// **** 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];
+}
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdMap[id];
+   else
+      return netui_tagIdMap[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);
+}
+-->
+&lt;/script>
+
+&lt;/body>
+
+&lt;/html></ses:responseBody>
+         </ses:response>
+      </ses:test>
+      <ses:test>
+         <ses:testNumber>2</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/area/base/red.do</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>715EDADD3B1E0B614FD9BCE9B41011C4</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>-------</ses:name>
+                  
<ses:value>----:-----------:----------------------------------------------</ses:value>
+               </ses:header>
+               <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=715EDADD3B1E0B614FD9BCE9B41011C4</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>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+&lt;html lang="en">
+
+    &lt;head>
+        &lt;base 
href="http://localhost:8080/coreWeb/coretags/area/base/index.jsp";>
+    &lt;/head>
+    &lt;body id="body">
+        &lt;p style="color: green">
+        &lt;/p>
+       &lt;img src="/coreWeb/coretags/area/base/redblue.gif" width="200" 
height="100" usemap="#map1" alt="pick a color">
+        &lt;map id="map1" name="map1">
+             &lt;area href="/coreWeb/coretags/area/base/red.do" shape="rect" 
coords="10, 10, 90, 90">
+             &lt;area href="/coreWeb/coretags/area/base/blue.do" shape="rect" 
coords="110, 10, 190, 90">
+        &lt;/map>
+        &lt;hr>
+       &lt;span>Action: red&lt;/span>
+        &lt;/p>
+    
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** 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.body="body"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdMap == null)
+   var netui_tagIdMap = new Object();
+netui_tagIdMap.body="body"
+
+
+// **** 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];
+}
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdMap[id];
+   else
+      return netui_tagIdMap[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);
+}
+-->
+&lt;/script>
+
+&lt;/body>
+
+&lt;/html></ses:responseBody>
+         </ses:response>
+      </ses:test>
+      <ses:test>
+         <ses:testNumber>3</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/area/base/blue.do</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>715EDADD3B1E0B614FD9BCE9B41011C4</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>-------</ses:name>
+                  
<ses:value>----:-----------:--------------------------------------</ses:value>
+               </ses:header>
+               <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=715EDADD3B1E0B614FD9BCE9B41011C4</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>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+&lt;html lang="en">
+
+    &lt;head>
+        &lt;base 
href="http://localhost:8080/coreWeb/coretags/area/base/index.jsp";>
+    &lt;/head>
+    &lt;body id="body">
+        &lt;p style="color: green">
+        &lt;/p>
+       &lt;img src="/coreWeb/coretags/area/base/redblue.gif" width="200" 
height="100" usemap="#map1" alt="pick a color">
+        &lt;map id="map1" name="map1">
+             &lt;area href="/coreWeb/coretags/area/base/red.do" shape="rect" 
coords="10, 10, 90, 90">
+             &lt;area href="/coreWeb/coretags/area/base/blue.do" shape="rect" 
coords="110, 10, 190, 90">
+        &lt;/map>
+        &lt;hr>
+       &lt;span>Action: blue&lt;/span>
+        &lt;/p>
+    
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** 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.body="body"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdMap == null)
+   var netui_tagIdMap = new Object();
+netui_tagIdMap.body="body"
+
+
+// **** 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];
+}
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdMap[id];
+   else
+      return netui_tagIdMap[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);
+}
+-->
+&lt;/script>
+
+&lt;/body>
+
+&lt;/html></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>09 Jan 2005, 01:37:49.421 PM MST</ses:endDate>
+   <ses:testCount>3</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file

Added: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapNonCtrls.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapNonCtrls.xml?view=auto&rev=124739
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/IdMapNonCtrls.xml
 Sun Jan  9 13:35:08 2005
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>IdMapNonCtrls</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>09 Jan 2005, 01:33:10.484 PM MST</ses:startDate>
+   <ses:description>Verify all of the non-HTML Controls produce the proper 
thing with a tagId and lookup table.</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/nonCtrls/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>715EDADD3B1E0B614FD9BCE9B41011C4</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=715EDADD3B1E0B614FD9BCE9B41011C4</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>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
+       "http://www.w3.org/TR/html4/loose.dtd";>
+&lt;html lang="en">
+
+    &lt;head>
+        &lt;base href="http://localhost:8080/coreWeb/idmap/nonCtrls/index.jsp";>
+    &lt;/head>
+    &lt;body id="body">
+        &lt;p style="color: green">This test sets the tagId on all of the
+       non-HTML Controls.  This we lookup each and verify that we find
+       them based upon the tagId.
+        &lt;/p>
+       &lt;a id="anchor" 
href="/coreWeb/idmap/nonCtrls/begin.do">Begin&lt;/a>&lt;br>
+       &lt;area id="area" href="/coreWeb/idmap/nonCtrls/begin.do">&lt;br>
+        &lt;span id="span">span&lt;/span>&lt;br>
+       &lt;img src="/coreWeb/idmap/nonCtrls/alien.gif" id="image">&lt;br>
+       &lt;input type="image" id="imageButton" 
src="/coreWeb/idmap/nonCtrls/alien.gif">&lt;br>
+       &lt;a id="imageAnchor" href="/coreWeb/idmap/nonCtrls/begin.do">&lt;img 
src="/coreWeb/idmap/nonCtrls/alien.gif">&lt;/a>&lt;br>
+        &lt;hr>
+        &lt;p style="color: green">Below we sure for each of the non-HTML 
Controls
+       using the tagId.  All should be false.  &lt;b>Note:&lt;/b> under FireFox
+       the area tag will be reported as true.  This does work under IE.  After
+       the lookups we will dump the IdMap.
+        &lt;/p>
+        &lt;p id="javaOut">&lt;/p>
+    
+
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
+
+// **** 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.imageButton="imageButton"
+netui_names.image="image"
+netui_names.imageAnchor="imageAnchor"
+netui_names.area="area"
+netui_names.body="body"
+netui_names.span="span"
+netui_names.anchor="anchor"
+
+
+// Build the netui_names table to map the tagId attributes
+// to the real id written into the HTML
+if (netui_tagIdMap == null)
+   var netui_tagIdMap = new Object();
+netui_tagIdMap.imageButton="imageButton"
+netui_tagIdMap.image="image"
+netui_tagIdMap.imageAnchor="imageAnchor"
+netui_tagIdMap.area="area"
+netui_tagIdMap.body="body"
+netui_tagIdMap.span="span"
+netui_tagIdMap.anchor="anchor"
+
+
+// **** 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];
+}
+
+// lookup by tagId to "real id"
+function lookupIdByTagId(id, tag)
+{
+   var scopeId = getScopeId(tag);
+   if (scopeId == "")
+      return netui_tagIdMap[id];
+   else
+      return netui_tagIdMap[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);
+}
+-->
+&lt;/script>
+
+&lt;/body>
+    &lt;script language="JavaScript" type="text/JavaScript">
+
+    var p = document.getElementById("javaOut");
+
+    var val = "&lt;b>Document Access&lt;/b>&lt;br>";
+
+    val = val + "Body by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("body")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "Anchor by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("anchor")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "Area by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("area")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "Span by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("span")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "Image by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("image")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "ImageButton by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("imageButton")) == null) + 
"&lt;/b>&lt;br>";
+    val = val + "ImageAnchor by id is null: &lt;b>" +
+        (document.getElementById(lookupIdByTagId("imageAnchor")) == null) + 
"&lt;/b>&lt;br>";
+
+    val = val + "&lt;br>";
+    if (typeof(netui_tagIdMap) != "undefined") {
+       val = val + "&lt;b>tagIdMap:&lt;/b>&lt;br>";
+       for (var x in netui_tagIdMap) {
+           val = val + "Name '" + x + "' value '" + netui_tagIdMap[x] + 
"'&lt;br>";
+       }
+       val = val + "&lt;br>";
+    }
+    else {
+       val = val + "tagIdMap is &lt;b>undefined&lt;/b>&lt;br>";
+    }
+
+    p.innerHTML = val;
+
+    &lt;/script>
+
+&lt;/html></ses:responseBody>
+         </ses:response>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>09 Jan 2005, 01:33:23.750 PM MST</ses:endDate>
+   <ses:testCount>1</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file

Reply via email to