Re: Default Focus Behavior?

2009-12-28 Thread duncan787

Great tip, thanks!  After implementing, I see that the behavior is added to
the text field correctly, but the renderHead() method is not being called,
can you help me understand why that is?


jwcarman wrote:
 
 On 3/9/08, James Carman ja...@carmanconsulting.com wrote:
 On 3/9/08, Warren war...@clarksnutrition.com wrote:
   WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
bodyTag.add(new SimpleAttributeModifier(onload,
form.username.focus();));


 Ok, but wouldn't it be cooler/easier/more java-oriented to do:

  TextField userName = new TextField(userName);
  userName.addBehavior(new DefaultFocusBehavior());

  or

  Behaviors.defaultFocus(userName); // Assuming Behaviors existed.


 
 How about something like:
 
 public class DefaultFocusBehavior extends AbstractBehavior
 {
 private Component component;
 
 public void bind( Component component )
 {
 this.component = component;
 component.setOutputMarkupId(true);
 }
 
 public void renderHead( IHeaderResponse iHeaderResponse )
 {
 super.renderHead(iHeaderResponse);
 iHeaderResponse.renderOnLoadJavascript(document.getElementById('
 + component.getMarkupId() + ').focus(););
 }
 }
 
  
  
 -Original Message-
 From: jcar...@carmanconsulting.com
 [mailto:jcar...@carmanconsulting.com]on Behalf Of James Carman
 Sent: Sunday, March 09, 2008 7:58 AM
 To: users@wicket.apache.org
 Subject: Default Focus Behavior?


 Is there a behavior (or some other way) for having a field receive
 the
 focus when the page loads?  For instance, in a login form, you'd
 want
 the focus to go to the username field or perhaps the password field
 if
 you've got remember me turned on.

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

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

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

-- 
View this message in context: 
http://old.nabble.com/Default-Focus-Behavior--tp15934889p26944784.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2009-12-28 Thread Martin Makundi
Hi!

Did you implement the IHeaderContributor and mark @Override?

2009/12/28 duncan787 duncan...@gmail.com:

 Great tip, thanks!  After implementing, I see that the behavior is added to
 the text field correctly, but the renderHead() method is not being called,
 can you help me understand why that is?


**
Martin

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



Re: Default Focus Behavior?

2009-12-28 Thread duncan787

Thank you MartinM.  Your question caused me to question the other methods I
was overriding from the super...after removing those unnecessary overridden
methods, its working like a charm.

Thank you!


MartinM wrote:
 
 Hi!
 
 Did you implement the IHeaderContributor and mark @Override?
 
 2009/12/28 duncan787 duncan...@gmail.com:

 Great tip, thanks!  After implementing, I see that the behavior is added
 to
 the text field correctly, but the renderHead() method is not being
 called,
 can you help me understand why that is?

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

-- 
View this message in context: 
http://old.nabble.com/Default-Focus-Behavior--tp15934889p26944984.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2008-12-29 Thread Scott Swank
Jonathan,

Have you considered O'Reilly's Cookbook series?  I've done some tech
review for them over the years, though not recently.  E-mail me
directly if you'd like a potentially dated contact.  :)

Scott


On Sun, Dec 28, 2008 at 9:26 AM, Jonathan Locke
jonathan.lo...@gmail.com wrote:


 I have a really elegant solution to this problem that is general enough to
 go in core or extensions eventually (solves all of the above problems).

 Actually, I'm putting together a short, but action-packed book called
 Twenty-Six Wicket Tricks and the code for this problem is going to be
 trick F (i'm halfway through the alphabet already). If anyone really
 desperately wants this and they promise to give me feedback on it, they can
 email me.


 Antony Stubbs wrote:

 Why not put this code into Wicket?


 jwcarman wrote:

 On 3/11/08, Martijn Dashorst martijn.dasho...@gmail.com wrote:
 I suggest wiki.


 Done:

 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component

 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.

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






 --
 View this message in context: 
 http://www.nabble.com/Default-Focus-Behavior--tp15934889p21194288.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: Default Focus Behavior?

2008-12-28 Thread Jonathan Locke


I have a really elegant solution to this problem that is general enough to
go in core or extensions eventually (solves all of the above problems).

Actually, I'm putting together a short, but action-packed book called
Twenty-Six Wicket Tricks and the code for this problem is going to be
trick F (i'm halfway through the alphabet already). If anyone really
desperately wants this and they promise to give me feedback on it, they can
email me.


Antony Stubbs wrote:
 
 Why not put this code into Wicket?
 
 
 jwcarman wrote:
 
 On 3/11/08, Martijn Dashorst martijn.dasho...@gmail.com wrote:
 I suggest wiki.

 
 Done:
 
 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component
 
 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p21194288.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2008-12-02 Thread Antony Stubbs

Why not put this code into Wicket?


jwcarman wrote:
 
 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 I suggest wiki.

 
 Done:
 
 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component
 
 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


-
___

http://stubbisms.wordpress.com http://stubbisms.wordpress.com 
-- 
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p20790155.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2008-06-12 Thread Rod Good
Hi,
 
I'm trying to set the 'focus on load' to an AutoCompleteTextField within
a form.
 
I tried extending the technique outlined by James Carman (see link) to
extend AbstractDefaultAjaxBehavior, without success.
 
Any thoughts on how to do this ?
 
Thanks,
Rod.
 
http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Spe
cific+Form+Component

NOTICE
This e-mail and any attachments are confidential and may contain copyright 
material of Macquarie Group Limited or third parties. If you are not the 
intended recipient of this email you should not read, print, re-transmit, store 
or act in reliance on this e-mail or any attachments, and should destroy all 
copies of them. Macquarie Group Limited does not guarantee the integrity of any 
emails or any attached files. The views or opinions expressed are the author's 
own and may not reflect the views or opinions of Macquarie Group Limited.



RE: Default Focus Behavior?

2008-06-12 Thread Rod Good
Here's that link ...

http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Spe
cific+Form+Component

Note that the technique outlined does set the focus correctly, but after
I use the autocomplete box it throws a runtime exception : 

Root cause:
java.lang.IllegalStateException: No behavior listener found with
behaviorId 4; Component: [MarkupContainer [Component id = ac, page =
au.com.macquarie.hr.edms.web.ed.EDMainPage, path =
6:edSelectionPanel:form:ac.EDSelectionPanel$EdSelectionForm$1, isVisible
= true, isVersioned = false]] 
at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
t.processEvents(BehaviorRequestTarget.java:95) 
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
stractRequestCycleProcessor.java:91) 
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
:1171) 
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1248) 
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1349) 
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) 
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:387
) 
at
org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:
145) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252) 
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173) 
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFil
terInternal(OpenSessionInViewFilter.java:198) 
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequ
estFilter.java:75) 
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202) 
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173) 
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213) 
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178) 
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126) 
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105) 
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107) 
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48) 
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9) 
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:667) 
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527) 
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80) 
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684) 
at java.lang.Thread.run(Thread.java:619)
 

