Re: Call listener after page appears on screen

2006-10-27 Thread gant

Why don't you use tacos:ProgressBar. It is easy to use.

- Original Message - 
From: Peter Beshai [EMAIL PROTECTED]

To: users@tapestry.apache.org
Sent: Friday, October 27, 2006 3:47 AM
Subject: Re: Call listener after page appears on screen



The XTile seems to work exactly how I want it to, but there is a problem.

This is my setup:

Stage 1:
- User selects file in upload component and submits form.

I needed a way to keep track of the progress of the file while it was 
uploading (to implement a progress bar). I couldn't do this in the same 
listener as the one that is called when the form is submitted because 
async submits don't work with upload components (apparently). So it was 
suggested to me that I create a thread that will be initialized when the 
form is submitted and it will handle the file uploading.


- Thread is initialized with filename and inputstream and starts running.
- Thread is stored in a static Map of threads with its hashCode as the key

The listener finishes and the page reloads.

Stage 2:
- XTile calls a listener to start watching the progress of the file in the 
thread.


The send function for XTile passes in the hashCode of the thread that was 
used to upload the file (stored in a hidden field on the page).


The method is called until I put in the call to get my thread from the 
static Map. I get this error in the firebug console:


  response.responseXML has no properties.



Any ideas how to fix this? Or a better way of handling tracking the 
progress of a file?


Peter Beshai



