You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by es...@husbanken.no on 2010/03/10 16:12:23 UTC
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
Re: A question about using Spring in Wicket 1.4
Posted by Gwyn Evans <gw...@gmail.com>.
Fixed the Javadoc in 1.4.x & trunk. Thanks for reporting.
/Gwyn
On 11 March 2010 14:14, David Chang <da...@yahoo.com> wrote:
> James, thanks for quick reply. I guess I am a little confused is that in
> the init method, I use
>
> addComponentInstantiationListener(new SpringComponentInjector(this));
>
> instead of
>
> add(new SpringComponentInjector(this));
>
> as "Migrating" guide specified. The Guide-specified approach actually
> generates compiler error.
>
> Regards.
>
>
> --- On Thu, 3/11/10, James Carman <jc...@carmanconsulting.com> wrote:
>
> > From: James Carman <jc...@carmanconsulting.com>
> > Subject: Re: A question about using Spring in Wicket 1.4
> > To: users@wicket.apache.org
> > Date: Thursday, March 11, 2010, 9:09 AM
> > yes
> >
> > On Thu, Mar 11, 2010 at 8:56 AM, David Chang <da...@yahoo.com>
> > wrote:
> > > Yesterday I was looking at the page "Migrating to
> > Wicket 1.4"
> > >
> > > http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html
> > >
> > > Regarding SpringWebApplication, it says:
> > >
> > > SpringWebApplication has been deprecated in favor of
> > SpringBean annotation. See SpringWebApplication javadoc for
> > how to setup SpringBean based injection.
> > >
> > > I went to Wicket API about SpringWebApplication and it
> > says:
> > >
> > > Deprecated. when using java5 it is preferrable to use
> > SpringBean annotations for injection rather then this
> > spring-specific application subclass with its helpers. To
> > setup SpringBean add the following line to your
> > WebApplication subclass init method add(new
> > SpringComponentInjector(this));
> > >
> > > Here is my way of using Spring in my wicket app.
> > >
> > > 1. In the init method:
> > >
> > > addComponentInstantiationListener(new
> > SpringComponentInjector(this));
> > >
> > > Please note that it is not: add(new
> > SpringComponentInjector(this));
> > >
> > > 2. In wicket components that access Spring beans:
> > >
> > > @SpringBean
> > > private SupportService supportService;
> > >
> > >
> > > Am I doing Spring in Wicket right way?
> > >
> > > Thanks for input!
> > >
> > >
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: A question about using Spring in Wicket 1.4
Posted by Matthias Keller <ma...@ergon.ch>.
Hi David
addComponentInstantiationListener(new SpringComponentInjector(this));
is correct, as there is no add() method in Application.
Matt
On 2010-03-11 15:14, David Chang wrote:
> James, thanks for quick reply. I guess I am a little confused is that in the init method, I use
>
> addComponentInstantiationListener(new SpringComponentInjector(this));
>
> instead of
>
> add(new SpringComponentInjector(this));
>
> as "Migrating" guide specified. The Guide-specified approach actually generates compiler error.
>
> Regards.
>
>
> --- On Thu, 3/11/10, James Carman<jc...@carmanconsulting.com> wrote:
>
>
>> From: James Carman<jc...@carmanconsulting.com>
>> Subject: Re: A question about using Spring in Wicket 1.4
>> To: users@wicket.apache.org
>> Date: Thursday, March 11, 2010, 9:09 AM
>> yes
>>
>> On Thu, Mar 11, 2010 at 8:56 AM, David Chang<da...@yahoo.com>
>> wrote:
>>
>>> Yesterday I was looking at the page "Migrating to
>>>
>> Wicket 1.4"
>>
>>> http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html
>>>
>>> Regarding SpringWebApplication, it says:
>>>
>>> SpringWebApplication has been deprecated in favor of
>>>
>> SpringBean annotation. See SpringWebApplication javadoc for
>> how to setup SpringBean based injection.
>>
>>> I went to Wicket API about SpringWebApplication and it
>>>
>> says:
>>
>>> Deprecated. when using java5 it is preferrable to use
>>>
>> SpringBean annotations for injection rather then this
>> spring-specific application subclass with its helpers. To
>> setup SpringBean add the following line to your
>> WebApplication subclass init method add(new
>> SpringComponentInjector(this));
>>
>>> Here is my way of using Spring in my wicket app.
>>>
>>> 1. In the init method:
>>>
>>> addComponentInstantiationListener(new
>>>
>> SpringComponentInjector(this));
>>
>>> Please note that it is not: add(new
>>>
>> SpringComponentInjector(this));
>>
>>> 2. In wicket components that access Spring beans:
>>>
>>> @SpringBean
>>> private SupportService supportService;
>>>
>>>
>>> Am I doing Spring in Wicket right way?
>>>
>>> Thanks for input!
>>>
>>>
>>>
>>>
>>>
>>>
Re: A question about using Spring in Wicket 1.4
Posted by David Chang <da...@yahoo.com>.
James, thanks for quick reply. I guess I am a little confused is that in the init method, I use
addComponentInstantiationListener(new SpringComponentInjector(this));
instead of
add(new SpringComponentInjector(this));
as "Migrating" guide specified. The Guide-specified approach actually generates compiler error.
Regards.
--- On Thu, 3/11/10, James Carman <jc...@carmanconsulting.com> wrote:
> From: James Carman <jc...@carmanconsulting.com>
> Subject: Re: A question about using Spring in Wicket 1.4
> To: users@wicket.apache.org
> Date: Thursday, March 11, 2010, 9:09 AM
> yes
>
> On Thu, Mar 11, 2010 at 8:56 AM, David Chang <da...@yahoo.com>
> wrote:
> > Yesterday I was looking at the page "Migrating to
> Wicket 1.4"
> >
> > http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html
> >
> > Regarding SpringWebApplication, it says:
> >
> > SpringWebApplication has been deprecated in favor of
> SpringBean annotation. See SpringWebApplication javadoc for
> how to setup SpringBean based injection.
> >
> > I went to Wicket API about SpringWebApplication and it
> says:
> >
> > Deprecated. when using java5 it is preferrable to use
> SpringBean annotations for injection rather then this
> spring-specific application subclass with its helpers. To
> setup SpringBean add the following line to your
> WebApplication subclass init method add(new
> SpringComponentInjector(this));
> >
> > Here is my way of using Spring in my wicket app.
> >
> > 1. In the init method:
> >
> > addComponentInstantiationListener(new
> SpringComponentInjector(this));
> >
> > Please note that it is not: add(new
> SpringComponentInjector(this));
> >
> > 2. In wicket components that access Spring beans:
> >
> > @SpringBean
> > private SupportService supportService;
> >
> >
> > Am I doing Spring in Wicket right way?
> >
> > Thanks for input!
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: A question about using Spring in Wicket 1.4
Posted by James Carman <jc...@carmanconsulting.com>.
yes
On Thu, Mar 11, 2010 at 8:56 AM, David Chang <da...@yahoo.com> wrote:
> Yesterday I was looking at the page "Migrating to Wicket 1.4"
>
> http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html
>
> Regarding SpringWebApplication, it says:
>
> SpringWebApplication has been deprecated in favor of SpringBean annotation. See SpringWebApplication javadoc for how to setup SpringBean based injection.
>
> I went to Wicket API about SpringWebApplication and it says:
>
> Deprecated. when using java5 it is preferrable to use SpringBean annotations for injection rather then this spring-specific application subclass with its helpers. To setup SpringBean add the following line to your WebApplication subclass init method add(new SpringComponentInjector(this));
>
> Here is my way of using Spring in my wicket app.
>
> 1. In the init method:
>
> addComponentInstantiationListener(new SpringComponentInjector(this));
>
> Please note that it is not: add(new SpringComponentInjector(this));
>
> 2. In wicket components that access Spring beans:
>
> @SpringBean
> private SupportService supportService;
>
>
> Am I doing Spring in Wicket right way?
>
> Thanks for input!
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
A question about using Spring in Wicket 1.4
Posted by David Chang <da...@yahoo.com>.
Yesterday I was looking at the page "Migrating to Wicket 1.4"
http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html
Regarding SpringWebApplication, it says:
SpringWebApplication has been deprecated in favor of SpringBean annotation. See SpringWebApplication javadoc for how to setup SpringBean based injection.
I went to Wicket API about SpringWebApplication and it says:
Deprecated. when using java5 it is preferrable to use SpringBean annotations for injection rather then this spring-specific application subclass with its helpers. To setup SpringBean add the following line to your WebApplication subclass init method add(new SpringComponentInjector(this));
Here is my way of using Spring in my wicket app.
1. In the init method:
addComponentInstantiationListener(new SpringComponentInjector(this));
Please note that it is not: add(new SpringComponentInjector(this));
2. In wicket components that access Spring beans:
@SpringBean
private SupportService supportService;
Am I doing Spring in Wicket right way?
Thanks for input!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Ad: Re: Generic solution for tabindex?
Posted by es...@husbanken.no.
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 <sc...@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 TabIndexTextField<T> extends TextField<T> implements
TabIndexable {
private Model<Integer> tabIndexModel = new Model<Integer>(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, <es...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generic solution for tabindex?
Posted by Scott Swank <sc...@gmail.com>.
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 TabIndexTextField<T> extends TextField<T> implements TabIndexable {
private Model<Integer> tabIndexModel = new Model<Integer>(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, <es...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org