You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/03/12 10:19:17 UTC

T5: Please wait before I show you next page

Hi,

Often I have to process something for a while before returning a new page,
I'd like to inform users to wait for a while, any easy way to do this?
thanks.

A.C.
-- 
View this message in context: http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16000636.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


AW: AW: T5: Please wait before I show you next page

Posted by Martin Kersten <Ma...@mercateo.com>.
 
Hi Angelo,

  Sorry I am out of luck here. Are you meaning the client side
validation 
(you may switch it off for the sake of first testing) or server side
validation.
Since Server side validation should work, I guess you mean the client
side one.

As far as I remember the client side validation is implemented by JS.
Just use 
FireBug (or alike) and check what's happening onSubmit. I am too
outdated to 
answer this question, sorry.


Cheers,

Martin (Kersten)

<<<>>>>

Hi Kris and Martin,

Javascript works, however, here is a little problem, i display the
message when user submits, but if onValidationFromForm sends back an
error message, user has to correct some mistake, so the message is
always display regardless if the onSuccess is called or not, might be
nice if it will not display the 'in progress' message if there is some
validation error, thanks.

A.C.


Martin Kersten-2 wrote:
> 
> Hi Angelo,
> 
> If you might want to use a more simplier (and natural) approach use 
> java script.
> 
> 1. When user clicks the link -> Show a ProcessingMessage (gray out 
> form or whole page) 2. When the current page is being replaced -> Stop

> the ProcessingMessage (remove it) 3. The browser displays the next 
> page.
> 
> This works since tapestry blocks until the onSubmit (or whatever) is 
> finished so nothing is send unless the whole page (in case of submit a

> simple redirect) is completed.
> 
> 
> Think that will solve your problem! :-)
> 
> Cheers,
> 
> Martin (Kersten)
> 
> 
> A.C.
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp
> 16
> 000636p16000636.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

--
View this message in context:
http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16
000636p16001450.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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


Re: AW: T5: Please wait before I show you next page

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Kris and Martin,

Javascript works, however, here is a little problem, i display the message
when user submits, but if onValidationFromForm sends back an error message,
user has to correct some mistake, so the message is always display
regardless if the onSuccess is called or not, might be nice if it will not
display the 'in progress' message if there is some validation error, thanks.

A.C.


Martin Kersten-2 wrote:
> 
> Hi Angelo,
> 
> If you might want to use a more simplier (and natural) approach use java
> script.
> 
> 1. When user clicks the link -> Show a ProcessingMessage (gray out form
> or whole page)
> 2. When the current page is being replaced -> Stop the ProcessingMessage
> (remove it)
> 3. The browser displays the next page.
> 
> This works since tapestry blocks until the onSubmit (or whatever) is
> finished so nothing
> is send unless the whole page (in case of submit a simple redirect) is
> completed.
> 
> 
> Think that will solve your problem! :-)
> 
> Cheers,
> 
> Martin (Kersten)
> 
> 
> A.C.
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16
> 000636p16000636.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16001450.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


AW: T5: Please wait before I show you next page

Posted by Martin Kersten <Ma...@mercateo.com>.
Hi Angelo,

> Often I have to process something for a while before returning a new
page, 
> I'd like to inform users to wait for a while, any easy way to do this?
> thanks.

Idea 1: Use a page redirect

Page.onSubmit -> RedirectToLoadingPage -> LoadingPage displays ->
RedirectToAnswerPage
(The AnswerPage (or the page doing the actual work) will finish its
processing and will
magically replace the loading page).

I am a bit out of date of simple http redirects. But as far as I can
remember while
waiting for a page you redirect to the body content of the page forcing
the redirect
is still displayed.

If you might want to use a more simplier (and natural) approach use java
script.

1. When user clicks the link -> Show a ProcessingMessage (gray out form
or whole page)
2. When the current page is being replaced -> Stop the ProcessingMessage
(remove it)
3. The browser displays the next page.

This works since tapestry blocks until the onSubmit (or whatever) is
finished so nothing
is send unless the whole page (in case of submit a simple redirect) is
completed.


Think that will solve your problem! :-)

Cheers,

Martin (Kersten)


A.C.
--
View this message in context:
http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16
000636p16000636.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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


Re: T5: Please wait before I show you next page

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Harald,

