You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Haselbach <ch...@tngtech.com> on 2008/09/19 10:56:11 UTC

Upgrade from T4 to T4.1: Javascript problem

Hi,

I was just trying to upgrade from T4 to T4.1 (4.1.6). When Javascript is
enabled, the page will be blank. With Javascript disabled in the
browser, the page renders just fine. I replaces the ajaxDelegate in the
Shell component with an empty render method. This works, but of course I
get Javascript errors, that Tapestry is not defined.

I'm not sure why the Page is blank. I guess that Tapestry hides the
content and waits for the whole DOM tree to be available before it shows
the content, but the last steps fails. Can this be?

Thanks and Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Upgrade from T4 to T4.1: Javascript problem

Posted by Matt Brock <br...@gmail.com>.
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:
&lt;html jwcid="@Shell" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
ajaxDelegate="ognl:myAjaxDelegate"&gt;

In the Border component specification:
&lt;component-specification&gt;
  &lt;inject property="myAjaxDelegate"
object="service:my.package.JSShellDelegate"/&gt;
  ...

In your hivemodule.xml:

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

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.

Re: Upgrade from T4 to T4.1: Javascript problem

Posted by Christian Haselbach <ch...@tngtech.com>.
Hi

Andreas Andreou wrote:
> well, if it's easily reproducable add a bug report -
>   
It is easily reproducible, but I'm not sure that the problem is a bug in
Tapestry. It probably is not.

> otherwise, perhaps attaching the resulting html might help us find the cause
>   
Unfortunately, I cannot do this right now.

Thanks to you and Matt Brock for the answers. Upgrading does not have a
high priority right now. So I'll have a closer look later.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Upgrade from T4 to T4.1: Javascript problem

Posted by Andreas Andreou <an...@gmail.com>.
well, if it's easily reproducable add a bug report -

otherwise, perhaps attaching the resulting html might help us find the cause

On Fri, Sep 19, 2008 at 12:57 PM, Christian Haselbach
<ch...@tngtech.com> wrote:
> Hi
>
> Andreas Andreou wrote:
>> No, this shouldn't be the cause of this...
>>
>> Does this happen on FF? Does firebug show any resources not loading?
>>
> It happens on Firefox and IE. No, firebug reports nothing suspicious.
>
> I think I saw someone reporting a similar problem, but there was no
> further response.
>
> Regards,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Upgrade from T4 to T4.1: Javascript problem

Posted by Christian Haselbach <ch...@tngtech.com>.
Hi

Andreas Andreou wrote:
> No, this shouldn't be the cause of this...
>
> Does this happen on FF? Does firebug show any resources not loading?
>   
It happens on Firefox and IE. No, firebug reports nothing suspicious.

I think I saw someone reporting a similar problem, but there was no
further response.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Upgrade from T4 to T4.1: Javascript problem

Posted by Andreas Andreou <an...@gmail.com>.
No, this shouldn't be the cause of this...

Does this happen on FF? Does firebug show any resources not loading?


On Fri, Sep 19, 2008 at 11:56 AM, Christian Haselbach
<ch...@tngtech.com> wrote:
> Hi,
>
> I was just trying to upgrade from T4 to T4.1 (4.1.6). When Javascript is
> enabled, the page will be blank. With Javascript disabled in the
> browser, the page renders just fine. I replaces the ajaxDelegate in the
> Shell component with an empty render method. This works, but of course I
> get Javascript errors, that Tapestry is not defined.
>
> I'm not sure why the Page is blank. I guess that Tapestry hides the
> content and waits for the whole DOM tree to be available before it shows
> the content, but the last steps fails. Can this be?
>
> Thanks and Regards,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org