You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2010/05/05 19:15:28 UTC

svn commit: r941389 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5: corelib/components/Form.java internal/InternalSymbols.java services/TapestryModule.java

Author: hlship
Date: Wed May  5 17:15:27 2010
New Revision: 941389

URL: http://svn.apache.org/viewvc?rev=941389&view=rev
Log:
TAP5-1130: LinkSubmit component doesn't work when form contains Select component with default id

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java?rev=941389&r1=941388&r2=941389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java Wed May  5 17:15:27 2010
@@ -34,6 +34,7 @@ import org.apache.tapestry5.corelib.mixi
 import org.apache.tapestry5.dom.Element;
 import org.apache.tapestry5.internal.BeanValidationContext;
 import org.apache.tapestry5.internal.BeanValidationContextImpl;
+import org.apache.tapestry5.internal.InternalSymbols;
 import org.apache.tapestry5.internal.services.HeartbeatImpl;
 import org.apache.tapestry5.internal.util.AutofocusValidationDecorator;
 import org.apache.tapestry5.ioc.Location;
@@ -229,6 +230,10 @@ public class Form implements ClientEleme
     @Inject
     private ComponentSource source;
 
+    @Inject
+    @Symbol(InternalSymbols.PRE_SELECTED_FORM_NAMES)
+    private String preselectedFormNames;
+
     @Persist(PersistenceConstants.FLASH)
     private ValidationTracker defaultTracker;
 
@@ -357,8 +362,10 @@ public class Form implements ClientEleme
 
         IdAllocator allocator = new IdAllocator();
 
-        allocator.allocateId("reset");
-        allocator.allocateId("submit");
+        for (String name : preselectedFormNames.split("\\s*,\\s*"))
+        {
+            allocator.allocateId(name);
+        }
 
         formSupport = createRenderTimeFormSupport(clientId, actionSink, allocator);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java?rev=941389&r1=941388&r2=941389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java Wed May  5 17:15:27 2010
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2010 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.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,8 +17,8 @@ package org.apache.tapestry5.internal;
 public class InternalSymbols
 {
     /**
-     * The application mode, generally "servlet", used to select the correct contributions to the {@link
-     * org.apache.tapestry5.services.Alias} service.
+     * The application mode, generally "servlet", used to select the correct contributions to the
+     * {@link org.apache.tapestry5.services.Alias} service.
      */
     public static final String ALIAS_MODE = "tapestry.alias-mode";
 
@@ -31,8 +31,16 @@ public class InternalSymbols
     /**
      * The application package converted to a path ('.' becomes '/'). Useful for finding resources on the classpath
      * relevant to the application.
-     *
+     * 
      * @since 5.1.0.0
      */
     public static final String APP_PACKAGE_PATH = "tapestry.app-package-path";
+
+    /**
+     * Comma-seperated list of pre-allocated Form component control names. Basically, this exists to work
+     * around name collisions on the client side.
+     * 
+     * @since 5.2.0
+     */
+    public static final String PRE_SELECTED_FORM_NAMES = "tapestry.pre-selected-form-names";
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=941389&r1=941388&r2=941389&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed May  5 17:15:27 2010
@@ -2441,6 +2441,8 @@ public final class TapestryModule
         configuration.add(SymbolConstants.ENCODE_LOCALE_INTO_PATH, "true");
 
         configuration.add(SymbolConstants.BLACKBIRD_ENABLED, "false");
+        
+        configuration.add(InternalSymbols.PRE_SELECTED_FORM_NAMES, "reset,submit,select");
     }
 
     /**