Thanks for the example, i tried that out and got the idea, since we need to
add onClick to link the component to a certain javascript code, i don't
think mixins will work with jQuery as jQuery does not attach to any
component in the html code, what do you think?

A.C.

Harald Geritzer-2 wrote:
> 
> Angelo Chen schrieb:
>> Hi Kris,
>> 
>> mixin is interesting, is there a simple sample that I can learn from ?
>> thanks.
> 
> if you assign that mixing to a submit component, on click the javascript
> function 
> showProgressIndicator is called. the only drawback is, if you do client
> side validation and there is 
> an error, no roundtrip to the server is done and the message stays on
> screen :-(
> 
> @MixinAfter
> public class ProgressIndicator {
> 	
> 	@Parameter(value="message:progress-message-label",
> defaultPrefix="message")
> 	private String _message;
> 
> 	void beginRender(MarkupWriter writer) {
> 		writer.getElement().attribute("onClick", "javascript:
> showProgressIndicator('" + _message + "');");
> 	}
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16047719.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Antwort: Re: T5: Please wait before I show you next page

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi harald,

sorry... just read the part with the client side validation.... i think 
there is
an event we could use.... i've to dig deeper :)




Kristian Marinkovic <kr...@porsche.co.at> 
13.03.2008 16:43
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
"Tapestry users" <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: Please wait before I show you next page






i think the correct way what would be this:

1) write a mixin that collects the ids of the components in a global 
service/aso/whatever

2) after the page has rendered (maybe with a heartbeat or with 
in a MarkupRendererFilter service after renderMarkup(...)) use 
the collected ids and generate a javascript array

3) add javascript functions to your page that use the javascript array
to register eventhandler for every component id

with prototype you'd do somthing like that
$(element).observe("click",handler); 

4) let the registered event handler show the progress bar...
and let the event bubble up!!!

with prototype do NOT call following line:
Event.stop(event);

also take a closer look at PageRenderSupport for javascript
rendering

g,
kris

ps: don't use onClick anymore... instead always register event 
handlers; see www.quirksmode.org for more details on events






Harald Geritzer <h....@gmail.com> 
13.03.2008 15:41
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: Please wait before I show you next page







Angelo Chen schrieb:
> Hi Kris,
> 
> mixin is interesting, is there a simple sample that I can learn from ?
> thanks.

if you assign that mixing to a submit component, on click the javascript 
function 
showProgressIndicator is called. the only drawback is, if you do client 
side validation and there is 
an error, no roundtrip to the server is done and the message stays on 
screen :-(

@MixinAfter
public class ProgressIndicator {
 
                 @Parameter(value="message:progress-message-label", 
defaultPrefix="message")
                 private String _message;

                 void beginRender(MarkupWriter writer) {
                                 writer.getElement().attribute("onClick", 
"javascript: showProgressIndicator('" + _message + "');");
                 }
}

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




Re: T5: Please wait before I show you next page

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
i think the correct way what would be this:

1) write a mixin that collects the ids of the components in a global 
service/aso/whatever

2) after the page has rendered (maybe with a heartbeat or with 
in a MarkupRendererFilter service after renderMarkup(...)) use 
the collected ids and generate a javascript array

3) add javascript functions to your page that use the javascript array
to register eventhandler for every component id

with prototype you'd do somthing like that
$(element).observe("click",handler); 

4) let the registered event handler show the progress bar...
and let the event bubble up!!!

with prototype do NOT call following line:
Event.stop(event);

also take a closer look at PageRenderSupport for javascript
rendering

g,
kris

ps: don't use onClick anymore... instead always register event 
handlers; see www.quirksmode.org for more details on events






Harald Geritzer <h....@gmail.com> 
13.03.2008 15:41
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: Please wait before I show you next page







Angelo Chen schrieb:
> Hi Kris,
> 
> mixin is interesting, is there a simple sample that I can learn from ?
> thanks.

