Hi!
I've created a customized version of the Shell component...essentially I
want to to extend the handling of stylesheet assets to javascripts (write
<script> tags embedded in the <head > element).
CustomShell.java adds to the original:

    public abstract IAsset getJavascript();
    public abstract Object getJavascripts();

public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
/** added the following **/
 IAsset javascript = getJavascript();

            if (javascript != null)
                writeJavascriptScript(writer, cycle, javascript);

            Iterator scripts = (Iterator) getValueConverter().coerceValue(
                    getJavascripts(),
                    Iterator.class);

            while (scripts.hasNext())
            {
                javascript = (IAsset) i.next();

                writeJavascriptScript(writer, cycle, javascript);
            }
}
   private void writeJavascriptScript(IMarkupWriter writer, IRequestCycle
cycle, IAsset javascript)
    {
        writer.beginEmpty("script");
        writer.attribute("type", "text/javascript");
        writer.attribute("src", javascript.buildURL());
        writer.closeTag();
        writer.println();
    }

CustomShell.jwc adds these to the original:
  <parameter name="javascript">
    <description>
    If specified, provides an external javascript for the page.
    </description>
  </parameter>

  <parameter name="javascripts">
      <description>
      Array or collection of stylesheet assets.
      </description>
  </parameter>


However, this isn't working as I'm running into a ValueConverter issue:

Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
converter for type org.apache.tapestry.IAsset is available.

Borrowing from the Shell.jwc file, I notice that the following service is
injected - which apparently implements
org.apache.tapestry.coerce.ValueConverterImpl

  <inject property="valueConverter" object="service:
tapestry.coerce.ValueConverter"/>

What do I need to do to get my custom shell comp to render the script
assets? Thanks in advance!
Jason

Reply via email to