-Original Message-
From: Rod Good 
Sent: Friday, 13 June 2008 1:06 PM
To: users@wicket.apache.org
Subject: Re: Default Focus Behavior?

Hi,
 
I'm trying to set the 'focus on load' to an AutoCompleteTextField within
a form.
 
I tried extending the technique outlined by James Carman (see link) to
extend AbstractDefaultAjaxBehavior, without success.
 
Any thoughts on how to do this ?
 
Thanks,
Rod.
 
http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Spe
cific+Form+Component

NOTICE
This e-mail and any attachments are confidential and may contain
copyright material of Macquarie Group Limited or third parties. If you
are not the intended recipient of this email you should not read, print,
re-transmit, store or act in reliance on this e-mail or any attachments,
and should destroy all copies of them. Macquarie Group Limited does not
guarantee the integrity of any emails or any attached files. The views
or opinions expressed are the author's own and may not reflect the views
or opinions of Macquarie Group Limited.


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



Re: Default Focus Behavior?

2008-05-29 Thread Doug Donohoe

This helped me.  Thanks, jwcarman!

-Doug


jwcarman wrote:
 
 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 I suggest wiki.

 
 Done:
 
 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component
 
 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p17547678.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2008-05-29 Thread James Carman
Glad to hear it!  If you are using it to highlight/focus on errors and
you have the time, update the wiki with a little example since I never
got around to it. :)


On Thu, May 29, 2008 at 6:43 PM, Doug Donohoe [EMAIL PROTECTED] wrote:

 This helped me.  Thanks, jwcarman!

 -Doug


 jwcarman wrote:

 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 I suggest wiki.


 Done:

 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component

 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.

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




 --
 View this message in context: 
 http://www.nabble.com/Default-Focus-Behavior--tp15934889p17547678.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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: Default Focus Behavior?

2008-03-11 Thread Martijn Dashorst
We have this discussion with each major release of Wicket, and each
time there are 100 ways to skin the cat. We want not only to minimize
the surface area, but also the number of requests to alter the
behavior of existing functionality. If we implement method X, then
sure enough someone comes along and wants method Y because that is his
usecase, then someone wants method Z etc. In this case there won't be
a convergence to a single usecase.

Martijn

On 3/11/08, James Carman [EMAIL PROTECTED] wrote:
 On 3/10/08, Igor Vaynberg [EMAIL PROTECTED] wrote:
   i dont think something like this should go into core. it seems pretty
clear from this thread that there are very many ways to do this and
each project will use their own. what you have proposed seems trivial
to construct, so for projects that want to use it its a nobrainer. i
think things that go into core should at least satisfy the majority of
common usecases or be at least of moderate complexity. if we start
putting every trivial thing like this into core we will end up with a
huge surface area - at which point you have to start thinking of the
find/build tradeoff - is it easier to find something that does what i
want in core or simply roll my own which will only take fifteen
minutes...


 Okay, suit yourself, but I was actually quite surprised that this
  wasn't included in the core.  This seems like a common enough
  requirement that a certain field in a form should receive the focus
  when the page loads.

  p.s. I might change the name to FocusOnLoadBehavior, though.  That
  seems more descriptive.


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




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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



Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 We have this discussion with each major release of Wicket, and each
  time there are 100 ways to skin the cat. We want not only to minimize
  the surface area, but also the number of requests to alter the
  behavior of existing functionality. If we implement method X, then
  sure enough someone comes along and wants method Y because that is his
  usecase, then someone wants method Z etc. In this case there won't be
  a convergence to a single usecase.


Ok, if someone wants to use that code example I posted, then they can
find it in the archives.  Or, I guess we could put that out there as a
wiki tip?

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



Re: Default Focus Behavior?

2008-03-11 Thread Martijn Dashorst
I suggest wiki.

Thanks,

Martijn

On 3/11/08, James Carman [EMAIL PROTECTED] wrote:
 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
   We have this discussion with each major release of Wicket, and each
time there are 100 ways to skin the cat. We want not only to minimize
the surface area, but also the number of requests to alter the
behavior of existing functionality. If we implement method X, then
sure enough someone comes along and wants method Y because that is his
usecase, then someone wants method Z etc. In this case there won't be
a convergence to a single usecase.
  


 Ok, if someone wants to use that code example I posted, then they can
  find it in the archives.  Or, I guess we could put that out there as a
  wiki tip?


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




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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



Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 I suggest wiki.


Done:

http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component

I'm happy now.  My work (no matter how trivial) may help someone
someday! :)  I don't have time to do so now, but I might add in some
examples on how to do focus on errors, etc.

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



Re: Default Focus Behavior?

2008-03-11 Thread Martijn Dashorst
Another option would be (if there is enough interest) to add it to
wicketstuff minis.

Martijn

-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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



Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
i still think that behaviors to control focus is a bit wrong
focus should have 1 entry point
and i guess that is WebPage.focusComponent()
or maybe Form (but you could have 2)
By the way we have focus support in ajax mode... see AjaxRequestTarget

johan



On Tue, Mar 11, 2008 at 12:41 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
  Another option would be (if there is enough interest) to add it to
   wicketstuff minis.
 

 Yeah, I thought about that.  And, I may try to put that in there.
 Perhaps there could be a few focus behaviors in there?  Perhaps even a
 FocusBehaviors class with static helper methods:

 public FocusBehaviors
 {
  public static void focusOnLoad(FormComponent fc);
  public static void focusFirstError(Form form);
 }

 Something like that.

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




Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 Another option would be (if there is enough interest) to add it to
  wicketstuff minis.


Yeah, I thought about that.  And, I may try to put that in there.
Perhaps there could be a few focus behaviors in there?  Perhaps even a
FocusBehaviors class with static helper methods:

public FocusBehaviors
{
  public static void focusOnLoad(FormComponent fc);
  public static void focusFirstError(Form form);
}

Something like that.

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



Re: Default Focus Behavior?

2008-03-11 Thread Sebastiaan van Erk

Sebastiaan van Erk wrote:

Johan Compagner wrote:

i still think that behaviors to control focus is a bit wrong
focus should have 1 entry point


I agree.


and i guess that is WebPage.focusComponent()


I agree on that one too.


or maybe Form (but you could have 2)


Exactly, so not a good idea. The page should determine which form gets 
focus.



By the way we have focus support in ajax mode... see AjaxRequestTarget

johan


It would still be useful to have some strategies for selecting the 
component to focus lying around, so you can plug them in, e.g., first 
blank field, first error, etc. These strategies could then work on a 
form. If you have multiple forms on a page, you'll have to make up your 
own strategy to choose which form you focus, but you can still use the 
provided strategies once you've chosen that.


