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 2008/09/11 21:22:45 UTC

svn commit: r694429 - in /tapestry/tapestry5/trunk: src/site/apt/ tapestry-core/src/main/java/org/apache/tapestry5/ tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/

Author: hlship
Date: Thu Sep 11 12:22:43 2008
New Revision: 694429

URL: http://svn.apache.org/viewvc?rev=694429&view=rev
Log:
TAPESTRY-2300: The RadioGroup component always generates its control name from its component id; a new parameter should give some override control over this

Modified:
    tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RadioContainer.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java

Modified: tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/upgrade.apt?rev=694429&r1=694428&r2=694429&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/upgrade.apt Thu Sep 11 12:22:43 2008
@@ -14,6 +14,12 @@
 
 Release 5.0.15
 
+  Method <<<getElementName()>>> of the
+  {{{../apidocs/org/apache/tapestry5/RadioContainer.html}RadioContainer}} interface was renamed
+  to <<<getControlName()>>>, to bring it into alignment with the analagous method
+  of the
+   {{{../apidocs/org/apache/tapestry5/Field.html}Field}} interface..  This should not affect any user code.
+
 * {{{https://issues.apache.org/jira/browse/TAPESTRY-2656}TAPESTRY-2656}}
 
   A method of the interface {{{../apidocs/org/apache/tapestry5/grid/GridSortModel.html}GridSortModel}} was renamed

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RadioContainer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RadioContainer.java?rev=694429&r1=694428&r2=694429&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RadioContainer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/RadioContainer.java Thu Sep 11 12:22:43 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -25,8 +25,10 @@
     /**
      * Returns the value used as the name attribute of the rendered element. This value will be unique within an
      * enclosing form, even if the same component renders multiple times.
+     *
+     * @see org.apache.tapestry5.Field#getControlName()
      */
-    String getElementName();
+    String getControlName();
 
     /**
      * If true, then all buttons within the container should also be disabled.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java?rev=694429&r1=694428&r2=694429&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.java Thu Sep 11 12:22:43 2008
@@ -120,7 +120,7 @@
         String value = container.toClient(this.value);
 
         clientId = renderSupport.allocateClientId(resources);
-        controlName = container.getElementName();
+        controlName = container.getControlName();
 
         writer.element("input", "type", "radio", "id", clientId, "name", controlName, "value", value);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java?rev=694429&r1=694428&r2=694429&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java Thu Sep 11 12:22:43 2008
@@ -48,6 +48,14 @@
     private String label;
 
     /**
+     * The id used to generate a page-unique client-side identifier for the component. If a component renders multiple
+     * times, a suffix will be appended to the to id to ensure uniqueness. The uniqued value may be accessed via the
+     * {@link #getClientId() clientId property}.
+     */
+    @Parameter(value = "prop:componentResources.id", defaultPrefix = BindingConstants.LITERAL)
+    private String clientId;
+
+    /**
      * Allows a specific implementation of {@link org.apache.tapestry5.ValueEncoder} to be supplied. This is used to
      * create client-side string values for the different radio button values.
      */
@@ -143,9 +151,7 @@
      */
     final void setupRender()
     {
-        String name = formSupport.allocateControlName(resources.getId());
-
-        ComponentAction<RadioGroup> action = new Setup(name);
+        ComponentAction<RadioGroup> action = new Setup(formSupport.allocateControlName(clientId));
 
         formSupport.storeAndExecute(this, action);
 
@@ -153,10 +159,9 @@
 
         final String selectedValue = submittedValue != null ? submittedValue : encoder.toClient(value);
 
-
         environment.push(RadioContainer.class, new RadioContainer()
         {
-            public String getElementName()
+            public String getControlName()
             {
                 return controlName;
             }
@@ -178,7 +183,6 @@
             {
                 return TapestryInternalUtils.isEqual(encoder.toClient(value), selectedValue);
             }
-
         });
 
         formSupport.store(this, PROCESS_SUBMISSION);