My Start.java follows - note that *themes.default* is a symbol
contributed in my app module. It is valid as I am able to inject and
access it via a getter.
package com.propertypix.www.pages;
import org.apache.tapestry.Asset;
import org.apache.tapestry.annotations.Environmental;
import org.apache.tapestry.annotations.Inject;
import org.apache.tapestry.annotations.Path;
public class Start
{
@Inject
@Path("${theme.default}")
private Asset style;
@Environmental
private DocumentStyleBuilder styleBuilder;
void onActivate() {
styleBuilder.addStyleLink(style);
}
}
Howard Lewis Ship wrote:
Could we see your Start page?
On 9/28/07, Chris Lewis <[EMAIL PROTECTED]> wrote:
I'm creating something like DocumentScriptBuilder for inserting
stylesheets, much like DocumentScriptBuilderImpl does for javascripts. I
have this method in my app module, inspired by the method in
TapestryModule:
public void
contributePageRenderInitializer(OrderedConfiguration<PageRenderCommand>
configuration) {
configuration.add("DocumentStyleBuilder", new PageRenderCommand()
{
public void cleanup(Environment environment) {
DocumentStyleBuilder builder =
environment.pop(DocumentStyleBuilder.class);
Document doc = environment.peek(Document.class);
builder.updateDocument(doc);
}
public void setup(Environment environment) {
environment.push(DocumentStyleBuilder.class, new
DocumentStyleBuilderImpl());
}
}, "before:PageRenderSupport");
}
When I try to inject this via @Environmental, a RuntimeException is
thrown with this message:
"No object of type xxx.services.DocumentStyleBuilder is available from
the Environment. Available types are ."
With logging I've verified that this is thrown _before_ my contribution
is called, suggesting that the page using the @Environmental (my Start
page) is initialized before my contribution is called. I tried using
"before:PageRenderSupport" as a constraint to no avail. How can I get my
object into the environment, since mimicking what's in TapestryModule
doesn't seem to work?
thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]