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

2008-09-23 Thread Matt Brock

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:myAjaxDelegategt;

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

In your hivemodule.xml:

lt;module id=my.package version=1.0.0gt;
  ...
  lt;service-point id=JavascriptManager
interface=org.apache.tapestry.javascript.JavascriptManagergt;
lt;invoke-factorygt;
  lt;construct
class=my.package.services.SimpleJavascriptManagerImplgt;
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;/constructgt;
lt;/invoke-factorygt;
  lt;/service-pointgt;
  lt;service-point id=JSDelegateFactory
interface=org.apache.hivemind.ServiceImplementationFactory
parameters-occurs=nonegt;
lt;invoke-factorygt;
  lt;construct class=my.package.services.JSDelegateFactorygt;
lt;set-service property=javascriptManager
service-id=my.package.JavascriptManager/gt;
  lt;/constructgt;
lt;/invoke-factorygt;
  lt;/service-pointgt;
  lt;service-point id=JSShellDelegate
interface=org.apache.tapestry.IRendergt;
lt;invoke-factory service-id=my.package.JSDelegateFactory/gt;
  lt;/service-pointgt;
  ...

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.


Upgrade from T4 to T4.1: Javascript problem

2008-09-19 Thread Christian Haselbach
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2008-09-19 Thread Andreas Andreou
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
[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2008-09-19 Thread Christian Haselbach
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2008-09-19 Thread Andreas Andreou
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
[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]