Regards,
Sebastiaan


Thinking about it some more, you probably want to delegate the *choice* 
of which form field is focused to the form which is selected for focus. 
That is, page decides which form to focus, form decides which field to 
focus. That way you can encapsulate complicated focusing behavior in the 
components themselves instead of having to put it the page. A good 
default behavior for a page could be to ask the first form in the 
component hierarchy which field to focus. Another good default is to 
focus nothing.


Regards,
Sebastiaan




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Default Focus Behavior?

2008-03-11 Thread Sebastiaan van Erk

Johan Compagner wrote:

i still think that behaviors to control focus is a bit wrong
focus should have 1 entry point


I agree.


and i guess that is WebPage.focusComponent()


I agree on that one too.


or maybe Form (but you could have 2)


Exactly, so not a good idea. The page should determine which form gets 
focus.



By the way we have focus support in ajax mode... see AjaxRequestTarget

johan


It would still be useful to have some strategies for selecting the 
component to focus lying around, so you can plug them in, e.g., first 
blank field, first error, etc. These strategies could then work on a 
form. If you have multiple forms on a page, you'll have to make up your 
own strategy to choose which form you focus, but you can still use the 
provided strategies once you've chosen that.


Regards,
Sebastiaan





On Tue, Mar 11, 2008 at 12:41 PM, James Carman [EMAIL PROTECTED]
wrote:


On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:

Another option would be (if there is enough interest) to add it to
 wicketstuff minis.


Yeah, I thought about that.  And, I may try to put that in there.
Perhaps there could be a few focus behaviors in there?  Perhaps even a
FocusBehaviors class with static helper methods:

public FocusBehaviors
{
 public static void focusOnLoad(FormComponent fc);
 public static void focusFirstError(Form form);
}

Something like that.

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






smime.p7s
Description: S/MIME Cryptographic Signature


Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 i still think that behaviors to control focus is a bit wrong
  focus should have 1 entry point
  and i guess that is WebPage.focusComponent()
  or maybe Form (but you could have 2)
  By the way we have focus support in ajax mode... see AjaxRequestTarget

So, who calls WebPage.focusComponent()?

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



Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
you do

WebPage.focusComponent(textField)

johan

On Tue, Mar 11, 2008 at 2:30 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
  i still think that behaviors to control focus is a bit wrong
   focus should have 1 entry point
   and i guess that is WebPage.focusComponent()
   or maybe Form (but you could have 2)
   By the way we have focus support in ajax mode... see AjaxRequestTarget

 So, who calls WebPage.focusComponent()?

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




Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 you do

  WebPage.focusComponent(textField)

I mean, in what class?  Your page class?  In a component class?  I'm
just trying to understand what the difference is between doing
WebPage.focusComponent(textField) or textField.add(new
FocuOnLoadBehavior())?  If it's the same code that would be calling
either one, it's just a matter of *how* it's being set up.  It's not a
matter of responsibility going to the correct place.

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



Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
MyPage()
{
 textField1.add(new FocuOnLoadBehavior());
 textField2.add(new FocuOnLoadBehavior());
 textField3.add(new FocuOnLoadBehavior());
}

which fields gets the focus?
On Tue, Mar 11, 2008 at 2:49 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
  you do
 
   WebPage.focusComponent(textField)

 I mean, in what class?  Your page class?  In a component class?  I'm
 just trying to understand what the difference is between doing
 WebPage.focusComponent(textField) or textField.add(new
 FocuOnLoadBehavior())?  If it's the same code that would be calling
 either one, it's just a matter of *how* it's being set up.  It's not a
 matter of responsibility going to the correct place.

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




Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
and a behavior is really the wrong thing
Because who says if you render the page again that it has to again set the
focus on that one?

 MyPage()
{
 textField1.add(new FocuOnLoadBehavior());
 textField2.add(new FocuOnLoadBehavior());
 textField3.add(new FocuOnLoadBehavior());
 Form form = new Form()
{
  onSubmit()
{
   // validate fails on textfield4 so transfer focus to that one like
this:??
textField4.add(new FocuOnLoadBehavior());
}
}

what happens now?


On Tue, Mar 11, 2008 at 3:12 PM, Johan Compagner [EMAIL PROTECTED]
wrote:

 MyPage()
 {
  textField1.add(new FocuOnLoadBehavior());
  textField2.add(new FocuOnLoadBehavior());
  textField3.add(new FocuOnLoadBehavior());
 }

 which fields gets the focus?
   On Tue, Mar 11, 2008 at 2:49 PM, James Carman 
 [EMAIL PROTECTED] wrote:

  On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
   you do
  
WebPage.focusComponent(textField)
 
  I mean, in what class?  Your page class?  In a component class?  I'm
  just trying to understand what the difference is between doing
  WebPage.focusComponent(textField) or textField.add(new
  FocuOnLoadBehavior())?  If it's the same code that would be calling
  either one, it's just a matter of *how* it's being set up.  It's not a
  matter of responsibility going to the correct place.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
that still wouldn't help adding 3 of them at once



On Tue, Mar 11, 2008 at 3:17 PM, Gerolf Seitz [EMAIL PROTECTED]
wrote:

 the behavior would have to be temporary.

 On Tue, Mar 11, 2008 at 3:14 PM, Johan Compagner [EMAIL PROTECTED]
  wrote:

  and a behavior is really the wrong thing
  Because who says if you render the page again that it has to again set
 the
  focus on that one?
 
   MyPage()
  {
   textField1.add(new FocuOnLoadBehavior());
   textField2.add(new FocuOnLoadBehavior());
   textField3.add(new FocuOnLoadBehavior());
   Form form = new Form()
  {
   onSubmit()
  {
// validate fails on textfield4 so transfer focus to that one like
  this:??
 textField4.add(new FocuOnLoadBehavior());
  }
  }
 
  what happens now?
 
 
  On Tue, Mar 11, 2008 at 3:12 PM, Johan Compagner [EMAIL PROTECTED]
  wrote:
 
   MyPage()
   {
textField1.add(new FocuOnLoadBehavior());
textField2.add(new FocuOnLoadBehavior());
textField3.add(new FocuOnLoadBehavior());
   }
  
   which fields gets the focus?
 On Tue, Mar 11, 2008 at 2:49 PM, James Carman 
   [EMAIL PROTECTED] wrote:
  
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 you do

  WebPage.focusComponent(textField)
   
I mean, in what class?  Your page class?  In a component class?  I'm
just trying to understand what the difference is between doing
WebPage.focusComponent(textField) or textField.add(new
FocuOnLoadBehavior())?  If it's the same code that would be calling
either one, it's just a matter of *how* it's being set up.  It's not
 a
matter of responsibility going to the correct place.
   
   
 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
 


th


Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Gerolf Seitz [EMAIL PROTECTED] wrote:
 the behavior would have to be temporary.

Yes, the behaviors stay with the component.  I guess that would screw
this up! :)

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



Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 that still wouldn't help adding 3 of them at once


Well, adding three of them like this would just be stupid. :)  It
wouldn't really break anything.  The last one that gets rendered would
probably get the focus, since it would be the last one to contribute
its head contribution.

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



Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
yes so it is not the last one you ask to have focus on
Very confusing for an average user

