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 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]



_________________________________________________________________
Essayez la nouvelle génération de recherche avec Live Search. http://www.live.com/?mkt=fr-ca


---------------------------------------------------------------------
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]

Reply via email to