It's funny, here at JavaOne I've been having some discussions with people, and I think an area of error in Tapestry is it does too many "smart" things (such as your idea) that make certain edge cases very concise, but make the totality of the framework harder to describe (and make its behavior harder to predict and reason about).
On Thu, Oct 6, 2011 at 8:22 AM, Howard Lewis Ship <hls...@gmail.com> wrote: > Other things have colons in them that are not binding prefixes, such > as the Resource path used to identify Assets ... or many things even > further from our control, such as (JDBC) URLs. > > On Thu, Oct 6, 2011 at 3:16 AM, Massimo Lusetti <mluse...@gmail.com> wrote: >> BTW this is relative to TAP5-1677 >> >> On Thu, Oct 6, 2011 at 12:06 PM, Massimo Lusetti <mluse...@gmail.com> wrote: >> >>> What do you think about changing the implementation of >>> SymbolBindingFactory to let it check if the resulted symbol value is a >>> "binding expression" and if true let it resolve the binding and return >>> the actual binding instead of the symbol value ? >>> >>> This will let you declare a symbol which is a binding expression and >>> have the binding resolved when the symbol is evaluated, for ex this >>> will let you specify the Block for the empty Grid in a Symbol like >>> "block:empty" and the Block binding will be resolved at runtime. >>> >>> Is this something wanted ? ... I think it could be useful at least for >>> components writers. >>> >>> Let me know what you think, here is the diff: >>> >>> diff --git >>> a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/SymbolBindingFactory.java >>> b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/SymbolBindingFactory.java >>> index dce5a6b..b30786c 100644 >>> --- >>> a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/SymbolBindingFactory.java >>> +++ >>> b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/SymbolBindingFactory.java >>> @@ -18,22 +18,32 @@ import org.apache.tapestry5.ComponentResources; >>> import org.apache.tapestry5.ioc.Location; >>> import org.apache.tapestry5.ioc.services.SymbolSource; >>> import org.apache.tapestry5.services.BindingFactory; >>> +import org.apache.tapestry5.services.BindingSource; >>> >>> public class SymbolBindingFactory implements BindingFactory >>> { >>> + private BindingSource bindingSource; >>> private SymbolSource symbolSource; >>> >>> - public SymbolBindingFactory(SymbolSource symbolSource) >>> + public SymbolBindingFactory(SymbolSource symbolSource, >>> BindingSource bindingSource) >>> { >>> + this.bindingSource = bindingSource; >>> this.symbolSource = symbolSource; >>> } >>> >>> public Binding newBinding(String description, ComponentResources >>> container, >>> ComponentResources component, String expression, Location >>> location) >>> { >>> - >>> String value = symbolSource.valueForSymbol(expression); >>> - >>> + >>> + int colon = value.indexOf(":"); >>> + >>> + if (colon > 0) >>> + { >>> + return bindingSource.newBinding(description, container, >>> component, >>> + value.substring(0, colon), value.substring(colon >>> + 1), location); >>> + } >>> + >>> return new LiteralBinding(location, description, value); >>> } >>> >>> Cheers >>> -- >>> Massimo >>> http://meridio.blogspot.com >>> >> >> >> >> -- >> Massimo >> http://meridio.blogspot.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: dev-h...@tapestry.apache.org >> >> > > > > -- > 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 > -- 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: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org