thats why there should be a single point just like
AjaxRequestTarget.focusComponent() works.

johan



On Tue, Mar 11, 2008 at 3:24 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
  that still wouldn't help adding 3 of them at once
 

 Well, adding three of them like this would just be stupid. :)  It
 wouldn't really break anything.  The last one that gets rendered would
 probably get the focus, since it would be the last one to contribute
 its head contribution.

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




Re: Default Focus Behavior?

2008-03-11 Thread Gerolf Seitz
the behavior would have to be temporary.

On Tue, Mar 11, 2008 at 3:14 PM, Johan Compagner [EMAIL PROTECTED]
wrote:

 and a behavior is really the wrong thing
 Because who says if you render the page again that it has to again set the
 focus on that one?

  MyPage()
 {
  textField1.add(new FocuOnLoadBehavior());
  textField2.add(new FocuOnLoadBehavior());
  textField3.add(new FocuOnLoadBehavior());
  Form form = new Form()
 {
  onSubmit()
 {
   // validate fails on textfield4 so transfer focus to that one like
 this:??
textField4.add(new FocuOnLoadBehavior());
 }
 }

 what happens now?


 On Tue, Mar 11, 2008 at 3:12 PM, Johan Compagner [EMAIL PROTECTED]
 wrote:

  MyPage()
  {
   textField1.add(new FocuOnLoadBehavior());
   textField2.add(new FocuOnLoadBehavior());
   textField3.add(new FocuOnLoadBehavior());
  }
 
  which fields gets the focus?
On Tue, Mar 11, 2008 at 2:49 PM, James Carman 
  [EMAIL PROTECTED] wrote:
 
   On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
you do
   
 WebPage.focusComponent(textField)
  
   I mean, in what class?  Your page class?  In a component class?  I'm
   just trying to understand what the difference is between doing
   WebPage.focusComponent(textField) or textField.add(new
   FocuOnLoadBehavior())?  If it's the same code that would be calling
   either one, it's just a matter of *how* it's being set up.  It's not a
   matter of responsibility going to the correct place.
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 



Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 yes so it is not the last one you ask to have focus on
  Very confusing for an average user

  thats why there should be a single point just like
  AjaxRequestTarget.focusComponent() works.

Ok, you've sold me.  So, is this something that belongs in core?
Shouldn't the core have facilities for managing component focus?  The
Ajax folks shouldn't be the only ones who get this luxury. :)  Perhaps
an IFocusManager interface?  Would that go on the IRequestCycle (since
you can only focus one component per request) or on the Page?

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



Re: Default Focus Behavior?

2008-03-11 Thread Gerolf Seitz
how about boolean WebPage#isAutoFocusEnabled and the possibility
to provide several IFocusStrategy instances with different priority?
this would allow to eg only set the focus on the first formcomponent of the
first form if no other formcomponent has an error...

On Tue, Mar 11, 2008 at 3:36 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
  yes so it is not the last one you ask to have focus on
   Very confusing for an average user
 
   thats why there should be a single point just like
   AjaxRequestTarget.focusComponent() works.

 Ok, you've sold me.  So, is this something that belongs in core?
 Shouldn't the core have facilities for managing component focus?  The
 Ajax folks shouldn't be the only ones who get this luxury. :)  Perhaps
 an IFocusManager interface?  Would that go on the IRequestCycle (since
 you can only focus one component per request) or on the Page?

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




Re: Default Focus Behavior?

2008-03-11 Thread Johan Compagner
hmm the request cycle would be quite awful its not really there for that
kind of state
The problem is that the AjaxRequestTarget is in normal rendering something
like PageRequestTarget.

The problem is you cant really through it on a Page because the page can
maybe not be accessed
(if you have a panel that wants to try to set the focus on its first
component)

So then we are back at the that the only place where it could be on is the
RequestCycle yes.

johan



On Tue, Mar 11, 2008 at 3:36 PM, James Carman [EMAIL PROTECTED]
wrote:

 On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
  yes so it is not the last one you ask to have focus on
   Very confusing for an average user
 
   thats why there should be a single point just like
   AjaxRequestTarget.focusComponent() works.

 Ok, you've sold me.  So, is this something that belongs in core?
 Shouldn't the core have facilities for managing component focus?  The
 Ajax folks shouldn't be the only ones who get this luxury. :)  Perhaps
 an IFocusManager interface?  Would that go on the IRequestCycle (since
 you can only focus one component per request) or on the Page?

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




Re: Default Focus Behavior?

2008-03-11 Thread James Carman
On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:
 hmm the request cycle would be quite awful its not really there for that
  kind of state
  The problem is that the AjaxRequestTarget is in normal rendering something
  like PageRequestTarget.

  The problem is you cant really through it on a Page because the page can
  maybe not be accessed
  (if you have a panel that wants to try to set the focus on its first
  component)

  So then we are back at the that the only place where it could be on is the
  RequestCycle yes.

Yeah, I didn't like RequestCycle at first either, but it seems like
the only place for it if you want to abstract it so that ajax and
non-ajax requests alike could access the IFocusManager.

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



Re: Default Focus Behavior?

2008-03-11 Thread Sebastiaan van Erk

Gerolf Seitz wrote:

how about boolean WebPage#isAutoFocusEnabled and the possibility
to provide several IFocusStrategy instances with different priority?
this would allow to eg only set the focus on the first formcomponent of the
first form if no other formcomponent has an error...


I like something like this idea, though I don't really see the need for 
the isAutoFocusEnabled?


If you have an IFocusStrategy with a method getFocusComponent() which 
returns the component that should get the focus, then null could mean 
none (i.e., no autofocus), and anything else could mean focus that 
component. You could just have 1 single IFocusStrategy on a page, and if 
you want to chain them just make a ChainingFocusStrategy (i.e., one of 
them returns null, then go to the next).


What I would also like is if components can have their own 
IFocusStrategy, so that you can use these to compose your focus strategy 
for the page. This way complex components can manage their own focus 
strategy and you don't break encapsulation.


This all amounts to a setFocusStrategy on Component, with the one in the 
page ultimately choosing the component which gets the focus.


Just some thoughts...

Regards,
Sebastiaan




On Tue, Mar 11, 2008 at 3:36 PM, James Carman [EMAIL PROTECTED]
wrote:


On 3/11/08, Johan Compagner [EMAIL PROTECTED] wrote:

yes so it is not the last one you ask to have focus on
 Very confusing for an average user

 thats why there should be a single point just like
 AjaxRequestTarget.focusComponent() works.

Ok, you've sold me.  So, is this something that belongs in core?
Shouldn't the core have facilities for managing component focus?  The
Ajax folks shouldn't be the only ones who get this luxury. :)  Perhaps
an IFocusManager interface?  Would that go on the IRequestCycle (since
you can only focus one component per request) or on the Page?

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






smime.p7s
Description: S/MIME Cryptographic Signature


Re: Default Focus Behavior?

2008-03-10 Thread Nino Saturnino Martinez Vazquez Wael
What I mean is commonly used when users must enter data quickly, eg no 
mouse clicks. Not sure if the use case is large enough, though..


So the following thing can happend:

When you fill a textfield to a certain length(or press enter) or choose 
a radio button it automaticly passes on to the next tab order.. :


User comes to the form page(or wizard with multible steps)
Fills in data by using only keyboard and numeric pad(for selecting 
radios etc)...


Does that clarify anything?

And yes tab order should be followed..

regards Nino

Sebastiaan van Erk wrote:
I think he means that, suppose you have a username and password field; 
then if the username is already filled in (e.g. from a cookie), then 
focus should go to the next field (password field).


It probably should be the same as the tab order (first empty field in 
tab order gets focus) from a ui perspective...


Regards,
Sebastiaan

James Carman wrote:

I don't think I understand what you mean here.  Do you mean something
like setting the tab order like in Swing?

On 3/9/08, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

What about a chaining component?

 EG you enter something in form.field a, and when thats filled then it
 jumps to form field b..? Etc...



 regards Nino

 James Carman wrote:


On 3/9/08, Warren [EMAIL PROTECTED] wrote:

 
  WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
   bodyTag.add(new SimpleAttributeModifier(onload,
   form.username.focus();));
 
 
  Ok, but wouldn't it be cooler/easier/more java-oriented to do:
 
  TextField userName = new TextField(userName);
  userName.addBehavior(new DefaultFocusBehavior());
 
  or
 
  Behaviors.defaultFocus(userName); // Assuming Behaviors existed.
 
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of James Carman
Sent: Sunday, March 09, 2008 7:58 AM
To: users@wicket.apache.org
Subject: Default Focus Behavior?
   
   
Is there a behavior (or some other way) for having a field 
receive the
focus when the page loads?  For instance, in a login form, 
you'd want
the focus to go to the username field or perhaps the password 
field if

you've got remember me turned on.
   
 
 
  
-

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

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

 --

-Wicket for love
 -Jme for fun

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


 -

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]



