Author: hlship
Date: Mon Sep  3 09:53:06 2007
New Revision: 572389

URL: http://svn.apache.org/viewvc?rev=572389&view=rev
Log:
TAPESTRY-1626: T5 Form Component Generates contactForm:errors Div With Invalid 
Empty List

Modified:
    tapestry/tapestry5/trunk/pom.xml
    tapestry/tapestry5/trunk/src/site/apt/index.apt
    tapestry/tapestry5/trunk/support/tapestry-core.launch
    tapestry/tapestry5/trunk/support/tapestry-ioc.launch
    tapestry/tapestry5/trunk/tapestry-core/pom.xml
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Errors.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml

Modified: tapestry/tapestry5/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/pom.xml?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/pom.xml (original)
+++ tapestry/tapestry5/trunk/pom.xml Mon Sep  3 09:53:06 2007
@@ -273,11 +273,11 @@
   <repositories>
     <repository>
       <id>tapestry</id>
-      <url>http://people.apache.org/~hlship/tapestry-repository/</url>
+      <url>http://people.apache.org/~hlship/tapestry-repository</url>
     </repository>
     <repository>
       <id>tapestry-snapshot</id>
-      <url>http://people.apache.org/~hlship/tapestry-snapshot-repository/</url>
+      <url>http://people.apache.org/~hlship/tapestry-snapshot-repository</url>
       <snapshots>
         <enabled>true</enabled>
       </snapshots>

Modified: tapestry/tapestry5/trunk/src/site/apt/index.apt
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/index.apt?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/index.apt Mon Sep  3 09:53:06 2007
@@ -145,10 +145,10 @@
   for 5.0.3-SNAPSHOT.  Maven keys off the -SNAPSHOT suffix and handles the 
dependency specially. It knows that snapshot releases can change frequently,
   so it will keep checking (at least once a day, maybe more often) to see if 
there's an updated version of the snapshot.
   
