You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/01/12 02:10:11 UTC

svn commit: r368196 [12/25] - in /jakarta/tapestry: branches/4.0/ branches/4.0/.settings/ branches/4.0/contrib/src/java/org/apache/tapestry/contrib/inspector/ branches/4.0/contrib/src/java/org/apache/tapestry/contrib/jdbc/ branches/4.0/contrib/src/java...

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/event/ReportStatusEvent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/event/ReportStatusEvent.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/event/ReportStatusEvent.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/event/ReportStatusEvent.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,21 +21,18 @@
 import org.apache.tapestry.describe.DescriptionReceiver;
 
 /**
- * Event object used by {@link org.apache.tapestry.event.ReportStatusListener}; the event
- * implements {@link org.apache.tapestry.describe.DescriptionReceiver}; classes (typically,
- * HiveMind service implementations) that implement the listener interface will "describe"
- * themselves to the event.
+ * Event object used by {@link org.apache.tapestry.event.ReportStatusListener};
+ * the event implements {@link org.apache.tapestry.describe.DescriptionReceiver};
+ * classes (typically, HiveMind service implementations) that implement the
+ * listener interface will "describe" themselves to the event.
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public class ReportStatusEvent extends EventObject implements DescriptionReceiver
 {
-    /**
-	 * 
-	 */
-	private static final long serialVersionUID = 7546818328708861783L;
-	private final DescriptionReceiver _receiver;
+    private static final long serialVersionUID = 7546818328708861783L;
+    private final DescriptionReceiver _receiver;
 
     public ReportStatusEvent(Object source, DescriptionReceiver receiver)
     {

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -23,15 +23,17 @@
 import org.apache.tapestry.valid.ValidationConstants;
 
 /**
- * A base class for building components that correspond to HTML form elements. All such components
- * must be wrapped (directly or indirectly) by a {@link Form} component.
+ * A base class for building components that correspond to HTML form elements.
+ * All such components must be wrapped (directly or indirectly) by a
+ * {@link Form} component.
  * 
  * @author Howard Lewis Ship
  * @author Paul Ferraro
  * @since 1.0.3
  */
-public abstract class AbstractFormComponent extends AbstractComponent implements IFormComponent
-{
+public abstract class AbstractFormComponent extends AbstractComponent implements
+        IFormComponent {
+
     public abstract IForm getForm();
 
     public abstract void setForm(IForm form);
@@ -41,9 +43,10 @@
     public abstract void setName(String name);
 
     /**
-     * Returns true if the corresponding field, on the client side, can accept user focus (i.e.,
-     * implements the focus() method). Most components can take focus (if not disabled), but a few ({@link Hidden})
-     * override this method to always return false.
+     * Returns true if the corresponding field, on the client side, can accept
+     * user focus (i.e., implements the focus() method). Most components can
+     * take focus (if not disabled), but a few ({@link Hidden}) override this
+     * method to always return false.
      */
 
     protected boolean getCanTakeFocus()
@@ -52,22 +55,24 @@
     }
 
     /**
-     * Should be connected to a parameter named "id" (annotations would be helpful here!). For
-     * components w/o such a parameter, this will simply return null.
+     * Should be connected to a parameter named "id" (annotations would be
+     * helpful here!). For components w/o such a parameter, this will simply
+     * return null.
      */
 
     public abstract String getIdParameter();
 
     /**
-     * Stores the actual id allocated (or null if the component doesn't support this).
+     * Stores the actual id allocated (or null if the component doesn't support
+     * this).
      */
 
     public abstract void setClientId(String id);
 
     /**
-     * Invoked from {@link #renderFormComponent(IMarkupWriter, IRequestCycle)} (that is, an
-     * implementation in a subclass), to obtain an id and render an id attribute. Reads
-     * {@link #getIdParameter()}.
+     * Invoked from {@link #renderFormComponent(IMarkupWriter, IRequestCycle)}
+     * (that is, an implementation in a subclass), to obtain an id and render an
+     * id attribute. Reads {@link #getIdParameter()}.
      */
 
     protected void renderIdAttribute(IMarkupWriter writer, IRequestCycle cycle)
@@ -77,10 +82,10 @@
 
         String rawId = getIdParameter();
 
-        if (rawId == null)
-            return;
+        if (rawId == null) return;
 
-        String id = cycle.getUniqueId(TapestryUtils.convertTapestryIdToNMToken(rawId));
+        String id = cycle.getUniqueId(TapestryUtils
+                .convertTapestryIdToNMToken(rawId));
 
         // Store for later access by the FieldLabel (or JavaScript).
 
@@ -99,8 +104,7 @@
 
         setForm(form);
 
-        if (form.wasPrerendered(writer, this))
-            return;
+        if (form.wasPrerendered(writer, this)) return;
 
         IValidationDelegate delegate = form.getDelegate();
 
@@ -108,27 +112,21 @@
 
         setName(form);
 
-        if (form.isRewinding())
-        {
-            if (!isDisabled())
-            {
+        if (form.isRewinding()) {
+            if (!isDisabled()) {
                 rewindFormComponent(writer, cycle);
             }
 
-            // This is for the benefit of the couple of components (LinkSubmit) that allow a body.
+            // This is for the benefit of the couple of components (LinkSubmit)
+            // that allow a body.
             // The body should render when the component rewinds.
 
-            if (getRenderBodyOnRewind())
-                renderBody(writer, cycle);
-        }
-        else if (!cycle.isRewinding())
-        {
+            if (getRenderBodyOnRewind()) renderBody(writer, cycle);
+        } else if (!cycle.isRewinding()) {
             renderFormComponent(writer, cycle);
 
-            if (getCanTakeFocus() && !isDisabled())
-            {
-                delegate.registerForFocus(
-                        this,
+            if (getCanTakeFocus() && !isDisabled()) {
+                delegate.registerForFocus(this,
                         delegate.isInError() ? ValidationConstants.ERROR_FIELD
                                 : ValidationConstants.NORMAL_FIELD);
             }
@@ -137,12 +135,14 @@
     }
 
     /**
-     * A small number of components should always render their body on rewind (even if the component
-     * is itself disabled) and should override this method to return true. Components that
-     * explicitly render their body inside
-     * {@link #rewindFormComponent(IMarkupWriter, IRequestCycle)} should leave this method returning
-     * false. Remember that if the component is {@link IFormComponent#isDisabled() disabled} then
-     * {@link #rewindFormComponent(IMarkupWriter, IRequestCycle)} won't be invoked.
+     * A small number of components should always render their body on rewind
+     * (even if the component is itself disabled) and should override this
+     * method to return true. Components that explicitly render their body
+     * inside {@link #rewindFormComponent(IMarkupWriter, IRequestCycle)} should
+     * leave this method returning false. Remember that if the component is
+     * {@link IFormComponent#isDisabled() disabled} then
+     * {@link #rewindFormComponent(IMarkupWriter, IRequestCycle)} won't be
+     * invoked.
      * 
      * @return false; override this method to change.
      */
@@ -151,17 +151,20 @@
         return false;
     }
 
-    protected void renderDelegatePrefix(IMarkupWriter writer, IRequestCycle cycle)
+    protected void renderDelegatePrefix(IMarkupWriter writer,
+            IRequestCycle cycle)
     {
         getForm().getDelegate().writePrefix(writer, cycle, this, null);
     }
 
-    protected void renderDelegateAttributes(IMarkupWriter writer, IRequestCycle cycle)
+    protected void renderDelegateAttributes(IMarkupWriter writer,
+            IRequestCycle cycle)
     {
         getForm().getDelegate().writeAttributes(writer, cycle, this, null);
     }
 
-    protected void renderDelegateSuffix(IMarkupWriter writer, IRequestCycle cycle)
+    protected void renderDelegateSuffix(IMarkupWriter writer,
+            IRequestCycle cycle)
     {
         getForm().getDelegate().writeSuffix(writer, cycle, this, null);
     }
@@ -172,8 +175,9 @@
     }
 
     /**
-     * Returns false. Subclasses that might be required must override this method. Typically, this
-     * involves checking against the component's validators.
+     * Returns false. Subclasses that might be required must override this
+     * method. Typically, this involves checking against the component's
+     * validators.
      * 
      * @since 4.0
      */
@@ -182,7 +186,9 @@
         return false;
     }
 
-    protected abstract void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle);
+    protected abstract void renderFormComponent(IMarkupWriter writer,
+            IRequestCycle cycle);
 
-    protected abstract void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle);
-}
\ No newline at end of file
+    protected abstract void rewindFormComponent(IMarkupWriter writer,
+            IRequestCycle cycle);
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractSubmit.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractSubmit.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractSubmit.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/AbstractSubmit.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -29,8 +29,8 @@
  * @since 4.0
  */
 
-abstract class AbstractSubmit extends AbstractFormComponent
-{
+abstract class AbstractSubmit extends AbstractFormComponent {
+
     /**
      * Determine if this submit component was clicked.
      * 
@@ -41,76 +41,71 @@
     protected abstract boolean isClicked(IRequestCycle cycle, String name);
 
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter,
+     *      org.apache.tapestry.IRequestCycle)
      */
     protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
-        if (isClicked(cycle, getName()))
-            handleClick(cycle, getForm());
+        if (isClicked(cycle, getName())) handleClick(cycle, getForm());
     }
 
     void handleClick(final IRequestCycle cycle, IForm form)
     {
-        if (isParameterBound("selected"))
-            setSelected(getTag());
+        if (isParameterBound("selected")) setSelected(getTag());
 
         final IActionListener listener = getListener();
         final IActionListener action = getAction();
 
-        if (listener == null && action == null)
-            return;
+        if (listener == null && action == null) return;
 
         final ListenerInvoker listenerInvoker = getListenerInvoker();
 
         Object parameters = getParameters();
-        if (parameters != null)
-        {
-            if (parameters instanceof Collection)
-            {
-                cycle.setListenerParameters(((Collection) parameters).toArray());
-            }
-            else
-            {
-                cycle.setListenerParameters(new Object[]
-                { parameters });
+        if (parameters != null) {
+            if (parameters instanceof Collection) {
+                cycle.setListenerParameters(((Collection)parameters).toArray());
+            } else {
+                cycle.setListenerParameters(new Object[] { parameters });
             }
         }
 
         // Invoke 'listener' now, but defer 'action' for later
         if (listener != null)
-        	listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
-        
+            listenerInvoker
+                    .invokeListener(listener, AbstractSubmit.this, cycle);
+
         if (action != null) {
-	        Runnable notify = new Runnable()
-	        {
-	            public void run()
-	            {
-	                listenerInvoker.invokeListener(action, AbstractSubmit.this, cycle);
-	            }
-	        };
-	
+            Runnable notify = new Runnable() {
+
+                public void run()
+                {
+                    listenerInvoker.invokeListener(action, AbstractSubmit.this,
+                            cycle);
+                }
+            };
+
             form.addDeferredRunnable(notify);
         }
     }
 
-    /** parameter */
+    /** Parameter. */
     public abstract IActionListener getListener();
 
-    /** parameter */
+    /** Parameter. */
     public abstract IActionListener getAction();
 
-    /** parameter */
+    /** Parameter. */
     public abstract Object getTag();
 
-    /** parameter */
+    /** Parameter. */
     public abstract void setSelected(Object tag);
 
-    /** parameter */
+    /** Parameter. */
     public abstract boolean getDefer();
 
-    /** parameter */
+    /** Parameter. */
     public abstract Object getParameters();
 
-    /** Injected */
+    /** Injected. */
     public abstract ListenerInvoker getListenerInvoker();
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Form.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Form.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Form.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Form.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.form;
 
-import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Location;
 import org.apache.tapestry.AbstractComponent;
 import org.apache.tapestry.IActionListener;
@@ -36,38 +35,47 @@
 import org.apache.tapestry.web.WebResponse;
 
 /**
- * Component which contains form element components. Forms use the action or direct services to
- * handle the form submission. A Form will wrap other components and static HTML, including form
- * components such as {@link TextArea}, {@link TextField}, {@link Checkbox}, etc. [ <a
+ * Component which contains form element components. Forms use the action or
+ * direct services to handle the form submission. A Form will wrap other
+ * components and static HTML, including form components such as
+ * {@link TextArea}, {@link TextField}, {@link Checkbox}, etc. [ <a
  * href="../../../../../ComponentReference/Form.html">Component Reference </a>]
  * <p>
- * When a form is submitted, it continues through the rewind cycle until <em>after</em> all of its
- * wrapped elements have renderred. As the form component render (in the rewind cycle), they will be
- * updating properties of the containing page and notifying thier listeners. Again: each form
- * component is responsible not only for rendering HTML (to present the form), but for handling it's
- * share of the form submission.
+ * When a form is submitted, it continues through the rewind cycle until
+ * <em>after</em> all of its wrapped elements have renderred. As the form
+ * component render (in the rewind cycle), they will be updating properties of
+ * the containing page and notifying thier listeners. Again: each form component
+ * is responsible not only for rendering HTML (to present the form), but for
+ * handling it's share of the form submission.
  * <p>
  * Only after all that is done will the Form notify its listener.
  * <p>
- * Starting in release 1.0.2, a Form can use either the direct service or the action service. The
- * default is the direct service, even though in earlier releases, only the action service was
- * available.
+ * Starting in release 1.0.2, a Form can use either the direct service or the
+ * action service. The default is the direct service, even though in earlier
+ * releases, only the action service was available.
  * <p>
- * Release 4.0 adds two new listeners, {@link #getCancel()} and {@link #getRefresh()} and
- * corresponding client-side behavior to force a form to refresh (update, bypassing input field
- * validation) or cancel (update immediately).
+ * Release 4.0 adds two new listeners, {@link #getCancel()} and
+ * {@link #getRefresh()} and corresponding client-side behavior to force a form
+ * to refresh (update, bypassing input field validation) or cancel (update
+ * immediately).
  * 
  * @author Howard Lewis Ship, David Solis
  */
 
 public abstract class Form extends AbstractComponent implements IForm, IDirect
 {
+
     private String _name;
 
     private FormSupport _formSupport;
 
+    /**
+     * Inner class to render informal parameters, passed to the
+     * {@link FormSupport}.
+     */
     private class RenderInformalParameters implements IRender
     {
+
         public void render(IMarkupWriter writer, IRequestCycle cycle)
         {
             renderInformalParameters(writer, cycle);
@@ -77,20 +85,22 @@
     private IRender _renderInformalParameters;
 
     /**
-     * Returns the currently active {@link IForm}, or null if no form is active. This is a
-     * convienience method, the result will be null, or an instance of {@link IForm}, but not
-     * necessarily a <code>Form</code>.
+     * Returns the currently active {@link IForm}, or null if no form is
+     * active. This is a convienience method, the result will be null, or an
+     * instance of {@link IForm}, but not necessarily a <code>Form</code>.
      * 
-     * @deprecated Use {@link TapestryUtils#getForm(IRequestCycle, IComponent)} instead.
+     * @deprecated Use {@link TapestryUtils#getForm(IRequestCycle, IComponent)}
+     *             instead.
      */
 
     public static IForm get(IRequestCycle cycle)
     {
-        return (IForm) cycle.getAttribute(ATTRIBUTE_NAME);
+        return (IForm)cycle.getAttribute(ATTRIBUTE_NAME);
     }
 
     /**
-     * Indicates to any wrapped form components that they should respond to the form submission.
+     * Indicates to any wrapped form components that they should respond to the
+     * form submission.
      * 
      * @throws ApplicationRuntimeException
      *             if not rendering.
@@ -98,8 +108,7 @@
 
     public boolean isRewinding()
     {
-        if (!isRendering())
-            throw Tapestry.createRenderOnlyPropertyException(this, "rewinding");
+        if (!isRendering()) throw Tapestry.createRenderOnlyPropertyException(this, "rewinding");
 
         return _formSupport.isRewinding();
     }
@@ -123,7 +132,8 @@
     /**
      * Returns true if this Form is configured to use the direct service.
      * <p>
-     * This is derived from the direct parameter, and defaults to true if not bound.
+     * This is derived from the direct parameter, and defaults to true if not
+     * bound.
      * 
      * @since 1.0.2
      */
@@ -131,8 +141,8 @@
     public abstract boolean isDirect();
 
     /**
-     * Returns true if the stateful parameter is bound to a true value. If stateful is not bound,
-     * also returns the default, true.
+     * Returns true if the stateful parameter is bound to a true value. If
+     * stateful is not bound, also returns the default, true.
      * 
      * @since 1.0.1
      */
@@ -143,12 +153,12 @@
     }
 
     /**
-     * Constructs a unique identifier (within the Form). The identifier consists of the component's
-     * id, with an index number added to ensure uniqueness.
+     * Constructs a unique identifier (within the Form). The identifier consists
+     * of the component's id, with an index number added to ensure uniqueness.
      * <p>
      * Simply invokes
-     * {@link #getElementId(org.apache.tapestry.form.IFormComponent, java.lang.String)}with the
-     * component's id.
+     * {@link #getElementId(org.apache.tapestry.form.IFormComponent, java.lang.String)}with
+     * the component's id.
      * 
      * @since 1.0.2
      */
@@ -159,11 +169,11 @@
     }
 
     /**
-     * Constructs a unique identifier from the base id. If possible, the id is used as-is.
-     * Otherwise, a unique identifier is appended to the id.
+     * Constructs a unique identifier from the base id. If possible, the id is
+     * used as-is. Otherwise, a unique identifier is appended to the id.
      * <p>
-     * This method is provided simply so that some components ({@link ImageSubmit}) have more
-     * specific control over their names.
+     * This method is provided simply so that some components ({@link ImageSubmit})
+     * have more specific control over their names.
      * 
      * @since 1.0.3
      */
@@ -174,15 +184,16 @@
     }
 
     /**
-     * Returns the name generated for the form. This is used to faciliate components that write
-     * JavaScript and need to access the form or its contents.
+     * Returns the name generated for the form. This is used to faciliate
+     * components that write JavaScript and need to access the form or its
+     * contents.
      * <p>
-     * This value is generated when the form renders, and is not cleared. If the Form is inside a
-     * {@link org.apache.tapestry.components.Foreach}, this will be the most recently generated
-     * name for the Form.
+     * This value is generated when the form renders, and is not cleared. If the
+     * Form is inside a {@link org.apache.tapestry.components.Foreach}, this
+     * will be the most recently generated name for the Form.
      * <p>
-     * This property is exposed so that sophisticated applications can write JavaScript handlers for
-     * the form and components within the form.
+     * This property is exposed so that sophisticated applications can write
+     * JavaScript handlers for the form and components within the form.
      * 
      * @see AbstractFormComponent#getName()
      */
@@ -209,8 +220,7 @@
 
         IValidationDelegate delegate = getDelegate();
 
-        if (delegate != null)
-            delegate.setFormComponent(null);
+        if (delegate != null) delegate.setFormComponent(null);
 
         super.cleanupAfterRender(cycle);
     }
@@ -242,8 +252,7 @@
 
         _name = baseName + getResponse().getNamespace();
 
-        if (_renderInformalParameters == null)
-            _renderInformalParameters = new RenderInformalParameters();
+        if (_renderInformalParameters == null) _renderInformalParameters = new RenderInformalParameters();
 
         ILink link = getLink(cycle, actionId);
 
@@ -258,22 +267,20 @@
             result = getCancel();
         else if (mode.equals(FormConstants.SUBMIT_REFRESH))
             result = getRefresh();
-        else if (!getDelegate().getHasErrors())
-            result = getSuccess();
+        else if (!getDelegate().getHasErrors()) result = getSuccess();
 
         // If not success, cancel or refresh, or the corresponding listener
         // is itself null, then use the default listener
         // (which may be null as well!).
 
-        if (result == null)
-            result = getListener();
+        if (result == null) result = getListener();
 
         return result;
     }
 
     /**
-     * Construct a form name for use with the action service. This implementation returns "Form"
-     * appended with the actionId.
+     * Construct a form name for use with the action service. This
+     * implementation returns "Form" appended with the actionId.
      * 
      * @since 4.0
      */
@@ -284,9 +291,10 @@
     }
 
     /**
-     * Constructs a form name for use with the direct service. This implementation bases the form
-     * name on the form component's id (but ensures it is unique). Remember that Tapestry assigns an
-     * "ugly" id if an explicit component id is not provided.
+     * Constructs a form name for use with the direct service. This
+     * implementation bases the form name on the form component's id (but
+     * ensures it is unique). Remember that Tapestry assigns an "ugly" id if an
+     * explicit component id is not provided.
      * 
      * @since 4.0
      */