--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Default Focus Behavior?

2008-03-10 Thread Igor Vaynberg
On Sun, Mar 9, 2008 at 1:37 PM, James Carman [EMAIL PROTECTED] wrote:
 On 3/9/08, djo.mos [EMAIL PROTECTED] wrote:
  
  
   This simply looks great ! I think this should make it into the core Wicket
behaviors as the componenet focus is quite useful.
  

  Me too!  That's why I submitted:

  https://issues.apache.org/jira/browse/WICKET-1404

  I was pretty surprised something didn't exist for this already.  I
  don't mean any offense by that at all.  It's just that it seems like
  every time I think to myself there should be a way to do x with
  Wicket, there's already something for that!  This Wicket stuff is
  pretty cool!

i dont think something like this should go into core. it seems pretty
clear from this thread that there are very many ways to do this and
each project will use their own. what you have proposed seems trivial
to construct, so for projects that want to use it its a nobrainer. i
think things that go into core should at least satisfy the majority of
common usecases or be at least of moderate complexity. if we start
putting every trivial thing like this into core we will end up with a
huge surface area - at which point you have to start thinking of the
find/build tradeoff - is it easier to find something that does what i
want in core or simply roll my own which will only take fifteen
minutes...

now, for example, if this behavior was meant to be attached to a form
and would set focus on the first component that is not valid...

-igor






  -
  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: Default Focus Behavior?

2008-03-10 Thread Gin Yeah
Can we have a faq in the wiki enumerating all the possible scenarios and
solutions?

On Sun, Mar 9, 2008 at 11:51 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 On Sun, Mar 9, 2008 at 1:37 PM, James Carman [EMAIL PROTECTED]
 wrote:
  On 3/9/08, djo.mos [EMAIL PROTECTED] wrote:
   
   
This simply looks great ! I think this should make it into the core
 Wicket
 behaviors as the componenet focus is quite useful.
   
 
   Me too!  That's why I submitted:
 
   https://issues.apache.org/jira/browse/WICKET-1404
 
   I was pretty surprised something didn't exist for this already.  I
   don't mean any offense by that at all.  It's just that it seems like
   every time I think to myself there should be a way to do x with
   Wicket, there's already something for that!  This Wicket stuff is
   pretty cool!

 i dont think something like this should go into core. it seems pretty
 clear from this thread that there are very many ways to do this and
 each project will use their own. what you have proposed seems trivial
 to construct, so for projects that want to use it its a nobrainer. i
 think things that go into core should at least satisfy the majority of
 common usecases or be at least of moderate complexity. if we start
 putting every trivial thing like this into core we will end up with a
 huge surface area - at which point you have to start thinking of the
 find/build tradeoff - is it easier to find something that does what i
 want in core or simply roll my own which will only take fifteen
 minutes...

 now, for example, if this behavior was meant to be attached to a form
 and would set focus on the first component that is not valid...

 -igor



 
 
 
   -
   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: Default Focus Behavior?

2008-03-10 Thread James Carman
On 3/10/08, Igor Vaynberg [EMAIL PROTECTED] wrote:
 i dont think something like this should go into core. it seems pretty
  clear from this thread that there are very many ways to do this and
  each project will use their own. what you have proposed seems trivial
  to construct, so for projects that want to use it its a nobrainer. i
  think things that go into core should at least satisfy the majority of
  common usecases or be at least of moderate complexity. if we start
  putting every trivial thing like this into core we will end up with a
  huge surface area - at which point you have to start thinking of the
  find/build tradeoff - is it easier to find something that does what i
  want in core or simply roll my own which will only take fifteen
  minutes...

Okay, suit yourself, but I was actually quite surprised that this
wasn't included in the core.  This seems like a common enough
requirement that a certain field in a form should receive the focus
when the page loads.

p.s. I might change the name to FocusOnLoadBehavior, though.  That
seems more descriptive.

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



RE: Default Focus Behavior?

2008-03-09 Thread Warren
WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
bodyTag.add(new SimpleAttributeModifier(onload,
form.username.focus();));

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of James Carman
 Sent: Sunday, March 09, 2008 7:58 AM
 To: users@wicket.apache.org
 Subject: Default Focus Behavior?


 Is there a behavior (or some other way) for having a field receive the
 focus when the page loads?  For instance, in a login form, you'd want
 the focus to go to the username field or perhaps the password field if
 you've got remember me turned on.

 -
 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: Default Focus Behavior?

2008-03-09 Thread James Carman
On 3/9/08, Warren [EMAIL PROTECTED] wrote:
 WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
  bodyTag.add(new SimpleAttributeModifier(onload,
  form.username.focus();));

Ok, but wouldn't it be cooler/easier/more java-oriented to do:

TextField userName = new TextField(userName);
userName.addBehavior(new DefaultFocusBehavior());

or

Behaviors.defaultFocus(userName); // Assuming Behaviors existed.



   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] Behalf Of James Carman
   Sent: Sunday, March 09, 2008 7:58 AM
   To: users@wicket.apache.org
   Subject: Default Focus Behavior?
  
  
   Is there a behavior (or some other way) for having a field receive the
   focus when the page loads?  For instance, in a login form, you'd want
   the focus to go to the username field or perhaps the password field if
   you've got remember me turned on.
  

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



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



Re: Default Focus Behavior?

2008-03-09 Thread James Carman
On 3/9/08, James Carman [EMAIL PROTECTED] wrote:
 On 3/9/08, Warren [EMAIL PROTECTED] wrote:
   WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
bodyTag.add(new SimpleAttributeModifier(onload,
form.username.focus();));


 Ok, but wouldn't it be cooler/easier/more java-oriented to do:

  TextField userName = new TextField(userName);
  userName.addBehavior(new DefaultFocusBehavior());

  or

  Behaviors.defaultFocus(userName); // Assuming Behaviors existed.



How about something like:

public class DefaultFocusBehavior extends AbstractBehavior
{
private Component component;

public void bind( Component component )
{
this.component = component;
component.setOutputMarkupId(true);
}

public void renderHead( IHeaderResponse iHeaderResponse )
{
super.renderHead(iHeaderResponse);
iHeaderResponse.renderOnLoadJavascript(document.getElementById('
+ component.getMarkupId() + ').focus(););
}
}

  
  
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of James Carman
 Sent: Sunday, March 09, 2008 7:58 AM
 To: users@wicket.apache.org
 Subject: Default Focus Behavior?


 Is there a behavior (or some other way) for having a field receive the
 focus when the page loads?  For instance, in a login form, you'd want
 the focus to go to the username field or perhaps the password field if
 you've got remember me turned on.

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


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



Re: Default Focus Behavior?

2008-03-09 Thread Nino Saturnino Martinez Vazquez Wael

true..!

You could add it to wicket input events , if it fits..


regards Nino

James Carman wrote:

On 3/9/08, Warren [EMAIL PROTECTED] wrote:
  

WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
 bodyTag.add(new SimpleAttributeModifier(onload,
 form.username.focus();));



Ok, but wouldn't it be cooler/easier/more java-oriented to do:

TextField userName = new TextField(userName);
userName.addBehavior(new DefaultFocusBehavior());

or

Behaviors.defaultFocus(userName); // Assuming Behaviors existed.

  

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of James Carman
  Sent: Sunday, March 09, 2008 7:58 AM
  To: users@wicket.apache.org
  Subject: Default Focus Behavior?
 
 
  Is there a behavior (or some other way) for having a field receive the
  focus when the page loads?  For instance, in a login form, you'd want
  the focus to go to the username field or perhaps the password field if
  you've got remember me turned on.
 



-
  

  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]





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


  


--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Default Focus Behavior?

2008-03-09 Thread Nino Saturnino Martinez Vazquez Wael
What about a chaining component? 

EG you enter something in form.field a, and when thats filled then it 
jumps to form field b..? Etc...



regards Nino

James Carman wrote:

On 3/9/08, Warren [EMAIL PROTECTED] wrote:
  

WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
 bodyTag.add(new SimpleAttributeModifier(onload,
 form.username.focus();));



Ok, but wouldn't it be cooler/easier/more java-oriented to do:

TextField userName = new TextField(userName);
userName.addBehavior(new DefaultFocusBehavior());

or

Behaviors.defaultFocus(userName); // Assuming Behaviors existed.

  

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of James Carman
  Sent: Sunday, March 09, 2008 7:58 AM
  To: users@wicket.apache.org
  Subject: Default Focus Behavior?
 
 
  Is there a behavior (or some other way) for having a field receive the
  focus when the page loads?  For instance, in a login form, you'd want
  the focus to go to the username field or perhaps the password field if
  you've got remember me turned on.
 



-
  

  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]





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


  


--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



RE: Default Focus Behavior?

