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 2015/04/08 00:15:46 UTC
[3/5] tapestry-5 git commit: Revert the introduction of the Field2
interface
Revert the introduction of the Field2 interface
This was a dead-end, rather than fixing everything during Ajax requests.
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/eff79410
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/eff79410
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/eff79410
Branch: refs/heads/master
Commit: eff794101b8eb1c3bf00dc12d76f17e7d72182e7
Parents: 04a7edc
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Apr 7 14:50:35 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Apr 7 14:50:35 2015 -0700
----------------------------------------------------------------------
.../main/java/org/apache/tapestry5/Field2.java | 38 --------------------
.../apache/tapestry5/ValidationTrackerImpl.java | 6 ----
.../tapestry5/corelib/base/AbstractField.java | 26 +-------------
3 files changed, 1 insertion(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/eff79410/tapestry-core/src/main/java/org/apache/tapestry5/Field2.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/Field2.java b/tapestry-core/src/main/java/org/apache/tapestry5/Field2.java
deleted file mode 100644
index 6382f39..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/Field2.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry5;
-
-/**
- * Due to how control names and client ids are allocated inside during an Ajax request, it is difficult to
- * to connect input data and field validation errors to the fields, since the control name and client id are different
- * during the processing of the submitted form data and during the subsequent render. Starting in 5.4, the
- * key used to identify a field inside the {@link ValidationTracker} is this new validation id,
- * which is assigned on first read.
- *
- * If a field implements {@link Field} but not Field2, then the control name is used as the
- * validation id (which will work correctly during non-Ajax requests).
- *
- * This assumes a "flat" field structure, where a given component renders only once (not multiple times, inside
- * a {@link org.apache.tapestry5.corelib.components.Loop}.
- *
- * @since 5.4
- */
-public interface Field2 extends Field
-{
- /**
- * Returns a request-scoped unique validation id for the field. This returns the same value regardless of how
- * many times the field is rendered, which means that the behavior will be incorrect when the
- * field component is placed inside a loop.
- */
- String getValidationId();
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/eff79410/tapestry-core/src/main/java/org/apache/tapestry5/ValidationTrackerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/ValidationTrackerImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/ValidationTrackerImpl.java
index c77e154..bccb1ee 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/ValidationTrackerImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/ValidationTrackerImpl.java
@@ -70,12 +70,6 @@ public final class ValidationTrackerImpl extends BaseOptimizedSessionPersistedOb
private String getKey(Field field)
{
- if (field instanceof Field2)
- {
- Field2 field2 = (Field2) field;
- return field2.getValidationId();
- }
-
return field.getControlName();
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/eff79410/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
index c8331b8..cd56f3c 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
@@ -30,7 +30,6 @@ import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import java.io.Serializable;
-import java.util.UUID;
/**
* Provides initialization of the clientId and elementName properties. In addition, adds the {@link RenderInformals},
@@ -39,7 +38,7 @@ import java.util.UUID;
* @tapestrydoc
*/
@SupportsInformalParameters
-public abstract class AbstractField implements Field2
+public abstract class AbstractField implements Field
{
/**
* The user presentable label for the field. If not provided, a reasonable label is generated from the component's
@@ -363,27 +362,4 @@ public abstract class AbstractField implements Field2
beanValidationContext.setCurrentProperty(null);
}
-
- /**
- * The validation id is used by Tapestry to coordinate an incoming request (with input for fields,
- * an validation errors) with a render of the form containing a field. Normally, a validationId is assigned
- * on first access and persists for the remainder of the request; however the {@link org.apache.tapestry5.corelib.components.BeanEditor}
- * (or rather, the components used by the BeanEditor) may need to override this as the same fields render and re-render
- * multiple times in the same request.
- *
- * @since 5.4
- */
- @Parameter
- private String validationId;
-
- @Override
- public String getValidationId()
- {
- if (validationId == null)
- {
- validationId = UUID.randomUUID().toString();
- }
-
- return validationId;
- }
}