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 2008/02/07 00:20:52 UTC
svn commit: r619218 [1/2] - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry/
tapestry-core/src/main/java/org/apache/tapestry/corelib/base/
tapestry-core/src/main/java/org/apache/tapestry/corelib/components/
tapestry-core/s...
Author: hlship
Date: Wed Feb 6 15:20:48 2008
New Revision: 619218
URL: http://svn.apache.org/viewvc?rev=619218&view=rev
Log:
TAPESTRY-2085: When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/TextFieldWrapperTypeDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/TextFieldWrapperTypeDemo.java
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorDefaultSourceImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorDefaultSource.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorDefaultSourceImplTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Form.xdoc
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/DefaultNullFieldStrategy.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorSourceImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/ByteTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/DoubleTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/FloatTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/IntegerTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/LongTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/StringTranslator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentDefaultProvider.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorSource.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditorTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AnnotationDataTypeAnalyzerTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorSourceImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/StrategyRegistry.java
tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt
tapestry/tapestry5/trunk/tapestry-ioc/src/site/resources/images/type-coercer.png
tapestry/tapestry5/trunk/tapestry-ioc/src/test/conf/testng.xml
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/util/StrategyRegistryTest.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java Wed Feb 6 15:20:48 2008
@@ -37,6 +37,13 @@
String toClient(T value);
/**
+ * Returns the type of the server-side value.
+ *
+ * @return a type
+ */
+ Class<T> getType();
+
+ /**
* Converts a submitted request value into an appropriate server side value.
*
* @param clientValue to convert to a server value; this will not be null, but may be blank
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java Wed Feb 6 15:20:48 2008
@@ -18,9 +18,9 @@
import org.apache.tapestry.annotations.*;
import org.apache.tapestry.corelib.mixins.RenderDisabled;
import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.services.ComponentDefaultProvider;
import org.apache.tapestry.services.FieldValidatorDefaultSource;
import org.apache.tapestry.services.Request;
-import org.apache.tapestry.services.TranslatorDefaultSource;
import java.util.Locale;
@@ -78,9 +78,6 @@
private ValidationTracker _tracker;
@Inject
- private TranslatorDefaultSource _translatorDefaultSource;
-
- @Inject
private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
@Inject
@@ -99,19 +96,16 @@
@Mixin
private RenderDisabled _renderDisabled;
+ @Inject
+ private ComponentDefaultProvider _defaultProvider;
+
/**
- * Computes a default value for the "translate" parameter using {@link TranslatorDefaultSource}.
+ * Computes a default value for the "translate" parameter using
+ * {@link org.apache.tapestry.services.ComponentDefaultProvider#defaultTranslator(String, org.apache.tapestry.ComponentResources)}.
*/
final Translator defaultTranslate()
{
- // Because the value parameter is a principal parameter, we know that it will be bound (even
- // via its default parameter) by the time this method is invoked.
-
- Class type = _resources.getBoundType("value");
-
- if (type == null) return null;
-
- return _translatorDefaultSource.get(type);
+ return _defaultProvider.defaultTranslator("value", _resources);
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Form.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Form.xdoc?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Form.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Form.xdoc Wed Feb 6 15:20:48 2008
@@ -62,7 +62,9 @@
<p>
Examples of the Form component are provided in the many
other pages that discuss specific form control element components,
- such as TextArea.
+ such as
+ <a href="Radio.html">Radio</a>
+ and<a href="TextField.html">TextField</a>.
</p>
</section>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyEditor.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -92,9 +92,6 @@
private BeanModel _model;
@Inject
- private TranslatorDefaultSource _translatorDefaultSource;
-
- @Inject
private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
@Inject
@@ -117,6 +114,9 @@
private PropertyModel _propertyModel;
+ @Inject
+ private TranslatorSource _translatorSource;
+
/**
* Creates a {@link PropertyEditContext} and pushes it onto the {@link Environment} stack.
*/
@@ -153,7 +153,7 @@
public Translator getTranslator()
{
- return _translatorDefaultSource.get(_propertyModel.getPropertyType());
+ return _translatorSource.getByType(_propertyModel.getPropertyType());
}
public FieldValidator getValidator(Field field)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/DefaultNullFieldStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/DefaultNullFieldStrategy.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/DefaultNullFieldStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/DefaultNullFieldStrategy.java Wed Feb 6 15:20:48 2008
@@ -34,6 +34,6 @@
*/
public String replaceFromClient()
{
- return "";
+ return null;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImpl.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImpl.java Wed Feb 6 15:20:48 2008
@@ -14,10 +14,7 @@
package org.apache.tapestry.internal.services;
-import org.apache.tapestry.Binding;
-import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.TapestryConstants;
-import org.apache.tapestry.ValueEncoder;
+import org.apache.tapestry.*;
import org.apache.tapestry.internal.TapestryInternalUtils;
import org.apache.tapestry.ioc.Messages;
import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
@@ -26,6 +23,7 @@
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.services.BindingSource;
import org.apache.tapestry.services.ComponentDefaultProvider;
+import org.apache.tapestry.services.TranslatorSource;
import org.apache.tapestry.services.ValueEncoderSource;
public class ComponentDefaultProviderImpl implements ComponentDefaultProvider
@@ -36,12 +34,15 @@
private final ValueEncoderSource _valueEncoderSource;
+ private final TranslatorSource _translatorSource;
+
public ComponentDefaultProviderImpl(PropertyAccess propertyAccess, BindingSource bindingSource,
- ValueEncoderSource valueEncoderSource)
+ ValueEncoderSource valueEncoderSource, TranslatorSource translatorSource)
{
_propertyAccess = propertyAccess;
_bindingSource = bindingSource;
_valueEncoderSource = valueEncoderSource;
+ _translatorSource = translatorSource;
}
public String defaultLabel(ComponentResources resources)
@@ -93,5 +94,17 @@
if (parameterType == null) return null;
return _valueEncoderSource.getValueEncoder(parameterType);
+ }
+
+ public Translator defaultTranslator(String parameterName, ComponentResources resources)
+ {
+ notBlank(parameterName, "parameterName");
+ notNull(resources, "resources");
+
+ Class type = resources.getBoundType(parameterName);
+
+ if (type == null) return null;
+
+ return _translatorSource.findByType(type);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java Wed Feb 6 15:20:48 2008
@@ -20,6 +20,7 @@
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.Defense;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.ioc.util.ExceptionUtils;
import org.apache.tapestry.services.ValidationMessagesSource;
@@ -31,9 +32,12 @@
private final ValidationMessagesSource _messagesSource;
- public FieldValidationSupportImpl(ValidationMessagesSource messagesSource)
+ private final TypeCoercer _typeCoercer;
+
+ public FieldValidationSupportImpl(ValidationMessagesSource messagesSource, TypeCoercer typeCoercer)
{
_messagesSource = messagesSource;
+ _typeCoercer = typeCoercer;
}
@SuppressWarnings({"unchecked"})
@@ -69,14 +73,20 @@
Object effectiveValue = value;
if (effectiveValue == null)
+ {
effectiveValue = nullFieldStrategy.replaceToClient();
- // We don't translate null.
+ // Don't try to coerce or translate null.
- if (effectiveValue == null)
- return null;
+ if (effectiveValue == null) return null;
+ }
- return translator.toClient(effectiveValue);
+ // And now, whether its a value from a bound property, or from the null field strategy,
+ // get it into the right format for the translator and let it translate.
+
+ Object coerced = _typeCoercer.coerce(effectiveValue, translator.getType());
+
+ return translator.toClient(coerced);
}
@@ -92,12 +102,9 @@
if (InternalUtils.isBlank(effectiveValue))
{
-
effectiveValue = nullFieldStrategy.replaceFromClient();
- if (effectiveValue == null)
- throw new NullPointerException(
- String.format("Client value provided by %s is null.", nullFieldStrategy));
+ if (effectiveValue == null) return null;
}
final Holder<Object> resultHolder = Holder.create();
@@ -145,6 +152,7 @@
throw outerException;
}
+ @SuppressWarnings({"unchecked"})
public void validate(Object value, ComponentResources componentResources, FieldValidator validator)
throws ValidationException
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java Wed Feb 6 15:20:48 2008
@@ -398,4 +398,10 @@
{
return MESSAGES.format("unknown-null-field-strategy-name", name, InternalUtils.joinSorted(names));
}
+
+ public static String noTranslatorForType(Class valueType, Collection<String> typeNames)
+ {
+ return MESSAGES.format("no-translator-for-type", ClassFabUtils.toJavaClassName(valueType),
+ InternalUtils.joinSorted(typeNames));
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorSourceImpl.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/TranslatorSourceImpl.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,18 +15,33 @@
package org.apache.tapestry.internal.services;
import org.apache.tapestry.Translator;
+import org.apache.tapestry.internal.events.InvalidationListener;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.ioc.util.StrategyRegistry;
import org.apache.tapestry.services.TranslatorSource;
+import java.util.List;
import java.util.Map;
-public class TranslatorSourceImpl implements TranslatorSource
+public class TranslatorSourceImpl implements TranslatorSource, InvalidationListener
{
private final Map<String, Translator> _translators;
+ private final StrategyRegistry<Translator> _registry;
+
public TranslatorSourceImpl(final Map<String, Translator> translators)
{
_translators = translators;
+
+ Map<Class, Translator> typeToTranslator = CollectionFactory.newMap();
+
+ for (Translator t : translators.values())
+ {
+ typeToTranslator.put(t.getType(), t);
+ }
+
+ _registry = StrategyRegistry.newInstance(Translator.class, typeToTranslator);
}
public Translator get(String name)
@@ -41,4 +56,33 @@
return result;
}
+ public Translator getByType(Class valueType)
+ {
+ Translator result = _registry.get(valueType);
+
+ if (result == null)
+ {
+
+ List<String> names = CollectionFactory.newList();
+
+ for (Class type : _registry.getTypes())
+ {
+ names.add(type.getName());
+ }
+
+ throw new IllegalArgumentException(ServicesMessages.noTranslatorForType(valueType, names));
+ }
+
+ return result;
+ }
+
+ public Translator findByType(Class valueType)
+ {
+ return _registry.get(valueType);
+ }
+
+ public void objectWasInvalidated()
+ {
+ _registry.clearCache();
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/ByteTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/ByteTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/ByteTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/ByteTranslator.java Wed Feb 6 15:20:48 2008
@@ -25,6 +25,11 @@
return value.toString();
}
+ public Class<Byte> getType()
+ {
+ return Byte.class;
+ }
+
public Byte parseClient(String clientValue, Messages messages) throws ValidationException
{
try
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/DoubleTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/DoubleTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/DoubleTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/DoubleTranslator.java Wed Feb 6 15:20:48 2008
@@ -44,4 +44,9 @@
{
return value.toString();
}
+
+ public Class<Double> getType()
+ {
+ return Double.class;
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/FloatTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/FloatTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/FloatTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/FloatTranslator.java Wed Feb 6 15:20:48 2008
@@ -20,6 +20,11 @@
public class FloatTranslator implements Translator<Float>
{
+ public Class<Float> getType()
+ {
+ return Float.class;
+ }
+
public String toClient(Float value)
{
return value.toString();
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/IntegerTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/IntegerTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/IntegerTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/IntegerTranslator.java Wed Feb 6 15:20:48 2008
@@ -23,6 +23,11 @@
*/
public final class IntegerTranslator implements Translator<Integer>
{
+ public Class<Integer> getType()
+ {
+ return Integer.class;
+ }
+
/**
* Parses blank values to null, otherwise parses the client value to an integer.
*
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/LongTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/LongTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/LongTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/LongTranslator.java Wed Feb 6 15:20:48 2008
@@ -23,6 +23,11 @@
*/
public class LongTranslator implements Translator<Long>
{
+ public Class<Long> getType()
+ {
+ return Long.class;
+ }
+
/**
* Parses blank values to null, otherwise parses the client value to a long
*
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/StringTranslator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/StringTranslator.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/StringTranslator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/translator/StringTranslator.java Wed Feb 6 15:20:48 2008
@@ -20,6 +20,11 @@
public class StringTranslator implements Translator<String>
{
+ public Class<String> getType()
+ {
+ return String.class;
+ }
+
/**
* Returns the client value (or null, if the client value is blank).
*/
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentDefaultProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentDefaultProvider.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentDefaultProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentDefaultProvider.java Wed Feb 6 15:20:48 2008
@@ -51,4 +51,13 @@
*/
ValueEncoder defaultValueEncoder(String parameterName, ComponentResources resources);
+ /**
+ * Provides a translator based on the bound parameter type, if possible.
+ *
+ * @param parameterName
+ * @param resources
+ * @return the translator, or null
+ */
+ Translator defaultTranslator(String parameterName, ComponentResources resources);
+
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Wed Feb 6 15:20:48 2008
@@ -73,7 +73,6 @@
binder.bind(ApplicationStatePersistenceStrategySource.class,
ApplicationStatePersistenceStrategySourceImpl.class);
binder.bind(BindingSource.class, BindingSourceImpl.class);
- binder.bind(TranslatorSource.class, TranslatorSourceImpl.class);
binder.bind(PersistentFieldManager.class, PersistentFieldManagerImpl.class);
binder.bind(FieldValidatorSource.class, FieldValidatorSourceImpl.class);
binder.bind(ApplicationGlobals.class, ApplicationGlobalsImpl.class);
@@ -543,21 +542,6 @@
configuration.add("Localization", new LocalizationFilter(localizationSetter), "after:ErrorFilter");
}
-
- /**
- * Contributes the basic set of default translators: <ul> <li>String</li> <li>Byte</li> <li>Integer</li>
- * <li>Long</li> <li>Float</li> <li>Double</li> </li>
- */
- public static void contributeTranslatorDefaultSource(MappedConfiguration<Class, Translator> configuration)
- {
- configuration.add(String.class, new StringTranslator());
- configuration.add(Byte.class, new ByteTranslator());
- configuration.add(Integer.class, new IntegerTranslator());
- configuration.add(Long.class, new LongTranslator());
- configuration.add(Float.class, new FloatTranslator());
- configuration.add(Double.class, new DoubleTranslator());
- }
-
/**
* Contributes the basic set of named translators: <ul> <li>string</li> <li>byte</li> <li>integer</li>
* <li>long</li> <li>float</li> <li>double</li> </ul>
@@ -1005,10 +989,10 @@
return service;
}
- public TranslatorDefaultSource buildTranslatorDefaultSource(ServiceResources resources)
+ public TranslatorSource buildTranslatorSource(ServiceResources resources)
{
- TranslatorDefaultSourceImpl service = resources
- .autobuild(TranslatorDefaultSourceImpl.class);
+ TranslatorSourceImpl service = resources
+ .autobuild(TranslatorSourceImpl.class);
_componentInstantiatorSource.addInvalidationListener(service);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorSource.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TranslatorSource.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -29,4 +29,23 @@
* @throws RuntimeException if no translator is configured for the provided name
*/
Translator get(String name);
+
+ /**
+ * Finds a {@link Translator} that is appropriate to the given type, which is usually obtained via {@link
+ * org.apache.tapestry.Binding#getBindingType()}. Performs an inheritanced-based search for the best match.
+ *
+ * @param valueType the type of value for which a default translator is needed
+ * @return the matching translator, or null if no match can be found
+ */
+ Translator findByType(Class valueType);
+
+ /**
+ * Finds a {@link Translator} that is appropriate to the given type, which is usually obtained via {@link
+ * org.apache.tapestry.Binding#getBindingType()}. Performs an inheritanced-based search for the best match.
+ *
+ * @param valueType the type of value for which a default translator is needed
+ * @return the matching translator
+ * @throws IllegalArgumentException if no known validator matches the provided type
+ */
+ Translator getByType(Class valueType);
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java Wed Feb 6 15:20:48 2008
@@ -871,9 +871,9 @@
expect(source.create(beanClass, filterReadOnly, containerResources)).andReturn(model);
}
- protected final void train_getBoundType(ComponentResources resources, Class type)
+ protected final void train_getBoundType(ComponentResources resources, String parameterName, Class type)
{
- expect(resources.getBoundType("object")).andReturn(type);
+ expect(resources.getBoundType(parameterName)).andReturn(type);
}
protected final BeanModel mockBeanModel()
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties Wed Feb 6 15:20:48 2008
@@ -91,3 +91,4 @@
Try increasing the hard limit (symbol tapestry.page-pool.hard-limit) to allow additional instances to be created, \
or increasing the soft wait (symbol tapestry.page-pool.soft-wait) to trade away some throughput for more efficient use of page instances.
unknown-null-field-strategy-name=Unrecognized name '%s' locating a null field strategy. Available strategies: %s.
+no-translator-for-type=No translator is defined for type %s. Registered types: %s.
\ No newline at end of file
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/TextFieldWrapperTypeDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/TextFieldWrapperTypeDemo.tml?rev=619218&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/TextFieldWrapperTypeDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/TextFieldWrapperTypeDemo.tml Wed Feb 6 15:20:48 2008
@@ -0,0 +1,35 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+ <h1>TextField Wrapper Types Demo</h1>
+
+ <p>
+ Demonstrates the use of wrapper types (i.e. java.lang.Integer) with a TextField.
+ </p>
+
+ <t:form>
+ <t:errors/>
+
+ <t:textfield t:id="count" nulls="default"/>
+
+ <br/>
+
+ <input type="submit" value="Continue"/>
+
+ </t:form>
+
+ <hr/>
+
+ <p>
+ Count:
+ <t:if test="countNull">
+ <em id="value">null</em>
+ <t:parameter name="else">
+ <span id="value">${count}</span>
+ </t:parameter>
+ </t:if>
+
+ [<t:actionlink t:id="clear">clear</t:actionlink>]
+
+ </p>
+
+</html>
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
expect(resources.triggerEvent(Form.PREPARE, null, null)).andReturn(false);
- train_getBoundType(resources, RegistrationData.class);
+ train_getBoundType(resources, "object", RegistrationData.class);
replay();
@@ -56,7 +56,7 @@
expect(resources.triggerEvent(Form.PREPARE, null, null)).andReturn(false);
- train_getBoundType(resources, Runnable.class);
+ train_getBoundType(resources, "object", Runnable.class);
train_getCompleteId(resources, "Foo.bar");
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditorTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditorTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditorTest.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
BeanModelSource source = mockBeanModelSource();
BeanModel model = mockBeanModel();
- train_getBoundType(resources, RegistrationData.class);
+ train_getBoundType(resources, "object", RegistrationData.class);
train_getContainerResources(overrides, containerResources);
@@ -62,7 +62,7 @@
ComponentResources resources = mockComponentResources();
Location l = mockLocation();
- train_getBoundType(resources, Runnable.class);
+ train_getBoundType(resources, "object", Runnable.class);
train_getCompleteId(resources, "Foo.bar");
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Wed Feb 6 15:20:48 2008
@@ -1562,4 +1562,33 @@
assertTextPresent(
"Render queue error in BeginRender[RenderPhaseMethodExceptionDemo]: java.sql.SQLException: Simulated JDBC exception while rendering.");
}
+
+ /**
+ * TAPESTRY-2085
+ */
+ @Test
+ public void wrapper_types_with_text_field()
+ {
+ start("TextField Wrapper Types", "clear");
+
+ assertFieldValue("count", "");
+ assertText("value", "null");
+
+ type("count", "0");
+ clickAndWait(SUBMIT);
+
+ assertFieldValue("count", "0");
+ assertText("value", "0");
+
+ type("count", "1");
+ clickAndWait(SUBMIT);
+
+ assertFieldValue("count", "1");
+ assertText("value", "1");
+
+ clickAndWait("link=clear");
+
+ assertFieldValue("count", "");
+ assertText("value", "null");
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java Wed Feb 6 15:20:48 2008
@@ -73,6 +73,8 @@
new Item("instancemixin", "InstanceMixin", "mixin added to a particular component instance"),
+ new Item("TextFieldWrapperTypeDemo", "TextField Wrapper Types",
+ "use of TextField to edit numeric wrapper types (not primitives) "),
new Item("EnvironmentalDemo", "Environmental Annotation Usage",
"Storing and retrieving Environmental values"),
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/TextFieldWrapperTypeDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/TextFieldWrapperTypeDemo.java?rev=619218&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/TextFieldWrapperTypeDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/TextFieldWrapperTypeDemo.java Wed Feb 6 15:20:48 2008
@@ -0,0 +1,37 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// 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.integration.app1.pages;
+
+import org.apache.tapestry.annotations.Persist;
+
+public class TextFieldWrapperTypeDemo
+{
+ @Persist
+ private Integer _count;
+
+ public Integer getCount()
+ {
+ return _count;
+ }
+
+ public void setCount(Integer count)
+ {
+ _count = count;
+ }
+
+ public boolean isCountNull() { return _count == null; }
+
+ void onActionFromClear() { _count = null; }
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AnnotationDataTypeAnalyzerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AnnotationDataTypeAnalyzerTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AnnotationDataTypeAnalyzerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AnnotationDataTypeAnalyzerTest.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -63,10 +63,5 @@
verify();
- }
-
- private PropertyAdapter mockPropertyAdapter()
- {
- return newMock(PropertyAdapter.class);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImplTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentDefaultProviderImplTest.java Wed Feb 6 15:20:48 2008
@@ -17,6 +17,7 @@
import org.apache.tapestry.Binding;
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.TapestryConstants;
+import org.apache.tapestry.Translator;
import org.apache.tapestry.internal.test.InternalBaseTestCase;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.services.ClassPropertyAdapter;
@@ -25,6 +26,7 @@
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.services.BindingSource;
import org.apache.tapestry.services.ComponentDefaultProvider;
+import org.apache.tapestry.services.TranslatorSource;
import org.testng.annotations.Test;
public class ComponentDefaultProviderImplTest extends InternalBaseTestCase
@@ -48,7 +50,7 @@
replay();
- ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null);
+ ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null, null);
assertSame(provider.defaultLabel(resources), message);
@@ -72,7 +74,7 @@
replay();
- ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null);
+ ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null, null);
assertEquals(provider.defaultLabel(resources), "My Field");
@@ -88,8 +90,8 @@
ComponentResources resources = mockComponentResources();
Component container = mockComponent();
- PropertyAccess access = newPropertyAccess();
- ClassPropertyAdapter classPropertyAdapter = newClassPropertyAdapter();
+ PropertyAccess access = mockPropertyAccess();
+ ClassPropertyAdapter classPropertyAdapter = mockClassPropertyAdapter();
BindingSource bindingSource = mockBindingSource();
train_getId(resources, id);
@@ -100,7 +102,8 @@
replay();
- ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null);
+ ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null,
+ null);
assertNull(source.defaultBinding(parameterName, resources));
@@ -116,9 +119,9 @@
ComponentResources resources = mockComponentResources();
Component container = mockComponent();
- PropertyAccess access = newPropertyAccess();
- ClassPropertyAdapter classPropertyAdapter = newClassPropertyAdapter();
- PropertyAdapter propertyAdapter = newPropertyAdapter();
+ PropertyAccess access = mockPropertyAccess();
+ ClassPropertyAdapter classPropertyAdapter = mockClassPropertyAdapter();
+ PropertyAdapter propertyAdapter = mockPropertyAdapter();
BindingSource bindingSource = mockBindingSource();
Binding binding = mockBinding();
ComponentResources containerResources = mockComponentResources();
@@ -141,38 +144,49 @@
replay();
- ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null);
+ ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null,
+ null);
assertSame(source.defaultBinding(parameterName, resources), binding);
verify();
}
- protected final PropertyAdapter newPropertyAdapter()
+ @Test
+ public void default_translator_property_type_is_null()
{
- return newMock(PropertyAdapter.class);
- }
+ TranslatorSource source = mockTranslatorSource();
+ ComponentResources resources = mockComponentResources();
- protected final ClassPropertyAdapter newClassPropertyAdapter()
- {
- return newMock(ClassPropertyAdapter.class);
- }
+ train_getBoundType(resources, "object", null);
- protected final PropertyAccess newPropertyAccess()
- {
- return newMock(PropertyAccess.class);
- }
+ replay();
- protected final void train_getPropertyAdapter(ClassPropertyAdapter classPropertyAdapter,
- String propertyName, PropertyAdapter propertyAdapter)
- {
- expect(classPropertyAdapter.getPropertyAdapter(propertyName)).andReturn(propertyAdapter)
- .atLeastOnce();
+ ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null, source);
+
+ assertNull(provider.defaultTranslator("object", resources));
+
+ verify();
}
- protected final void train_getAdapter(PropertyAccess access, Object object,
- ClassPropertyAdapter classPropertyAdapter)
+ @Test
+ public void default_translator()
{
- expect(access.getAdapter(object)).andReturn(classPropertyAdapter);
+ TranslatorSource source = mockTranslatorSource();
+ ComponentResources resources = mockComponentResources();
+ Translator translator = mockTranslator();
+
+ train_getBoundType(resources, "object", Integer.class);
+
+ expect(source.findByType(Integer.class)).andReturn(translator);
+
+ replay();
+
+ ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null, source);
+
+ assertSame(provider.defaultTranslator("object", resources), translator);
+
+ verify();
}
+
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java Wed Feb 6 15:20:48 2008
@@ -16,17 +16,27 @@
import org.apache.tapestry.*;
import org.apache.tapestry.corelib.internal.InternalMessages;
+import org.apache.tapestry.internal.test.InternalBaseTestCase;
import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.services.ValidationMessagesSource;
-import org.apache.tapestry.test.TapestryTestCase;
import org.easymock.EasyMock;
import org.easymock.IAnswer;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.Locale;
-public class FieldValidationSupportImplTest extends TapestryTestCase
+public class FieldValidationSupportImplTest extends InternalBaseTestCase
{
+ private TypeCoercer _typeCoercer;
+
+ @BeforeClass
+ public void setup()
+ {
+ _typeCoercer = getService(TypeCoercer.class);
+ }
+
@SuppressWarnings({"unchecked"})
@Test
@@ -62,7 +72,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
@@ -95,7 +105,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
@@ -136,7 +146,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
try
{
@@ -173,7 +183,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
try
{
@@ -212,7 +222,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
@@ -225,12 +235,14 @@
@Test
public void to_client_via_translator()
{
- Object value = new Object();
+ Object value = new Integer(99);
ComponentResources resources = mockComponentResources();
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
+ expect(translator.getType()).andReturn(Integer.class);
+
String clientValue = "abracadabra";
EasyMock.expect(resources.triggerEvent(EasyMock.eq(FieldValidationSupportImpl.TO_CLIENT_EVENT),
@@ -241,7 +253,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
String actual = support.toClient(value, resources, translator, nullFieldStrategy);
@@ -281,7 +293,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, null);
String actual = support.toClient(value, resources, translator, nullFieldStrategy);
@@ -319,7 +331,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, null);
try
{
@@ -358,7 +370,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
support.validate(value, resources, fv);
@@ -388,7 +400,7 @@
replay();
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ FieldValidationSupport support = new FieldValidationSupportImpl(source, _typeCoercer);
try
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorSourceImplTest.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorSourceImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TranslatorSourceImplTest.java Wed Feb 6 15:20:48 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,21 +15,39 @@
package org.apache.tapestry.internal.services;
import org.apache.tapestry.Translator;
+import org.apache.tapestry.ValidationException;
import org.apache.tapestry.internal.test.InternalBaseTestCase;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.services.TranslatorSource;
+import org.apache.tapestry.services.ValidationMessagesSource;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Collections;
+import java.util.Locale;
import java.util.Map;
public class TranslatorSourceImplTest extends InternalBaseTestCase
{
+ private TranslatorSource _source;
+ private ValidationMessagesSource _messagesSource;
+
+ @BeforeClass
+ public void setup()
+ {
+ _source = getService(TranslatorSource.class);
+ _messagesSource = getService(ValidationMessagesSource.class);
+ }
+
+
@Test
public void found_translator_by_name()
{
Translator translator = mockTranslator();
+ train_getType(translator, String.class);
+
Map<String, Translator> configuration = Collections.singletonMap("mock", translator);
replay();
@@ -41,12 +59,20 @@
verify();
}
+ protected final void train_getType(Translator translator, Class type)
+ {
+ expect(translator.getType()).andReturn(type).atLeastOnce();
+ }
+
@Test
public void unknown_translator_is_failure()
{
Translator fred = mockTranslator();
Translator barney = mockTranslator();
+ train_getType(fred, Long.class);
+ train_getType(barney, String.class);
+
Map<String, Translator> configuration = CollectionFactory.newMap();
configuration.put("fred", fred);
@@ -66,6 +92,103 @@
assertEquals(
ex.getMessage(),
"Unknown translator type 'wilma'. Configured translators are barney, fred.");
+ }
+
+ }
+
+
+ @DataProvider(name = "to_client_data")
+ public Object[][] to_client_data()
+ {
+ return new Object[][]{
+
+ {Byte.class, (byte) 65, "65"},
+
+ {Integer.class, 997, "997"},
+
+ {Long.class, 12345l, "12345"},
+
+ {Double.class, 123.45d, "123.45"},
+
+ {String.class, "abcd", "abcd"},
+
+ {Float.class, (float) -22.7, "-22.7"}
+
+ };
+ }
+
+ @Test(dataProvider = "to_client_data")
+ public void to_client(Class type, Object value, String expected)
+ {
+ Translator t = _source.getByType(type);
+
+ String actual = t.toClient(value);
+
+ assertEquals(actual, expected);
+ }
+
+ @DataProvider(name = "parse_client_success_data")
+ public Object[][] parse_client_success_data()
+ {
+ return new Object[][]{
+
+ {Byte.class, " 23 ", (byte) 23},
+
+ {Integer.class, " 123 ", 123},
+
+ {Long.class, " -1234567 ", -1234567l},
+
+ {Double.class, " 3.14 ", 3.14d},
+
+ {String.class, " abcdef ", " abcdef "},
+
+ {Float.class, " 28.95 ", (float) 28.95},
+
+ };
+ }
+
+ @Test(dataProvider = "parse_client_success_data")
+ public void parse_client(Class type, String input, Object expected) throws Exception
+ {
+ Translator t = _source.getByType(type);
+
+ Object actual = t.parseClient(input, _messagesSource.getValidationMessages(Locale.ENGLISH));
+
+ assertEquals(actual, expected);
+ }
+
+ @DataProvider(name = "parse_client_failure_data")
+ public Object[][] parse_client_failure_data()
+ {
+ return new Object[][]{
+
+ {Byte.class, "fred", "The input value 'fred' is not parseable as an integer value."},
+
+ {Integer.class, "fred", "The input value 'fred' is not parseable as an integer value."},
+
+ {Long.class, "fred", "The input value 'fred' is not parseable as an integer value."},
+
+ {Double.class, "fred", "The input value 'fred' is not parseable as a numeric value."},
+
+ {Float.class, "fred", "The input value 'fred' is not parseable as a numeric value."}
+
+ };
+ }
+
+ @Test(dataProvider = "parse_client_failure_data")
+ public void parse_client_failure(Class type, String input, String expectedMessage)
+ {
+
+ Translator t = _source.getByType(type);
+
+ try
+ {
+ t.parseClient(input, _messagesSource.getValidationMessages(Locale.ENGLISH));
+ unreachable();
+ }
+ catch (ValidationException ex)
+ {
+ assertEquals(ex.getMessage(), expectedMessage);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java Wed Feb 6 15:20:48 2008
@@ -30,6 +30,9 @@
import org.apache.tapestry.ioc.internal.InternalRegistry;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
import org.apache.tapestry.ioc.internal.util.MessagesImpl;
+import org.apache.tapestry.ioc.services.ClassPropertyAdapter;
+import org.apache.tapestry.ioc.services.PropertyAccess;
+import org.apache.tapestry.ioc.services.PropertyAdapter;
import org.apache.tapestry.ioc.services.SymbolProvider;
import org.apache.tapestry.model.ComponentModel;
import org.apache.tapestry.model.EmbeddedComponentModel;
@@ -38,6 +41,7 @@
import org.apache.tapestry.services.ComponentClassResolver;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.TapestryModule;
+import org.apache.tapestry.services.TranslatorSource;
import org.apache.tapestry.test.TapestryTestCase;
import org.easymock.EasyMock;
import static org.easymock.EasyMock.eq;
@@ -606,5 +610,23 @@
protected final void train_getCount(EventContext context, int count)
{
expect(context.getCount()).andReturn(count).atLeastOnce();
+ }
+
+ protected final TranslatorSource mockTranslatorSource()
+ {
+ return newMock(TranslatorSource.class);
+ }
+
+ protected final void train_getPropertyAdapter(ClassPropertyAdapter classPropertyAdapter,
+ String propertyName, PropertyAdapter propertyAdapter)
+ {
+ expect(classPropertyAdapter.getPropertyAdapter(propertyName)).andReturn(propertyAdapter)
+ .atLeastOnce();
+ }
+
+ protected final void train_getAdapter(PropertyAccess access, Object object,
+ ClassPropertyAdapter classPropertyAdapter)
+ {
+ expect(access.getAdapter(object)).andReturn(classPropertyAdapter);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle?rev=619218&r1=619217&r2=619218&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle Wed Feb 6 15:20:48 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ActiveLayerIndex</key>
@@ -7,7 +7,7 @@
<key>ApplicationVersion</key>
<array>
<string>com.omnigroup.OmniGraffle</string>
- <string>129.15</string>
+ <string>129.18</string>
</array>
<key>AutoAdjust</key>
<true/>
@@ -36,69 +36,7 @@
<array>
<dict>
<key>Bounds</key>
- <string>{{165, 558}, {54, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>ID</key>
- <integer>78</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 File}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{300.5, 132.6}, {61, 36}}</string>
+ <string>{{161.5, 168.6}, {61, 36}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -150,8 +88,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica-Oblique;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -164,189 +102,14 @@
<key>Head</key>
<dict>
<key>ID</key>
- <integer>71</integer>
- </dict>
- <key>ID</key>
- <integer>77</integer>
- <key>Points</key>
- <array>
- <string>{302.25, 163.7}</string>
- <string>{253.503, 185.912}</string>
- </array>
- <key>Style</key>
- <dict>
- <key>stroke</key>
- <dict>
- <key>HeadArrow</key>
- <string>FilledArrow</string>
- <key>LineType</key>
- <integer>1</integer>
- <key>TailArrow</key>
- <string>0</string>
- <key>Width</key>
- <real>4</real>
- </dict>
- </dict>
- <key>Tail</key>
- <dict>
- <key>ID</key>
- <integer>65</integer>
- </dict>
- </dict>
- <dict>
- <key>Class</key>
- <string>LineGraphic</string>
- <key>Head</key>
- <dict>
- <key>ID</key>
- <integer>70</integer>
- </dict>
- <key>ID</key>
- <integer>76</integer>
- <key>Points</key>
- <array>
- <string>{299.5, 150.6}</string>
- <string>{244, 150.6}</string>
- </array>
- <key>Style</key>
- <dict>
- <key>stroke</key>
- <dict>
- <key>HeadArrow</key>
- <string>FilledArrow</string>
- <key>LineType</key>
- <integer>1</integer>
- <key>TailArrow</key>
- <string>0</string>
- <key>Width</key>
- <real>4</real>
- </dict>
- </dict>
- <key>Tail</key>
- <dict>
- <key>ID</key>
- <integer>65</integer>
- </dict>
- </dict>
- <dict>
- <key>Class</key>
- <string>LineGraphic</string>
- <key>Head</key>
- <dict>
- <key>ID</key>
- <integer>68</integer>
- </dict>
- <key>ID</key>
- <integer>75</integer>
- <key>Points</key>
- <array>
- <string>{301.99, 138.037}</string>
- <string>{254.315, 117.392}</string>
- </array>
- <key>Style</key>
- <dict>
- <key>stroke</key>
- <dict>
- <key>HeadArrow</key>
- <string>FilledArrow</string>
- <key>LineType</key>
- <integer>1</integer>
- <key>TailArrow</key>
- <string>0</string>
- <key>Width</key>
- <real>4</real>
- </dict>
- </dict>
- <key>Tail</key>
- <dict>
- <key>ID</key>
- <integer>65</integer>
- </dict>
- </dict>
- <dict>
- <key>Class</key>
- <string>LineGraphic</string>
- <key>Head</key>
- <dict>
- <key>ID</key>
- <integer>67</integer>
- </dict>
- <key>ID</key>
- <integer>74</integer>
- <key>Points</key>
- <array>
- <string>{359.604, 163.983}</string>
- <string>{411.956, 188.476}</string>
- </array>
- <key>Style</key>
- <dict>
- <key>stroke</key>
- <dict>
- <key>HeadArrow</key>
- <string>FilledArrow</string>
- <key>LineType</key>
- <integer>1</integer>
- <key>TailArrow</key>
- <string>0</string>
- <key>Width</key>
- <real>4</real>
- </dict>
- </dict>
- <key>Tail</key>
- <dict>
- <key>ID</key>
- <integer>65</integer>
- </dict>
- </dict>
- <dict>
- <key>Class</key>
- <string>LineGraphic</string>
- <key>Head</key>
- <dict>
- <key>ID</key>
- <integer>69</integer>
- </dict>
- <key>ID</key>
- <integer>73</integer>
- <key>Points</key>
- <array>
- <string>{362.5, 150.6}</string>
- <string>{411.5, 150.6}</string>
- </array>
- <key>Style</key>
- <dict>
- <key>stroke</key>
- <dict>
- <key>HeadArrow</key>
- <string>FilledArrow</string>
- <key>LineType</key>
- <integer>1</integer>
- <key>TailArrow</key>
- <string>0</string>
- <key>Width</key>
- <real>4</real>
- </dict>
- </dict>
- <key>Tail</key>
- <dict>
- <key>ID</key>
- <integer>65</integer>
- </dict>
- </dict>
- <dict>
- <key>Class</key>
- <string>LineGraphic</string>
- <key>Head</key>
- <dict>
- <key>ID</key>
- <integer>66</integer>
+ <integer>42</integer>
</dict>
<key>ID</key>
- <integer>72</integer>
+ <integer>80</integer>
<key>Points</key>
<array>
- <string>{359.878, 137.76}</string>
- <string>{414.122, 113.64}</string>
+ <string>{167.455, 204.571}</string>
+ <string>{102.33, 252.254}</string>
</array>
<key>Style</key>
<dict>
@@ -370,11 +133,11 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{46.5, 472.8}, {61, 36}}</string>
+ <string>{{165, 558}, {54, 36}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
- <integer>48</integer>
+ <integer>78</integer>
<key>Shape</key>
<string>RoundRect</string>
<key>Style</key>
@@ -422,33 +185,21 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-\f0\fs24 \cf0 Object}</string>
+\f0\fs24 \cf0 File}</string>
</dict>
</dict>
<dict>
<key>Bounds</key>
- <string>{{171, 185}, {90, 36}}</string>
+ <string>{{46.5, 472.8}, {61, 36}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
- <key>FontInfo</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>0</string>
- <key>r</key>
- <string>0</string>
- </dict>
- </dict>
<key>ID</key>
- <integer>71</integer>
+ <integer>48</integer>
<key>Shape</key>
<string>RoundRect</string>
<key>Style</key>
@@ -496,349 +247,12 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-\f0\fs24 \cf0 BigInteger}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{189, 132.6}, {54, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>ID</key>
- <integer>70</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 Long}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{412.5, 132.6}, {61, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>FontInfo</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>w</key>
- <string>0</string>
- </dict>
- <key>Font</key>
- <string>Helvetica</string>
- <key>NSKern</key>
- <real>0.0</real>
- <key>Size</key>
- <real>12</real>
- </dict>
- <key>ID</key>
- <integer>69</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 \expnd0\expndtw0\kerning0
-Double}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{171, 82.8}, {90, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>FontInfo</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>0</string>
- <key>r</key>
- <string>0</string>
- </dict>
- </dict>
- <key>ID</key>
- <integer>68</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 BigDecimal}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{409, 185}, {68, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>ID</key>
- <integer>67</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 Boolean}</string>
- </dict>
- </dict>
- <dict>
- <key>Bounds</key>
- <string>{{412.5, 82.8}, {61, 36}}</string>
- <key>Class</key>
- <string>ShapedGraphic</string>
- <key>ID</key>
- <integer>66</integer>
- <key>Shape</key>
- <string>RoundRect</string>
- <key>Style</key>
- <dict>
- <key>fill</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.721691</string>
- <key>g</key>
- <string>0.996139</string>
- <key>r</key>
- <string>1</string>
- </dict>
- <key>FillType</key>
- <integer>2</integer>
- <key>GradientColor</key>
- <dict>
- <key>b</key>
- <string>0</string>
- <key>g</key>
- <string>1</string>
- <key>r</key>
- <string>1</string>
- </dict>
- </dict>
- <key>stroke</key>
- <dict>
- <key>Color</key>
- <dict>
- <key>b</key>
- <string>0.156298</string>
- <key>g</key>
- <string>0.676951</string>
- <key>r</key>
- <string>0.684443</string>
- </dict>
- <key>CornerRadius</key>
- <real>6</real>
- <key>Width</key>
- <real>2</real>
- </dict>
- </dict>
- <key>Text</key>
- <dict>
- <key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 List}</string>
+\f0\fs24 \cf0 Object}</string>
</dict>
</dict>
<dict>
@@ -907,8 +321,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -969,8 +383,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1031,8 +445,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1128,8 +542,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1260,8 +674,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1336,8 +750,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1399,8 +813,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1461,8 +875,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1523,8 +937,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1585,8 +999,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1659,8 +1073,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1721,8 +1135,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1795,8 +1209,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -1871,8 +1285,8 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf949
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -2544,7 +1958,7 @@
</dict>
</array>
<key>ModificationDate</key>
- <string>2007-10-13 12:54:58 -0700</string>
+ <string>2008-02-06 10:47:28 -0800</string>
<key>Modifier</key>
<string>Howard Lewis Ship</string>
<key>NotesVisible</key>
@@ -2561,13 +1975,13 @@
<dict>
<key>NSBottomMargin</key>
<array>
- <string>float</string>
- <string>0</string>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFklwCG</string>
</array>
<key>NSLeftMargin</key>
<array>
- <string>float</string>
- <string>0</string>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFklwCG</string>
</array>
<key>NSPaperSize</key>
<array>
@@ -2576,13 +1990,13 @@
</array>
<key>NSRightMargin</key>
<array>
- <string>float</string>
- <string>0</string>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFklwCG</string>
</array>
<key>NSTopMargin</key>
<array>
- <string>float</string>
- <string>0</string>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFklwCG</string>
</array>
</dict>
<key>ReadOnly</key>