From: Christian Dutaret [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:16:41 +0200

I don't think this would work in this case. The @InvokeListener component 
is

called on the server side, before the rendered response is flushed to the
client. What is discussed here is having a listener invoked after the page
is rendered on the client side, typically for a wait screen that will keep
displaying an animated gif until a long database transaction completes on
the server side (at least that is why I needed this).

2006/10/26, Daniel Tabuenca [EMAIL PROTECTED]:


Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:
 I tried to achieve the same thing some time ago, and I couldn't find
 anything that would work with dojo and EventListeners.
 As you mentioned, this is probably due to tapestry connect events 
 being

 called _after_ any point where we could insert any custom js.

 The workaround I found to work perfectly is use contrib:XTile 
 component

 instead, with a small js script that calls the XTile generated js
function
 at the bottom of the page

 hth
 Ch.

 2006/10/26, Peter Beshai [EMAIL PROTECTED]:
 
  Oh, I should've mentioned I tried that already. It doesn't give an
error
  on
  page load, but it also doesn't call the listener. It gives this 
  error

when
  I
  try calling it manually:
 
  dojo.byId(mockHidden).click()
  Error: buildTargetProperties() Unknown target type:[object
HTMLDocument]
 
  I have tried making the mockHidden a Button (forgot this causes
  EventListener to break
  [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField
(same
  error), Submit button (works, but sends the page into an infinite
loop...
  it
  doesn't pick up that it should be asynchronous), a span (same
error),
  and
  currently a Checkbox.
 
  Also, onclick() -worked- after the page had loaded and I tried
calling
it
  manually.
 
  Peter Beshai
 
  From: Karthik N [EMAIL PROTECTED]
  Reply-To: Tapestry users users@tapestry.apache.org
  To: Tapestry users users@tapestry.apache.org
  Subject: Re: Call listener after page appears on screen
  Date: Thu, 26 Oct 2006 20:25:55 +0530
  
  please try click() instead of onclick()
  
  On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
  
  Is there an easy way of calling a listener after the page appears
  (rendered)
  on screen? I couldn't think of one, and so I tried having adding 
  an

  event
  to
  the onload of the page:
  
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
  
  or
  
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
  
  where mockHidden is a component that has an eventlistener (the
listener
  I
  want to have called after the page is loaded) attached to it in my
.java
  file. If I call dojo.byId(mockHidden).onclick() from firebug's
  console,
  it
  works, but when the page loads it says :: dojo.byId
  (mockHidden).onclick
  is
  not a function.
  
  I figured that was because tapestry connects the event at the end
of
the
  page (and that script block is somewhere before that). Is there
any
  way
  of
  having the javascript called AFTER tapestry has connected the
event

Re: Call listener after page appears on screen

2006-10-27 Thread Christian Dutaret

On some pages with a lot of EventListeners, I also see this 
tapestry.cleanConnect is not a function every now and then. When this
occurs, all the ajax stuff on the page won't work, since the connect events
are never executed. The problem only shows with Firefox, never with IE.
After I disabled Firebug, the problem never showed up again. I guess that
Firebug sometimes fails to execute some dojo.require stuff on highly
js-loaded pages.

Since most of the visitors of my website won't use Firebug, this shouldn't
be too much of an issue ;-)

2006/10/26, Peter Beshai [EMAIL PROTECTED]:


I did eventually try that and it worked but it seemed slightly volatile.
I'm
not sure if this has to do with how my snapshots have been rolled back to
August versions (see snapshots thread), but I randomly see in my dojo
console tapestry.cleanConnect is not a function and when that happens
that
solution doesn't work.

Peter Beshai


From: andyhot [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 19:25:31 +0300

Try this:
script type=text/javascript
dojo.event.connect(window, onload,
   setTimeout(function() {
 dojo.byId(mockHidden).onclick();
 }, 50)
);
/script



Peter Beshai wrote:
  Is there an easy way of calling a listener after the page appears
  (rendered) on screen? I couldn't think of one, and so I tried having
  adding an event to the onload of the page:
 
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
 
  or
 
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
 
  where mockHidden is a component that has an eventlistener (the
  listener I want to have called after the page is loaded) attached to
  it in my .java file. If I call dojo.byId(mockHidden).onclick() from
  firebug's console, it works, but when the page loads it says ::
  dojo.byId(mockHidden).onclick is not a function.
 
  I figured that was because tapestry connects the event at the end of
  the page (and that script block is somewhere before that). Is there
  any way of having the javascript called AFTER tapestry has connected
  the event?? Or is there another way of accomplishing this goal?
 
  Thanks,
  Peter Beshai
 
  _
  Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
  http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting


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


_
Découvrez Live Search de votre PC ou de votre appareil mobile dès
aujourd'hui. http://www.live.com/?mkt=fr-ca


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




Re: Call listener after page appears on screen

2006-10-27 Thread Peter Beshai
I had tried, but it seemed like tacos wouldn't work with Tapestry 4.1.1. I 
kept getting errors about things in hivemind being duplicated and it was 
just giving me a headache. So I'm going to create a wrapper for the new dojo 
progress bar, which should do the trick :-)


Peter Beshai



From: [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Fri, 27 Oct 2006 16:51:17 +0900

Why don't you use tacos:ProgressBar. It is easy to use.

- Original Message - From: Peter Beshai [EMAIL PROTECTED]
To: users@tapestry.apache.org
Sent: Friday, October 27, 2006 3:47 AM
Subject: Re: Call listener after page appears on screen



The XTile seems to work exactly how I want it to, but there is a problem.

This is my setup:

Stage 1:
- User selects file in upload component and submits form.

I needed a way to keep track of the progress of the file while it was 
uploading (to implement a progress bar). I couldn't do this in the same 
listener as the one that is called when the form is submitted because 
async submits don't work with upload components (apparently). So it was 
suggested to me that I create a thread that will be initialized when the 
form is submitted and it will handle the file uploading.


- Thread is initialized with filename and inputstream and starts running.
- Thread is stored in a static Map of threads with its hashCode as the key

The listener finishes and the page reloads.

Stage 2:
- XTile calls a listener to start watching the progress of the file in the 
thread.


The send function for XTile passes in the hashCode of the thread that was 
used to upload the file (stored in a hidden field on the page).


The method is called until I put in the call to get my thread from the 
static Map. I get this error in the firebug console:


  response.responseXML has no properties.



Any ideas how to fix this? Or a better way of handling tracking the 
progress of a file?


Peter Beshai



From: Christian Dutaret [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:16:41 +0200

I don't think this would work in this case. The @InvokeListener component 
is

called on the server side, before the rendered response is flushed to the
client. What is discussed here is having a listener invoked after the 
page
is rendered on the client side, typically for a wait screen that will 
keep

displaying an animated gif until a long database transaction completes on
the server side (at least that is why I needed this).

2006/10/26, Daniel Tabuenca [EMAIL PROTECTED]:


Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:
 I tried to achieve the same thing some time ago, and I couldn't find
 anything that would work with dojo and EventListeners.
 As you mentioned, this is probably due to tapestry connect events  
being

 called _after_ any point where we could insert any custom js.

 The workaround I found to work perfectly is use contrib:XTile  
component

 instead, with a small js script that calls the XTile generated js
function
 at the bottom of the page

 hth
 Ch.

 2006/10/26, Peter Beshai [EMAIL PROTECTED]:
 
  Oh, I should've mentioned I tried that already. It doesn't give an
error
  on
  page load, but it also doesn't call the listener. It gives this   
error

when
  I
  try calling it manually:
 
  dojo.byId(mockHidden).click()
  Error: buildTargetProperties() Unknown target type:[object
HTMLDocument]
 
  I have tried making the mockHidden a Button (forgot this causes
  EventListener to break
  [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField
(same
  error), Submit button (works, but sends the page into an infinite
loop...
  it
  doesn't pick up that it should be asynchronous), a span (same
error),
  and
  currently a Checkbox.
 
  Also, onclick() -worked- after the page had loaded and I tried
calling
it
  manually.
 
  Peter Beshai
 
  From: Karthik N [EMAIL PROTECTED]
  Reply-To: Tapestry users users@tapestry.apache.org
  To: Tapestry users users@tapestry.apache.org
  Subject: Re: Call listener after page appears on screen
  Date: Thu, 26 Oct 2006 20:25:55 +0530
  
  please try click() instead of onclick()
  
  On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
  
  Is there an easy way of calling a listener after the page appears
  (rendered)
  on screen? I couldn't think of one, and so I tried having adding 
  an

  event
  to
  the onload of the page:
  
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
  
  or
  
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
  
  where mockHidden is a component that has an eventlistener

Call listener after page appears on screen

2006-10-26 Thread Peter Beshai
Is there an easy way of calling a listener after the page appears (rendered) 
on screen? I couldn't think of one, and so I tried having adding an event to 
the onload of the page:


script type=text/javascript
dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
/script

or

script type=text/javascript
dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
/script

where mockHidden is a component that has an eventlistener (the listener I 
want to have called after the page is loaded) attached to it in my .java 
file. If I call dojo.byId(mockHidden).onclick() from firebug's console, it 
works, but when the page loads it says :: dojo.byId(mockHidden).onclick is 
not a function.


I figured that was because tapestry connects the event at the end of the 
page (and that script block is somewhere before that). Is there any way of 
having the javascript called AFTER tapestry has connected the event?? Or is 
there another way of accomplishing this goal?


Thanks,
Peter Beshai

_
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca



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



Re: Call listener after page appears on screen

2006-10-26 Thread Karthik N

please try click() instead of onclick()

On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:


Is there an easy way of calling a listener after the page appears
(rendered)
on screen? I couldn't think of one, and so I tried having adding an event
to
the onload of the page:

script type=text/javascript
dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
/script

or

script type=text/javascript
dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
/script

where mockHidden is a component that has an eventlistener (the listener I
want to have called after the page is loaded) attached to it in my .java
file. If I call dojo.byId(mockHidden).onclick() from firebug's console,
it
works, but when the page loads it says :: dojo.byId(mockHidden).onclick
is
not a function.

I figured that was because tapestry connects the event at the end of the
page (and that script block is somewhere before that). Is there any way
of
having the javascript called AFTER tapestry has connected the event?? Or
is
there another way of accomplishing this goal?

Thanks,
Peter Beshai

_
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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





--
Thanks, Karthik


Re: Call listener after page appears on screen

2006-10-26 Thread Peter Beshai
Oh, I should've mentioned I tried that already. It doesn't give an error on 
page load, but it also doesn't call the listener. It gives this error when I 
try calling it manually:



dojo.byId(mockHidden).click()

Error: buildTargetProperties() Unknown target type:[object HTMLDocument]

I have tried making the mockHidden a Button (forgot this causes 
EventListener to break  
[https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField (same 
error), Submit button (works, but sends the page into an infinite loop... it 
doesn't pick up that it should be asynchronous), a span (same error), and 
currently a Checkbox.


Also, onclick() -worked- after the page had loaded and I tried calling it 
manually.


Peter Beshai


From: Karthik N [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:25:55 +0530

please try click() instead of onclick()

On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:


Is there an easy way of calling a listener after the page appears
(rendered)
on screen? I couldn't think of one, and so I tried having adding an event
to
the onload of the page:

script type=text/javascript
dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
/script

or

script type=text/javascript
dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
/script

where mockHidden is a component that has an eventlistener (the listener I
want to have called after the page is loaded) attached to it in my .java
file. If I call dojo.byId(mockHidden).onclick() from firebug's console,
it
works, but when the page loads it says :: dojo.byId(mockHidden).onclick
is
not a function.

I figured that was because tapestry connects the event at the end of the
page (and that script block is somewhere before that). Is there any way
of
having the javascript called AFTER tapestry has connected the event?? Or
is
there another way of accomplishing this goal?

Thanks,
Peter Beshai

_
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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





--
Thanks, Karthik


_
Découvrez Live Search de votre PC ou de votre appareil mobile dès 
aujourd’hui. http://www.live.com/?mkt=fr-ca



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



Re: Call listener after page appears on screen

2006-10-26 Thread Christian Dutaret

I tried to achieve the same thing some time ago, and I couldn't find
anything that would work with dojo and EventListeners.
As you mentioned, this is probably due to tapestry connect events being
called _after_ any point where we could insert any custom js.

The workaround I found to work perfectly is use contrib:XTile component
instead, with a small js script that calls the XTile generated js function
at the bottom of the page

hth
Ch.

2006/10/26, Peter Beshai [EMAIL PROTECTED]:


Oh, I should've mentioned I tried that already. It doesn't give an error
on
page load, but it also doesn't call the listener. It gives this error when
I
try calling it manually:

dojo.byId(mockHidden).click()
Error: buildTargetProperties() Unknown target type:[object HTMLDocument]

I have tried making the mockHidden a Button (forgot this causes
EventListener to break
[https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField (same
error), Submit button (works, but sends the page into an infinite loop...
it
doesn't pick up that it should be asynchronous), a span (same error),
and
currently a Checkbox.

Also, onclick() -worked- after the page had loaded and I tried calling it
manually.

Peter Beshai

From: Karthik N [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:25:55 +0530

please try click() instead of onclick()

On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:

Is there an easy way of calling a listener after the page appears
(rendered)
on screen? I couldn't think of one, and so I tried having adding an
event
to
the onload of the page:

script type=text/javascript
dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
/script

or

script type=text/javascript
dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
/script

where mockHidden is a component that has an eventlistener (the listener
I
want to have called after the page is loaded) attached to it in my .java
file. If I call dojo.byId(mockHidden).onclick() from firebug's
console,
it
works, but when the page loads it says :: dojo.byId
(mockHidden).onclick
is
not a function.

I figured that was because tapestry connects the event at the end of the
page (and that script block is somewhere before that). Is there any
way
of
having the javascript called AFTER tapestry has connected the event?? Or
is
there another way of accomplishing this goal?

Thanks,
Peter Beshai

_
Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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




--
Thanks, Karthik

_
Découvrez Live Search de votre PC ou de votre appareil mobile dès
aujourd'hui. http://www.live.com/?mkt=fr-ca


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




Re: Call listener after page appears on screen

2006-10-26 Thread Daniel Tabuenca

Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:

I tried to achieve the same thing some time ago, and I couldn't find
anything that would work with dojo and EventListeners.
As you mentioned, this is probably due to tapestry connect events being
called _after_ any point where we could insert any custom js.

The workaround I found to work perfectly is use contrib:XTile component
instead, with a small js script that calls the XTile generated js function
at the bottom of the page

hth
Ch.

2006/10/26, Peter Beshai [EMAIL PROTECTED]:

 Oh, I should've mentioned I tried that already. It doesn't give an error
 on
 page load, but it also doesn't call the listener. It gives this error when
 I
 try calling it manually:

 dojo.byId(mockHidden).click()
 Error: buildTargetProperties() Unknown target type:[object HTMLDocument]

 I have tried making the mockHidden a Button (forgot this causes
 EventListener to break
 [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField (same
 error), Submit button (works, but sends the page into an infinite loop...
 it
 doesn't pick up that it should be asynchronous), a span (same error),
 and
 currently a Checkbox.

 Also, onclick() -worked- after the page had loaded and I tried calling it
 manually.

 Peter Beshai

 From: Karthik N [EMAIL PROTECTED]
 Reply-To: Tapestry users users@tapestry.apache.org
 To: Tapestry users users@tapestry.apache.org
 Subject: Re: Call listener after page appears on screen
 Date: Thu, 26 Oct 2006 20:25:55 +0530
 
 please try click() instead of onclick()
 
 On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
 
 Is there an easy way of calling a listener after the page appears
 (rendered)
 on screen? I couldn't think of one, and so I tried having adding an
 event
 to
 the onload of the page:
 
 script type=text/javascript
 dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
 /script
 
 or
 
 script type=text/javascript
 dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
 /script
 
 where mockHidden is a component that has an eventlistener (the listener
 I
 want to have called after the page is loaded) attached to it in my .java
 file. If I call dojo.byId(mockHidden).onclick() from firebug's
 console,
 it
 works, but when the page loads it says :: dojo.byId
 (mockHidden).onclick
 is
 not a function.
 
 I figured that was because tapestry connects the event at the end of the
 page (and that script block is somewhere before that). Is there any
 way
 of
 having the javascript called AFTER tapestry has connected the event?? Or
 is
 there another way of accomplishing this goal?
 
 Thanks,
 Peter Beshai
 
 _
 Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
 http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 --
 Thanks, Karthik

 _
 Découvrez Live Search de votre PC ou de votre appareil mobile dès
 aujourd'hui. http://www.live.com/?mkt=fr-ca


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






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



Re: Call listener after page appears on screen

2006-10-26 Thread Christian Dutaret

I don't think this would work in this case. The @InvokeListener component is
called on the server side, before the rendered response is flushed to the
client. What is discussed here is having a listener invoked after the page
is rendered on the client side, typically for a wait screen that will keep
displaying an animated gif until a long database transaction completes on
the server side (at least that is why I needed this).

2006/10/26, Daniel Tabuenca [EMAIL PROTECTED]:


Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:
 I tried to achieve the same thing some time ago, and I couldn't find
 anything that would work with dojo and EventListeners.
 As you mentioned, this is probably due to tapestry connect events being
 called _after_ any point where we could insert any custom js.

 The workaround I found to work perfectly is use contrib:XTile component
 instead, with a small js script that calls the XTile generated js
function
 at the bottom of the page

 hth
 Ch.

 2006/10/26, Peter Beshai [EMAIL PROTECTED]:
 
  Oh, I should've mentioned I tried that already. It doesn't give an
error
  on
  page load, but it also doesn't call the listener. It gives this error
when
  I
  try calling it manually:
 
  dojo.byId(mockHidden).click()
  Error: buildTargetProperties() Unknown target type:[object
HTMLDocument]
 
  I have tried making the mockHidden a Button (forgot this causes
  EventListener to break
  [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField
(same
  error), Submit button (works, but sends the page into an infinite
loop...
  it
  doesn't pick up that it should be asynchronous), a span (same
error),
  and
  currently a Checkbox.
 
  Also, onclick() -worked- after the page had loaded and I tried calling
it
  manually.
 
  Peter Beshai
 
  From: Karthik N [EMAIL PROTECTED]
  Reply-To: Tapestry users users@tapestry.apache.org
  To: Tapestry users users@tapestry.apache.org
  Subject: Re: Call listener after page appears on screen
  Date: Thu, 26 Oct 2006 20:25:55 +0530
  
  please try click() instead of onclick()
  
  On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
  
  Is there an easy way of calling a listener after the page appears
  (rendered)
  on screen? I couldn't think of one, and so I tried having adding an
  event
  to
  the onload of the page:
  
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
  
  or
  
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
  
  where mockHidden is a component that has an eventlistener (the
listener
  I
  want to have called after the page is loaded) attached to it in my
.java
  file. If I call dojo.byId(mockHidden).onclick() from firebug's
  console,
  it
  works, but when the page loads it says :: dojo.byId
  (mockHidden).onclick
  is
  not a function.
  
  I figured that was because tapestry connects the event at the end of
the
  page (and that script block is somewhere before that). Is there
any
  way
  of
  having the javascript called AFTER tapestry has connected the
event?? Or
  is
  there another way of accomplishing this goal?
  
  Thanks,
  Peter Beshai
  
  _
  Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
  http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca
  
  
 
-
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
  --
  Thanks, Karthik
 
  _
  Découvrez Live Search de votre PC ou de votre appareil mobile dès
  aujourd'hui. http://www.live.com/?mkt=fr-ca
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



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




Re: Call listener after page appears on screen

2006-10-26 Thread Peter Beshai

The XTile seems to work exactly how I want it to, but there is a problem.

This is my setup:

Stage 1:
- User selects file in upload component and submits form.

I needed a way to keep track of the progress of the file while it was 
uploading (to implement a progress bar). I couldn't do this in the same 
listener as the one that is called when the form is submitted because async 
submits don't work with upload components (apparently). So it was suggested 
to me that I create a thread that will be initialized when the form is 
submitted and it will handle the file uploading.


- Thread is initialized with filename and inputstream and starts running.
- Thread is stored in a static Map of threads with its hashCode as the key

The listener finishes and the page reloads.

Stage 2:
- XTile calls a listener to start watching the progress of the file in the 
thread.


The send function for XTile passes in the hashCode of the thread that was 
used to upload the file (stored in a hidden field on the page).


The method is called until I put in the call to get my thread from the 
static Map. I get this error in the firebug console:


  response.responseXML has no properties.



Any ideas how to fix this? Or a better way of handling tracking the progress 
of a file?


Peter Beshai



From: Christian Dutaret [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:16:41 +0200

I don't think this would work in this case. The @InvokeListener component 
is

called on the server side, before the rendered response is flushed to the
client. What is discussed here is having a listener invoked after the page
is rendered on the client side, typically for a wait screen that will keep
displaying an animated gif until a long database transaction completes on
the server side (at least that is why I needed this).

2006/10/26, Daniel Tabuenca [EMAIL PROTECTED]:


Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:
 I tried to achieve the same thing some time ago, and I couldn't find
 anything that would work with dojo and EventListeners.
 As you mentioned, this is probably due to tapestry connect events being
 called _after_ any point where we could insert any custom js.

 The workaround I found to work perfectly is use contrib:XTile component
 instead, with a small js script that calls the XTile generated js
function
 at the bottom of the page

 hth
 Ch.

 2006/10/26, Peter Beshai [EMAIL PROTECTED]:
 
  Oh, I should've mentioned I tried that already. It doesn't give an
error
  on
  page load, but it also doesn't call the listener. It gives this error
when
  I
  try calling it manually:
 
  dojo.byId(mockHidden).click()
  Error: buildTargetProperties() Unknown target type:[object
HTMLDocument]
 
  I have tried making the mockHidden a Button (forgot this causes
  EventListener to break
  [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField
(same
  error), Submit button (works, but sends the page into an infinite
loop...
  it
  doesn't pick up that it should be asynchronous), a span (same
error),
  and
  currently a Checkbox.
 
  Also, onclick() -worked- after the page had loaded and I tried 
calling

it
  manually.
 
  Peter Beshai
 
  From: Karthik N [EMAIL PROTECTED]
  Reply-To: Tapestry users users@tapestry.apache.org
  To: Tapestry users users@tapestry.apache.org
  Subject: Re: Call listener after page appears on screen
  Date: Thu, 26 Oct 2006 20:25:55 +0530
  
  please try click() instead of onclick()
  
  On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
  
  Is there an easy way of calling a listener after the page appears
  (rendered)
  on screen? I couldn't think of one, and so I tried having adding an
  event
  to
  the onload of the page:
  
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
  
  or
  
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
  
  where mockHidden is a component that has an eventlistener (the
listener
  I
  want to have called after the page is loaded) attached to it in my
.java
  file. If I call dojo.byId(mockHidden).onclick() from firebug's
  console,
  it
  works, but when the page loads it says :: dojo.byId
  (mockHidden).onclick
  is
  not a function.
  
  I figured that was because tapestry connects the event at the end 
of

the
  page (and that script block is somewhere before that). Is there
any
  way
  of
  having the javascript called AFTER tapestry has connected the
event?? Or
  is
  there another way of accomplishing this goal?
  
  Thanks,
  Peter Beshai
  
  _
  Voyez vos amis en faisant un appel vidèo dans Windows Live 
Messenger

  http://imagine-msn.com/messenger

Re: Call listener after page appears on screen

2006-10-26 Thread andyhot
Try this:
script type=text/javascript
dojo.event.connect(window, onload,
  setTimeout(function() {
dojo.byId(mockHidden).onclick();
}, 50)
);
/script



Peter Beshai wrote:
 Is there an easy way of calling a listener after the page appears
 (rendered) on screen? I couldn't think of one, and so I tried having
 adding an event to the onload of the page:

 script type=text/javascript
 dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
 /script

 or

 script type=text/javascript
 dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
 /script

 where mockHidden is a component that has an eventlistener (the
 listener I want to have called after the page is loaded) attached to
 it in my .java file. If I call dojo.byId(mockHidden).onclick() from
 firebug's console, it works, but when the page loads it says ::
 dojo.byId(mockHidden).onclick is not a function.

 I figured that was because tapestry connects the event at the end of
 the page (and that script block is somewhere before that). Is there
 any way of having the javascript called AFTER tapestry has connected
 the event?? Or is there another way of accomplishing this goal?

 Thanks,
 Peter Beshai

 _
 Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
 http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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




-- 
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


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



Re: Call listener after page appears on screen

2006-10-26 Thread Peter Beshai
Ok, resolved the response.responseXML has no properties problem. I was 
tipped off by this post:


http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200512.mbox/[EMAIL
 PROTECTED]

public void xTileListener(IRequestCycle cycle, String stringKey) {
   Integer threadKey = Integer.valueOf(stringKey);
...
}
instead of Integer threadKey as the parameter.

Thanks for the help!
Peter


From: Peter Beshai [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 14:47:04 -0400

The XTile seems to work exactly how I want it to, but there is a problem.

This is my setup:

Stage 1:
- User selects file in upload component and submits form.

I needed a way to keep track of the progress of the file while it was 
uploading (to implement a progress bar). I couldn't do this in the same 
listener as the one that is called when the form is submitted because async 
submits don't work with upload components (apparently). So it was suggested 
to me that I create a thread that will be initialized when the form is 
submitted and it will handle the file uploading.


- Thread is initialized with filename and inputstream and starts running.
- Thread is stored in a static Map of threads with its hashCode as the key

The listener finishes and the page reloads.

Stage 2:
- XTile calls a listener to start watching the progress of the file in the 
thread.


The send function for XTile passes in the hashCode of the thread that was 
used to upload the file (stored in a hidden field on the page).


The method is called until I put in the call to get my thread from the 
static Map. I get this error in the firebug console:


  response.responseXML has no properties.



Any ideas how to fix this? Or a better way of handling tracking the 
progress of a file?


Peter Beshai



From: Christian Dutaret [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 20:16:41 +0200

I don't think this would work in this case. The @InvokeListener component 
is

called on the server side, before the rendered response is flushed to the
client. What is discussed here is having a listener invoked after the page
is rendered on the client side, typically for a wait screen that will keep
displaying an animated gif until a long database transaction completes on
the server side (at least that is why I needed this).

2006/10/26, Daniel Tabuenca [EMAIL PROTECTED]:


Why not just use an @InvokeListener component as the last component in
your page?


On 10/26/06, Christian Dutaret [EMAIL PROTECTED] wrote:
 I tried to achieve the same thing some time ago, and I couldn't find
 anything that would work with dojo and EventListeners.
 As you mentioned, this is probably due to tapestry connect events 
being

 called _after_ any point where we could insert any custom js.

 The workaround I found to work perfectly is use contrib:XTile 
component

 instead, with a small js script that calls the XTile generated js
function
 at the bottom of the page

 hth
 Ch.

 2006/10/26, Peter Beshai [EMAIL PROTECTED]:
 
  Oh, I should've mentioned I tried that already. It doesn't give an
error
  on
  page load, but it also doesn't call the listener. It gives this 
error

when
  I
  try calling it manually:
 
  dojo.byId(mockHidden).click()
  Error: buildTargetProperties() Unknown target type:[object
HTMLDocument]
 
  I have tried making the mockHidden a Button (forgot this causes
  EventListener to break
  [https://issues.apache.org/jira/browse/TAPESTRY-1095]), TextField
(same
  error), Submit button (works, but sends the page into an infinite
loop...
  it
  doesn't pick up that it should be asynchronous), a span (same
error),
  and
  currently a Checkbox.
 
  Also, onclick() -worked- after the page had loaded and I tried 
calling

it
  manually.
 
  Peter Beshai
 
  From: Karthik N [EMAIL PROTECTED]
  Reply-To: Tapestry users users@tapestry.apache.org
  To: Tapestry users users@tapestry.apache.org
  Subject: Re: Call listener after page appears on screen
  Date: Thu, 26 Oct 2006 20:25:55 +0530
  
  please try click() instead of onclick()
  
  On 10/26/06, Peter Beshai [EMAIL PROTECTED] wrote:
  
  Is there an easy way of calling a listener after the page appears
  (rendered)
  on screen? I couldn't think of one, and so I tried having adding 
an

  event
  to
  the onload of the page:
  
  script type=text/javascript
  dojo.event.connect(window, onload,dojo.byId
(mockHidden).onclick());
  /script
  
  or
  
  script type=text/javascript
  dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
  /script
  
  where mockHidden is a component that has an eventlistener (the
listener
  I
  want to have called after the page is loaded) attached to it in my
.java
  file. If I call dojo.byId(mockHidden).onclick() from

Re: Call listener after page appears on screen

2006-10-26 Thread Peter Beshai
I did eventually try that and it worked but it seemed slightly volatile. I'm 
not sure if this has to do with how my snapshots have been rolled back to 
August versions (see snapshots thread), but I randomly see in my dojo 
console tapestry.cleanConnect is not a function and when that happens that 
solution doesn't work.


Peter Beshai



From: andyhot [EMAIL PROTECTED]
Reply-To: Tapestry users users@tapestry.apache.org
To: Tapestry users users@tapestry.apache.org
Subject: Re: Call listener after page appears on screen
Date: Thu, 26 Oct 2006 19:25:31 +0300

Try this:
script type=text/javascript
dojo.event.connect(window, onload,
  setTimeout(function() {
dojo.byId(mockHidden).onclick();
}, 50)
);
/script



Peter Beshai wrote:
 Is there an easy way of calling a listener after the page appears
 (rendered) on screen? I couldn't think of one, and so I tried having
 adding an event to the onload of the page:

 script type=text/javascript
 dojo.event.connect(window, onload,dojo.byId(mockHidden).onclick());
 /script

 or

 script type=text/javascript
 dojo.addOnLoad(function(e){ dojo.byId(mockHidden).onclick() });
 /script

 where mockHidden is a component that has an eventlistener (the
 listener I want to have called after the page is loaded) attached to
 it in my .java file. If I call dojo.byId(mockHidden).onclick() from
 firebug's console, it works, but when the page loads it says ::
 dojo.byId(mockHidden).onclick is not a function.

 I figured that was because tapestry connects the event at the end of
 the page (and that script block is somewhere before that). Is there
 any way of having the javascript called AFTER tapestry has connected
 the event?? Or is there another way of accomplishing this goal?

 Thanks,
 Peter Beshai

 _
 Voyez vos amis en faisant un appel vidèo dans Windows Live Messenger
 http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-ca


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




--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting


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



_
Découvrez Live Search de votre PC ou de votre appareil mobile dès 
aujourd’hui. http://www.live.com/?mkt=fr-ca



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