It doesn't sound like you're overriding the ajaxDelegate properly.  In case
you don't already know (and for posterity if anyone else decides to do
this), you have to implement your own Ajax delegate factory (and config it
correctly in hivemodule), then provide a javascript interface to the
built-in JS routines that Tapestry needs.  This isn't as hard as it sounds,
but the existing documentation on the subject is PANTS.

In a nutshell...

In your @Shell component:
<html jwcid="@Shell" xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"
ajaxDelegate="ognl:myAjaxDelegate">

In the Border component specification:
<component-specification>
  <inject property="myAjaxDelegate"
object="service:my.package.JSShellDelegate"/>
  ...

In your hivemodule.xml:

<module id="my.package" version="1.0.0">
  ...
  <service-point id="JavascriptManager"
interface="org.apache.tapestry.javascript.JavascriptManager">
    <invoke-factory>
      <construct
class="my.package.services.SimpleJavascriptManagerImpl">
        <set-service property="assetSource"
service-id="tapestry.asset.AssetSource"/>
        <set property="files"
value="context:/js/FILES.js,context:/js/LOADED.js,context:/js/IN.js,context:/js/HEAD.js"/>
        <set property="formFiles" value=""/>
        <set property="widgetFiles" value=""/>
        <set property="folder" value=""/>
        <set property="tapestryFile"
value="context:/js/TapestryAdapter.js"/>
        <set property="tapestryFolder" value="context:/js/"/>
      </construct>
    </invoke-factory>
  </service-point>
  <service-point id="JSDelegateFactory"
interface="org.apache.hivemind.ServiceImplementationFactory"
parameters-occurs="none">
    <invoke-factory>
      <construct class="my.package.services.JSDelegateFactory">
        <set-service property="javascriptManager"
service-id="my.package.JavascriptManager"/>
      </construct>
    </invoke-factory>
  </service-point>
  <service-point id="JSShellDelegate"
interface="org.apache.tapestry.IRender">
    <invoke-factory service-id="my.package.JSDelegateFactory"/>
  </service-point>
  ...

New class my.package.services.JSDelegateFactory:
public class JSDelegateFactory implements ServiceImplementationFactory {
  private JavascriptManager javascriptManager;
  public void setJavascriptManager(JavascriptManager javascriptManager) {
    this.javascriptManager = javascriptManager;
  }
  public Object
createCoreServiceImplementation(ServiceImplementationFactoryParameters
factoryParameters) {
    return new JSShellDelegate(javascriptManager);
  }
}

New class my.package.services.JSShellDelegate:
public class JSShellDelegate extends SimpleAjaxShellDelegate {
  public JSShellDelegate(JavascriptManager javascriptManager) {
    super(javascriptManager);
  }
}

New class my.package.services.SimpleJavascriptManagerImpl:
public class SimpleJavascriptManagerImpl extends JavascriptManagerImpl {
}

New file /js/TapestryAdapter.js:
Copy CORE.JS from SKELETON directory in tapestry jar and implement as you
please.

Note: this will completely disengage any DOJO functionality, so be prepared
to write some javascript if you were counting on any of the shinier Tap4.1
components to work.  Personally, I'm glad to be rid of the handful of
asynchronous JS eval() calls every. single. pageload.

-- 
View this message in context: 
http://www.nabble.com/Upgrade-from-T4-to-T4.1%3A-Javascript-problem-tp19568501p19628422.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to