Wicket 6.0 and Javascript Event Registration question

2012-01-30 Thread Thomas Götz
Just a thought about the upcoming changes to Wicket's Javascript event 
registration mechanism in Wicket 6.0 (instead of inline JS events): 

we have several Behaviors that provide Javascript in which we register to JS 
events, e.g. 'onblur'. Now I have a Component that additionally has an 
AjaxEventBehavior(onblur). Currently, the Behaviors that registered to 
'onblur' are guaranteed to execute before the inline 'onblur' event (provided 
by the AjaxEventBehavior). Could this be a problem with Wicket 6.0? Meaning: 
will it still be possible to provide additional Behaviors that register JS 
events that execute *before* any event behavior already registered to some 
Component? Or how will Wicket's JS event mechanism figure out the order of 
Behaviors?

Cheers,
   -Tom
 



Re: Wicket 6.0 and Javascript Event Registration question

2012-01-30 Thread Martin Grigorov
Hi,

The new code registers listeners with jQuery's on() method which uses
internally addEventListener() (IE9 and others) and attachEvent() (IE8
and less).
So you need to execute your JS code after Wicket's.
Wicket executes its bindings when the DOM is ready, so you must be
careful that your Mootools code is run after Wicket's.
Better try with a simple app and see how it behaves.

On Mon, Jan 30, 2012 at 5:49 PM, Thomas Götz t...@richmountain.de wrote:
 Just a thought about the upcoming changes to Wicket's Javascript event 
 registration mechanism in Wicket 6.0 (instead of inline JS events):

 we have several Behaviors that provide Javascript in which we register to JS 
 events, e.g. 'onblur'. Now I have a Component that additionally has an 
 AjaxEventBehavior(onblur). Currently, the Behaviors that registered to 
 'onblur' are guaranteed to execute before the inline 'onblur' event (provided 
 by the AjaxEventBehavior). Could this be a problem with Wicket 6.0? Meaning: 
 will it still be possible to provide additional Behaviors that register JS 
 events that execute *before* any event behavior already registered to some 
 Component? Or how will Wicket's JS event mechanism figure out the order of 
 Behaviors?

 Cheers,
   -Tom





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 6.0 and Javascript Event Registration question

2012-01-30 Thread Thomas Götz
This will cause quite some trouble for the application I'm currently developing.

Example:
we have a Behavior that puts input hints on several textfields (e.g. 
dd/mm/ for day input fields). The Behavior provides a JS file in which we 
register for the submit event of the containing form and thus assure that 
input hints are removed on form submit. For this implementation it's crucial 
that the JS is executed before any 'onsubmit' handler provided by Wicket. Also, 
we remove/restore input hints 'onblur' of the textfield, which also has an 
AjaxFormComponentUpdatingBehavior(onblur). Here it's also crucial that our 
code is executed before Wicket's (which will ajax post the values).

Just an example in our applications, but maybe worth considering as others 
might have similar implementations for other usecases. Sure, many things can be 
handled by AjaxCallDecorator, but not all ;-)

Cheers,
   -Tom



Martin Grigorov wrote:

 Hi,
  
 The new code registers listeners with jQuery's on() method which uses
 internally addEventListener() (IE9 and others) and attachEvent() (IE8
 and less).
 So you need to execute your JS code after Wicket's.
 Wicket executes its bindings when the DOM is ready, so you must be
 careful that your Mootools code is run after Wicket's.
 Better try with a simple app and see how it behaves.
  
 On Mon, Jan 30, 2012 at 5:49 PM, Thomas Götz t...@richmountain.de 
 (mailto:t...@richmountain.de) wrote:
  Just a thought about the upcoming changes to Wicket's Javascript event 
  registration mechanism in Wicket 6.0 (instead of inline JS events):
   
  we have several Behaviors that provide Javascript in which we register to 
  JS events, e.g. 'onblur'. Now I have a Component that additionally has an 
  AjaxEventBehavior(onblur). Currently, the Behaviors that registered to 
  'onblur' are guaranteed to execute before the inline 'onblur' event 
  (provided by the AjaxEventBehavior). Could this be a problem with Wicket 
  6.0? Meaning: will it still be possible to provide additional Behaviors 
  that register JS events that execute *before* any event behavior already 
  registered to some Component? Or how will Wicket's JS event mechanism 
  figure out the order of Behaviors?
   
  Cheers,
