[prev in list] [next in list] [prev in thread] [next in thread]
List: tapestry-dev
Subject: svn commit: r480770 - in /tapestry/tapestry5/tapestry-core/trunk/src:
From: hlship () apache ! org
Date: 2006-11-29 23:44:09
Message-ID: 20061129234411.09AE41A9846 () eris ! apache ! org
[Download RAW message or body]
Author: hlship
Date: Wed Nov 29 15:44:05 2006
New Revision: 480770
URL: http://svn.apache.org/viewvc?view=rev&rev=480770
Log:
Add support for injecting Messages (obtained from the ComponentMessagesSource) into \
components.
Added:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/CommonResourcesInjectionProvider.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.html
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.properties
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageElementFactoryImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PageElementFactoryImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImplTest.java
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/ComponentResources.java?view=diff&rev=480770&r1=480769&r2=480770 \
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java \
Wed Nov 29 15:44:05 2006 @@ -14,6 +14,7 @@
package org.apache.tapestry;
+import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.model.ComponentModel;
import org.apache.tapestry.runtime.Component;
@@ -65,4 +66,7 @@
* @param writer
*/
void renderInformalParameters(MarkupWriter writer);
+
+ /** Returns the message catalog for this component. */
+ Messages getMessages();
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/ComponentResourcesCommon.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java \
Wed Nov 29 15:44:05 2006 @@ -14,6 +14,8 @@
package org.apache.tapestry;
+import java.util.Locale;
+
import org.apache.commons.logging.Log;
import org.apache.tapestry.internal.structure.ComponentPageElement;
import org.apache.tapestry.model.ComponentModel;
@@ -96,4 +98,7 @@
* @see ComponentModel#getLog()
*/
Log getLog();
+
+ /** Returns the locale for the page containing this component. */
+ Locale getLocale();
}
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/CommonResourcesInjectionProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/internal/services/CommonResourcesInjectionProvider.java?view=auto&rev=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/CommonResourcesInjectionProvider.java \
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/CommonResourcesInjectionProvider.java \
Wed Nov 29 15:44:05 2006 @@ -0,0 +1,73 @@
+// 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.internal.services;
+
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.tapestry.ioc.Messages;
+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 a number of annonymous injections based on the type of field that is \
to be injected. + */
+public class CommonResourcesInjectionProvider implements InjectionProvider
+{
+ private static final Map<String, String> _configuration = newMap();
+
+ public CommonResourcesInjectionProvider()
+ {
+ add(Messages.class, "getMessages");
+ add(Locale.class, "getLocale");
+ add(Log.class, "getLog");
+ add(String.class, "getCompleteId");
+ }
+
+ private void add(Class fieldType, String methodName)
+ {
+ _configuration.put(fieldType.getName(), methodName);
+ }
+
+ public boolean provideInjection(String fieldName, String fieldType, \
ServiceLocator locator, + ClassTransformation transformation, \
MutableComponentModel componentModel) + {
+ String implementationMethodName = _configuration.get(fieldType);
+
+ if (implementationMethodName == null)
+ return false;
+
+ String resourcesField = transformation.getResourcesFieldName();
+
+ String body = String.format(
+ "%s = %s.%s();",
+ fieldName,
+ resourcesField,
+ implementationMethodName);
+
+ transformation.makeReadOnly(fieldName);
+
+ transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, \
body); +
+ return true;
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/internal/services/InternalModule.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java \
Wed Nov 29 15:44:05 2006 @@ -53,6 +53,7 @@
import org.apache.tapestry.services.BindingSource;
import org.apache.tapestry.services.ComponentClassResolver;
import org.apache.tapestry.services.ComponentClassTransformWorker;
+import org.apache.tapestry.services.ComponentMessagesSource;
import org.apache.tapestry.services.MarkupWriterFactory;
import org.apache.tapestry.services.PageRenderInitializer;
import org.apache.tapestry.services.PersistentFieldManager;
@@ -148,11 +149,12 @@
}
public PageElementFactory \
buildPageElementFactory(@Inject("infrastructure:typeCoercer")
- TypeCoercer typeCoercer, @InjectService("tapestry.BindingSource")
- BindingSource bindingSource)
+ TypeCoercer typeCoercer, @Inject("infrastructure:bindingSource")
+ BindingSource bindingSource, @Inject("infrastructure:componentMessagesSource")
+ ComponentMessagesSource componentMessagesSource)
{
return new PageElementFactoryImpl(_componentInstantiatorSource, \
_componentClassResolver,
- typeCoercer, bindingSource);
+ typeCoercer, bindingSource, componentMessagesSource);
}
public PageLoader buildPageLoader(@InjectService("PageElementFactory")
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageElementFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/internal/services/PageElementFactoryImpl.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageElementFactoryImpl.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageElementFactoryImpl.java \
Wed Nov 29 15:44:05 2006 @@ -12,200 +12,205 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.internal.services;
-
-import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.MarkupWriter;
-import org.apache.tapestry.internal.InternalConstants;
-import org.apache.tapestry.internal.parser.AttributeToken;
-import org.apache.tapestry.internal.parser.ExpansionToken;
-import org.apache.tapestry.internal.parser.StartElementToken;
-import org.apache.tapestry.internal.parser.TextToken;
-import org.apache.tapestry.internal.structure.AttributePageElement;
-import org.apache.tapestry.internal.structure.ComponentPageElement;
-import org.apache.tapestry.internal.structure.ComponentPageElementImpl;
-import org.apache.tapestry.internal.structure.ExpansionPageElement;
-import org.apache.tapestry.internal.structure.Page;
-import org.apache.tapestry.internal.structure.PageElement;
-import org.apache.tapestry.internal.structure.StartElementPageElement;
-import org.apache.tapestry.internal.structure.TextPageElement;
+package org.apache.tapestry.internal.services;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.internal.InternalConstants;
+import org.apache.tapestry.internal.parser.AttributeToken;
+import org.apache.tapestry.internal.parser.ExpansionToken;
+import org.apache.tapestry.internal.parser.StartElementToken;
+import org.apache.tapestry.internal.parser.TextToken;
+import org.apache.tapestry.internal.structure.AttributePageElement;
+import org.apache.tapestry.internal.structure.ComponentPageElement;
+import org.apache.tapestry.internal.structure.ComponentPageElementImpl;
+import org.apache.tapestry.internal.structure.ExpansionPageElement;
+import org.apache.tapestry.internal.structure.Page;
+import org.apache.tapestry.internal.structure.PageElement;
+import org.apache.tapestry.internal.structure.StartElementPageElement;
+import org.apache.tapestry.internal.structure.TextPageElement;
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.internal.util.TapestryException;
-import org.apache.tapestry.ioc.services.TypeCoercer;
-import org.apache.tapestry.model.ComponentModel;
-import org.apache.tapestry.runtime.RenderQueue;
+import org.apache.tapestry.ioc.services.TypeCoercer;
+import org.apache.tapestry.model.ComponentModel;
+import org.apache.tapestry.runtime.RenderQueue;
import org.apache.tapestry.services.Binding;
-import org.apache.tapestry.services.BindingSource;
-import org.apache.tapestry.services.ComponentClassResolver;
-
-/**
- * Null check suppressed as much as to simplify testing (yea! I can pass a null \
TypeCoercer) as it
- * is for efficiency.
- */
-
-public class PageElementFactoryImpl implements PageElementFactory
-{
- private final ComponentInstantiatorSource _componentInstantiatorSource;
-
- private final ComponentClassResolver _componentClassResolver;
-
- private final TypeCoercer _typeCoercer;
-
- private final BindingSource _bindingSource;
-
- public PageElementFactoryImpl(ComponentInstantiatorSource \
componentInstantiatorSource,
- ComponentClassResolver resolver, TypeCoercer typeCoercer, BindingSource \
bindingSource)
- {
- _componentInstantiatorSource = componentInstantiatorSource;
- _componentClassResolver = resolver;
- _typeCoercer = typeCoercer;
- _bindingSource = bindingSource;
- }
-
- /** Singleton instance that represents any close tag of any element in any \
template. */
- private final PageElement _endElement = new PageElement()
- {
- public void render(MarkupWriter writer, RenderQueue queue)
- {
- writer.end();
- }
-
- @Override
- public String toString()
- {
- return "End";
- }
- };
-
- public PageElement newStartElement(StartElementToken token)
- {
- return new StartElementPageElement(token.getName());
- }
-
- public PageElement newTextElement(TextToken token)
- {
- return new TextPageElement(token.getText());
- }
-
- public PageElement newEndElement()
- {
- return _endElement;
- }
-
- public PageElement newAttributeElement(AttributeToken token)
- {
- return new AttributePageElement(token.getName(), token.getValue());
- }
-
- public PageElement newExpansionElement(ComponentResources componentResources,
- ExpansionToken token)
- {
- Binding binding = _bindingSource.newBinding(
- "expansion",
- componentResources,
- InternalConstants.PROP_BINDING_PREFIX,
- token.getExpression(),
- token.getLocation());
-
- return new ExpansionPageElement(binding, _typeCoercer);
- }
-
- public ComponentPageElement newComponentElement(Page page, ComponentPageElement \
container,
- String id, String componentType, String componentClassName, Location \
location)
- {
- String finalClassName = componentClassName;
-
- // This awkwardness is making me think that the page loader should resolve \
the component
- // type before invoking this method (we would then remove the componentType \
parameter).
-
- if (InternalUtils.isNonBlank(componentType))
- {
- // The type actually overrides the specified class name. The class name \
is defined
- // by the type of the field. In many scenarios, the field type is a \
common interface,
- // and the type is used to determine the concrete class to instantiate.
-
- try
- {
- finalClassName = _componentClassResolver
- .resolveComponentTypeToClassName(componentType);
- }
- catch (IllegalArgumentException ex)
- {
- throw new TapestryException(ex.getMessage(), location, ex);
- }
- }
-
- Instantiator instantiator = \
_componentInstantiatorSource.findInstantiator(finalClassName);
-
- // The container for any components is the loading component, regardless of
- // how the component elements are nested within the loading component's
- // template.
-
- ComponentPageElementImpl result = new ComponentPageElementImpl(page, \
container, id,
- instantiator, _typeCoercer, location);
-
- page.addLifecycleListener(result);
-
- container.addEmbeddedElement(result);
-
- addMixins(result, instantiator);
-
- return result;
- }
-
- public ComponentPageElement newRootComponentElement(Page page, String \
componentType)
- {
- Instantiator instantiator = \
_componentInstantiatorSource.findInstantiator(componentType);
-
- ComponentPageElementImpl result = new ComponentPageElementImpl(page, \
instantiator,
- _typeCoercer);
-
- addMixins(result, instantiator);
-
- page.addLifecycleListener(result);
-
- return result;
- }
-
- private void addMixins(ComponentPageElement component, Instantiator \
instantiator)
- {
- ComponentModel model = instantiator.getModel();
- for (String mixinClassName : model.getMixinClassNames())
- addMixinByClassName(component, mixinClassName);
- }
-
- public PageElement newRenderBodyElement(final ComponentPageElement component)
- {
- return new PageElement()
- {
- public void render(MarkupWriter writer, RenderQueue queue)
- {
- component.enqueueBeforeRenderBody(queue);
- }
-
- @Override
- public String toString()
- {
- // TODO: Change this to be nested id
- return String.format("RenderBody[%s]", component.getId());
- }
- };
- }
-
- public void addMixinByTypeName(ComponentPageElement component, String mixinType)
- {
- String mixinClassName = \
_componentClassResolver.resolveMixinTypeToClassName(mixinType);
-
- addMixinByClassName(component, mixinClassName);
- }
-
- public void addMixinByClassName(ComponentPageElement component, String \
mixinClassName)
- {
- Instantiator mixinInstantiator = _componentInstantiatorSource
- .findInstantiator(mixinClassName);
-
- component.addMixin(mixinInstantiator);
- }
-
-}
+import org.apache.tapestry.services.BindingSource;
+import org.apache.tapestry.services.ComponentClassResolver;
+import org.apache.tapestry.services.ComponentMessagesSource;
+
+/**
+ * Null check suppressed as much as to simplify testing (yea! I can pass a null \
TypeCoercer) as it + * is for efficiency.
+ */
+
+public class PageElementFactoryImpl implements PageElementFactory
+{
+ private final ComponentInstantiatorSource _componentInstantiatorSource;
+
+ private final ComponentClassResolver _componentClassResolver;
+
+ private final TypeCoercer _typeCoercer;
+
+ private final BindingSource _bindingSource;
+
+ private final ComponentMessagesSource _messagesSource;
+
+ public PageElementFactoryImpl(ComponentInstantiatorSource \
componentInstantiatorSource, + ComponentClassResolver resolver, \
TypeCoercer typeCoercer, BindingSource bindingSource, + \
ComponentMessagesSource messagesSource) + {
+ _componentInstantiatorSource = componentInstantiatorSource;
+ _componentClassResolver = resolver;
+ _typeCoercer = typeCoercer;
+ _bindingSource = bindingSource;
+ _messagesSource = messagesSource;
+ }
+
+ /** Singleton instance that represents any close tag of any element in any \
template. */ + private final PageElement _endElement = new PageElement()
+ {
+ public void render(MarkupWriter writer, RenderQueue queue)
+ {
+ writer.end();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "End";
+ }
+ };
+
+ public PageElement newStartElement(StartElementToken token)
+ {
+ return new StartElementPageElement(token.getName());
+ }
+
+ public PageElement newTextElement(TextToken token)
+ {
+ return new TextPageElement(token.getText());
+ }
+
+ public PageElement newEndElement()
+ {
+ return _endElement;
+ }
+
+ public PageElement newAttributeElement(AttributeToken token)
+ {
+ return new AttributePageElement(token.getName(), token.getValue());
+ }
+
+ public PageElement newExpansionElement(ComponentResources componentResources,
+ ExpansionToken token)
+ {
+ Binding binding = _bindingSource.newBinding(
+ "expansion",
+ componentResources,
+ InternalConstants.PROP_BINDING_PREFIX,
+ token.getExpression(),
+ token.getLocation());
+
+ return new ExpansionPageElement(binding, _typeCoercer);
+ }
+
+ public ComponentPageElement newComponentElement(Page page, ComponentPageElement \
container, + String id, String componentType, String componentClassName, \
Location location) + {
+ String finalClassName = componentClassName;
+
+ // This awkwardness is making me think that the page loader should resolve \
the component + // type before invoking this method (we would then remove the \
componentType parameter). +
+ if (InternalUtils.isNonBlank(componentType))
+ {
+ // The type actually overrides the specified class name. The class name \
is defined + // by the type of the field. In many scenarios, the field \
type is a common interface, + // and the type is used to determine the \
concrete class to instantiate. +
+ try
+ {
+ finalClassName = _componentClassResolver
+ .resolveComponentTypeToClassName(componentType);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ throw new TapestryException(ex.getMessage(), location, ex);
+ }
+ }
+
+ Instantiator instantiator = \
_componentInstantiatorSource.findInstantiator(finalClassName); +
+ // The container for any components is the loading component, regardless of
+ // how the component elements are nested within the loading component's
+ // template.
+
+ ComponentPageElementImpl result = new ComponentPageElementImpl(page, \
container, id, + instantiator, _typeCoercer, _messagesSource, \
location); +
+ page.addLifecycleListener(result);
+
+ container.addEmbeddedElement(result);
+
+ addMixins(result, instantiator);
+
+ return result;
+ }
+
+ public ComponentPageElement newRootComponentElement(Page page, String \
componentType) + {
+ Instantiator instantiator = \
_componentInstantiatorSource.findInstantiator(componentType); +
+ ComponentPageElementImpl result = new ComponentPageElementImpl(page, \
instantiator, + _typeCoercer, _messagesSource);
+
+ addMixins(result, instantiator);
+
+ page.addLifecycleListener(result);
+
+ return result;
+ }
+
+ private void addMixins(ComponentPageElement component, Instantiator \
instantiator) + {
+ ComponentModel model = instantiator.getModel();
+ for (String mixinClassName : model.getMixinClassNames())
+ addMixinByClassName(component, mixinClassName);
+ }
+
+ public PageElement newRenderBodyElement(final ComponentPageElement component)
+ {
+ return new PageElement()
+ {
+ public void render(MarkupWriter writer, RenderQueue queue)
+ {
+ component.enqueueBeforeRenderBody(queue);
+ }
+
+ @Override
+ public String toString()
+ {
+ // TODO: Change this to be nested id
+ return String.format("RenderBody[%s]", component.getId());
+ }
+ };
+ }
+
+ public void addMixinByTypeName(ComponentPageElement component, String mixinType)
+ {
+ String mixinClassName = \
_componentClassResolver.resolveMixinTypeToClassName(mixinType); +
+ addMixinByClassName(component, mixinClassName);
+ }
+
+ public void addMixinByClassName(ComponentPageElement component, String \
mixinClassName) + {
+ Instantiator mixinInstantiator = _componentInstantiatorSource
+ .findInstantiator(mixinClassName);
+
+ component.addMixin(mixinInstantiator);
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java \
Wed Nov 29 15:44:05 2006 @@ -19,6 +19,7 @@
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -44,6 +45,7 @@
import org.apache.tapestry.runtime.RenderCommand;
import org.apache.tapestry.runtime.RenderQueue;
import org.apache.tapestry.services.Binding;
+import org.apache.tapestry.services.ComponentMessagesSource;
/**
* Implements {@link org.apache.tapestry.internal.structure.PageElement} and
@@ -325,6 +327,8 @@
// The user-provided class, with runtime code enhancements.
private final Component _component;
+ private final ComponentMessagesSource _messagesSource;
+
/**
* Component lifecycle instances for all mixins; the core component is added to \
this list during
* page load. This is only used in the case that a component has mixins (in \
which case, the core @@ -462,12 +466,15 @@
* used to create the new component instance and access the \
component's model
* @param typeCoercer
* used when coercing parameter values
+ * @param messagesSource
+ * TODO
* @param location
* location of the element (within a template), used as part of \
exception reporting
*/
public ComponentPageElementImpl(Page page, ComponentPageElement container, \
String id,
- Instantiator instantiator, TypeCoercer typeCoercer, Location location)
+ Instantiator instantiator, TypeCoercer typeCoercer,
+ ComponentMessagesSource messagesSource, Location location)
{
super(location);
@@ -477,9 +484,11 @@
_id = id;
_page = page;
_typeCoercer = typeCoercer;
+ _messagesSource = messagesSource;
_log = model.getLog();
- _coreResources = new InternalComponentResourcesImpl(this, instantiator, \
_typeCoercer); + _coreResources = new InternalComponentResourcesImpl(this, \
instantiator, _typeCoercer, + _messagesSource);
_component = _coreResources.getComponent();
@@ -515,9 +524,10 @@
/**
* Constructor for the root component of a page.
*/
- public ComponentPageElementImpl(Page page, Instantiator instantiator, \
TypeCoercer typeCoercer) + public ComponentPageElementImpl(Page page, Instantiator \
instantiator, TypeCoercer typeCoercer, + ComponentMessagesSource \
messagesSource) {
- this(page, null, null, instantiator, typeCoercer, null);
+ this(page, null, null, instantiator, typeCoercer, messagesSource, null);
}
public void addEmbeddedElement(ComponentPageElement child)
@@ -544,7 +554,7 @@
String mixinName = IOCUtilities.toSimpleId(mixinClassName);
InternalComponentResourcesImpl resources = new \
InternalComponentResourcesImpl(this,
- instantiator, _typeCoercer);
+ instantiator, _typeCoercer, _messagesSource);
// TODO: Check for name collision?
@@ -923,6 +933,11 @@
return;
throw new TapestryException(StructureMessages.missingParameters(unbound, \
this), this, null); + }
+
+ public Locale getLocale()
+ {
+ return _page.getLocale();
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java \
/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java \
Wed Nov 29 15:44:05 2006 @@ -16,6 +16,7 @@
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -24,11 +25,13 @@
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.internal.InternalComponentResources;
import org.apache.tapestry.internal.services.Instantiator;
+import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.TapestryException;
import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.model.ComponentModel;
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.services.Binding;
+import org.apache.tapestry.services.ComponentMessagesSource;
/**
* The bridge between a component and its {@link ComponentPageElement}, that \
supplies all kinds of @@ -48,12 +51,18 @@
private Map<String, Binding> _bindings;
+ private final ComponentMessagesSource _messagesSource;
+
+ private Messages _messages;
+
public InternalComponentResourcesImpl(ComponentPageElement element,
- Instantiator componentInstantiator, TypeCoercer typeCoercer)
+ Instantiator componentInstantiator, TypeCoercer typeCoercer,
+ ComponentMessagesSource messagesSource)
{
_element = element;
_componentModel = componentInstantiator.getModel();
_typeCoercer = typeCoercer;
+ _messagesSource = messagesSource;
_component = componentInstantiator.newInstance(this);
}
@@ -238,6 +247,19 @@
ComponentPageElement containerElement = _element.getContainerElement();
return containerElement == null ? null : containerElement.getComponent();
+ }
+
+ public Locale getLocale()
+ {
+ return _element.getLocale();
+ }
+
+ public Messages getMessages()
+ {
+ if (_messages == null)
+ _messages = _messagesSource.getMessages(_componentModel, getLocale());
+
+ return _messages;
}
}
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=480770&r1=480769&r2=480770
==============================================================================
--- 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 \
Wed Nov 29 15:44:05 2006 @@ -44,12 +44,14 @@
import org.apache.tapestry.internal.bindings.LiteralBindingFactory;
import org.apache.tapestry.internal.services.ApplicationGlobalsImpl;
import org.apache.tapestry.internal.services.BindingSourceImpl;
+import org.apache.tapestry.internal.services.CommonResourcesInjectionProvider;
import org.apache.tapestry.internal.services.ComponentClassFactoryImpl;
import org.apache.tapestry.internal.services.ComponentClassResolverImpl;
import org.apache.tapestry.internal.services.ComponentEventDispatcher;
import org.apache.tapestry.internal.services.ComponentInstanceEventHandler;
import org.apache.tapestry.internal.services.ComponentInstantiatorSource;
import org.apache.tapestry.internal.services.ComponentLifecycleMethodWorker;
+import org.apache.tapestry.internal.services.ComponentMessagesSourceImpl;
import org.apache.tapestry.internal.services.ComponentResourcesInjectionProvider;
import org.apache.tapestry.internal.services.ComponentSourceImpl;
import org.apache.tapestry.internal.services.ComponentWorker;
@@ -397,6 +399,8 @@
add(configuration, locator, PersistentFieldManager.class);
add(configuration, locator, Environment.class);
add(configuration, locator, ComponentSource.class);
+ add(configuration, locator, BindingSource.class);
+ add(configuration, locator, ComponentMessagesSource.class);
configuration.add(new InfrastructureContribution("request", request));
configuration.add(new InfrastructureContribution("response", response));
@@ -498,6 +502,9 @@
OrderedConfiguration<InjectionProvider> configuration)
{
configuration.add("ComponentResources", new \
ComponentResourcesInjectionProvider()); + configuration.add(
+ "CommonResourcesInjectionProvider",
+ new CommonResourcesInjectionProvider());
configuration.add("Default", new DefaultInjectionProvider(), "after:*.*");
}
@@ -720,5 +727,10 @@
public ComponentEventHandler buildComponentInstanceEventHandler(Log log)
{
return new ComponentInstanceEventHandler(_requestPageCache, log);
+ }
+
+ public ComponentMessagesSource buildComponentMessagesSource()
+ {
+ return new ComponentMessagesSourceImpl();
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt Wed \
Nov 29 15:44:05 2006 @@ -19,7 +19,7 @@
The infrastructure
- {{{../../tapestry-ioc/provider.html}object provider}}
+ {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/provider.html}object \
provider}} is a key element in making Tapestry extensible; it adds a layer of
indirection between service implementations and their collaborators. Using the \
infrastructure provider allows applications to identify and override individual \
services within Tapestry's @@ -46,24 +46,51 @@
The following table identifies the properties that are available via the \
infrastructure provider by default:
-*-----------------------+--------------------------------------------------------------------+------------------------------------+
-| <<Property>> | <<Service Interface>> \
| <<Default Service>> |
-*-----------------------+--------------------------------------------------------------------+-----------------------------------+
-| componentSource | \
{{{../apidocs/org/apache/tapestry/services/ComponentSource.html}ComponentSource}} | \
tapestry.ComponentSource |
-*-----------------------+--------------------------------------------------------------------+-----------------------------------+
-| environment | {{{../apidocs/org/apache/tapestry/services/Environment.html}Environment}} \
| tapestry.Environment |
-*-----------------------+--------------------------------------------------------------------+-----------------------------------+
-| markupWriterFactory | \
{{{../apidocs/org/apache/tapestry/services/MarkupWriterFactory.html}MarkupWriterFactory}} \
| tapestry.MarkupWriterFactory |
-*-----------------------+--------------------------------------------------------------------+-----------------------------------+
-| persistentFieldManager | \
{{{../apidocs/org/apache/tapestry/services/PersistentFieldManager.html}PersistentFieldManager}} \
| tapestry.PersistentFieldManager |
-*-----------------------+--------------------------------------------------------------------+-----------------------------------+
-| request | \
{{{../apidocs/org/apache/tapestry/services/WebRequest.html}WebRequest}} | \
tapestry.WebRequest |
-*-----------------------+--------------------------------------------------------------------------------------------------------+
-| response | {{{../apidocs/org/apache/tapestry/services/WebResponse.html}WebResponse}} \
| tapestry.WebResponse |
-*-----------------------+--------------------------------------------------------------------------------------------------------+
-| typeCoercer | org.apache.tapestry.ioc.services.TypeCoercer | \
tapestry.ioc.TypeCoercer |
-*-----------------------+--------------------------------------------------------------------------------------------------------+
-Default properties available via the infrastructure object provider
+ [bindingSource]
+ {{{../apidocs/org/apache/tapestry/services/BindingSource.html}BindingSource}} \
(tapestry.BindingSource) +
+ Central factory for creating all types of component Binding objects.
+
+ [componentSource]
+ {{{../apidocs/org/apache/tapestry/services/ComponentSource.html}ComponentSource}} \
(tapestry.ComponentSource) +
+ Used to retrieve component instances via their complete id.
+
+ [componentMessagesSource]
+ {{{../apidocs/org/apache/tapestry/services/ComponentMessagesSource.html}ComponentMessagesSource}} \
(tapestry.ComponentMessagesSource) +
+ Access to message catalogs for components.
+
+ [environment]
+ {{{../apidocs/org/apache/tapestry/services/Environment.html}Environment}} \
(tapestry.Environment) +
+ Used to access environmental services (typically, to install a new environmental \
service). +
+ [markupWriterFactory]
+ {{{../apidocs/org/apache/tapestry/services/MarkupWriterFactory.html}MarkupWriterFactory}} \
(tapestry.MarkupWriterFactory) +
+ Used as a source for MarkupWriter instances.
+
+ [persistentFieldManager]
+ {{{../apidocs/org/apache/tapestry/services/PersistentFieldManager.html}PersistentFieldManager}} \
(tapestry.PersistentFieldManager) +
+ Main access point between components and persistent field storage. Delegates \
out most behavior to + particular persistent strategies.
+
+ [request]
+ {{{../apidocs/org/apache/tapestry/services/WebRequest.html}WebRequest}} \
(tapestry.WebRequest) +
+ The current request object (for the current thread).
+
+ [response]
+ {{{../apidocs/org/apache/tapestry/services/WebResponse.html}WebResponse}} \
(tapestry.WebResponse) +
+ The current response object (for the current thread).
+
+ [typeCoercer]
+ {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/org/apache/tapestry/ioc/services/TypeCoercer.html}TypeCoercer}} \
(tapestry.ioc.TypeCoercer) +
+ Used to coerce values from one type to another (such as string to integer).
Contributing to Infrastructure
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt Wed Nov 29 \
15:44:05 2006 @@ -5,7 +5,7 @@
Injection with Components
A key concept in Tapestry is the use of <injection>. The
- {{{../ioc/index.html}Tapestry IoC container}} makes use of one form
+ {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/index.html}Tapestry IoC \
container}} makes use of one form of injection, via parameters to service builder \
methods.
For components, Tapestry takes a completely different tack: injection directly \
into @@ -32,7 +32,7 @@
* Named Injection
Here, a specific object is requested. The value of the Inject annotation is an
- {{{../ioc/provider.html}object reference}} used to identify the exact service, or \
other resource, + {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/provider.html}object \
reference}} used to identify the exact service, or other resource, to be injected.
Commonly, the "infrastructure:" prefix is used with the Inject annotation, to \
indirectly identify services contributed @@ -65,6 +65,26 @@
<<TODO: Don't like the name "Annonymous" either.>>
+ The following types are supported for annonymous injection out of the box:
+
+ [java.lang.String]
+ The complete id of the component, which incorporates the complete class name of \
the containing page and the nested + id of the component within the page.
+
+ [java.util.Locale]
+ The locale for the component (all components within a page use the same locale).
+
+ [org.apache.commons.logging.Log]
+ A Log instance configured for the component, based on the component's class \
name. +
+ [org.apache.tapestry.ComponentResources]
+ The resources for the component, often used to generate links related to the \
component. +
+ [org.apache.tapestry.ioc.Messages]
+ The component message catalog for the component, from which
+ {{{localization.html}localized}} messages can be generated.
+
+
** Default Annonymous Injection
There are a finite number of types that Tapestry can check for. Beyond that, the \
final default behavior @@ -76,13 +96,13 @@
Caution should be used when leveraging this default behavior, since minor code \
changes may introduce new services that will cause previously working injections to \
fail. In general, relying on default annonymous injection should be avoided in \
anything but a prototype.
-
+
** Defining New Annonymous Injection Logic
Annonymous injection is controlled by the
{{{../apidocs/org/apache/tapestry/services/InjectionProvider.html}tapestry.InjectionProvider}}
service. The configuration for this service is a
- {{{../ioc/command.html}chain of command}} for handling annonymous injections.
+ {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/command.html}chain of \
command}} for handling annonymous injections.
Other Injections
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app1/index.html Wed Nov 29 \
15:44:05 2006 @@ -45,6 +45,9 @@
<li>
<a href="NumberSelect.html">NumberSelect</a> -- passivate/activate \
page context demo </li>
+ <li>
+ <a href="Localization.html">Localization</a> -- accessing localized \
messages from the component catalog + </li>
</ul>
</p>
</body>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java \
/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java \
Wed Nov 29 15:44:05 2006 @@ -309,6 +309,15 @@
assertTextPresent("You chose 5.");
}
+ @Test
+ public void app1_localization()
+ {
+ _selenium.open(BASE_URL);
+ clickAndWait("link=Localization");
+
+ assertTextPresent("Via injected Messages property: [Accessed via injected \
Messages]"); + }
+
private void assertText(String locator, String expected)
{
String actual = _selenium.getText(locator);
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java \
/org/apache/tapestry/integration/app1/pages/Localization.java?view=auto&rev=480770 \
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java \
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java \
Wed Nov 29 15:44:05 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.integration.app1.pages;
+
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.Inject;
+import org.apache.tapestry.ioc.Messages;
+
+@ComponentClass
+public class Localization
+{
+ @Inject
+ private Messages _messages;
+
+ public String getInjectedMessage()
+ {
+ return _messages.get("via-inject");
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PageElementFactoryImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java \
/org/apache/tapestry/internal/services/PageElementFactoryImplTest.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PageElementFactoryImplTest.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PageElementFactoryImplTest.java \
Wed Nov 29 15:44:05 2006 @@ -46,7 +46,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null); StartElementToken token = new StartElementToken("fred", \
l);
PageElement element = factory.newStartElement(token);
@@ -70,7 +70,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null); AttributeToken token = new AttributeToken("name", \
"value", l);
PageElement element = factory.newAttributeElement(token);
@@ -95,7 +95,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null);
PageElement element = factory.newEndElement();
@@ -121,7 +121,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null);
PageElement element1 = factory.newEndElement();
PageElement element2 = factory.newEndElement();
@@ -142,7 +142,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null); TextToken token = new TextToken("some text", l);
PageElement element = factory.newTextElement(token);
@@ -169,7 +169,7 @@
replay();
- PageElementFactory factory = new PageElementFactoryImpl(source, resolver, \
null, null); + PageElementFactory factory = new PageElementFactoryImpl(source, \
resolver, null, null, null);
PageElement element = factory.newRenderBodyElement(component);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java \
/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java \
Wed Nov 29 15:44:05 2006 @@ -50,7 +50,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
ComponentResources resources = cpe.getComponentResources();
assertFalse(resources.isBound("fred"));
@@ -84,7 +84,7 @@
replay();
- ComponentPageElementImpl cpe = new ComponentPageElementImpl(page, ins, \
coercer); + ComponentPageElementImpl cpe = new ComponentPageElementImpl(page, \
ins, coercer, null);
cpe.addParameter("barney", binding);
@@ -114,7 +114,7 @@
replay();
- ComponentPageElementImpl cpe = new ComponentPageElementImpl(page, ins, \
coercer); + ComponentPageElementImpl cpe = new ComponentPageElementImpl(page, \
ins, coercer, null);
cpe.containingPageDidLoad();
@@ -155,7 +155,7 @@
replay();
ComponentPageElementImpl cpe = new ComponentPageElementImpl(page, container, \
"myid", ins,
- coercer, l);
+ coercer, null, l);
try
{
@@ -193,7 +193,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
assertFalse(cpe.getComponentResources().isInvariant("fred"));
@@ -230,7 +230,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addParameter("barney", binding);
@@ -270,7 +270,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addParameter("barney", binding);
@@ -293,7 +293,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
try
{
@@ -329,7 +329,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addEmbeddedElement(childElement);
@@ -359,7 +359,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addMixin(mixinIns);
@@ -388,7 +388,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addMixin(mixinIns);
@@ -427,7 +427,7 @@
replay();
- ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer);
+ ComponentPageElement cpe = new ComponentPageElementImpl(page, ins, coercer, \
null);
cpe.addMixin(mixinInstantiator);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java \
/org/apache/tapestry/internal/structure/InternalComponentResourcesImplTest.java?view=diff&rev=480770&r1=480769&r2=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImplTest.java \
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImplTest.java \
Wed Nov 29 15:44:05 2006 @@ -42,7 +42,7 @@
replay();
InternalComponentResources resources = new \
InternalComponentResourcesImpl(element, ins,
- coercer);
+ coercer, null);
resources.renderInformalParameters(writer);
@@ -68,7 +68,7 @@
replay();
InternalComponentResources resources = new \
InternalComponentResourcesImpl(element, ins,
- coercer);
+ coercer, null);
resources.addParameter("fred", binding);
@@ -103,7 +103,7 @@
replay();
InternalComponentResources resources = new \
InternalComponentResourcesImpl(element, ins,
- coercer);
+ coercer, null);
resources.addParameter("fred", binding);
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/reso \
urces/org/apache/tapestry/integration/app1/pages/Localization.html?view=auto&rev=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.html \
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.html \
Wed Nov 29 15:44:05 2006 @@ -0,0 +1,12 @@
+<t:comp type="Border" \
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> + \
<h1>Localization</h1> +
+
+<p>Demonstrates a few ways that component message catalogs can be accessed in code \
and in the template.</p> +
+
+ <p>
+ Via injected Messages property: [${injectedMessage}]
+ </p>
+
+</t:comp>
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/reso \
urces/org/apache/tapestry/integration/app1/pages/Localization.properties?view=auto&rev=480770
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.properties \
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Localization.properties \
Wed Nov 29 15:44:05 2006 @@ -0,0 +1 @@
+via-inject=Accessed via injected Messages
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic