Ad: Re: Generic solution for tabindex?
Thanks a lot Scott :) I've been thinking of something similar, but I don't like the idea of subclassing every component, that needs to be indexed. I've been playing with the thought of going through the components on a page and modify / add the tabindex attribute on the components in the page. I'm not really sure about how and where I could possibly do this?! It has to be done after all components, also those from the panels is available in the object hierarchy, is there any hooks in the framework that would allow me to do something like this? I guess this would still not solve the Ajax issues mentioned :( -- Espen Ønvik Pedersen Seksjon for IT-utvikling, Husbanken Kontor: +47 32 26 26 33 - Sentralbord: +47 815 33 370 Fra: Scott Swank scott.sw...@gmail.com Til: users@wicket.apache.org Dato: 10.03.2010 18:45 Emne: Re: Generic solution for tabindex? We have created a bad solution. The core problem is ajax. Say you have five fields: A, B, C, D E. Now you want to insert X Y between A B. No static numbering system will allow an unknown number of fields to be inserted in between the existing fields. On top of that you need to have the boundaries of the numbering ranges well-defined. Say you have two columns, numbered as follows: A(10) D(40) B(20) E(50) C(30) F(60) Now let's say you insert a new row (our old friends X Y) after the first, you want to end up with something like: A(10) D(40) X(15) Y(45) B(20) E(50) C(30) F(60) But it is not a simple matter to accomplish this. So here's what we have, which as I said has problems with corner cases. For various FormComponents we have subclasses such as the following: public class TabIndexTextFieldT extends TextFieldT implements TabIndexable { private ModelInteger tabIndexModel = new ModelInteger(0); public TabIndexTextField(String id) { super(id); add(new AttributeModifier(tabindex, true, tabIndexModel)); } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); // call a parent WebMarkupContainer that implements TabIndexed // and knows how to examine // ValueMap vMap = c.getMarkupAttributes(); // if (vMap.containsKey(tabindex)) //tabIndex = vMap.getInt(tabindex); // to set the tabIndexModel's value } } The above is reasonably sound, however the implementation of TabIndexed needs cleanup and has problems with corner conditions. I'll post the gist of that logic if you like, but the actual implementation is spread out (unnecessarily) across a couple of classes. Scott On Wed, Mar 10, 2010 at 7:12 AM, espen.peder...@husbanken.no wrote: Hi! Is use a lot of panels on my pages and need to be able to dynamically set the tabindex attribute on the FormComponents contained in the panels, so that when I reuse them in differenet page compositions the tabindex will be correct (top-to-bottom). Any good ideas out there on how this could be done? -- Espen Ønvik Pedersen - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Generic solution for tabindex?
Hi! Is use a lot of panels on my pages and need to be able to dynamically set the tabindex attribute on the FormComponents contained in the panels, so that when I reuse them in differenet page compositions the tabindex will be correct (top-to-bottom). Any good ideas out there on how this could be done? -- Espen Ønvik Pedersen
Validate with info messages, instead of errors
Hi all! I'm Looking for a way to perform validation, but print the messages as INFO (with Ajax), instead of ERRORs. I'd like to have a combination of error and info validators. An error will prevent the user from submitting the form, the info message will give the user a warning/info message. The messages should popup during an onblur event from the component and be displayed in a way similar to: http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket . I've been looking into extending for instance MaximumValidator and let it report info messages, unfortunately I'm unable to get hold og the Component through the IValidatable interface impl. The error message, which I'd like to use, is built up inside the FromComponents error method and unavailable for me. Maybe I'm on the wrong the wrong path here? Anybody that has done something similar? -- Espen Ønvik Pedersen
Ad: Re: Validate with info messages, instead of errors
Hmm .. you're probably right about your first statement. I still have some issues with adapting MaximumValidator as it does not give access to the FormComponent that has this validator attached. So as far as I can see I have to send the component in as a parameter, which I'd like to avoid. Also the error message that is created by the validator which available from within the Validator itself, so I would have to fetch it my self. Not a big deal I guess if I have the instance object of the FormComponent, but if possible I'd like to inherit the creation of the messages from MaximumValidator. -- Espen Ønvik Pedersen Fra: Antoine van Wel antoine.van@gmail.com Til: users@wicket.apache.org Dato: 25.02.2010 16:04 Emne: Re: Validate with info messages, instead of errors As for the link you show, the author is building something which is available in the Wicket core, which he seems to have missed or perhaps it's just an outdated article. Make a FeedbackPanel for every FormComponent you want to have messages for and initialize it with a ComponentFeedbackMessageFilter so you will only see the info/error messages relevant to the FormComponent you attach that filter to. I don't really see the problem with adapting a MaximumValidator output info messages instead of errors, just override validate or copy and paste the whole thing and adapt it, it's a small class. Antoine. On Thu, Feb 25, 2010 at 1:27 PM, espen.peder...@husbanken.no wrote: Hi all! I'm Looking for a way to perform validation, but print the messages as INFO (with Ajax), instead of ERRORs. I'd like to have a combination of error and info validators. An error will prevent the user from submitting the form, the info message will give the user a warning/info message. The messages should popup during an onblur event from the component and be displayed in a way similar to: http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket . I've been looking into extending for instance MaximumValidator and let it report info messages, unfortunately I'm unable to get hold og the Component through the IValidatable interface impl. The error message, which I'd like to use, is built up inside the FromComponents error method and unavailable for me. Maybe I'm on the wrong the wrong path here? Anybody that has done something similar? -- Espen Ønvik Pedersen - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org