You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/01/03 01:29:24 UTC
svn commit: r608291 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry/annotations/
main/java/org/apache/tapestry/internal/
main/java/org/apache/tapestry/internal/model/
main/java/org/apache/tapestry/internal/services/ main...
Author: hlship
Date: Wed Jan 2 16:29:22 2008
New Revision: 608291
URL: http://svn.apache.org/viewvc?rev=608291&view=rev
Log:
TAPESTRY-1546: Add inheritInformalParameters flag to the @Component annotation
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InheritInformalsDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/Any.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/OuterAny.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/InheritInformalsDemo.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/OuterAny.tml
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/InternalComponentResourcesCommon.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableEmbeddedComponentModelImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/MutableComponentModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css
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/internal/model/MutableComponentModelImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/system_doctype.xml
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java Wed Jan 2 16:29:22 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006, 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.annotations;
import java.lang.annotation.Documented;
@@ -46,4 +46,10 @@
* The value is a binding expression, with a default binding prefix of "prop:".
*/
String[] parameters() default {};
+
+ /**
+ * If true, then the component will inherit all informal parameters from its parent component.
+ * The default is false.
+ */
+ boolean inheritInformalParameters() default false;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/InternalComponentResourcesCommon.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/InternalComponentResourcesCommon.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/InternalComponentResourcesCommon.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/InternalComponentResourcesCommon.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -19,6 +19,8 @@
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.runtime.RenderQueue;
+import java.util.Map;
+
/**
* Operations shared by {@link InternalComponentResources} and {@link ComponentPageElement}.
* Typically, these means methods of InternalComponentResources that are delegated to the component
@@ -64,4 +66,13 @@
* Invoked to make the receiver queue itself to be rendered.
*/
void queueRender(RenderQueue queue);
+
+ /**
+ * Constructs a map linking informal parameters to the corresponding bindings.
+ *
+ * @return map, possible empty
+ */
+ Map<String, Binding> getInformalParameterBindings();
+
+
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableComponentModelImpl.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -106,14 +106,11 @@
// TODO: Check for conflict with base model
- if (_parameters == null)
- _parameters = newCaseInsensitiveMap();
+ if (_parameters == null) _parameters = newCaseInsensitiveMap();
else
{
if (_parameters.containsKey(name))
- throw new IllegalArgumentException(ModelMessages.duplicateParameter(
- name,
- _componentClassName));
+ throw new IllegalArgumentException(ModelMessages.duplicateParameter(name, _componentClassName));
}
_parameters.put(name, new ParameterModelImpl(name, required, defaultBindingPrefix));
@@ -123,8 +120,7 @@
{
ParameterModel result = InternalUtils.get(_parameters, parameterName.toLowerCase());
- if (result == null && _parentModel != null)
- result = _parentModel.getParameterModel(parameterName);
+ if (result == null && _parentModel != null) result = _parentModel.getParameterModel(parameterName);
return result;
}
@@ -147,21 +143,19 @@
return InternalUtils.sortedKeys(_parameters);
}
- public MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type,
- String componentClassName, Location location)
+ public MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName,
+ boolean inheritInformalParameters, Location location)
{
// TODO: Parent compent model? Or would we simply override the parent?
- if (_embeddedComponents == null)
- _embeddedComponents = newCaseInsensitiveMap();
+ if (_embeddedComponents == null) _embeddedComponents = newCaseInsensitiveMap();
else if (_embeddedComponents.containsKey(id))
- throw new IllegalArgumentException(ModelMessages.duplicateComponentId(
- id,
- _componentClassName));
-
- MutableEmbeddedComponentModel embedded = new MutableEmbeddedComponentModelImpl(id, type,
- componentClassName,
- _componentClassName, location);
+ throw new IllegalArgumentException(ModelMessages.duplicateComponentId(id, _componentClassName));
+
+ MutableEmbeddedComponentModel embedded = new MutableEmbeddedComponentModelImpl(id, type, componentClassName,
+ _componentClassName,
+ inheritInformalParameters,
+ location);
_embeddedComponents.put(id, embedded);
@@ -185,8 +179,7 @@
{
EmbeddedComponentModel result = InternalUtils.get(_embeddedComponents, componentId);
- if (result == null && _parentModel != null)
- result = _parentModel.getEmbeddedComponentModel(componentId);
+ if (result == null && _parentModel != null) result = _parentModel.getEmbeddedComponentModel(componentId);
return result;
}
@@ -195,11 +188,9 @@
{
String result = InternalUtils.get(_persistentFields, fieldName);
- if (result == null && _parentModel != null)
- result = _parentModel.getFieldPersistenceStrategy(fieldName);
+ if (result == null && _parentModel != null) result = _parentModel.getFieldPersistenceStrategy(fieldName);
- if (result == null)
- throw new IllegalArgumentException(ModelMessages.missingPersistentField(fieldName));
+ if (result == null) throw new IllegalArgumentException(ModelMessages.missingPersistentField(fieldName));
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableEmbeddedComponentModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableEmbeddedComponentModelImpl.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableEmbeddedComponentModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/model/MutableEmbeddedComponentModelImpl.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -25,8 +25,7 @@
import java.util.List;
import java.util.Map;
-public class MutableEmbeddedComponentModelImpl extends BaseLocatable implements
- MutableEmbeddedComponentModel
+public class MutableEmbeddedComponentModelImpl extends BaseLocatable implements MutableEmbeddedComponentModel
{
private final String _id;
@@ -36,6 +35,8 @@
private final String _declaredClass;
+ private final boolean _inheritInformalParameters;
+
private Map<String, String> _parameters;
/**
@@ -43,14 +44,15 @@
*/
private List<String> _mixinClassNames;
- public MutableEmbeddedComponentModelImpl(String id, String componentType,
- String componentClassName, String declaredClass, Location location)
+ public MutableEmbeddedComponentModelImpl(String id, String componentType, String componentClassName,
+ String declaredClass, boolean inheritInformalParameters, Location location)
{
super(location);
_id = id;
_componentType = componentType;
_componentClassName = componentClassName;
+ _inheritInformalParameters = inheritInformalParameters;
_declaredClass = declaredClass;
}
@@ -62,22 +64,15 @@
@Override
public String toString()
{
- return String.format(
- "EmbeddedComponentModel[id=%s type=%s class=%s]",
- _id,
- _componentType,
- _componentClassName);
+ return String.format("EmbeddedComponentModel[id=%s type=%s class=%s inheritInformals=%s]", _id, _componentType,
+ _componentClassName, _inheritInformalParameters);
}
public void addParameter(String name, String value)
{
- if (_parameters == null)
- _parameters = newMap();
+ if (_parameters == null) _parameters = newMap();
else if (_parameters.containsKey(name))
- throw new IllegalArgumentException(ModelMessages.duplicateParameterValue(
- name,
- _id,
- _declaredClass));
+ throw new IllegalArgumentException(ModelMessages.duplicateParameterValue(name, _id, _declaredClass));
_parameters.put(name, value);
}
@@ -117,11 +112,15 @@
}
else
{
- if (_mixinClassNames.contains(mixinClassName))
- throw new IllegalArgumentException(ModelMessages
- .duplicateMixin(mixinClassName, _id));
+ if (_mixinClassNames.contains(mixinClassName)) throw new IllegalArgumentException(ModelMessages
+ .duplicateMixin(mixinClassName, _id));
}
_mixinClassNames.add(mixinClassName);
+ }
+
+ public boolean getInheritInformalParameters()
+ {
+ return _inheritInformalParameters;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentWorker.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentWorker.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -60,18 +60,14 @@
.getClassName(), fieldName), 0);
MutableEmbeddedComponentModel embedded = model.addEmbeddedComponent(id, annotation
- .type(), type, location);
+ .type(), type, annotation.inheritInformalParameters(), location);
addParameters(embedded, annotation.parameters());
transformation.makeReadOnly(fieldName);
- String body = String.format(
- "%s = (%s) %s.getEmbeddedComponent(\"%s\");",
- fieldName,
- type,
- transformation.getResourcesFieldName(),
- id);
+ String body = String.format("%s = (%s) %s.getEmbeddedComponent(\"%s\");", fieldName, type,
+ transformation.getResourcesFieldName(), id);
transformation
.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java Wed Jan 2 16:29:22 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.
@@ -22,6 +22,7 @@
import org.apache.tapestry.internal.parser.*;
import org.apache.tapestry.internal.structure.*;
import org.apache.tapestry.ioc.Location;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.*;
import org.apache.tapestry.ioc.internal.util.IdAllocator;
import static org.apache.tapestry.ioc.internal.util.InternalUtils.isBlank;
@@ -36,11 +37,15 @@
import org.apache.tapestry.services.PersistentFieldManager;
import org.slf4j.Logger;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.regex.Pattern;
/**
* Contains all the work-state related to the {@link PageLoaderImpl}.
+ * <p/>
+ * <em>This is the Tapestry heart, this is the Tapestry soul ...</em>
*/
class PageLoaderProcessor
{
@@ -57,6 +62,9 @@
}
};
+
+ private static final Pattern COMMA_PATTERN = Pattern.compile(",");
+
private Stack<ComponentPageElement> _activeElementStack = newStack();
private boolean _addAttributesAsComponentBindings = false;
@@ -72,6 +80,12 @@
private final Stack<Runnable> _endElementCommandStack = newStack();
+ /**
+ * Used as a queue of Runnable objects used to handle final setup.
+ */
+
+ private final List<Runnable> _finalization = CollectionFactory.newList();
+
private final IdAllocator _idAllocator = new IdAllocator();
private final LinkFactory _linkFactory;
@@ -142,30 +156,37 @@
if (mixins != null)
{
- for (String type : mixins.split(","))
+ for (String type : COMMA_PATTERN.split(mixins))
_pageElementFactory.addMixinByTypeName(component, type);
}
}
+
+ /**
+ * @param model embededded model defining the new component, from an {@link org.apache.tapestry.annotations.Component} annotation
+ * @param loadingComponent the currently loading container component
+ * @param newComponent the new child of the container whose parameters are being bound
+ * @param newComponentBindings map of bindings for the new component (used to handle inheriting of informal parameters)
+ */
private void bindParametersFromModel(EmbeddedComponentModel model, ComponentPageElement loadingComponent,
- ComponentPageElement component, Map<String, Binding> bindingMap)
+ ComponentPageElement newComponent, Map<String, Binding> newComponentBindings)
{
for (String name : model.getParameterNames())
{
String value = model.getParameterValue(name);
- String defaultBindingPrefix = determineDefaultBindingPrefix(component, name,
+ String defaultBindingPrefix = determineDefaultBindingPrefix(newComponent, name,
TapestryConstants.PROP_BINDING_PREFIX);
- Binding binding = findBinding(loadingComponent, component, name, value, defaultBindingPrefix,
- component.getLocation());
+ Binding binding = findBinding(loadingComponent, newComponent, name, value, defaultBindingPrefix,
+ newComponent.getLocation());
if (binding != null)
{
- component.bindParameter(name, binding);
+ newComponent.bindParameter(name, binding);
// So that the binding can be shared if inherited by a subcomponent
- bindingMap.put(name, binding);
+ newComponentBindings.put(name, binding);
}
}
}
@@ -345,6 +366,13 @@
workComponentQueue();
+ // Take care of any finalization logic that's been deferred out.
+
+ for (Runnable r : _finalization)
+ {
+ r.run();
+ }
+
// The page is *loaded* before it is attached to the request.
// This is to help ensure that no client-specific information leaks
// into the page.
@@ -579,7 +607,7 @@
if (embeddedId == null) embeddedId = generateEmbeddedId(embeddedType, _idAllocator);
- EmbeddedComponentModel embeddedModel = _loadingComponentModel
+ final EmbeddedComponentModel embeddedModel = _loadingComponentModel
.getEmbeddedComponentModel(embeddedId);
if (embeddedModel != null)
@@ -600,17 +628,19 @@
ServicesMessages.noTypeForEmbeddedComponent(embeddedId, _loadingComponentModel.getComponentClassName()),
token, null);
- ComponentPageElement newComponent = _pageElementFactory.newComponentElement(_page, _loadingElement, embeddedId,
- embeddedType,
- embeddedComponentClassName,
- elementName, token.getLocation());
+ final ComponentPageElement newComponent = _pageElementFactory.newComponentElement(_page, _loadingElement,
+ embeddedId, embeddedType,
+ embeddedComponentClassName,
+ elementName,
+ token.getLocation());
addMixinsToComponent(newComponent, embeddedModel, token.getMixins());
- Map<String, Binding> bindingMap = newMap();
- _componentIdToBindingMap.put(newComponent.getCompleteId(), bindingMap);
+ final Map<String, Binding> newComponentBindings = newMap();
+ _componentIdToBindingMap.put(newComponent.getCompleteId(), newComponentBindings);
- if (embeddedModel != null) bindParametersFromModel(embeddedModel, _loadingElement, newComponent, bindingMap);
+ if (embeddedModel != null)
+ bindParametersFromModel(embeddedModel, _loadingElement, newComponent, newComponentBindings);
addToBody(newComponent);
@@ -632,10 +662,40 @@
// And clean that up when the end element is reached.
+
+ final ComponentModel newComponentModel = newComponent.getComponentResources().getComponentModel();
+
+ // If the component was from an embedded @Component annotation, and it is inheritting informal parameters,
+ // and the component in question supports informal parameters, than get those inheritted informal parameters ...
+ // but later (this helps ensure that <t:parameter> elements that may provide informal parameters are
+ // visible when the informal parameters are copied to the child component).
+
+ if (embeddedModel != null && embeddedModel.getInheritInformalParameters() && newComponentModel.getSupportsInformalParameters())
+ {
+ final ComponentPageElement loadingElement = _loadingElement;
+
+ Runnable finalizer = new Runnable()
+ {
+ public void run()
+ {
+ handleInformalParameters(loadingElement, embeddedModel, newComponent, newComponentModel,
+ newComponentBindings);
+
+ }
+ };
+
+
+ _finalization.add(finalizer);
+ }
+
+
Runnable cleanup = new Runnable()
{
public void run()
{
+ // May need a separate queue for this, to execute at the very end of page loading.
+
+
_activeElementStack.pop();
_bodyPageElementStack.pop();
}
@@ -644,6 +704,34 @@
// The start tag is not added to the body of the component, so neither should
// the end tag.
configureEnd(true, cleanup);
+ }
+
+ /**
+ * Invoked when a component's end tag is reached, to check and process informal parameters as per the
+ * {@link org.apache.tapestry.model.EmbeddedComponentModel#getInheritInformalParameters()} flag.
+ *
+ * @param loadingComponent the container component that was loaded
+ * @param model
+ * @param newComponent
+ * @param newComponentBindings
+ */
+ private void handleInformalParameters(ComponentPageElement loadingComponent, EmbeddedComponentModel model,
+ ComponentPageElement newComponent, ComponentModel newComponentModel,
+ Map<String, Binding> newComponentBindings)
+ {
+
+ Map<String, Binding> informals = loadingComponent.getInformalParameterBindings();
+
+
+ for (String name : informals.keySet())
+ {
+ if (newComponentModel.getParameterModel(name) != null) continue;
+
+ Binding binding = informals.get(name);
+
+ newComponent.bindParameter(name, binding);
+ newComponentBindings.put(name, binding);
+ }
}
private void startElement(StartElementToken token)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java Wed Jan 2 16:29:22 2008
@@ -1099,4 +1099,8 @@
return _page.getLogicalName();
}
+ public Map<String, Binding> getInformalParameterBindings()
+ {
+ return _coreResources.getInformalParameterBindings();
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java Wed Jan 2 16:29:22 2008
@@ -22,6 +22,7 @@
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.Resource;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
import org.apache.tapestry.ioc.internal.util.TapestryException;
import org.apache.tapestry.ioc.services.TypeCoercer;
@@ -359,4 +360,21 @@
return _element.getPageName();
}
+ public Map<String, Binding> getInformalParameterBindings()
+ {
+ Map<String, Binding> result = CollectionFactory.newMap();
+
+ if (_bindings != null)
+ {
+ for (String name : _bindings.keySet())
+ {
+
+ if (_componentModel.getParameterModel(name) != null) continue;
+
+ result.put(name, _bindings.get(name));
+ }
+ }
+
+ return result;
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java Wed Jan 2 16:29:22 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006, 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.model;
import org.apache.tapestry.annotations.Component;
@@ -57,4 +57,8 @@
*/
List<String> getMixinClassNames();
+ /**
+ * If true, then the component should inherit informal parameters from its container.
+ */
+ boolean getInheritInformalParameters();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/MutableComponentModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/MutableComponentModel.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/MutableComponentModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/MutableComponentModel.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -40,14 +40,14 @@
/**
* Defines a new embedded component.
*
- * @param id the unique id for the embedded component, which must not already exist.
- * @param type the type of the component (posslibly blank)
- * @param componentClassName the fully qualified class name (derived from the field), used if the type is blank
- * @param location where the component is defined
- * @return a mutable model allowing parameters to be set
+ * @param id the unique id for the embedded component, which must not already exist.
+ * @param type the type of the component (posslibly blank)
+ * @param componentClassName the fully qualified class name (derived from the field), used if the type is blank
+ * @param inheritInformalParameters if true, then the component will inherit informal parameters provided to its container
+ * @param location where the component is defined @return a mutable model allowing parameters to be set
*/
- MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type,
- String componentClassName, Location location);
+ MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName,
+ boolean inheritInformalParameters, Location location);
/**
* Used to define the field persistence strategy for a particular field name. Returns a logical
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=608291&r1=608290&r2=608291&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 Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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,6 +30,7 @@
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
import org.apache.tapestry.ioc.test.IOCTestCase;
import org.apache.tapestry.model.ComponentModel;
+import org.apache.tapestry.model.EmbeddedComponentModel;
import org.apache.tapestry.model.MutableComponentModel;
import org.apache.tapestry.model.ParameterModel;
import org.apache.tapestry.runtime.Component;
@@ -693,7 +694,7 @@
protected final void train_getSupportsInformalParameters(ComponentModel model, boolean supports)
{
- expect(model.getSupportsInformalParameters()).andReturn(supports);
+ expect(model.getSupportsInformalParameters()).andReturn(supports).atLeastOnce();
}
protected final void train_getValidationMessages(ValidationMessagesSource messagesSource, Locale locale,
@@ -958,5 +959,10 @@
protected final PageRenderSupport mockPageRenderSupport()
{
return newMock(PageRenderSupport.class);
+ }
+
+ protected final void train_getInheritInformalParameters(EmbeddedComponentModel model, boolean inherits)
+ {
+ expect(model.getInheritInformalParameters()).andReturn(inherits).atLeastOnce();
}
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InheritInformalsDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InheritInformalsDemo.tml?rev=608291&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InheritInformalsDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InheritInformalsDemo.tml Wed Jan 2 16:29:22 2008
@@ -0,0 +1,8 @@
+<html t:type="Border"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+ <h1>Inherit Informals Demo</h1>
+
+ <t:outerany id="target" class="inherit">Should be italic</t:outerany>
+
+</html>
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml Wed Jan 2 16:29:22 2008
@@ -291,6 +291,11 @@
a component
</li>
+ <li>
+ <t:pagelink page="inheritinformalsdemo">Inherit Informal Parameters Demo</t:pagelink>
+ -- Demo a component which inherits informal parameters from its container
+ </li>
+
</ul>
</html>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css Wed Jan 2 16:29:22 2008
@@ -1,3 +1,7 @@
BODY {
font-family: "Trebuchet MS";
+}
+
+SPAN.inherit {
+ font-style: italic;
}
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=608291&r1=608290&r2=608291&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 Jan 2 16:29:22 2008
@@ -1253,4 +1253,16 @@
assertTextPresent("Link was clicked.");
}
+
+ /**
+ * Tests TAPESTRY-1546
+ */
+ @Test
+ public void inherit_informals() throws Exception
+ {
+ start("Inherit Informal Parameters Demo");
+
+ assertText("//span[@id='target']/@class", "inherit");
+ }
+
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/Any.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/Any.java?rev=608291&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/Any.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/Any.java Wed Jan 2 16:29:22 2008
@@ -0,0 +1,39 @@
+// 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.components;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.annotations.SupportsInformalParameters;
+import org.apache.tapestry.ioc.annotations.Inject;
+
+@SupportsInformalParameters
+public class Any
+{
+ @Inject
+ private ComponentResources _resources;
+
+ void beginRender(MarkupWriter writer)
+ {
+ writer.element(_resources.getElementName());
+
+ _resources.renderInformalParameters(writer);
+ }
+
+ void afterRender(MarkupWriter writer)
+ {
+ writer.end(); // the element
+ }
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/OuterAny.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/OuterAny.java?rev=608291&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/OuterAny.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/OuterAny.java Wed Jan 2 16:29:22 2008
@@ -0,0 +1,26 @@
+// 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.components;
+
+import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.annotations.SupportsInformalParameters;
+
+@SupportsInformalParameters
+public class OuterAny
+{
+ @Component(inheritInformalParameters = true)
+ private Any _innerAny;
+
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/InheritInformalsDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/InheritInformalsDemo.java?rev=608291&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/InheritInformalsDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/InheritInformalsDemo.java Wed Jan 2 16:29:22 2008
@@ -0,0 +1,19 @@
+// 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;
+
+public class InheritInformalsDemo
+{
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -155,9 +155,8 @@
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "Parameter 'Fred' of component org.example.components.Foo is already defined.");
+ assertEquals(ex.getMessage(),
+ "Parameter 'Fred' of component org.example.components.Foo is already defined.");
}
verify();
@@ -207,21 +206,15 @@
assertTrue(model.getEmbeddedComponentIds().isEmpty());
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- l);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, l);
assertEquals(fred.getId(), "fred");
assertEquals(fred.getComponentType(), "Fred");
+ assertFalse(fred.getInheritInformalParameters());
assertSame(fred.getLocation(), l);
- MutableEmbeddedComponentModel barney = model.addEmbeddedComponent(
- "barney",
- "Barney",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel barney = model.addEmbeddedComponent("barney", "Barney", COMPONENT_CLASS_NAME,
+ false, null);
assertEquals(model.getEmbeddedComponentIds(), Arrays.asList("barney", "fred"));
@@ -233,9 +226,8 @@
assertSame(model.getEmbeddedComponentModel("FRED"), fred);
assertSame(model.getEmbeddedComponentModel("BARNEY"), barney);
- assertEquals(
- fred.toString(),
- "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred]");
+ assertEquals(fred.toString(),
+ "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=false]");
verify();
}
@@ -250,24 +242,47 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, null);
+ model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, false, null);
try
{
- model.addEmbeddedComponent("fred", "Fred2", COMPONENT_CLASS_NAME, null);
+ model.addEmbeddedComponent("fred", "Fred2", COMPONENT_CLASS_NAME, false, null);
unreachable();
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "Embedded component 'fred' has already been defined for component class org.example.components.Foo.");
+ assertEquals(ex.getMessage(),
+ "Embedded component 'fred' has already been defined for component class org.example.components.Foo.");
}
verify();
}
@Test
+ public void add_embedded_with_inherit_informal_parameters()
+ {
+ Resource r = mockResource();
+ Logger logger = mockLogger();
+ Location l = mockLocation();
+
+ replay();
+
+ MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
+
+ assertTrue(model.getEmbeddedComponentIds().isEmpty());
+
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, true, l);
+
+ assertTrue(fred.getInheritInformalParameters());
+
+ assertEquals(fred.toString(),
+ "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=true]");
+
+ verify();
+ }
+
+
+ @Test
public void add_embedded_is_case_insensitive()
{
Resource r = mockResource();
@@ -277,18 +292,17 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, null);
+ model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, false, null);
try
{
- model.addEmbeddedComponent("FRED", "Fred2", COMPONENT_CLASS_NAME, null);
+ model.addEmbeddedComponent("FRED", "Fred2", COMPONENT_CLASS_NAME, false, null);
unreachable();
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "Embedded component 'FRED' has already been defined for component class org.example.components.Foo.");
+ assertEquals(ex.getMessage(),
+ "Embedded component 'FRED' has already been defined for component class org.example.components.Foo.");
}
verify();
@@ -304,11 +318,8 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
+ null);
assertTrue(fred.getParameterNames().isEmpty());
@@ -332,11 +343,8 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
+ null);
fred.addParameter("city", "bedrock");
@@ -347,9 +355,8 @@
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "A value for parameter 'city' of embedded component fred (of component class org.example.components.Foo) has already been provided.");
+ assertEquals(ex.getMessage(),
+ "A value for parameter 'city' of embedded component fred (of component class org.example.components.Foo) has already been provided.");
}
verify();
@@ -365,11 +372,8 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
+ null);
assertTrue(fred.getMixinClassNames().isEmpty());
@@ -386,11 +390,8 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
+ null);
fred.addMixin("zip.zop.Zoom");
fred.addMixin("foo.bar.Baz");
@@ -410,11 +411,8 @@
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);
- MutableEmbeddedComponentModel fred = model.addEmbeddedComponent(
- "fred",
- "Fred",
- COMPONENT_CLASS_NAME,
- null);
+ MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
+ null);
fred.addMixin("zip.zop.Zoom");
@@ -425,9 +423,7 @@
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "Mixin zip.zop.Zoom (for component fred) has already been defined.");
+ assertEquals(ex.getMessage(), "Mixin zip.zop.Zoom (for component fred) has already been defined.");
}
// Make sure it wasn't actually added.
@@ -566,9 +562,7 @@
}
catch (IllegalArgumentException ex)
{
- assertEquals(
- ex.getMessage(),
- "No field persistence strategy has been defined for field \'someField\'.");
+ assertEquals(ex.getMessage(), "No field persistence strategy has been defined for field \'someField\'.");
}
verify();
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java Wed Jan 2 16:29:22 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -73,9 +73,7 @@
train_getComponentIds(template, "baz", "biff");
- logger.error(ServicesMessages.embeddedComponentsNotInTemplate(
- Arrays.asList("foo", "bar"),
- PAGE_CLASS_NAME));
+ logger.error(ServicesMessages.embeddedComponentsNotInTemplate(Arrays.asList("foo", "bar"), PAGE_CLASS_NAME));
train_getTokens(template);
@@ -119,6 +117,7 @@
train_getTemplate(templateSource, model, LOCALE, template);
+
train_isMissing(template, false);
train_getLogger(model, logger);
@@ -127,10 +126,7 @@
train_getComponentIds(template, "foo");
- train_getTokens(
- template,
- new StartComponentToken(null, "foo", "Fred", null, l),
- new EndElementToken(null));
+ train_getTokens(template, new StartComponentToken(null, "foo", "Fred", null, l), new EndElementToken(null));
train_getEmbeddedComponentModel(model, "foo", emodel);
@@ -142,18 +138,13 @@
train_getComponentClassName(emodel, "foo.components.Barney");
- train_newComponentElement(
- elementFactory,
- rootElement,
- "foo",
- "Barney",
- "foo.components.Barney",
- null,
- l,
- childElement);
+ train_newComponentElement(elementFactory, rootElement, "foo", "Barney", "foo.components.Barney", null, l,
+ childElement);
train_getCompleteId(childElement, PAGE_CLASS_NAME + "/Barney");
+ train_getInheritInformalParameters(emodel, false);
+
rootElement.addToTemplate(childElement);
train_getParameterNames(emodel);
@@ -176,4 +167,5 @@
verify();
}
+
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/OuterAny.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/OuterAny.tml?rev=608291&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/OuterAny.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/OuterAny.tml Wed Jan 2 16:29:22 2008
@@ -0,0 +1,6 @@
+<t:container
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+ <span t:id="innerAny">
+ <t:body/>
+ </span>
+</t:container>
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/system_doctype.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/system_doctype.xml?rev=608291&r1=608290&r2=608291&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/system_doctype.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/system_doctype.xml Wed Jan 2 16:29:22 2008
@@ -1,6 +1,6 @@
<!DOCTYPE foo SYSTEM "src/test/resources/org/apache/tapestry/internal/services/simple.dtd" >
<!--
- 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.