You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/01/26 18:57:14 UTC

svn commit: r500290 - in /tapestry/tapestry5/tapestry-core/trunk/src/site: apt/ apt/guide/ resources/images/

Author: hlship
Date: Fri Jan 26 09:57:13 2007
New Revision: 500290

URL: http://svn.apache.org/viewvc?view=rev&rev=500290
Log:
Improve the documentation for the input validation guide, adding screenshots to show decorations

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_errors.png   (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_initial.png   (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_minlength.png   (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_password.png   (with props)
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/appstate.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/validation.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/appstate.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/appstate.apt?view=diff&rev=500290&r1=500289&r2=500290
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/appstate.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/appstate.apt Fri Jan 26 09:57:13 2007
@@ -53,7 +53,7 @@
   
   Alternately, you will configure an ASO so that you can control how it is instantiated.  You may need to inject some values into the ASO
   when it is first created, or otherwise initialize it.  In this second case, you may provide an
-  {{{../org/apache/tapestry/services/ApplicationStateCreator.html}ApplicationStateCreator}} object, which will be called upon to create the ASO
+  {{{../apidocs/org/apache/tapestry/services/ApplicationStateCreator.html}ApplicationStateCreator}} object, which will be called upon to create the ASO
   as necessary.  This is also the technique to use when you want your ASO to be represented by an <interface> rather than a <class>: you need to provide
   a creator that knows about the class that implements the interface.
   
@@ -83,5 +83,5 @@
   example.
   
   Finally, we create an 
-  {{{../org/apache/tapestry/services/ApplicationStateContribution.html}ApplicationStateContribution}}
+  {{{../apidocs/org/apache/tapestry/services/ApplicationStateContribution.html}ApplicationStateContribution}}
   identifying the strategy name and the creator, and give that to the configuration.

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/validation.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/validation.apt?view=diff&rev=500290&r1=500289&r2=500290
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/validation.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/validation.apt Fri Jan 26 09:57:13 2007
@@ -163,11 +163,11 @@
 
             <t:comp type="Errors"/>
 
-            <label t:type="Label" for="userName"/>
-            <input t:type="TextField" t:id="userName" t:validate="required,minlen=3" size="30"/>
+            <label t:type="Label" for="userName"/>:
+            <input t:type="TextField" t:id="userName" t:validate="required,minlength=3" size="30"/>
             <br/>
-            <label t:type="Label" for="password"/>
-            <input t:id="password" t:validate="required,minlen=3" size="30"/>
+            <label t:type="Label" for="password"/>:
+            <input t:id="password" t:validate="required,minlength=3" size="30"/>
             <br/>
             <input type="submit" value="Login"/>
         </form>
@@ -203,5 +203,38 @@
   is <well formed> either way. However, putting the Tapestry specific values into the Tapestry namespace ensures that the template will itself
   be <valid>.
   
+Errors and Decorations
+
+  When you first activate the Login page, the fields and forms will render normally, awaiting input:
+  
+[../images/validation_initial.png] Initial form presentation
+
+  Notice how the Label components are displaying the textual names for the fields. Given that we have not done any explicit configuration,
+  what's happened is that the component's ids ("userName" and "password") have been converted to "User Name" and "Password".
+  
+  If you just submit the form as is, the fields will violate the "required" constraint and the page will be redisplayed to present those
+  errors to the user:
+  
+[../images/validation_errors.png] Errors and decorations
+
+  There's a couple of subtle things going on here.  First, Tapestry tracks <all> the errors for <all> the fields.  The
+  Errors component has displayed them at the top of the form.  Further, the <default validation decorator> has added
+  decorations to the labels and the fields, adding "t-error" to the CSS class for the fields and labels. Tapestry provides a default
+  CSS stylesheet that combines with the "t-error" class to make things turn red.
+  
+  Next, we'll fill in the user name but not provide enough characters for password.
+  
+[../images/validation_minlength.png] Minlength error message
+
+  The user name field is OK, but there's an error on just the password field.  The PasswordField component always displays a blank value
+  by default, otherwise we'd see the partial password displayed inside.
+  
+  If you type in enough characters and submit, we see how the logic inside the Login page can attach errors to fields:
+  
+[../images/validation_password.png] Application supplied errors
+
+  This is nice and seamless; the same look and feel and behavior for both the built-in validators, and for errors generated based on
+  application logic.
+
   
   

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt?view=diff&rev=500290&r1=500289&r2=500290
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt Fri Jan 26 09:57:13 2007
@@ -44,7 +44,7 @@
   
   * Property expressions may now reference public methods (with no parameters) in addition to traditional property names.
   
-  * Page templates are now allowed to be stored in the web application root, as well as on the classpath.
+  * Page templates are now allowed to be stored in the WEB-INF , as well as on the classpath.
   
   * Invisible instrumentation, hiding Tapestry components inside ordinary HTML elements (a favorite feature of Tapestry 4), has been added to Tapestry 5.
   

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_errors.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_errors.png?view=auto&rev=500290
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_errors.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_initial.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_initial.png?view=auto&rev=500290
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_initial.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_minlength.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_minlength.png?view=auto&rev=500290
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_minlength.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_password.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_password.png?view=auto&rev=500290
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/images/validation_password.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream