Ad: Re: Generic solution for tabindex?

2010-03-11 Thread espen . pedersen
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?

2010-03-10 Thread espen . pedersen
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: Generic solution for tabindex?

2010-03-10 Thread Scott Swank
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