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