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 <[EMAIL PROTECTED]> 
13.03.2008 14:01
Bitte antworten an
"Tapestry users" <users@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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to