@@ -339,7 +347,8 @@
     }
 
     /**
-     * Builds the EngineServiceLink for the form, using either the direct or action service.
+     * Builds the EngineServiceLink for the form, using either the direct or
+     * action service.
      * 
      * @since 1.0.3
      */
@@ -439,4 +448,4 @@
         _formSupport.registerForFocus(field, priority);
     }
 
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormEventType.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormEventType.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormEventType.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormEventType.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
  *             a future release of Tapestry.
  */
 
-public class FormEventType
+public final class FormEventType
 {
     /**
      * Form event triggered when the form is submitted. Allows an event handler to perform any final

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormMessages.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormMessages.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/FormMessages.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
 package org.apache.tapestry.form;
 
 import org.apache.hivemind.HiveMind;
+import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 import org.apache.tapestry.IComponent;
 
@@ -22,51 +23,48 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-class FormMessages
+final class FormMessages
 {
-    private final static MessageFormatter _formatter = new MessageFormatter(FormMessages.class);
+
+    private final static Messages MESSAGES = new MessageFormatter(FormMessages.class);
+
+    /** @since 4.1 */
+    private FormMessages()
+    {
+    }
 
     static String formTooManyIds(IComponent form, int actualCount, IComponent component)
     {
-        return _formatter.format(
-                "form-too-many-ids",
-                form.getExtendedId(),
-                new Integer(actualCount),
-                component.getExtendedId());
+        return MESSAGES.format("form-too-many-ids", form.getExtendedId(), new Integer(actualCount), component
+                .getExtendedId());
     }
 
-    static String formIdMismatch(IComponent form, int mismatchIndex, String expectedId,
-            String actualId, IComponent component)
-    {
-        return _formatter.format("form-id-mismatch", new Object[]
-        { form.getExtendedId(), new Integer(mismatchIndex + 1), expectedId, actualId,
-                component.getExtendedId() });
+    static String formIdMismatch(IComponent form, int mismatchIndex, String expectedId, String actualId,
+            IComponent component)
+    {
+        return MESSAGES.format("form-id-mismatch", new Object[] { form.getExtendedId(), new Integer(mismatchIndex + 1),
+                expectedId, actualId, component.getExtendedId() });
     }
 
     static String formTooFewIds(IComponent form, int remainingCount, String nextExpectedId)
     {
-        return _formatter.format("form-too-few-ids", form.getExtendedId(), new Integer(
-                remainingCount), nextExpectedId);
+        return MESSAGES.format("form-too-few-ids", form.getExtendedId(), new Integer(remainingCount), nextExpectedId);
     }
 
-    static String encodingTypeContention(IComponent form, String establishedEncodingType,
-            String newEncodingType)
+    static String encodingTypeContention(IComponent form, String establishedEncodingType, String newEncodingType)
     {
-        return _formatter.format(
-                "encoding-type-contention",
-                form.getExtendedId(),
-                establishedEncodingType,
+        return MESSAGES.format("encoding-type-contention", form.getExtendedId(), establishedEncodingType,
                 newEncodingType);
     }
 
     static String fieldAlreadyPrerendered(IComponent field)
     {
-        return _formatter.format("field-already-prerendered", field);
+        return MESSAGES.format("field-already-prerendered", field);
     }
 
     static String linkSubmitMayNotNest(IComponent inner, IComponent outer)
     {
-        return _formatter.format("link-submit-may-not-nest", inner.getExtendedId(), outer
-                .getExtendedId(), HiveMind.getLocationString(outer));
+        return MESSAGES.format("link-submit-may-not-nest", inner.getExtendedId(), outer.getExtendedId(), HiveMind
+                .getLocationString(outer));
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/RadioPropertySelectionRenderer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/RadioPropertySelectionRenderer.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/RadioPropertySelectionRenderer.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/RadioPropertySelectionRenderer.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,20 +18,18 @@
 import org.apache.tapestry.IRequestCycle;
 
 /**
- *  Implementation of {@link IPropertySelectionRenderer} that
- *  produces a table of radio (&lt;input type=radio&gt;) elements.
- *
- *  @author Howard Lewis Ship
- *
- **/
+ * Implementation of {@link IPropertySelectionRenderer} that produces a table of
+ * radio (&lt;input type=radio&gt;) elements.
+ * 
+ * @author Howard Lewis Ship
+ */
 
 public class RadioPropertySelectionRenderer implements IPropertySelectionRenderer
 {
 
     /**
-     *  Writes the &lt;table&gt; element.
-     *
-     **/
+     * Writes the &lt;table&gt; element.
+     */
 
     public void beginRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
     {
@@ -42,9 +40,8 @@
     }
 
     /**
-     *  Closes the &lt;table&gt; element.
-     *
-     **/
+     * Closes the &lt;table&gt; element.
+     */
 
     public void endRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
     {
@@ -52,19 +49,12 @@
     }
 
     /**
-     *  Writes a row of the table.  The table contains two cells; the first is the radio
-     *  button, the second is the label for the radio button.
-     *
-     **/
-
-    public void renderOption(
-        PropertySelection component,
-        IMarkupWriter writer,
-        IRequestCycle cycle,
-        IPropertySelectionModel model,
-        Object option,
-        int index,
-        boolean selected)
+     * Writes a row of the table. The table contains two cells; the first is the
+     * radio button, the second is the label for the radio button.
+     */
+
+    public void renderOption(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle,
+            IPropertySelectionModel model, Object option, int index, boolean selected)
     {
         writer.begin("tr");
         writer.begin("td");
@@ -74,11 +64,9 @@
         writer.attribute("name", component.getName());
         writer.attribute("value", model.getValue(index));
 
-        if (component.isDisabled())
-            writer.attribute("disabled", "disabled");
+        if (component.isDisabled()) writer.attribute("disabled", "disabled");
 
-        if (selected)
-            writer.attribute("checked", "checked");
+        if (selected) writer.attribute("checked", "checked");
 
         writer.end(); // <td>
 
@@ -87,8 +75,8 @@
         writer.begin("td");
         writer.print(model.getLabel(index));
         writer.end(); // <td>
-        writer.end(); // <tr>	
+        writer.end(); // <tr>
 
         writer.println();
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Submit.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Submit.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Submit.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Submit.java Wed Jan 11 16:47:57 2006
@@ -18,18 +18,21 @@
 import org.apache.tapestry.IRequestCycle;
 
 /**
- * Implements a component that manages an HTML &lt;input type=submit&gt; form element. [ <a
- * href="../../../../../ComponentReference/Submit.html">Component Reference </a>]
+ * Implements a component that manages an HTML &lt;input type=submit&gt; form
+ * element. [ <a href="../../../../../ComponentReference/Submit.html">Component
+ * Reference </a>]
  * <p>
- * This component is generally only used when the form has multiple submit buttons, and it is
- * important for the application to know which one was pressed. You may also want to use
- * {@link ImageSubmit}which accomplishes much the same thing, but uses a graphic image instead.
+ * This component is generally only used when the form has multiple submit
+ * buttons, and it is important for the application to know which one was
+ * pressed. You may also want to use {@link ImageSubmit}which accomplishes much
+ * the same thing, but uses a graphic image instead.
  * 
  * @author Howard Lewis Ship
  */
 
 public abstract class Submit extends AbstractSubmit
 {
+
     protected boolean isClicked(IRequestCycle cycle, String name)
     {
         // How to know which Submit button was actually
@@ -52,13 +55,11 @@
         writer.attribute("type", "submit");
         writer.attribute("name", getName());
 
-        if (isDisabled())
-            writer.attribute("disabled", "disabled");
+        if (isDisabled()) writer.attribute("disabled", "disabled");
 
         String label = getLabel();
 
-        if (label != null)
-            writer.attribute("value", label);
+        if (label != null) writer.attribute("value", label);
 
         renderIdAttribute(writer, cycle);
 
@@ -67,7 +68,7 @@
         writer.closeTag();
     }
 
-    /** parameter */
+    /** Parameter. */
     public abstract String getLabel();
 
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextArea.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextArea.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextArea.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextArea.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,67 +19,67 @@
 import org.apache.tapestry.valid.ValidatorException;
 
 /**
- * Implements a component that manages an HTML &lt;textarea&gt; form element.
- *
- * [<a href="../../../../../ComponentReference/TextArea.html">Component Reference</a>]
+ * Implements a component that manages an HTML &lt;textarea&gt; form element. [<a
+ * href="../../../../../ComponentReference/TextArea.html">Component Reference</a>]
  * <p>
  * As of 4.0, this component can be configurably translated and validated.
- *
+ * 
  * @author Howard Lewis Ship
  * @author Paul Ferraro
  */
 public abstract class TextArea extends AbstractFormComponent implements TranslatedField
 {
+
     public abstract String getValue();
-    
+
     public abstract void setValue(String value);
-    
+
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
+     *      org.apache.tapestry.IRequestCycle)
      */
     protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
         String value = getTranslatedFieldSupport().format(this, getValue());
-        
+
         renderDelegatePrefix(writer, cycle);
-        
+
         writer.begin("textarea");
 
         writer.attribute("name", getName());
 
-        if (isDisabled())
-            writer.attribute("disabled", "disabled");
+        if (isDisabled()) writer.attribute("disabled", "disabled");
 
         renderIdAttribute(writer, cycle);
 
         renderDelegateAttributes(writer, cycle);
-        
+
         getTranslatedFieldSupport().renderContributions(this, writer, cycle);
         getValidatableFieldSupport().renderContributions(this, writer, cycle);
-        
+
         renderInformalParameters(writer, cycle);
 
-        if (value != null)
-            writer.print(value);
+        if (value != null) writer.print(value);
 
         writer.end();
-        
+
         renderDelegateSuffix(writer, cycle);
     }
 
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter,
+     *      org.apache.tapestry.IRequestCycle)
      */
     protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
         String value = cycle.getParameter(getName());
-        
+
         try
         {
-            String text = (String) getTranslatedFieldSupport().parse(this, value);
-            
+            String text = (String)getTranslatedFieldSupport().parse(this, value);
+
             getValidatableFieldSupport().validate(this, writer, cycle, text);
-            
+
             setValue(text);
         }
         catch (ValidatorException e)
@@ -105,4 +105,4 @@
     {
         return getValidatableFieldSupport().isRequired(this);
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextField.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextField.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextField.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TextField.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,9 +19,10 @@
 import org.apache.tapestry.valid.ValidatorException;
 
 /**
- * Implements a component that manages an HTML &lt;input type=text&gt; or &lt;input
- * type=password&gt; form element. [ <a
- * href="../../../../../ComponentReference/TextField.html">Component Reference </a>]
+ * Implements a component that manages an HTML &lt;input type=text&gt; or
+ * &lt;input type=password&gt; form element. [ <a
+ * href="../../../../../ComponentReference/TextField.html">Component Reference
+ * </a>]
  * <p>
  * As of 4.0, this component can be configurably translated and validated.
  * 
@@ -30,18 +31,21 @@
  */
 public abstract class TextField extends AbstractFormComponent implements TranslatedField
 {
+
     public abstract boolean isHidden();
 
     public abstract Object getValue();
+
     public abstract void setValue(Object value);
 
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
+     *      org.apache.tapestry.IRequestCycle)
      */
     protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
         String value = getTranslatedFieldSupport().format(this, getValue());
-        
+
         renderDelegatePrefix(writer, cycle);
 
         writer.beginEmpty("input");
@@ -50,11 +54,9 @@
 
         writer.attribute("name", getName());
 
-        if (isDisabled())
-            writer.attribute("disabled", "disabled");
+        if (isDisabled()) writer.attribute("disabled", "disabled");
 
-        if (value != null)
-            writer.attribute("value", value);
+        if (value != null) writer.attribute("value", value);
 
         renderIdAttribute(writer, cycle);
 
@@ -71,18 +73,19 @@
     }
 
     /**
-     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
+     * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter,
+     *      org.apache.tapestry.IRequestCycle)
      */
     protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
         String value = cycle.getParameter(getName());
-        
+
         try
         {
             Object object = getTranslatedFieldSupport().parse(this, value);
-            
+
             getValidatableFieldSupport().validate(this, writer, cycle, object);
-            
+
             setValue(object);
         }
         catch (ValidatorException e)
@@ -108,4 +111,4 @@
     {
         return getValidatableFieldSupport().isRequired(this);
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedField.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedField.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedField.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedField.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,7 +16,15 @@
 
 import org.apache.tapestry.form.translator.Translator;
 
+/**
+ * Translated fields provide a read-only property to access their translator
+ * object.
+ * 
+ * @author Paul Ferraro
+ * @since 4.0
+ */
 public interface TranslatedField extends ValidatableField
 {
-	public Translator getTranslator();
+
+    Translator getTranslator();
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupport.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,11 +18,20 @@
 import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.valid.ValidatorException;
 
+/**
+ * Basis for handling fields that must be parsed and translated (part of form
+ * submission semantics).
+ * 
+ * @author Howard M. Lewis Ship
+ * @since 4.0
+ */
 public interface TranslatedFieldSupport
 {
-    public String format(TranslatedField field, Object object);
-    
-    public Object parse(TranslatedField field, String text) throws ValidatorException;
 
-    public void renderContributions(TranslatedField field, IMarkupWriter writer, IRequestCycle cycle);
+    String format(TranslatedField field, Object object);
+
+    Object parse(TranslatedField field, String text)
+        throws ValidatorException;
+
+    void renderContributions(TranslatedField field, IMarkupWriter writer, IRequestCycle cycle);
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupportImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupportImpl.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupportImpl.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/TranslatedFieldSupportImpl.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,8 +20,16 @@
 import org.apache.tapestry.valid.IValidationDelegate;
 import org.apache.tapestry.valid.ValidatorException;
 
+/**
+ * Default implementation of
+ * {@link org.apache.tapestry.form.TranslatedFieldSupport}.
+ * 
+ * @author Paul Ferraro
+ * @since 4.0
+ */
 public class TranslatedFieldSupportImpl implements TranslatedFieldSupport
 {
+
     private ThreadLocale _threadLocale;
 
     /**
@@ -45,13 +53,12 @@
     {
         IValidationDelegate delegate = field.getForm().getDelegate();
 
-        return delegate.isInError() ? delegate.getFieldInputValue() : field.getTranslator().format(
-                field,
-                _threadLocale.getLocale(),
-                object);
+        return delegate.isInError() ? delegate.getFieldInputValue() : field.getTranslator().format(field,
+                _threadLocale.getLocale(), object);
     }
 
-    public Object parse(TranslatedField field, String text) throws ValidatorException
+    public Object parse(TranslatedField field, String text)
+        throws ValidatorException
     {
         IValidationDelegate delegate = field.getForm().getDelegate();
 

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Upload.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Upload.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Upload.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/Upload.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
 
 public abstract class Upload extends AbstractFormComponent implements ValidatableField
 {
+
     public abstract void setFile(IUploadFile file);
 
     /**
@@ -80,16 +81,16 @@
     protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
     {
         IUploadFile file = getDecoder().getFileUpload(getName());
-        
+
         if (HiveMind.isBlank(file.getFileName()))
         {
             file = null;
         }
-        
+
         try
         {
             getValidatableFieldSupport().validate(this, writer, cycle, file);
-            
+
             setFile(file);
         }
         catch (ValidatorException e)
@@ -97,7 +98,7 @@
             getForm().getDelegate().record(e);
         }
     }
-    
+
     /**
      * Injected.
      */
@@ -115,4 +116,4 @@
     {
         return getValidatableFieldSupport().isRequired(this);
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableField.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableField.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableField.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableField.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,17 +15,20 @@
 package org.apache.tapestry.form;
 
 /**
- * Implemented by form components that can need to be translated and validated. During render the
- * translator is used to translated the value to a string. During rewind, the submitted value is
- * translated back into an object by the translator and then validated.
+ * Implemented by form components that can need to be translated and validated.
+ * During render the translator is used to translated the value to a string.
+ * During rewind, the submitted value is translated back into an object by the
+ * translator and then validated.
  * 
  * @author Paul Ferraro
  * @since 4.0
  */
 public interface ValidatableField extends IFormComponent
 {
+
     /**
-     * Coerced into an Iterator of Validators
+     * Coerced into an Iterator of
+     * {@link org.apache.tapestry.form.validator.Validator}s.
      */
-    public Object getValidators();
+    Object getValidators();
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableFieldSupport.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableFieldSupport.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableFieldSupport.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidatableFieldSupport.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,31 +19,34 @@
 import org.apache.tapestry.valid.ValidatorException;
 
 /**
- * Implements the logic used by {@link RequiredField}s for required field checking on rewind and
- * generating client-side logic during render.
+ * Implements the logic used by {@link RequiredField}s for required field
+ * checking on rewind and generating client-side logic during render.
  * 
  * @author Paul Ferraro
  * @since 4.0
  */
 public interface ValidatableFieldSupport
 {
+
     /**
-     * Called during render of the specified component. Renders any contributions from validators.
+     * Called during render of the specified component. Renders any
+     * contributions from validators.
      */
-    public void renderContributions(ValidatableField field, IMarkupWriter writer,
-            IRequestCycle cycle);
+    void renderContributions(ValidatableField field, IMarkupWriter writer, IRequestCycle cycle);
 
     /**
-     * Called during rewind of the specified component. Specified value is validated using the 
-     * component's validators.
+     * Called during rewind of the specified component. Specified value is
+     * validated using the component's validators.
      * 
-     * @throws ValidatorException if validation fails
+     * @throws ValidatorException
+     *             if validation fails
      */
-    public void validate(ValidatableField component, IMarkupWriter writer, IRequestCycle cycle, Object value) throws ValidatorException;
+    void validate(ValidatableField component, IMarkupWriter writer, IRequestCycle cycle, Object value)
+        throws ValidatorException;
 
     /**
-     * Returns true if this component is required. This usually entails a search of the component's
-     * validators.
+     * Returns true if this component is required. This usually entails a search
+     * of the component's validators.
      */
-    public boolean isRequired(ValidatableField field);
-}
\ No newline at end of file
+    boolean isRequired(ValidatableField field);
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidationMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidationMessages.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidationMessages.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/ValidationMessages.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -17,32 +17,34 @@
 import java.util.Locale;
 
 /**
- * Support interface used to provide access to validation messages. Typically used by
- * {@link org.apache.tapestry.form.validator.Validator}s.
+ * Support interface used to provide access to validation messages. Typically
+ * used by {@link org.apache.tapestry.form.validator.Validator}s.
  * 
  * @author Howard Lewis Ship
  * @since 4.0
  */
 public interface ValidationMessages
 {
+
     /**
-     * Formats a validation message. Automatically chooses the correct localization.
+     * Formats a validation message. Automatically chooses the correct
+     * localization.
      * 
      * @param messageOverride
-     *            a supplied override to the default message format taken from the
-     *            ValidationStrings.properties message catalog.
+     *            a supplied override to the default message format taken from
+     *            the ValidationStrings.properties message catalog.
      * @param messageKey
-     *            used to look up pa message format when messageOverride is blank (null or empty)
+     *            used to look up pa message format when messageOverride is
+     *            blank (null or empty)
      * @param arguments
      *            array of arguments formatted with the message format
      */
 
-    public String formatValidationMessage(String messageOverride, String messageKey,
-            Object[] arguments);
+    String formatValidationMessage(String messageOverride, String messageKey, Object[] arguments);
 
     /**
      * Returns the locale for which messages are generated.
      */
 
-    public Locale getLocale();
+    Locale getLocale();
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/translator/Translator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/translator/Translator.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/translator/Translator.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/translator/Translator.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,35 +16,41 @@
 
 import java.util.Locale;
 
-import org.apache.tapestry.form.IFormComponent;
 import org.apache.tapestry.form.FormComponentContributor;
+import org.apache.tapestry.form.IFormComponent;
 import org.apache.tapestry.form.ValidationMessages;
 import org.apache.tapestry.valid.ValidatorException;
 
 /**
- * Interface used by {@link ValidatableField}s to both format an object as text and translate
- * submitted text into an appropriate object for a given field.
+ * Interface used by {@link ValidatableField}s to both format an object as text
+ * and translate submitted text into an appropriate object for a given field.
  * 
  * @author Paul Ferraro
  * @since 4.0
  */
 public interface Translator extends FormComponentContributor
 {
+
     /**
-     * Invoked during rendering to format an object (which may be null) into a text value (which
-     * should not be null) appropriate for the specified field.
-     * @param locale TODO
+     * Invoked during rendering to format an object (which may be null) into a
+     * text value (which should not be null) appropriate for the specified
+     * field.
+     * 
+     * @param locale
+     *            TODO
      */
-    public String format(IFormComponent field, Locale locale, Object object);
+    String format(IFormComponent field, Locale locale, Object object);
 
     /**
-     * Invoked during rewind to parse a submitted input value into an object suitable for the
-     * specified component.
-     * @param messages TODO
+     * Invoked during rewind to parse a submitted input value into an object
+     * suitable for the specified component.
      * 
+     * @param messages
+     *            TODO
      * @return the parsed object
      * @throws ValidatorException
      *             if the specified text could not be parsed into an object.
      */
-    public Object parse(IFormComponent field, ValidationMessages messages, String value) throws ValidatorException;
+    Object parse(IFormComponent field, ValidationMessages messages, String value)
+        throws ValidatorException;
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/Validator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/Validator.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/Validator.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/Validator.java Wed Jan 11 16:47:57 2006
@@ -14,54 +14,61 @@
 
 package org.apache.tapestry.form.validator;
 
-import org.apache.tapestry.form.IFormComponent;
 import org.apache.tapestry.form.FormComponentContributor;
+import org.apache.tapestry.form.IFormComponent;
 import org.apache.tapestry.form.ValidationMessages;
 import org.apache.tapestry.valid.ValidatorException;
 
 /**
- * An object that can be "attached" to a {@link org.apache.tapestry.form.IFormComponent} to perform
- * server-side validation ({@link #validate(IFormComponent, ValidationMessages, Object)}) as well
- * as generate cleint-side validation (in the form of JavaScript submit listeners).
+ * An object that can be "attached" to a
+ * {@link org.apache.tapestry.form.IFormComponent} to perform server-side
+ * validation ({@link #validate(IFormComponent, ValidationMessages, Object)})
+ * as well as generate cleint-side validation (in the form of JavaScript submit
+ * listeners).
  * 
  * @author Paul Ferraro
  * @since 4.0
  */
 public interface Validator extends FormComponentContributor
 {
+
     /**
      * Invoked to validate input for the field. A
-     * {@link org.apache.tapestry.form.translator.Translator} will have already converted the
-     * submitted user input string into an object.
+     * {@link org.apache.tapestry.form.translator.Translator} will have already
+     * converted the submitted user input string into an object.
      * 
      * @param field
-     *            the form element component being validated, often used to determine the
-     *            {@link IFormComponent#getDisplayName() user presentable name} for the field, used
-     *            in error messages.
+     *            the form element component being validated, often used to
+     *            determine the
+     *            {@link IFormComponent#getDisplayName() user presentable name}
+     *            for the field, used in error messages.
      * @param messages
-     *            access to the pre-defined validation messages, in the appropriate locale
+     *            access to the pre-defined validation messages, in the
+     *            appropriate locale
      * @param object
-     *            the client-side representation of the field's data. May be null if the client did
-     *            not provide a value for the field (most Validators should check for null and
-     *            perform no check if null).
+     *            the client-side representation of the field's data. May be
+     *            null if the client did not provide a value for the field (most
+     *            Validators should check for null and perform no check if
+     *            null).
      * @throws ValidatorException
-     *             if the object violates the constraint represented by this Validator.
+     *             if the object violates the constraint represented by this
+     *             Validator.
      */
 
-    public void validate(IFormComponent field, ValidationMessages messages, Object object)
-            throws ValidatorException;
+    void validate(IFormComponent field, ValidationMessages messages, Object object)
+        throws ValidatorException;
 
     /**
-     * Returns true if this validator accepts null as the object parameter to validate(). When the
-     * object is null, validators that can't accept null are skipped. It is rare for a validator to
-     * return true.
+     * Returns true if this validator accepts null as the object parameter to
+     * validate(). When the object is null, validators that can't accept null
+     * are skipped. It is rare for a validator to return true.
      */
 
-    public boolean getAcceptsNull();
+    boolean getAcceptsNull();
 
     /**
      * Returns true if this field is required. Returns false otherwise.
      */
 
-    public boolean isRequired();
+    boolean isRequired();
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorFactory.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorFactory.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorFactory.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,8 +19,9 @@
 import org.apache.tapestry.IComponent;
 
 /**
- * Constructs {@link org.apache.tapestry.form.validator.Validator} instances from a specification. A
- * specification is a comma-seperated list of entries. Each entry is in one of the following forms:
+ * Constructs {@link org.apache.tapestry.form.validator.Validator} instances
+ * from a specification. A specification is a comma-seperated list of entries.
+ * Each entry is in one of the following forms:
  * <ul>
  * <li><em>name</em>
  * <li><em>name</em>=<em>value</em>
@@ -29,30 +30,34 @@
  * <li>$<em>name</em>
  * </ul>
  * <p>
- * Most validator classes are <em>configurable</em>: they have a property that matches their
- * name. For example, {@link org.apache.tapestry.form.validator.MinDate} (which is named "minDate"
- * has a <code>minDate</code> property. A few validators are not configurable ("required" =>
- * {@link org.apache.tapestry.form.validator.Required}, for example).
+ * Most validator classes are <em>configurable</em>: they have a property
+ * that matches their name. For example,
+ * {@link org.apache.tapestry.form.validator.MinDate} (which is named "minDate"
+ * has a <code>minDate</code> property. A few validators are not configurable
+ * ("required" => {@link org.apache.tapestry.form.validator.Required}, for
+ * example).
  * <p>
- * Validators are expected to have a public no-args constructor. They are also expected to have a
- * <code>message</code> property which is set from the value in brackets.
- * The message is either a literal string, or may be prefixed with a '%' character, to indicate
- * a localized key, resolved using the component's message catalog.
+ * Validators are expected to have a public no-args constructor. They are also
+ * expected to have a <code>message</code> property which is set from the
+ * value in brackets. The message is either a literal string, or may be prefixed
+ * with a '%' character, to indicate a localized key, resolved using the
+ * component's message catalog.
  * <p>
- * When the name is prefixed with a dollary sign, it indicates a reference to a <em>bean</em>
- * with the given name.
+ * When the name is prefixed with a dollary sign, it indicates a reference to a
+ * <em>bean</em> with the given name.
  * <p>
  * A full validator specification might be:
- * <code>required,email[%email-format],minLength=20[Email addresses must be at least 20 characters long.]
+ * <code>required,email[%email-format],minLength=20[Email addresses must be at least 20 characters long.]</code>
  * 
  * @author Howard Lewis Ship
  * @since 4.0
  */
 public interface ValidatorFactory
 {
+
     /**
-     * Constructs a new (immutable) List of {@link Validator}, or returns a previously constructed
-     * List.
+     * Constructs a new (immutable) List of {@link Validator}, or returns a
+     * previously constructed List.
      * 
      * @param component
      *            the component for which the list is being created
@@ -60,5 +65,5 @@
      *            a string identifying which validators and their configuration
      * @return List of {@link Validator} (possibly empty)
      */
-    public List constructValidatorList(IComponent component, String specification);
+    List constructValidatorList(IComponent component, String specification);
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorMessages.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorMessages.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorMessages.java Wed Jan 11 16:47:57 2006
@@ -14,53 +14,55 @@
 
 package org.apache.tapestry.form.validator;
 
+import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 
 /**
  * @author Howard Lewis Ship
  * @since 4.0
  */
-class ValidatorMessages
+final class ValidatorMessages
 {
-    private static final MessageFormatter _formatter = new MessageFormatter(ValidatorMessages.class);
+
+    private static final Messages MESSAGES = new MessageFormatter(ValidatorMessages.class);
+
+    /** @since 4.1 */
+    private ValidatorMessages()
+    {
+    }
 
     static String unknownValidator(String name)
     {
-        return _formatter.format("unknown-validator", name);
+        return MESSAGES.format("unknown-validator", name);
     }
 
     static String needsConfiguration(String name)
     {
-        return _formatter.format("needs-configuration", name);
+        return MESSAGES.format("needs-configuration", name);
     }
 
     public static String notConfigurable(String name, String value)
     {
-        return _formatter.format("not-configurable", name, value);
+        return MESSAGES.format("not-configurable", name, value);
     }
 
-    public static String errorInitializingValidator(String name, Class validatorClass,
-            Throwable cause)
+    public static String errorInitializingValidator(String name, Class validatorClass, Throwable cause)
     {
-        return _formatter.format(
-                "error-initializing-validator",
-                name,
-                validatorClass.getName(),
-                cause);
+        return MESSAGES.format("error-initializing-validator", name, validatorClass.getName(), cause);
     }
 
     public static String badSpecification(String specification)
     {
-        return _formatter.format("bad-specification", specification);
+        return MESSAGES.format("bad-specification", specification);
     }
 
     public static String noValueOrMessageForBean(String name)
     {
-        return _formatter.format("no-value-or-message-for-bean", name);
+        return MESSAGES.format("no-value-or-message-for-bean", name);
     }
 
     public static String beanNotValidator(String name)
     {
-        return _formatter.format("bean-not-validator", name, Validator.class.getName());
+        return MESSAGES.format("bean-not-validator", name, Validator.class.getName());
     }
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorsBindingFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorsBindingFactory.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorsBindingFactory.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/form/validator/ValidatorsBindingFactory.java Wed Jan 11 16:47:57 2006
@@ -22,8 +22,16 @@
 import org.apache.tapestry.IComponent;
 import org.apache.tapestry.binding.AbstractBindingFactory;
 
+/**
+ * Binding factory that creates instances of
+ * {@link org.apache.tapestry.form.validator.ValidatorsBinding}.
+ * 
+ * @author Howard M. Lewis Ship
+ * @since 4.0
+ */
 public class ValidatorsBindingFactory extends AbstractBindingFactory
 {
+
     private ValidatorFactory _validatorFactory;
 
     public void setValidatorFactory(ValidatorFactory validatorFactory)
@@ -31,15 +39,13 @@
         _validatorFactory = validatorFactory;
     }
 
-    public IBinding createBinding(IComponent root, String bindingDescription, String expression,
-            Location location)
+    public IBinding createBinding(IComponent root, String bindingDescription, String expression, Location location)
     {
         try
         {
             List validators = _validatorFactory.constructValidatorList(root, expression);
 
-            return new ValidatorsBinding(bindingDescription, getValueConverter(), location,
-                    validators);
+            return new ValidatorsBinding(bindingDescription, getValueConverter(), location, validators);
         }
         catch (Exception ex)
         {

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/HTMLMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/HTMLMessages.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/HTMLMessages.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/HTMLMessages.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,18 +14,25 @@
 
 package org.apache.tapestry.html;
 
+import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 
 /**
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-class HTMLMessages
+final class HTMLMessages
 {
-    private static final MessageFormatter _formatter = new MessageFormatter(HTMLMessages.class);
+
+    private static final Messages MESSAGES = new MessageFormatter(HTMLMessages.class);
+
+    /** @since 4.1 */
+    private HTMLMessages()
+    {
+    }
 
     static String textConversionError(Throwable cause)
     {
-        return _formatter.format("text-conversion-error", cause);
+        return MESSAGES.format("text-conversion-error", cause);
     }
 }

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/InsertTextMode.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/InsertTextMode.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/InsertTextMode.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/html/InsertTextMode.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
 
 public abstract class InsertTextMode
 {
+
     /**
      * Mode where each line (after the first) is preceded by a &lt;br&gt; tag.
      */
@@ -52,7 +53,8 @@
      * Invoked by the {@link InsertText} component to write the next line.
      * 
      * @param lineNumber
-     *            the line number of the line, starting with 0 for the first line.
+     *            the line number of the line, starting with 0 for the first
+     *            line.
      * @param line
      *            the String for the current line.
      * @param writer
@@ -63,8 +65,10 @@
 
     public abstract void writeLine(int lineNumber, String line, IMarkupWriter writer, boolean raw);
 
-    private static class BreakMode extends InsertTextMode
+    /** Writes &lt;br;gt; elements between lines. */
+    private final static class BreakMode extends InsertTextMode
     {
+
         private BreakMode()
         {
             super("BREAK");
@@ -72,15 +76,16 @@
 
         public void writeLine(int lineNumber, String line, IMarkupWriter writer, boolean raw)
         {
-            if (lineNumber > 0)
-                writer.beginEmpty("br");
+            if (lineNumber > 0) writer.beginEmpty("br");
 
             writer.print(line, raw);
         }
     }
 
-    private static class ParagraphMode extends InsertTextMode
+    /** Writes &lt;p&gt; elements around lines. */
+    private final static class ParagraphMode extends InsertTextMode
     {
+
         private ParagraphMode()
         {
             super("PARAGRAPH");
@@ -96,4 +101,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -31,17 +31,19 @@
 import org.apache.tapestry.engine.ILink;
 
 /**
- * Base class for implementations of {@link ILinkComponent}. Includes a disabled attribute (that
- * should be bound to a disabled parameter), an anchor attribute, and a renderer attribute (that
- * should be bound to a renderer parameter). A default, shared instance of
- * {@link org.apache.tapestry.link.DefaultLinkRenderer} is used when no specific renderer is
- * provided.
+ * Base class for implementations of {@link ILinkComponent}. Includes a
+ * disabled attribute (that should be bound to a disabled parameter), an anchor
+ * attribute, and a renderer attribute (that should be bound to a renderer
+ * parameter). A default, shared instance of
+ * {@link org.apache.tapestry.link.DefaultLinkRenderer} is used when no specific
+ * renderer is provided.
  * 
  * @author Howard Lewis Ship
  */
 
-public abstract class AbstractLinkComponent extends AbstractComponent implements ILinkComponent
-{
+public abstract class AbstractLinkComponent extends AbstractComponent implements
+        ILinkComponent {
+
     private Map _eventHandlers;
 
     public abstract boolean isDisabled();
@@ -55,23 +57,20 @@
     {
         Object currentValue;
 
-        if (_eventHandlers == null)
-            _eventHandlers = new HashMap();
+        if (_eventHandlers == null) _eventHandlers = new HashMap();
 
         currentValue = _eventHandlers.get(eventType);
 
         // The first value is added as a String
 
-        if (currentValue == null)
-        {
+        if (currentValue == null) {
             _eventHandlers.put(eventType, functionName);
             return;
         }
 
         // When adding the second value, convert to a List
 
-        if (currentValue instanceof String)
-        {
+        if (currentValue instanceof String) {
             List list = new ArrayList();
             list.add(currentValue);
             list.add(functionName);
@@ -82,7 +81,7 @@
 
         // For the third and up, add the new function to the List
 
-        List list = (List) currentValue;
+        List list = (List)currentValue;
         list.add(functionName);
     }
 
@@ -106,40 +105,34 @@
     {
         String name = null;
 
-        if (_eventHandlers == null)
-            return;
+        if (_eventHandlers == null) return;
 
-        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);
+        PageRenderSupport pageRenderSupport = TapestryUtils
+                .getPageRenderSupport(cycle, this);
 
         Iterator i = _eventHandlers.entrySet().iterator();
 
-        while (i.hasNext())
-        {
-            Map.Entry entry = (Map.Entry) i.next();
-            LinkEventType type = (LinkEventType) entry.getKey();
-
-            name = writeEventHandler(
-                    writer,
-                    pageRenderSupport,
-                    name,
-                    type.getAttributeName(),
-                    entry.getValue());
+        while(i.hasNext()) {
+            Map.Entry entry = (Map.Entry)i.next();
+            LinkEventType type = (LinkEventType)entry.getKey();
+
+            name = writeEventHandler(writer, pageRenderSupport, name, type
+                    .getAttributeName(), entry.getValue());
         }
 
     }
 
-    protected String writeEventHandler(IMarkupWriter writer, PageRenderSupport pageRenderSupport,
-            String name, String attributeName, Object value)
+    protected String writeEventHandler(IMarkupWriter writer,
+            PageRenderSupport pageRenderSupport, String name,
+            String attributeName, Object value)
     {
         String wrapperFunctionName;
 
-        if (value instanceof String)
-        {
-            wrapperFunctionName = (String) value;
-        }
-        else
-        {
-            String finalName = name == null ? pageRenderSupport.getUniqueString("Link") : name;
+        if (value instanceof String) {
+            wrapperFunctionName = (String)value;
+        } else {
+            String finalName = name == null ? pageRenderSupport
+                    .getUniqueString("Link") : name;
 
             wrapperFunctionName = attributeName + "_" + finalName;
 
@@ -149,10 +142,9 @@
             buffer.append(wrapperFunctionName);
             buffer.append(" ()\n{\n");
 
-            Iterator i = ((List) value).iterator();
-            while (i.hasNext())
-            {
-                String functionName = (String) i.next();
+            Iterator i = ((List)value).iterator();
+            while(i.hasNext()) {
+                String functionName = (String)i.next();
                 buffer.append("  ");
                 buffer.append(functionName);
                 buffer.append("();\n");
@@ -163,7 +155,8 @@
             pageRenderSupport.addBodyScript(buffer.toString());
         }
 
-        writer.attribute(attributeName, "javascript:" + wrapperFunctionName + "();");
+        writer.attribute(attributeName, "javascript:" + wrapperFunctionName
+                + "();");
 
         return name;
     }
@@ -174,7 +167,8 @@
 
     public abstract void setRenderer(ILinkRenderer renderer);
 
-    public void renderAdditionalAttributes(IMarkupWriter writer, IRequestCycle cycle)
+    public void renderAdditionalAttributes(IMarkupWriter writer,
+            IRequestCycle cycle)
     {
         writeEventHandlers(writer, cycle);
 
@@ -184,15 +178,18 @@
     }
 
     /**
-     * Utility method for subclasses; Gets the named service from the engine and invokes
+     * Utility method for subclasses; Gets the named service from the engine and
+     * invokes
      * {@link IEngineService#getLink(org.apache.tapestry.IComponent, Object[])}on
      * it.
      * 
      * @since 3.0
-     * @deprecated To be removed in 4.1; links may now have the necessary engine service injected.
+     * @deprecated To be removed in 4.1; links may now have the necessary engine
+     *             service injected.
      */
 
-    protected ILink getLink(IRequestCycle cycle, String serviceName, Object parameter)
+    protected ILink getLink(IRequestCycle cycle, String serviceName,
+            Object parameter)
     {
         IEngineService service = cycle.getEngine().getService(serviceName);
 
@@ -217,4 +214,4 @@
         setRenderer(DefaultLinkRenderer.SHARED_INSTANCE);
     }
 
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/ActionLink.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/ActionLink.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/ActionLink.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/link/ActionLink.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,8 +24,9 @@
 import org.apache.tapestry.listener.ListenerInvoker;
 
 /**
- * A component for creating a link that is handled using the action service. [ <a
- * href="../../../../../ComponentReference/ActionLink.html">Component Reference </a>]
+ * A component for creating a link that is handled using the action service. [
+ * <a href="../../../../../ComponentReference/ActionLink.html">Component
+ * Reference </a>]
  * 
  * @author Howard Lewis Ship
  * @deprecated To be removed in 4.1
@@ -33,14 +34,16 @@
 
 public abstract class ActionLink extends AbstractLinkComponent implements IAction
 {
+
     public abstract boolean isStateful();
 
     /**
-     * Returns true if the stateful parameter is bound to a true value. If stateful is not bound,
-     * also returns the default, true.
+     * Returns true if the stateful parameter is bound to a true value. If
+     * stateful is not bound, also returns the default, true.
      * <p>
-     * Note that this method can be called when the component is not rendering, therefore it must
-     * directly access the {@link IBinding}for the stateful parameter.
+     * Note that this method can be called when the component is not rendering,
+     * therefore it must directly access the {@link IBinding}for the stateful
+     * parameter.
      */
 
     public boolean getRequiresSession()
@@ -65,4 +68,4 @@
     public abstract IActionListener getListener();
 
     public abstract ListenerInvoker getListenerInvoker();
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org