2008-03-09 Thread Warren
I extended WebMarkupContainer and called it BodyTag. I would then extend
TextField and mark it as needing focus. I would add my TextField to BodyTag
and have BodyTag look for a component that needed default focus and then add
SimpleAttributeModifier(onload, document.getElementById(' +
component.getMarkupId() + ').focus();) to BodyTag.

Your way looks much cleaner, java-oriented, especially since I have a lot
of other things I add to the onload event of the body tag. And the way you
have it, it looks like renderHead can get called many times by extending
AbstractBehavior. Thanks for the idea, I think I am going to try it your
way.

I am fairly new to Wicket and am not up to speed on all that it can do and
how it does it. I don't know if I answered any of your questions, but you
answered a few of mine.

Thanks,

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of James Carman
 Sent: Sunday, March 09, 2008 8:52 AM
 To: users@wicket.apache.org
 Subject: Re: Default Focus Behavior?


 On 3/9/08, James Carman [EMAIL PROTECTED] wrote:
  On 3/9/08, Warren [EMAIL PROTECTED] wrote:
WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
 bodyTag.add(new SimpleAttributeModifier(onload,
 form.username.focus();));
 
 
  Ok, but wouldn't it be cooler/easier/more java-oriented to do:
 
   TextField userName = new TextField(userName);
   userName.addBehavior(new DefaultFocusBehavior());
 
   or
 
   Behaviors.defaultFocus(userName); // Assuming Behaviors existed.
 
 

 How about something like:

 public class DefaultFocusBehavior extends AbstractBehavior
 {
 private Component component;

 public void bind( Component component )
 {
 this.component = component;
 component.setOutputMarkupId(true);
 }

 public void renderHead( IHeaderResponse iHeaderResponse )
 {
 super.renderHead(iHeaderResponse);
 iHeaderResponse.renderOnLoadJavascript(document.getElementById('
 + component.getMarkupId() + ').focus(););
 }
 }

   
   
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of James Carman
  Sent: Sunday, March 09, 2008 7:58 AM
  To: users@wicket.apache.org
  Subject: Default Focus Behavior?
 
 
  Is there a behavior (or some other way) for having a
 field receive the
  focus when the page loads?  For instance, in a login
 form, you'd want
  the focus to go to the username field or perhaps the
 password field if
  you've got remember me turned on.
 
   

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

 -
 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: Default Focus Behavior?

2008-03-09 Thread djo.mos



jwcarman wrote:
 
 How about something like:
 
 public class DefaultFocusBehavior extends AbstractBehavior
 {
 private Component component;
 
 public void bind( Component component )
 {
 this.component = component;
 component.setOutputMarkupId(true);
 }
 
 public void renderHead( IHeaderResponse iHeaderResponse )
 {
 super.renderHead(iHeaderResponse);
 iHeaderResponse.renderOnLoadJavascript(document.getElementById('
 + component.getMarkupId() + ').focus(););
 }
 }
 

This simply looks great ! I think this should make it into the core Wicket
behaviors as the componenet focus is quite useful.

Cheers.

-- 
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p15945036.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Default Focus Behavior?

2008-03-09 Thread Peter Ertl
-1 for letting components handle focus. There's only _one_ focus that  
can set on a page at a time. What if several components demand focus?  
Who will be the winner?


Also, not every WebComponent can receive focus (Label, Image, ...) but  
only FormComponents (input, select, button, ...)


I vote for a method like:

WebPage#setFocus(FormComponent component)

class WebPage
{
  private FormComponent focus;

public final void setFocus(FormComponent component)
{
  focus = component;
  focus.setOutputMarkupId(true);
}

public void renderHead(IHeaderResponse response)
{
  if (focus != null)
  {
	final String item = String.format(document.getElementById('%s'),  
focus.getMarkupId());
final String js = String.format(%s.focus(); try  
{ %s.select() } catch( /* ignore */ ), item);


response.renderOnDomReadyJavascript(js);
  }
}
}




Regards
Peter


Am 09.03.2008 um 20:04 schrieb djo.mos:





jwcarman wrote:


How about something like:

public class DefaultFocusBehavior extends AbstractBehavior
{
   private Component component;

   public void bind( Component component )
   {
   this.component = component;
   component.setOutputMarkupId(true);
   }

   public void renderHead( IHeaderResponse iHeaderResponse )
   {
   super.renderHead(iHeaderResponse);

iHeaderResponse.renderOnLoadJavascript(document.getElementById('

+ component.getMarkupId() + ').focus(););
   }
}



This simply looks great ! I think this should make it into the core  
Wicket

behaviors as the componenet focus is quite useful.

Cheers.

--
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p15945036.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
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: Default Focus Behavior?

2008-03-09 Thread James Carman
On 3/9/08, Peter Ertl [EMAIL PROTECTED] wrote:
 -1 for letting components handle focus. There's only _one_ focus that
  can set on a page at a time. What if several components demand focus?
  Who will be the winner?

Well, the last one that requests it will win because it will be the
last javascript statement executed.  The components themselves aren't
requesting focus.  The person who puts the page/form together is
requesting that the component be the one focused.  If they're dumb
enough to try to set focus on more than one form component, then
that's what they'll get.  This isn't for every situation, obviously,
but it could be helpful for many.


  Also, not every WebComponent can receive focus (Label, Image, ...) but
  only FormComponents (input, select, button, ...)


True, I might add some logic into the bind() method to throw an
exception if you pass in a component that can't be focused (a non
FormComponent maybe?).

  I vote for a method like:

  WebPage#setFocus(FormComponent component)

  class WebPage
  {
private FormComponent focus;

  public final void setFocus(FormComponent component)
  {
focus = component;
focus.setOutputMarkupId(true);
  }

  public void renderHead(IHeaderResponse response)
  {
if (focus != null)
{
 final String item = String.format(document.getElementById('%s'),
  focus.getMarkupId());
  final String js = String.format(%s.focus(); try
  { %s.select() } catch( /* ignore */ ), item);

  response.renderOnDomReadyJavascript(js);
}
  }
  }



I still like my way better. ;-)

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



Re: Default Focus Behavior?

2008-03-09 Thread James Carman
I don't think I understand what you mean here.  Do you mean something
like setting the tab order like in Swing?

On 3/9/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:
 What about a chaining component?

  EG you enter something in form.field a, and when thats filled then it
  jumps to form field b..? Etc...



  regards Nino

  James Carman wrote:

  On 3/9/08, Warren [EMAIL PROTECTED] wrote:
  
   WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
bodyTag.add(new SimpleAttributeModifier(onload,
form.username.focus();));
  
  
   Ok, but wouldn't it be cooler/easier/more java-oriented to do:
  
   TextField userName = new TextField(userName);
   userName.addBehavior(new DefaultFocusBehavior());
  
   or
  
   Behaviors.defaultFocus(userName); // Assuming Behaviors existed.
  
  
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of James Carman
 Sent: Sunday, March 09, 2008 7:58 AM
 To: users@wicket.apache.org
 Subject: Default Focus Behavior?


 Is there a behavior (or some other way) for having a field receive the
 focus when the page loads?  For instance, in a login form, you'd want
 the focus to go to the username field or perhaps the password field if
 you've got remember me turned on.

  
  
   -
  
 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]
  
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  

  --

 -Wicket for love
  -Jme for fun

  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684


  -

 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: Default Focus Behavior?

2008-03-09 Thread James Carman
On 3/9/08, djo.mos [EMAIL PROTECTED] wrote:


 This simply looks great ! I think this should make it into the core Wicket
  behaviors as the componenet focus is quite useful.


Me too!  That's why I submitted:

https://issues.apache.org/jira/browse/WICKET-1404

I was pretty surprised something didn't exist for this already.  I
don't mean any offense by that at all.  It's just that it seems like
every time I think to myself there should be a way to do x with
Wicket, there's already something for that!  This Wicket stuff is
pretty cool!

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



Re: Default Focus Behavior?

2008-03-09 Thread Sebastiaan van Erk
I think he means that, suppose you have a username and password field; 
then if the username is already filled in (e.g. from a cookie), then 
focus should go to the next field (password field).


It probably should be the same as the tab order (first empty field in 
tab order gets focus) from a ui perspective...


Regards,
Sebastiaan

James Carman wrote:

I don't think I understand what you mean here.  Do you mean something
like setting the tab order like in Swing?

On 3/9/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:

What about a chaining component?

 EG you enter something in form.field a, and when thats filled then it
 jumps to form field b..? Etc...



 regards Nino

 James Carman wrote:


On 3/9/08, Warren [EMAIL PROTECTED] wrote:

 
  WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
   bodyTag.add(new SimpleAttributeModifier(onload,
   form.username.focus();));
 
 
  Ok, but wouldn't it be cooler/easier/more java-oriented to do:
 
  TextField userName = new TextField(userName);
  userName.addBehavior(new DefaultFocusBehavior());
 
  or
 
  Behaviors.defaultFocus(userName); // Assuming Behaviors existed.
 
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of James Carman
Sent: Sunday, March 09, 2008 7:58 AM
To: users@wicket.apache.org
Subject: Default Focus Behavior?
   
   
Is there a behavior (or some other way) for having a field receive the
focus when the page loads?  For instance, in a login form, you'd want
the focus to go to the username field or perhaps the password field if
you've got remember me turned on.
   
 
 
  -
 
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]
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --

-Wicket for love
 -Jme for fun

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


 -

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]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Default Focus Behavior?

2008-03-09 Thread James Carman
On 3/9/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote:
 I think he means that, suppose you have a username and password field;
  then if the username is already filled in (e.g. from a cookie), then
  focus should go to the next field (password field).


Well, since you set up the behavior in your Java code, couldn't you
decide which item gets the focus there?  I realize that could be
tedious for a large form, but I'm sure a nice helper method could get
the job done pretty easily.

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



RE: Default Focus Behavior?

2008-03-09 Thread Warren
I need to write a function that involves many components. It would be nice
to add a behavior to a form, like you have with a TextField, that would
construct a function that included all of the relevant components of that
form. The function I need to write looks like this:

function keyPressed()
{
  if (window.event.keyCode == 49)
  {
document.getElementById('button1').click();
  }
  if (window.event.keyCode == 50)
  {
document.getElementById('button2').click();
  }
  if (window.event.keyCode == 51)
  {
document.getElementById('button3').click();
  }
  ...
}

body onKeyPress=keyPressed() ... 

Do you have any suggestions or ideas?

 On 3/9/08, James Carman [EMAIL PROTECTED] wrote:
  On 3/9/08, Warren [EMAIL PROTECTED] wrote:
WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag);
 bodyTag.add(new SimpleAttributeModifier(onload,
 form.username.focus();));
 
 
  Ok, but wouldn't it be cooler/easier/more java-oriented to do:
 
   TextField userName = new TextField(userName);
   userName.addBehavior(new DefaultFocusBehavior());
 
   or
 
   Behaviors.defaultFocus(userName); // Assuming Behaviors existed.
 
 

 How about something like:

 public class DefaultFocusBehavior extends AbstractBehavior
 {
 private Component component;

 public void bind( Component component )
 {
 this.component = component;
 component.setOutputMarkupId(true);
 }

 public void renderHead( IHeaderResponse iHeaderResponse )
 {
 super.renderHead(iHeaderResponse);
 iHeaderResponse.renderOnLoadJavascript(document.getElementById('
 + component.getMarkupId() + ').focus(););
 }
 }

   
   
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of James Carman
  Sent: Sunday, March 09, 2008 7:58 AM
  To: users@wicket.apache.org
  Subject: Default Focus Behavior?
 
 
  Is there a behavior (or some other way) for having a
 field receive the
  focus when the page loads?  For instance, in a login
 form, you'd want
  the focus to go to the username field or perhaps the
 password field if
  you've got remember me turned on.
 
   

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

 -
 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: Default focus behavior for ajax request

2007-09-11 Thread Matej Knopp
Because currently there is no way during ajax processing to determine
that the event was a focus related one. I think that it's good to
restore focus on last focused element by default. But I'm also aware
that it causes problems with focus related event, so i think maybe we
should just call target.focusCompnent(null) in abstract ajax event
behavior if the event is onblur. Can you submit RFE?

-Matej

On 9/11/07, Carlos Pita [EMAIL PROTECTED] wrote:
 Hi,

 why is the default behavior for ajax requests to force focus into some
 component (normally the one which triggered the event that caused the
 request, I guess)? This produces some bizarre situations when onfocus
 or onblur are used for ajax validation. For example, if the form
 component to be validated gets its focus transferred to some browser
 ui widget (for example, the location bar), triggering an onblur
 validation this way, it immediately recaptures focus after validation
 has been completed (making it impossible to type text at the location
 bar unless your fingers happen to be faster than the ajax rtt, to
 follow the example). A similar problem occurs with tinymce editor, at
 least. This behavior can be circumvented explicitly setting
 target.focusComponent(null) for validation purposes, but why is it not
 this way in the first place, at least for the focus related events? Is
 there any rationale behind this that I'm missing?

 Regards,
 Carlos

 -
 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: Default focus behavior for ajax request

2007-09-11 Thread Carlos Pita
 behavior if the event is onblur. Can you submit RFE?

Done. I filed it as minor improvement
https://issues.apache.org/jira/browse/WICKET-957.

 Because currently there is no way during ajax processing to determine
 that the event was a focus related one. I think that it's good to

Maybe setting focusComponent to null by default for any
AjaxEventBehavior whose event happens to be onblur or onchange will be
enough. Even if done at the AjaxFormComponentUpdatingBehavior imo this
will be a great relief for people who are implementing their first
wicket ajax-validated forms and haven't a clue about the cause of such
a strange focus behavior that suddenly possesses their browsers.

Regards,
Carlos

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



Re: Default focus behavior for ajax request

2007-09-11 Thread Johan Compagner
see my comments in that issue.
Its not that we have to do something on the serverside this is a clientside
issue.

johan


On 9/11/07, Carlos Pita [EMAIL PROTECTED] wrote:

  behavior if the event is onblur. Can you submit RFE?

 Done. I filed it as minor improvement
 https://issues.apache.org/jira/browse/WICKET-957.

  Because currently there is no way during ajax processing to determine
  that the event was a focus related one. I think that it's good to

 Maybe setting focusComponent to null by default for any
 AjaxEventBehavior whose event happens to be onblur or onchange will be
 enough. Even if done at the AjaxFormComponentUpdatingBehavior imo this
 will be a great relief for people who are implementing their first
 wicket ajax-validated forms and haven't a clue about the cause of such
 a strange focus behavior that suddenly possesses their browsers.

 Regards,
 Carlos

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




Re: Default focus behavior for ajax request

2007-09-11 Thread Carlos Pita
Dunno. Up till now my workaround is to set focusComponent to null at
the server-side for validation purposes. I'm not suggesting that this
should be wicket's approach or something similar, of course.

Regards,
Carlos

On 9/11/07, Johan Compagner [EMAIL PROTECTED] wrote:
 see my comments in that issue.
 Its not that we have to do something on the serverside this is a clientside
 issue.

 johan


 On 9/11/07, Carlos Pita [EMAIL PROTECTED] wrote:
 
   behavior if the event is onblur. Can you submit RFE?
 
  Done. I filed it as minor improvement
  https://issues.apache.org/jira/browse/WICKET-957.
 
   Because currently there is no way during ajax processing to determine
   that the event was a focus related one. I think that it's good to
 
  Maybe setting focusComponent to null by default for any
  AjaxEventBehavior whose event happens to be onblur or onchange will be
  enough. Even if done at the AjaxFormComponentUpdatingBehavior imo this
  will be a great relief for people who are implementing their first
  wicket ajax-validated forms and haven't a clue about the cause of such
  a strange focus behavior that suddenly possesses their browsers.
 
  Regards,
  Carlos
 
  -
  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]