-  Snapshots don't go in the central Maven repository (that's reserved for full 
releases). Instead, they  go into the Apache snapshots repository
-  at 
{{{http://people.apache.org/repo/m2-snapshot-repository/}http://people.apache.org/repo/m2-snapshot-repository/}}.
+  Snapshots don't go in the central Maven repository (that's reserved for full 
releases). Instead, they  go into the Tapestry snapshots repository
+  at 
{{{http://people.apache.org/~hlship/tapestry-snapshot-repository}http://people.apache.org/~hlship/tapestry-snapshot-repository}}.
   
-  To access this repository, you may add 
<<<-DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository/>>>
 to the command line when
+  To access this repository, you may add 
<<<-DremoteRepositories=http://people.apache.org/~hlship/tapestry-snapshot-repository>>>
 to the command line when
   running Maven.
   
   Your best bet is to use the {{{quickstart/}quickstart Maven archetype}} to 
create your initial Tapestry project; it generates a full project
@@ -199,11 +199,11 @@
   
 Public vs. Internal
 
-  An issue plaguing previous versions of Tapestry 4 was the lack of a clear 
deliniator
+  An issue plaguing previous versions of Tapestry 4 (and earlier) was the lack 
of a clear delineator
   between private, internal APIs and public, external APIs.  The fact that 
your code would extend
   from base objects but that many of the methods on those base objects were 
"off limits"
   further confused the issue. This has been identified as a key factor in the
-  "steep learning curve of Tapestry" myth.
+  "steep learning curve of Tapestry" meme.
   
   With the clean slate of Tapestry 5, we are being much more ruthless about 
internal vs. external.
   

Modified: tapestry/tapestry5/trunk/support/tapestry-core.launch
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/support/tapestry-core.launch?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/support/tapestry-core.launch (original)
+++ tapestry/tapestry5/trunk/support/tapestry-core.launch Mon Sep  3 09:53:06 
2007
@@ -1,21 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <launchConfiguration type="org.testng.eclipse.launchconfig">
-<intAttribute key="org.testng.eclipse.TYPE" value="3"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.testng.remote.RemoteTestNG"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" 
value="-Xmx600m"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" 
value="true"/>
 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
 <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
 <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
 </listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.testng.remote.RemoteTestNG"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="tapestry5"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" 
value="-Xmx600m"/>
 <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" 
value="${workspace_loc:tapestry5/tapestry-core}"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" 
value="true"/>
+<mapAttribute key="org.testng.eclipse.ALL_CLASS_METHODS"/>
+<listAttribute key="org.testng.eclipse.CLASS_TEST_LIST"/>
 <stringAttribute key="org.testng.eclipse.COMPLIANCE_LEVEL" value="JDK"/>
-<listAttribute key="org.testng.eclipse.GROUP_LIST_CLASS"/>
 <listAttribute key="org.testng.eclipse.GROUP_LIST"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="tapestry5"/>
-<mapAttribute key="org.testng.eclipse.ALL_CLASS_METHODS"/>
+<listAttribute key="org.testng.eclipse.GROUP_LIST_CLASS"/>
+<stringAttribute key="org.testng.eclipse.LOG_LEVEL" value="10"/>
 <listAttribute key="org.testng.eclipse.SUITE_TEST_LIST">
 <listEntry value="tapestry-core/src/test/conf/testng.xml"/>
 </listAttribute>
-<stringAttribute key="org.testng.eclipse.LOG_LEVEL" value="2"/>
+<intAttribute key="org.testng.eclipse.TYPE" value="3"/>
 </launchConfiguration>

Modified: tapestry/tapestry5/trunk/support/tapestry-ioc.launch
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/support/tapestry-ioc.launch?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/support/tapestry-ioc.launch (original)
+++ tapestry/tapestry5/trunk/support/tapestry-ioc.launch Mon Sep  3 09:53:06 
2007
@@ -1,19 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <launchConfiguration type="org.testng.eclipse.launchconfig">
-<listAttribute key="org.testng.eclipse.GROUP_LIST_CLASS"/>
-<listAttribute key="org.testng.eclipse.GROUP_LIST"/>
-<intAttribute key="org.testng.eclipse.TYPE" value="3"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.testng.remote.RemoteTestNG"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="tapestry5"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" 
value="true"/>
 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
 <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
 <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
 </listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.testng.remote.RemoteTestNG"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="tapestry5"/>
 <mapAttribute key="org.testng.eclipse.ALL_CLASS_METHODS"/>
+<listAttribute key="org.testng.eclipse.CLASS_TEST_LIST"/>
+<stringAttribute key="org.testng.eclipse.COMPLIANCE_LEVEL" value="JDK"/>
+<listAttribute key="org.testng.eclipse.GROUP_LIST"/>
+<listAttribute key="org.testng.eclipse.GROUP_LIST_CLASS"/>
+<stringAttribute key="org.testng.eclipse.LOG_LEVEL" value="2"/>
 <listAttribute key="org.testng.eclipse.SUITE_TEST_LIST">
 <listEntry value="tapestry-ioc/src/test/conf/testng.xml"/>
 </listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" 
value="true"/>
-<stringAttribute key="org.testng.eclipse.LOG_LEVEL" value="2"/>
-<stringAttribute key="org.testng.eclipse.COMPLIANCE_LEVEL" value="JDK"/>
+<intAttribute key="org.testng.eclipse.TYPE" value="3"/>
 </launchConfiguration>

Modified: tapestry/tapestry5/trunk/tapestry-core/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/pom.xml?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/pom.xml Mon Sep  3 09:53:06 2007
@@ -85,7 +85,7 @@
       <plugin>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-component-report</artifactId>
-        <version>5.0.2</version>
+        <version>${project.version}</version>
         <configuration>
           <rootPackage>org.apache.tapestry.corelib</rootPackage>
         </configuration>

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Errors.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Errors.java?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Errors.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Errors.java
 Mon Sep  3 09:53:06 2007
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry.corelib.components;
 
+import java.util.List;
+
 import org.apache.tapestry.MarkupWriter;
 import org.apache.tapestry.ValidationTracker;
 import org.apache.tapestry.annotations.Environmental;
@@ -51,8 +53,7 @@
         // TODO: Would be nice if there was a Location to report ... can we 
add a Location property
         // to ComponentResources?
 
-        if (_tracker == null)
-            throw new 
RuntimeException(ComponentMessages.encloseErrorsInForm());
+        if (_tracker == null) throw new 
RuntimeException(ComponentMessages.encloseErrorsInForm());
 
         String cssClass = _tracker.getHasErrors() ? _class : _class + " 
t-invisible";
 
@@ -63,16 +64,25 @@
         writer.write(_banner);
         writer.end();
 
-        writer.element("ul");
+        List<String> errors = _tracker.getErrors();
 
-        for (String message : _tracker.getErrors())
+        if (!errors.isEmpty())
         {
-            writer.element("li");
-            writer.write(message);
-            writer.end();
+            // Only write out the <UL> if it will contain <LI> elements. An 
empty <UL> is not
+            // valid XHTML.
+
+            writer.element("ul");
+
+            for (String message : errors)
+            {
+                writer.element("li");
+                writer.write(message);
+                writer.end();
+            }
+
+            writer.end(); // ul
         }
 
-        writer.end(); // ul
         writer.end(); // div
 
     }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
 Mon Sep  3 09:53:06 2007
@@ -20,23 +20,28 @@
     form.errorDiv = $(form.id + ':errors');
     
     if (form.errorDiv) {
-      form.errorList = form.errorDiv.getElementsBySelector("UL").first();
-      
       Tapestry.hideInvisible(form.errorDiv);
+      
+           form.errorList = form.errorDiv.getElementsBySelector("ul").first();
+               if (! form.errorList) {
+                 // create it now
+                 form.errorList = document.createElement("ul");
+                 form.errorDiv.appendChild(form.errorList);     
+           }      
        }
     
     // This can probably be cleaned up with bind() ...
     
     form.onsubmit = function() {
-      var event = new Tapestry.FormEvent(form);
-
+      var event = new Tapestry.FormEvent(form);      
+       
       form.firstError = true;
   
          if (form.errorList) {
-           form.errorList.innerHTML = '';
+               form.errorList.innerHTML = "";
          }
 
-         // Locaate elements that have an event manager (and therefore, 
validations)
+         // Locate elements that have an event manager (and therefore, 
validations)
          // and let those validations execute, which may result in calls to 
recordError().
          
       form.getElements().each(function(element) { 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml?rev=572389&r1=572388&r2=572389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml Mon Sep  3 
09:53:06 2007
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 
-<suite name="Tapestry Core" parallel="tests" thread-count="5" 
annotations="1.5" verbose="0">
+<suite name="Tapestry Core" annotations="1.5" verbose="0">
   <test name="Integration Tests">
     <packages>
       <package name="org.apache.tapestry.integration"/>


Reply via email to