if you assign that mixing to a submit component, on click the javascript 
function 
showProgressIndicator is called. the only drawback is, if you do client 
side validation and there is 
an error, no roundtrip to the server is done and the message stays on 
screen :-(

@MixinAfter
public class ProgressIndicator {
 
                 @Parameter(value="message:progress-message-label", 
defaultPrefix="message")
                 private String _message;

                 void beginRender(MarkupWriter writer) {
                                 writer.getElement().attribute("onClick", 
"javascript: showProgressIndicator('" + _message + "');");
                 }
}

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



Re: T5: Please wait before I show you next page

Posted by Harald Geritzer <h....@gmail.com>.
Angelo Chen schrieb:
> Hi Kris,
> 
> mixin is interesting, is there a simple sample that I can learn from ?
> thanks.

if you assign that mixing to a submit component, on click the javascript function 
showProgressIndicator is called. the only drawback is, if you do client side validation and there is 
an error, no roundtrip to the server is done and the message stays on screen :-(

@MixinAfter
public class ProgressIndicator {
	
	@Parameter(value="message:progress-message-label", defaultPrefix="message")
	private String _message;

	void beginRender(MarkupWriter writer) {
		writer.getElement().attribute("onClick", "javascript: showProgressIndicator('" + _message + "');");
	}
}

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


RE: T5: Please wait before I show you next page

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Kris,

mixin is interesting, is there a simple sample that I can learn from ?
thanks.

A.C.

kristian.marinkovic wrote:
> 
> hi,
> 
> use some Javascript that will display a nice "Please wait..." dialog
> when a user performs a submit/click. you can achieve this by creating
> a mixin that will render that portion of the javascript that registers an 
> javascript event handler for the desired event and component id
> 
> 
> g,
> kris
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16025537.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: T5: Please wait before I show you next page

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi angelo,

you can take a look at the Autocomplete mixin in tapestry-core... this is 
a example
of a mixin creating javascript code

a mixin is very much alike a component as it has the same render phases. 
for 
example a component has a beginRender phase, a mixin too. The difference
is that a mixin can be attached to a component. 

if a mixin is added to a component its render phase methods (event) are 
called
before the component's methods. if the mixin has the @MixinAfter 
annotation it will
be called after (you can attach multiple mixins to a component).

example:

public class MixinA() {
    void beginRender() {System.out.println("mixin A")};
}
@MixinAfter
public class MixinB() {
    void beginRender() {System.out.println("mixin B")};
}
public class Comp() {
    void beginRender() {System.out.println("comp")};
}


@Component @MixinClasses(MixinA.class,MixinB.class)
Comp c;

the outcome will be:
mixin A
comp
mixin B

because mixins are like component you can use the markupwriter  to 
generate 
code or  inject services to, for example, generate javascript for the 
component
through PageRenderSupport. mixins offer code reuse accross multiple maybe 
totaly different compnents (separation of concerns)

i hope this helps ! more is available from the docs and mailing list :)

g,
kris




Angelo Chen <an...@yahoo.com.hk> 
13.03.2008 14:01
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
RE: T5: Please wait before I show you next page








Hi Kris,

mixin is interesting, is there a simple sample that I can learn from ?
thanks.

A.C.

kristian.marinkovic wrote:
> 
> hi,
> 
> use some Javascript that will display a nice "Please wait..." dialog
> when a user performs a submit/click. you can achieve this by creating
> a mixin that will render that portion of the javascript that registers 
an 
> javascript event handler for the desired event and component id
> 
> 
> g,
> kris
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16025201.html

Sent from the Tapestry - User mailing list archive at Nabble.com.


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



RE: T5: Please wait before I show you next page

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Kris,

mixin is interesting, is there a simple sample that I can learn from ?
thanks.

A.C.

kristian.marinkovic wrote:
> 
> hi,
> 
> use some Javascript that will display a nice "Please wait..." dialog
> when a user performs a submit/click. you can achieve this by creating
> a mixin that will render that portion of the javascript that registers an 
> javascript event handler for the desired event and component id
> 
> 
> g,
> kris
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16025201.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: T5: Please wait before I show you next page

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi,

use some Javascript that will display a nice "Please wait..." dialog
when a user performs a submit/click. you can achieve this by creating
a mixin that will render that portion of the javascript that registers an 
javascript event handler for the desired event and component id


g,
kris




Angelo Chen <an...@yahoo.com.hk> 
12.03.2008 10:19
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
T5: Please wait before I show you next page








Hi,

Often I have to process something for a while before returning a new page,
I'd like to inform users to wait for a while, any easy way to do this?
thanks.

A.C.
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Please-wait-before-I-show-you-next-page-tp16000636p16000636.html

Sent from the Tapestry - User mailing list archive at Nabble.com.


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