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 2006/12/31 00:06:12 UTC
svn commit: r491342 [1/2] - in /tapestry/tapestry5/tapestry-core/trunk/src:
./ main/java/org/apache/tapestry/corelib/base/
main/java/org/apache/tapestry/corelib/components/
main/java/org/apache/tapestry/corelib/mixins/
main/java/org/apache/tapestry/int...
Author: hlship
Date: Sat Dec 30 15:06:09 2006
New Revision: 491342
URL: http://svn.apache.org/viewvc?view=rev&rev=491342
Log:
Fill in more of the details about validation.
Rename "validator:" binding prefix to "validate:".
Add a "required" validator.
Added:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/mixins/DiscardBody.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidateBindingFactory.java
- copied, changed from r491071, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactory.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java
- copied, changed from r491071, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectWorker.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/Required.java
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/Errors.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/ValidForm.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidateBindingFactoryTest.java
- copied, changed from r491071, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactoryTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectAssetWorkerTest.java
- copied, changed from r491071, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectWorkerTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/ValidForm.html
Removed:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactory.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectWorker.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactoryTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectWorkerTest.java
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/ComponentMessages.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextArea.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextField.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/BindingsMessages.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentResourcesInjectionProvider.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/EnvironmentImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PersistWorker.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Request.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/ComponentStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/bindings/BindingsStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/model/ModelStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/runtime/RuntimeStrings.properties
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
tapestry/tapestry5/tapestry-core/trunk/src/tapestry-formatting.xml
tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/web.xml
tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html
tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml
tapestry/tapestry5/tapestry-core/trunk/src/test/conf/webdefault.xml
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/log4j.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/ValidationTestMessages.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/ValidationTestMessages_fr.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/SimpleComponent.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/SimpleComponent_en_GB.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/SubclassComponent.properties
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/SubclassComponent_en_GB.properties
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java Sat Dec 30 15:06:09 2006
@@ -19,12 +19,16 @@
import org.apache.tapestry.ComponentAction;
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.Field;
+import org.apache.tapestry.FieldValidator;
+import org.apache.tapestry.Translator;
+import org.apache.tapestry.ValidationException;
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.Environmental;
import org.apache.tapestry.annotations.Inject;
import org.apache.tapestry.annotations.Mixin;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.annotations.SetupRender;
+import org.apache.tapestry.corelib.mixins.DiscardBody;
import org.apache.tapestry.corelib.mixins.RenderDisabled;
import org.apache.tapestry.corelib.mixins.RenderInformals;
import org.apache.tapestry.internal.TapestryUtils;
@@ -57,6 +61,33 @@
@Mixin
private RenderDisabled _renderDisabled;
+ @SuppressWarnings("unused")
+ @Mixin
+ private DiscardBody _discardBody;
+
+ private static final FieldValidator NOOP_VALIDATOR = new FieldValidator()
+ {
+ public void check(Object value) throws ValidationException
+ {
+ // Do nothing
+ }
+ };
+
+ private static final Translator DEFAULT_TRANSLATOR = new Translator()
+ {
+
+ public Object parseClient(String clientValue) throws ValidationException
+ {
+ return clientValue;
+ }
+
+ public String toClient(Object value)
+ {
+ return value == null ? "" : value.toString();
+ }
+
+ };
+
static class SetupAction implements ComponentAction<AbstractField>, Serializable
{
private static final long serialVersionUID = 2690270808212097020L;
@@ -151,7 +182,7 @@
*
* @param paramLookup
* an object providing lookup access to form parameters, presumably so that the
- * component may extract a quert parameter value that matches the component's element
+ * component may extract a query parameter value that matches the component's element
* name. Usually this object is the current request but could be a mock object if the
* app is driven by a {@link org.apache.tapestry.test.pagelevel.PageTester}.
* @param elementName
@@ -165,6 +196,23 @@
return _label;
return TapestryUtils.toUserPresentable(_resources.getId());
+ }
+
+ /**
+ * A field validator that does nothing. This is used as the default for subclasses' validate
+ * parameter.
+ */
+ public final FieldValidator getNoopValidator()
+ {
+ return NOOP_VALIDATOR;
+ }
+ /**
+ * A translator that converts objects to strings (and converts null to the empty string), used
+ * as the default for subclasses' translate parameter.
+ */
+ public final Translator getDefaultTranslator()
+ {
+ return DEFAULT_TRANSLATOR;
}
}
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java?view=auto&rev=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java Sat Dec 30 15:06:09 2006
@@ -0,0 +1,87 @@
+// Copyright 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.
+// 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.tapestry.corelib.base;
+
+import org.apache.tapestry.FieldValidator;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.Translator;
+import org.apache.tapestry.ValidationException;
+import org.apache.tapestry.ValidationTracker;
+import org.apache.tapestry.annotations.BeginRender;
+import org.apache.tapestry.annotations.Environmental;
+import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.internal.services.FormParameterLookup;
+
+/** Abstract class for a variety of components that render some variation of a text field. */
+public abstract class AbstractTextField extends AbstractField
+{
+ @Parameter(required = true)
+ private Object _value;
+
+ @Parameter("defaultTranslator")
+ private Translator<Object> _translate;
+
+ @Parameter("noopValidator")
+ private FieldValidator<Object> _validate;
+
+ @Environmental
+ private ValidationTracker _tracker;
+
+ @BeginRender
+ final void begin(MarkupWriter writer)
+ {
+ String value = _tracker.getInput(this);
+
+ if (value == null)
+ value = _translate.toClient(_value);
+
+ writeFieldTag(writer, value);
+ }
+
+ /**
+ * Invoked from {@link #begin(MarkupWriter)} to write out the element and attributes (typically,
+ * <input>).
+ *
+ * @param writer
+ * markup write to send output to
+ * @param value
+ * the value (either obtained and translated from the value parameter, or obtained
+ * from the tracker)
+ */
+ protected abstract void writeFieldTag(MarkupWriter writer, String value);
+
+ @Override
+ protected final void processSubmission(FormParameterLookup paramLookup, String elementName)
+ {
+ String rawValue = paramLookup.getParameter(elementName);
+
+ _tracker.recordInput(this, rawValue);
+
+ try
+ {
+
+ Object translated = _translate.parseClient(rawValue);
+
+ _validate.check(translated);
+
+ _value = translated;
+ }
+ catch (ValidationException ex)
+ {
+ _tracker.recordError(this, ex.getMessage());
+ return;
+ }
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/ComponentMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/ComponentMessages.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/ComponentMessages.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/ComponentMessages.java Sat Dec 30 15:06:09 2006
@@ -12,17 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.corelib.components;
-
+package org.apache.tapestry.corelib.components;
+
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.MessagesImpl;
-
-final class ComponentMessages
-{
- private static final Messages MESSAGES = MessagesImpl.forClass(ComponentMessages.class);
-
- static String componentActionNotSerializable(String componentId, Throwable cause)
- {
- return MESSAGES.format("component-action-not-serializable", componentId, cause);
- }
-}
+
+final class ComponentMessages
+{
+ private static final Messages MESSAGES = MessagesImpl.forClass(ComponentMessages.class);
+
+ static String componentActionNotSerializable(String componentId, Throwable cause)
+ {
+ return MESSAGES.format("component-action-not-serializable", componentId, cause);
+ }
+
+ static String encloseErrorsInForm()
+ {
+ return MESSAGES.get("enclose-errors-in-form");
+ }
+}
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java?view=auto&rev=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java Sat Dec 30 15:06:09 2006
@@ -0,0 +1,68 @@
+// Copyright 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.
+// 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.tapestry.corelib.components;
+
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.ValidationTracker;
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.Environmental;
+import org.apache.tapestry.annotations.Parameter;
+
+/**
+ * Standard validation error presenter. Must be enclosed by a {@link Form} component.
+ */
+@ComponentClass
+public class Errors
+{
+ @Parameter("message:default-banner")
+ private String _banner;
+
+ @Parameter
+ private String _class = "tapestry-error";
+
+ @Environmental
+ private ValidationTracker _tracker;
+
+ void beginRender(MarkupWriter writer)
+ {
+ // TODO: Would be nice if there was a Location to report ... can we add a Location property
+ // to ComponentResources?
+
+ if (_tracker == null)
+ throw new RuntimeException(ComponentMessages.encloseErrorsInForm());
+
+ if (!_tracker.getHasErrors())
+ return;
+
+ writer.element("div", "class", _class);
+
+ writer.element("span", "class", "banner");
+ writer.write(_banner);
+ writer.end();
+
+ writer.element("ul");
+
+ for (String message : _tracker.getErrors())
+ {
+ writer.element("li");
+ writer.write(message);
+ writer.end();
+ }
+
+ writer.end(); // ul
+ writer.end(); // div
+
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java Sat Dec 30 15:06:09 2006
@@ -24,6 +24,8 @@
import org.apache.tapestry.Link;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.TapestryConstants;
+import org.apache.tapestry.ValidationTracker;
+import org.apache.tapestry.ValidationTrackerImpl;
import org.apache.tapestry.annotations.AfterRender;
import org.apache.tapestry.annotations.BeginRender;
import org.apache.tapestry.annotations.CleanupRender;
@@ -33,6 +35,7 @@
import org.apache.tapestry.annotations.Mixin;
import org.apache.tapestry.annotations.OnEvent;
import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.annotations.SetupRender;
import org.apache.tapestry.corelib.mixins.RenderInformals;
import org.apache.tapestry.dom.Element;
@@ -52,9 +55,12 @@
* {@link #PREPARE_EVENT#prepare} notification event, to allow any listeners to set up the state of
* the page prior to rendering out the form's content.
* <p>
- * When the form is submitted, the component emits two events: first another prepare event to allow
- * the page to update its state as necessary to prepare for the form submission, and then a
- * {@link #SUBMIT submit} event once all data in the form has been propogated into the data model.
+ * When the form is submitted, the component emits four notifications: first another prepare event
+ * to allow the page to update its state as necessary to prepare for the form submission, then
+ * (after components enclosed by the form have operated), a "validate" event is emitted, to allow
+ * for cross-form validation. After that, either a "success" or "failure" event (depending on
+ * whether the {@link ValidationTracker} has recorded any errors). Lastly, a "submit" event, for any
+ * listeners that care only about form submission, regardless of success or failure.
* <p>
* For all of these notifications, the event context is derived from the <strong>context</strong>
* parameter. This context is encoded into the form's action URI (the parameter is not read when the
@@ -69,10 +75,32 @@
*/
public static final String PREPARE_EVENT = "prepare";
- /** Event type for a notification after the form has submitted. */
+ /**
+ * Event type for a notification after the form has submitted. This event notification occurs on
+ * any form submit, without respect to "success" or "failure".
+ */
public static final String SUBMIT = "submit";
/**
+ * Event type for a notification to perform validation of submitted data. This allows a listener
+ * to perform cross-field validation. This occurs before the {@link #SUCCESS} or
+ * {@link #FAILURE} notification.
+ */
+ public static final String VALIDATE = "validate";
+
+ /**
+ * Event type for a notification after the form has submitted, when there are no errors in the
+ * validation tracker. This occurs before the {@link #SUBMIT} event.
+ */
+ public static final String SUCCESS = "success";
+
+ /**
+ * Event type for a notification after the form has been submitted, when there are errors in the
+ * validation tracker. This occurs before the {@link #SUBMIT} event.
+ */
+ public static final String FAILURE = "failure";
+
+ /**
* The context for the link (optional parameter). This list of values will be converted into
* strings and included in the URI. The strings will be coerced back to whatever their values
* are and made available to event handler methods.
@@ -80,6 +108,9 @@
@Parameter
private List<?> _context;
+ @Parameter("defaultTracker")
+ private ValidationTracker _tracker;
+
/**
* Query parameter name storing form data (the serialized commands needed to process a form
* submission).
@@ -101,9 +132,11 @@
@Inject("infrastructure:ComponentSource")
private ComponentSource _source;
+ @Persist
+ private ValidationTracker _defaultTracker;
+
// Collects a stream of component actions. Each action goes in as a UTF string (the component
- // component id),
- // followed by a ComponentAction
+ // component id), followed by a ComponentAction
private Base64ObjectOutputStream _actions;
@@ -111,6 +144,19 @@
@Mixin
private RenderInformals _renderInformals;
+ public ValidationTracker getDefaultTracker()
+ {
+ if (_defaultTracker == null)
+ _defaultTracker = new ValidationTrackerImpl();
+
+ return _defaultTracker;
+ }
+
+ public void setDefaultTracker(ValidationTracker defaultTracker)
+ {
+ _defaultTracker = defaultTracker;
+ }
+
@SetupRender
void setup()
{
@@ -129,6 +175,7 @@
// for this kind of check?
_environment.push(FormSupport.class, support);
+ _environment.push(ValidationTracker.class, _tracker);
}
@@ -191,12 +238,20 @@
void cleanup()
{
_environment.pop(FormSupport.class);
+
+ // This forces a change to the tracker, which is nice because its internal state has
+ // changed.
+ _tracker = _environment.pop(ValidationTracker.class);
}
@SuppressWarnings("unchecked")
@OnEvent("action")
void onSubmit(Object[] context)
{
+ _tracker.clear();
+
+ _environment.push(ValidationTracker.class, _tracker);
+
_resources.triggerEvent(PREPARE_EVENT, context, null);
// TODO: Ajax stuff will eventually mean there are multiple values for this parameter name
@@ -226,9 +281,27 @@
throw new RuntimeException(ex);
}
+ ValidationTracker tracker = _environment.peek(ValidationTracker.class);
+
+ // Let the listeners peform any final validations
+
+ _resources.triggerEvent(VALIDATE, context, null);
+
+ // Let the listeners know about overall success or failure. Most listeners fall into one of
+ // those two camps.
+
+ _resources.triggerEvent(tracker.getHasErrors() ? FAILURE : SUCCESS, context, null);
+
// TODO: The return value should be used to control what renders.
+ // Lastly, tell anyone whose interested that the form is completely submitted.
+
_resources.triggerEvent(SUBMIT, context, null);
+
+ // Update through the parameter because the tracker has almost certainly changed internal
+ // state.
+
+ _tracker = tracker;
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextArea.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextArea.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextArea.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextArea.java Sat Dec 30 15:06:09 2006
@@ -16,37 +16,28 @@
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.AfterRender;
-import org.apache.tapestry.annotations.BeforeRenderBody;
-import org.apache.tapestry.annotations.BeginRender;
-import org.apache.tapestry.annotations.Parameter;
-import org.apache.tapestry.corelib.base.AbstractField;
-import org.apache.tapestry.internal.services.FormParameterLookup;
+import org.apache.tapestry.corelib.base.AbstractTextField;
/**
* TextArea component corresponds to a <textarea>. The value parameter is almost always bound
* to a string, but this is not an absolute requirement.
*/
-public class TextArea extends AbstractField
+public class TextArea extends AbstractTextField
{
+ private String _value;
- @Parameter(required = true)
- private Object _value;
-
- @BeginRender
- void begin(MarkupWriter writer)
+ @Override
+ protected final void writeFieldTag(MarkupWriter writer, String value)
{
writer.element("textarea", "name", getElementName(), "id", getClientId());
- }
- /** This will prevent the body of the component from rendering. */
- @BeforeRenderBody
- boolean rejectBody()
- {
- return false;
+ // Save until needed in after()
+
+ _value = value;
}
@AfterRender
- void after(MarkupWriter writer)
+ final void after(MarkupWriter writer)
{
// TextArea will not have a template.
@@ -54,12 +45,6 @@
writer.write(_value.toString());
writer.end(); // textarea
- }
-
- @Override
- protected void processSubmission(FormParameterLookup paramLookup, String elementName)
- {
- _value = paramLookup.getParameter(elementName);
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextField.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextField.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/TextField.java Sat Dec 30 15:06:09 2006
@@ -16,23 +16,17 @@
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.AfterRender;
-import org.apache.tapestry.annotations.BeginRender;
-import org.apache.tapestry.annotations.Parameter;
-import org.apache.tapestry.corelib.base.AbstractField;
-import org.apache.tapestry.internal.services.FormParameterLookup;
+import org.apache.tapestry.corelib.base.AbstractTextField;
/**
* TextField component corresponds to <input type="text">. The value parameter will be
* editted. TextField is generally used with string values, but other values are acceptible, as long
* as they can be freely converted back and forth to strings.
*/
-public class TextField extends AbstractField
+public class TextField extends AbstractTextField
{
- @Parameter(required = true)
- private Object _value;
-
- @BeginRender
- void begin(MarkupWriter writer)
+ @Override
+ protected final void writeFieldTag(MarkupWriter writer, String value)
{
writer.element(
"input",
@@ -43,19 +37,13 @@
"id",
getClientId(),
"value",
- _value);
+ value);
}
@AfterRender
- void after(MarkupWriter writer)
+ final void after(MarkupWriter writer)
{
writer.end(); // input
- }
-
- @Override
- protected void processSubmission(FormParameterLookup paramLookup, String elementName)
- {
- _value = paramLookup.getParameter(elementName);
}
}
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/mixins/DiscardBody.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/mixins/DiscardBody.java?view=auto&rev=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/mixins/DiscardBody.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/mixins/DiscardBody.java Sat Dec 30 15:06:09 2006
@@ -0,0 +1,31 @@
+// Copyright 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.
+// 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.tapestry.corelib.mixins;
+
+import org.apache.tapestry.annotations.BeforeRenderBody;
+import org.apache.tapestry.annotations.ComponentClass;
+
+/**
+ * Discards a component's body. Returns false from the {@link BeforeRenderBody} phase, which
+ * prevents the rendering of the body.
+ */
+@ComponentClass
+public class DiscardBody
+{
+ boolean beforeRenderBody()
+ {
+ return false;
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/BindingsMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/BindingsMessages.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/BindingsMessages.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/BindingsMessages.java Sat Dec 30 15:06:09 2006
@@ -51,8 +51,8 @@
return MESSAGES.format("write-only-property", propertyName, clazz.getName(), propertyPath);
}
- static String validatorBindingForFieldsOnly(ComponentResources component)
+ static String validateBindingForFieldsOnly(ComponentResources component)
{
- return MESSAGES.format("validator-binding-for-fields-only", component.getCompleteId());
+ return MESSAGES.format("validate-binding-for-fields-only", component.getCompleteId());
}
}
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidateBindingFactory.java (from r491071, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactory.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidateBindingFactory.java?view=diff&rev=491342&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactory.java&r1=491071&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidateBindingFactory.java&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidatorBindingFactory.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/bindings/ValidateBindingFactory.java Sat Dec 30 15:06:09 2006
@@ -27,11 +27,11 @@
* Factory for bindings that provide a {@link FieldValidator} based on a validator specification.
* This binding factory is only useable with components that implement the {@link Field} interface.
*/
-public class ValidatorBindingFactory implements BindingFactory
+public class ValidateBindingFactory implements BindingFactory
{
private final FieldValidatorSource _fieldValidatorSource;
- public ValidatorBindingFactory(FieldValidatorSource fieldValidatorSource)
+ public ValidateBindingFactory(FieldValidatorSource fieldValidatorSource)
{
_fieldValidatorSource = fieldValidatorSource;
}
@@ -42,7 +42,7 @@
Object fieldAsObject = component.getComponent();
if (!Field.class.isInstance(fieldAsObject))
- throw new TapestryException(BindingsMessages.validatorBindingForFieldsOnly(component),
+ throw new TapestryException(BindingsMessages.validateBindingForFieldsOnly(component),
location, null);
Field field = (Field) fieldAsObject;
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java Sat Dec 30 15:06:09 2006
@@ -209,7 +209,6 @@
public List<String> getPersistentFieldNames()
{
- // The name allocator is
return _persistentFieldNameAllocator.getAllocatedIds();
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentResourcesInjectionProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentResourcesInjectionProvider.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentResourcesInjectionProvider.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentResourcesInjectionProvider.java Sat Dec 30 15:06:09 2006
@@ -12,41 +12,39 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.internal.services;
-
-import static java.lang.String.format;
-
-import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.ioc.ServiceLocator;
-import org.apache.tapestry.model.MutableComponentModel;
-import org.apache.tapestry.services.ClassTransformation;
+package org.apache.tapestry.internal.services;
+
+import static java.lang.String.format;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.model.MutableComponentModel;
+import org.apache.tapestry.services.ClassTransformation;
import org.apache.tapestry.services.InjectionProvider;
-import org.apache.tapestry.services.TransformConstants;
-
-/**
- * Allows for the injection of the component's {@link org.apache.tapestry.ComponentResources}.
- *
- *
- */
-public class ComponentResourcesInjectionProvider implements InjectionProvider
-{
- private static final String COMPONENT_RESOURCES_CLASS_NAME = ComponentResources.class.getName();
-
- public boolean provideInjection(String fieldName, String fieldType, ServiceLocator locator,
- ClassTransformation transformation, MutableComponentModel componentModel)
- {
- if (fieldType.equals(COMPONENT_RESOURCES_CLASS_NAME))
- {
- String body = format("%s = %s;", fieldName, transformation.getResourcesFieldName());
-
- transformation
- .extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
-
- transformation.makeReadOnly(fieldName);
-
- return true;
- }
-
- return false;
- }
-}
+import org.apache.tapestry.services.TransformConstants;
+
+/**
+ * Allows for the injection of the component's {@link org.apache.tapestry.ComponentResources}.
+ */
+public class ComponentResourcesInjectionProvider implements InjectionProvider
+{
+ private static final String COMPONENT_RESOURCES_CLASS_NAME = ComponentResources.class.getName();
+
+ public boolean provideInjection(String fieldName, String fieldType, ServiceLocator locator,
+ ClassTransformation transformation, MutableComponentModel componentModel)
+ {
+ if (fieldType.equals(COMPONENT_RESOURCES_CLASS_NAME))
+ {
+ String body = format("%s = %s;", fieldName, transformation.getResourcesFieldName());
+
+ transformation
+ .extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
+
+ transformation.makeReadOnly(fieldName);
+
+ return true;
+ }
+
+ return false;
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/EnvironmentImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/EnvironmentImpl.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/EnvironmentImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/EnvironmentImpl.java Sat Dec 30 15:06:09 2006
@@ -15,22 +15,22 @@
package org.apache.tapestry.internal.services;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newLinkedList;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
import java.util.LinkedList;
import java.util.Map;
-import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.services.Environment;
/**
- * A non-threadsafe implementation (expects to use the "perthread" service lifecyle.
+ * A non-threadsafe implementation (expects to use the "perthread" service lifecyle).
*/
public class EnvironmentImpl implements Environment
{
// My generics mojo breaks down when we talk about the key and the value being related
// types.
- private final Map<Class, LinkedList> _stacks = CollectionFactory.newMap();
+ private final Map<Class, LinkedList> _stacks = newMap();
@SuppressWarnings("unchecked")
private <T> LinkedList<T> stackFor(Class<T> type)
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java (from r491071, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectWorker.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java?view=diff&rev=491342&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectWorker.java&r1=491071&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java Sat Dec 30 15:06:09 2006
@@ -32,13 +32,13 @@
*
* @see AssetSource
*/
-public class AssetInjectWorker implements ComponentClassTransformWorker
+public class InjectAssetWorker implements ComponentClassTransformWorker
{
static final String ASSET_TYPE_NAME = Asset.class.getName();
private final AssetSource _assetSource;
- public AssetInjectWorker(final AssetSource assetSource)
+ public InjectAssetWorker(final AssetSource assetSource)
{
_assetSource = assetSource;
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PersistWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PersistWorker.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PersistWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PersistWorker.java Sat Dec 30 15:06:09 2006
@@ -12,124 +12,127 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.internal.services;
-
-import static java.lang.String.format;
-
-import java.lang.reflect.Modifier;
-
-import org.apache.tapestry.annotations.Persist;
+package org.apache.tapestry.internal.services;
+
+import static java.lang.String.format;
+
+import java.lang.reflect.Modifier;
+
+import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.util.BodyBuilder;
-import org.apache.tapestry.model.MutableComponentModel;
-import org.apache.tapestry.services.ClassTransformation;
-import org.apache.tapestry.services.ComponentClassTransformWorker;
-import org.apache.tapestry.services.MethodSignature;
-import org.apache.tapestry.services.PersistentFieldBundle;
-import org.apache.tapestry.services.TransformConstants;
-import org.apache.tapestry.services.TransformUtils;
-
-/**
- * Converts fields with the {@link Persist} annotation into persistent fields.
- */
-public class PersistWorker implements ComponentClassTransformWorker
-{
-
- public void transform(ClassTransformation transformation, MutableComponentModel model)
- {
- for (String name : transformation.findFieldsWithAnnotation(Persist.class))
- {
- makeFieldPersistent(name, transformation, model);
- }
- }
-
- /**
- * Making a field persistent:
- * <ul>
- * <li>Need a secondary default field that stores the initial value</li>
- * <li>Store the active value into the default field when the page finishes loading</li>
- * <li>Roll the active value back to the default when the page detaches</li>
- * <ii>On changes to the active field, post the change via the InternalComponentResources</li>
- * <li>When the page attaches, pull the persisted value for the field out of the
- * {@link PersistentFieldBundle}</li>
- * </ul>
- *
- * @param fieldName
- * @param transformation
- * @param model
- */
- private void makeFieldPersistent(String fieldName, ClassTransformation transformation,
- MutableComponentModel model)
- {
- String fieldType = transformation.getFieldType(fieldName);
- Persist annotation = transformation.getFieldAnnotation(fieldName, Persist.class);
-
- // Record the type of persistence, until needed later.
-
- String logicalFieldName = model.setFieldPersistenceStrategy(fieldName, annotation.value());
-
- String defaultFieldName = transformation.addField(Modifier.PRIVATE, fieldType, fieldName
- + "_default");
-
- transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, format(
- "%s = %s;",
- defaultFieldName,
- fieldName));
-
- transformation.extendMethod(
- TransformConstants.CONTAINING_PAGE_DID_DETACH_SIGNATURE,
- format("%s = %s;", fieldName, defaultFieldName));
-
- String resourcesFieldName = transformation.getResourcesFieldName();
-
- String writeMethodName = transformation.newMemberName("_write_"
- + InternalUtils.stripMemberPrefix(fieldName));
-
- BodyBuilder builder = new BodyBuilder();
-
- builder.begin();
- builder.addln("%s.persistFieldChange(\"%s\", ($w) $1);", resourcesFieldName, logicalFieldName);
- builder.addln("%s = $1;", fieldName);
- builder.end();
-
- transformation.addMethod(new MethodSignature(Modifier.PRIVATE, "void", writeMethodName,
- new String[]
- { fieldType }, null), builder.toString());
-
- transformation.replaceWriteAccess(fieldName, writeMethodName);
-
- builder.clear();
- builder.begin();
-
- // Check to see if there's a recorded change for this component, this field.
-
- builder.addln("if (%s.hasFieldChange(\"%s\"))", resourcesFieldName, logicalFieldName);
-
- String wrapperType = TransformUtils.getWrapperTypeName(fieldType);
-
- // Get the value, cast it to the correct type (or wrapper type)
- builder.add(
- " %s = ((%s) %s.getFieldChange(\"%s\"))",
- fieldName,
- wrapperType,
- resourcesFieldName,
- logicalFieldName);
-
- // For primtive types, add in the method call to unwrap the wrapper type to a primitive type
-
- String unwrapMethodName = TransformUtils.getUnwrapperMethodName(fieldType);
-
- if (unwrapMethodName == null)
- builder.addln(";");
- else
- builder.addln(".%s();", unwrapMethodName);
-
- builder.end();
-
- transformation.extendMethod(
- TransformConstants.CONTAINING_PAGE_DID_ATTACH_SIGNATURE,
- builder.toString());
-
- transformation.claimField(fieldName, annotation);
- }
-}
+import org.apache.tapestry.model.MutableComponentModel;
+import org.apache.tapestry.services.ClassTransformation;
+import org.apache.tapestry.services.ComponentClassTransformWorker;
+import org.apache.tapestry.services.MethodSignature;
+import org.apache.tapestry.services.PersistentFieldBundle;
+import org.apache.tapestry.services.TransformConstants;
+import org.apache.tapestry.services.TransformUtils;
+
+/**
+ * Converts fields with the {@link Persist} annotation into persistent fields.
+ */
+public class PersistWorker implements ComponentClassTransformWorker
+{
+
+ public void transform(ClassTransformation transformation, MutableComponentModel model)
+ {
+ for (String name : transformation.findFieldsWithAnnotation(Persist.class))
+ {
+ makeFieldPersistent(name, transformation, model);
+ }
+ }
+
+ /**
+ * Making a field persistent:
+ * <ul>
+ * <li>Need a secondary default field that stores the initial value</li>
+ * <li>Store the active value into the default field when the page finishes loading</li>
+ * <li>Roll the active value back to the default when the page detaches</li>
+ * <ii>On changes to the active field, post the change via the InternalComponentResources</li>
+ * <li>When the page attaches, pull the persisted value for the field out of the
+ * {@link PersistentFieldBundle}</li>
+ * </ul>
+ *
+ * @param fieldName
+ * @param transformation
+ * @param model
+ */
+ private void makeFieldPersistent(String fieldName, ClassTransformation transformation,
+ MutableComponentModel model)
+ {
+ String fieldType = transformation.getFieldType(fieldName);
+ Persist annotation = transformation.getFieldAnnotation(fieldName, Persist.class);
+
+ // Record the type of persistence, until needed later.
+
+ String logicalFieldName = model.setFieldPersistenceStrategy(fieldName, annotation.value());
+
+ String defaultFieldName = transformation.addField(Modifier.PRIVATE, fieldType, fieldName
+ + "_default");
+
+ transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, format(
+ "%s = %s;",
+ defaultFieldName,
+ fieldName));
+
+ transformation.extendMethod(
+ TransformConstants.CONTAINING_PAGE_DID_DETACH_SIGNATURE,
+ format("%s = %s;", fieldName, defaultFieldName));
+
+ String resourcesFieldName = transformation.getResourcesFieldName();
+
+ String writeMethodName = transformation.newMemberName("_write_"
+ + InternalUtils.stripMemberPrefix(fieldName));
+
+ BodyBuilder builder = new BodyBuilder();
+
+ builder.begin();
+ builder.addln(
+ "%s.persistFieldChange(\"%s\", ($w) $1);",
+ resourcesFieldName,
+ logicalFieldName);
+ builder.addln("%s = $1;", fieldName);
+ builder.end();
+
+ transformation.addMethod(new MethodSignature(Modifier.PRIVATE, "void", writeMethodName,
+ new String[]
+ { fieldType }, null), builder.toString());
+
+ transformation.replaceWriteAccess(fieldName, writeMethodName);
+
+ builder.clear();
+ builder.begin();
+
+ // Check to see if there's a recorded change for this component, this field.
+
+ builder.addln("if (%s.hasFieldChange(\"%s\"))", resourcesFieldName, logicalFieldName);
+
+ String wrapperType = TransformUtils.getWrapperTypeName(fieldType);
+
+ // Get the value, cast it to the correct type (or wrapper type)
+ builder.add(
+ " %s = ((%s) %s.getFieldChange(\"%s\"))",
+ fieldName,
+ wrapperType,
+ resourcesFieldName,
+ logicalFieldName);
+
+ // For primtive types, add in the method call to unwrap the wrapper type to a primitive type
+
+ String unwrapMethodName = TransformUtils.getUnwrapperMethodName(fieldType);
+
+ if (unwrapMethodName == null)
+ builder.addln(";");
+ else
+ builder.addln(".%s();", unwrapMethodName);
+
+ builder.end();
+
+ transformation.extendMethod(
+ TransformConstants.CONTAINING_PAGE_DID_ATTACH_SIGNATURE,
+ builder.toString());
+
+ transformation.claimField(fieldName, annotation);
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Request.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Request.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Request.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Request.java Sat Dec 30 15:06:09 2006
@@ -33,14 +33,14 @@
/**
* Returns the parameter values for the given name. Returns null if no such parameter is in the
* request.
+ * <p>
+ * TODO: Shouldn't this move to {@link FormParameterLookup}?
*/
String[] getParameters(String name);
/**
* Returns the path portion of the request, which starts with a "/" and contains everything up
* to the start of the query parameters. It doesn't include the context path.
- *
- * @return
*/
String getPath();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java Sat Dec 30 15:06:09 2006
@@ -43,12 +43,12 @@
import org.apache.tapestry.internal.bindings.ComponentBindingFactory;
import org.apache.tapestry.internal.bindings.LiteralBindingFactory;
import org.apache.tapestry.internal.bindings.MessageBindingFactory;
-import org.apache.tapestry.internal.bindings.ValidatorBindingFactory;
+import org.apache.tapestry.internal.bindings.ValidateBindingFactory;
import org.apache.tapestry.internal.services.ActionLinkHandler;
import org.apache.tapestry.internal.services.ActionLinkHandlerImpl;
import org.apache.tapestry.internal.services.ApplicationGlobalsImpl;
import org.apache.tapestry.internal.services.AssetDispatcher;
-import org.apache.tapestry.internal.services.AssetInjectWorker;
+import org.apache.tapestry.internal.services.InjectAssetWorker;
import org.apache.tapestry.internal.services.AssetSourceImpl;
import org.apache.tapestry.internal.services.BindingSourceImpl;
import org.apache.tapestry.internal.services.ClasspathAssetAliasManagerImpl;
@@ -127,6 +127,7 @@
import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.ioc.util.StrategyRegistry;
import org.apache.tapestry.runtime.Component;
+import org.apache.tapestry.validator.Required;
/**
* The root module for Tapestry.
@@ -518,7 +519,7 @@
/**
* Contributes the factory for serveral built-in binding prefixes ("literal", prop", "component"
- * "message" and "validator").
+ * "message" and "validate").
*/
public static void contributeBindingSource(
MappedConfiguration<String, BindingFactory> configuration,
@@ -530,7 +531,7 @@
configuration.add(InternalConstants.PROP_BINDING_PREFIX, propBindingFactory);
configuration.add("component", new ComponentBindingFactory());
configuration.add("message", new MessageBindingFactory());
- configuration.add("validator", new ValidatorBindingFactory(fieldValidatorSource));
+ configuration.add("validate", new ValidateBindingFactory(fieldValidatorSource));
}
/**
@@ -541,7 +542,6 @@
@InjectService("tapestry.internal.ComponentInstantiatorSource")
ComponentInstantiatorSource source)
{
-
return _shadowBuilder.build(source, "classFactory", ClassFactory.class);
}
@@ -560,6 +560,7 @@
* Contributes the elemental providers:
* <ul>
* <li>ComponentResources -- give component access to its resources</li>
+ * <li>CommonResources -- access to properties of resources (log, messages, etc.)</li>
* <li>Default -- looks for a unique IoC service that matches the field type</li>
* </ul>
*/
@@ -567,9 +568,7 @@
OrderedConfiguration<InjectionProvider> configuration)
{
configuration.add("ComponentResources", new ComponentResourcesInjectionProvider());
- configuration.add(
- "CommonResourcesInjectionProvider",
- new CommonResourcesInjectionProvider());
+ configuration.add("CommonResources", new CommonResourcesInjectionProvider());
configuration.add("Default", new DefaultInjectionProvider(), "after:*.*");
}
@@ -615,10 +614,8 @@
"InjectAnonymous",
new InjectAnonymousWorker(locator, injectionProvider),
"after:InjectNamed");
- configuration.add("AssetInject", new AssetInjectWorker(assetSource), "before:InjectNamed");
+ configuration.add("InjectAsset", new InjectAssetWorker(assetSource), "before:InjectNamed");
configuration.add("MixinAfter", new MixinAfterWorker());
-
- configuration.add("Parameter", new ParameterWorker(bindingsource));
configuration.add("Component", new ComponentWorker(resolver));
configuration.add("Environment", new EnvironmentalWorker(environment));
configuration.add("Mixin", new MixinWorker(resolver));
@@ -627,6 +624,11 @@
configuration.add("InjectPage", new InjectPageWorker(requestPageCache));
configuration.add("InjectComponent", new InjectComponentWorker());
+ // Default values for parameters are often some form of injection, so make sure
+ // that Parameter fields are processed after injections.
+
+ configuration.add("Parameter", new ParameterWorker(bindingsource), "after:Inject*");
+
// Workers for the component rendering state machine methods; this is in typical
// execution order.
@@ -830,7 +832,7 @@
public void contributeValidationMessagesSource(Configuration<String> configuration)
{
- configuration.add("org/apache/tapestry/internal/ValidatonMessages");
+ configuration.add("org/apache/tapestry/internal/ValidationMessages");
}
public static AssetSource buildAssetSource(Map<String, AssetFactory> configuration)
@@ -871,5 +873,17 @@
TypeCoercer typeCoercer, Map<String, Validator> configuration)
{
return new FieldValidatorSourceImpl(messagesSource, typeCoercer, configuration);
+ }
+
+ /**
+ * Contributes the basic set of validators:
+ * <ul>
+ * <li>required</li>
+ * </ul>
+ */
+ public static void contributeFieldValidatorSource(
+ MappedConfiguration<String, Validator> configuration)
+ {
+ configuration.add("required", new Required());
}
}
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/Required.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/Required.java?view=auto&rev=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/Required.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/validator/Required.java Sat Dec 30 15:06:09 2006
@@ -0,0 +1,40 @@
+// Copyright 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.
+// 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.tapestry.validator;
+
+import org.apache.tapestry.Field;
+import org.apache.tapestry.ValidationException;
+import org.apache.tapestry.Validator;
+import org.apache.tapestry.ioc.Messages;
+
+/**
+ * A validator that enforces that the value is not null and not the empty string. This validator is
+ * not configurable.
+ */
+public class Required implements Validator<Void, Object>
+{
+ public void check(Field field, Void constraintValue, Messages messages, Object value)
+ throws ValidationException
+ {
+ if (value == null || value.toString().equals(""))
+ throw new ValidationException(messages.format("required", field.getLabel()));
+ }
+
+ public Class<Void> getConstraintType()
+ {
+ return null;
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/ComponentStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/ComponentStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/ComponentStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/ComponentStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,15 +1,16 @@
-# Copyright 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.
-# 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.
-
-component-action-not-serializable=Error serializing component action for component %s: %s
\ No newline at end of file
+# Copyright 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.
+# 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.
+
+component-action-not-serializable=Error serializing component action for component %s: %s
+enclose-errors-in-form=The Errors component must be enclosed by a Form component.
\ No newline at end of file
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/Errors.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/Errors.properties?view=auto&rev=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/Errors.properties (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/Errors.properties Sat Dec 30 15:06:09 2006
@@ -0,0 +1,15 @@
+# Copyright 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.
+# 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.
+
+default-banner=You must correct the following errors before you may continue.
\ No newline at end of file
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/bindings/BindingsStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/bindings/BindingsStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/bindings/BindingsStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/bindings/BindingsStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,19 +1,19 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
binding-is-read-only=Binding %s is read-only.
binding-is-write-only=Binding %s is write-only.
no-such-property=Class %s does not contain a property named '%s' (within property path '%s').
write-only-property=Property '%s' of class %s (within property path '%s') is not readable (it has no read accessor method).
-validator-binding-for-fields-only=Component '%s' is not a field (it does not implement the Field interface) and may not be used with the validator: binding prefix.
+validate-binding-for-fields-only=Component '%s' is not a field (it does not implement the Field interface) and may not be used with the validate: binding prefix.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/model/ModelStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/model/ModelStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/model/ModelStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/model/ModelStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,17 +1,17 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
duplicate-parameter=Parameter '%s' of component %s is already defined.
duplicate-parameter-value=A value for parameter '%s' of embedded component %s (of component class %s) has already been provided.
duplicate-component-id=Embedded component '%s' has already been defined for component class %s.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,17 +1,17 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
duplicate-contribution=Contribution %s (as '%s') duplicates existing contribution %s and has been ignored.
infrastructure-mode-not-set=The infrastructure mode has not been set. Unable to determine the correct set of infrastructure properties.
infrastructure-property-not-found=No infrastructure property '%s' has been configured. Configured properties are: %s.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,17 +1,17 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
missing-parameters=Parameter(s) %s are required for %s, but have not been bound.
no-such-component=Component %s does not contain an embedded component with id '%s'.
get-parameter-failure=Failure reading parameter %s of component %s: %s
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,17 +1,17 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
unable-to-read-last-modified=Unable to read last modified time stamp of resource %s: %s
no-return-value-accepted=Event '%s' from %s received an event handler method return value of %s from %s. \
This type of event does not support return values from event handler methods.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/runtime/RuntimeStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/runtime/RuntimeStrings.properties?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/runtime/RuntimeStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/runtime/RuntimeStrings.properties Sat Dec 30 15:06:09 2006
@@ -1,17 +1,17 @@
-# Copyright 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.
-# 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.
-
+# Copyright 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.
+# 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.
+
wrong-event-result-type=Return value of method %s is not compatible with the expected return type of %s. \
The value has been ignored. \
Further lifecycle methods may be invoked, which is likely to cause incorrect application behavior. \
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt Sat Dec 30 15:06:09 2006
@@ -125,7 +125,7 @@
*------------+----------------------------------------------------------------------------------+
| prop: | The name of a property of the containing component to read or update. |
*------------+----------------------------------------------------------------------------------+
-| validator: | A <validator specification> used to create some number of field validators. |
+| validate: | A <validator specification> used to create some number of field validators. |
*------------+----------------------------------------------------------------------------------+
The default binding prefix is "prop:".
@@ -165,7 +165,7 @@
Validator Bindings
- The "validator:" binding prefix is highly specialized. It allows a short string to be
+ The "validate:" binding prefix is highly specialized. It allows a short string to be
used to create and configure the objects that perform input validation for
form control components, such as TextField and Checkbox.
@@ -174,7 +174,7 @@
in some way: for example, a validator that enforces a minimum string length
needs to know what that minimum string length is. Such values are specified after an equals sign.
- For example: <<<validator:required,minLength=5>>> would presumably enforce that a field
+ For example: <<<validate:required,minLength=5>>> would presumably enforce that a field
requires a value, with at least five characters.
TODO: More ability to escape or quote constraint values. Ability to reference methods
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Sat Dec 30 15:06:09 2006
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 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.
- 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.
--->
-
+<!--
+ Copyright 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.
+ 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.
+-->
+
<project name="Tapestry Core">
<bannerLeft>
<name>Tapestry</name>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/tapestry-formatting.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/tapestry-formatting.xml?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/tapestry-formatting.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/tapestry-formatting.xml Sat Dec 30 15:06:09 2006
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 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.
- 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.
--->
-
+<!--
+ Copyright 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.
+ 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.
+-->
+
<profiles version="10">
<profile name="Tapestry Project" version="10">
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/web.xml?view=diff&rev=491342&r1=491341&r2=491342
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/web.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/web.xml Sat Dec 30 15:06:09 2006
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 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.
- 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.
--->
-
+<!--
+ Copyright 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.
+ 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.
+-->
+
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">