Cool. I'd love to start checking in generics support. Does this mean I'm free to do that?
On Mon, Dec 20, 2010 at 1:36 PM, Howard Lewis Ship <[email protected]> wrote: > I think it is time to update the version numbers for trunk to 5.3.0-SNAPSHOT > > On Mon, Dec 20, 2010 at 1:12 PM, <[email protected]> wrote: > >> Author: dadams >> Date: Mon Dec 20 21:12:29 2010 >> New Revision: 1051293 >> >> URL: http://svn.apache.org/viewvc?rev=1051293&view=rev >> Log: >> (closed TAP5-1378) Allow Delegate component to be used for creating >> in-template components >> >> Added: >> tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DelegateInline.tml >> >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DelegateInline.java >> Modified: >> >> tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.java >> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ (props changed) >> >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java >> >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java >> >> Modified: >> tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.java >> URL: >> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.java?rev=1051293&r1=1051292&r2=1051293&view=diff >> >> ============================================================================== >> --- >> tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.java >> (original) >> +++ >> tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.java >> Mon Dec 20 21:12:29 2010 >> @@ -15,12 +15,25 @@ >> package org.apache.tapestry5.corelib.components; >> >> import org.apache.tapestry5.Block; >> +import org.apache.tapestry5.ComponentResources; >> +import org.apache.tapestry5.annotations.InjectContainer; >> import org.apache.tapestry5.annotations.Parameter; >> +import org.apache.tapestry5.annotations.SupportsInformalParameters; >> +import org.apache.tapestry5.ioc.annotations.Inject; >> +import org.apache.tapestry5.runtime.Component; >> >> /** >> * A component that does not do any rendering of its own, but will delegate >> to some other object that can do rendering. >> * This other object may be a component or a {...@link Block} (among other >> things). >> + * <p> >> + * This component may also be used to create inline components. For each >> informal parameter the value will be stored as a >> + * render variable. To create an inline component, create a block >> + * and use Delegate multiple times in the template to render the block >> passing parameters to Delegate. In the block body >> + * reference the render variables using the "var:" binding prefix and the >> name of the parameter. >> + * <p> >> + * Note that the default binding prefix for parameter values is "literal". >> */ >> +...@supportsinformalparameters >> public class Delegate >> { >> /** >> @@ -30,8 +43,16 @@ public class Delegate >> @Parameter(required = true) >> private Object to; >> >> - Object beginRender() >> - { >> + @Inject private ComponentResources resources; >> + @InjectContainer private Component container; >> + >> + Object beginRender() >> + { >> + for(String name : resources.getInformalParameterNames()) { >> + Object value = resources.getInformalParameter(name, >> Object.class); >> + container.getComponentResources().storeRenderVariable(name, >> value); >> + } >> + >> return to; >> } >> } >> >> Added: >> tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DelegateInline.tml >> URL: >> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DelegateInline.tml?rev=1051293&view=auto >> >> ============================================================================== >> --- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DelegateInline.tml >> (added) >> +++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DelegateInline.tml >> Mon Dec 20 21:12:29 2010 >> @@ -0,0 +1,11 @@ >> +<t:border xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" >> xmlns:p="tapestry:parameter"> >> + <h1>Inline Components using Delegate</h1> >> + >> + <t:delegate to="block:block1" /> >> + <t:delegate to="block:block2" firstName="Steve" lastName="Rogers" >> /> >> + <t:delegate to="block:block2" firstName="Bruce" lastName="Banner" >> /> >> + >> + <t:block id="block1"><span id="block1">block 1</span></t:block> >> + <t:block id="block2"><p class="superhero">${var:firstName} >> ${var:lastName}</p></t:block> >> +</t:border> >> + >> >> Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ >> >> ------------------------------------------------------------------------------ >> --- svn:ignore (added) >> +++ svn:ignore Mon Dec 20 21:12:29 2010 >> @@ -0,0 +1 @@ >> +testng-custom.xml >> >> Modified: >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java >> URL: >> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java?rev=1051293&r1=1051292&r2=1051293&view=diff >> >> ============================================================================== >> --- >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java >> (original) >> +++ >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java >> Mon Dec 20 21:12:29 2010 >> @@ -81,4 +81,16 @@ public class GeneralComponentTests exten >> >> assertText("//t...@class='t-location-content t-location-current']", >> "<t:unavailablecomponent/>"); >> } >> + >> + /** TAP5-1378 */ >> + �...@test public void using_delegate_for_inline_components() { >> + clickThru("Inline Delegate"); >> + >> + // no params >> + assertText("block1", "block 1"); >> + >> + // multiple renders w/ multiple parameters >> + assertText("xpath=(//p...@class='superhero'])[1]", "Steve Rogers"); >> + assertText("xpath=(//p...@class='superhero'])[2]", "Bruce Banner"); >> + } >> } >> >> Added: >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DelegateInline.java >> URL: >> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DelegateInline.java?rev=1051293&view=auto >> >> ============================================================================== >> --- >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DelegateInline.java >> (added) >> +++ >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DelegateInline.java >> Mon Dec 20 21:12:29 2010 >> @@ -0,0 +1,19 @@ >> +// Copyright 2006, 2007, 2008, 2009, 2010 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.tapestry5.integration.app1.pages; >> + >> +public class DelegateInline { >> + >> +} >> >> Modified: >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java >> URL: >> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=1051293&r1=1051292&r2=1051293&view=diff >> >> ============================================================================== >> --- >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java >> (original) >> +++ >> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java >> Mon Dec 20 21:12:29 2010 >> @@ -356,6 +356,8 @@ public class Index >> "Actions can exist on pages other than the >> active page, via Blocks."), >> >> new Item("unlessdemo", "Unless Demo", "use of the >> Unless component"), >> + >> + new Item("delegateinline", "Inline Delegate", "Using >> the delegate component to create inline components"), >> >> new Item("MagicValueEncoder", "Magic ValueEncoder >> Demo", >> "Automatic creation of ValueEncoder using the >> TypeCoercer"), >> >> >> > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to learn > how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