-Tom
   
  
  
  
  
 --  
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com
  
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
 (mailto:users-unsubscr...@wicket.apache.org)
 For additional commands, e-mail: users-h...@wicket.apache.org 
 (mailto:users-h...@wicket.apache.org)
  
  




Re: Wicket 6.0 and Javascript Event Registration question

2012-01-30 Thread Martin Grigorov
Hi Thomas,

On Mon, Jan 30, 2012 at 10:40 PM, Thomas Götz t...@richmountain.de wrote:
 This will cause quite some trouble for the application I'm currently 
 developing.

 Example:
 we have a Behavior that puts input hints on several textfields (e.g. 
 dd/mm/ for day input fields). The Behavior provides a JS file in which we 
 register for the submit event of the containing form and thus assure that 
 input hints are removed on form submit. For this implementation it's crucial 
 that the JS is executed before any 'onsubmit' handler provided by Wicket. 
 Also, we remove/restore input hints 'onblur' of the textfield, which also has 
 an AjaxFormComponentUpdatingBehavior(onblur). Here it's also crucial that 
 our code is executed before Wicket's (which will ajax post the values).

 Just an example in our applications, but maybe worth considering as others 
 might have similar implementations for other usecases. Sure, many things can 
 be handled by AjaxCallDecorator, but not all ;-)

AjaxCallDecorator is removed because there is no script to decorate anymore.
There is AjaxCallListener which is called at the main lifecycle points
of the ajax call - before, after, onsuccess, onfailure and oncomplete.
For more information read
https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-o.a.w.ajax.IAjaxCallDecoratorisreplacedwitho.a.w.ajax.attributes.IAjaxCallListener.

In our Jira we accept tickets for Wicket 6.0 so don't hesitate to
create a quickstart that shows a real problem that cannot be
implemented with the new Wicket Ajax impl and we will try to improve
it before 6.0-final.


 Cheers,
   -Tom



 Martin Grigorov wrote:

 Hi,

 The new code registers listeners with jQuery's on() method which uses
 internally addEventListener() (IE9 and others) and attachEvent() (IE8
 and less).
 So you need to execute your JS code after Wicket's.
 Wicket executes its bindings when the DOM is ready, so you must be
 careful that your Mootools code is run after Wicket's.
 Better try with a simple app and see how it behaves.

 On Mon, Jan 30, 2012 at 5:49 PM, Thomas Götz t...@richmountain.de 
 (mailto:t...@richmountain.de) wrote:
  Just a thought about the upcoming changes to Wicket's Javascript event 
  registration mechanism in Wicket 6.0 (instead of inline JS events):
 
  we have several Behaviors that provide Javascript in which we register to 
  JS events, e.g. 'onblur'. Now I have a Component that additionally has an 
  AjaxEventBehavior(onblur). Currently, the Behaviors that registered to 
  'onblur' are guaranteed to execute before the inline 'onblur' event 
  (provided by the AjaxEventBehavior). Could this be a problem with Wicket 
  6.0? Meaning: will it still be possible to provide additional Behaviors 
  that register JS events that execute *before* any event behavior already 
  registered to some Component? Or how will Wicket's JS event mechanism 
  figure out the order of Behaviors?
 
  Cheers,
    -Tom
 




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
 (mailto:users-unsubscr...@wicket.apache.org)
 For additional commands, e-mail: users-h...@wicket.apache.org 
 (mailto:users-h...@wicket.apache.org)







-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org