Dynamic Column Mapping

Hi,

I am using the FLEXGRID control and do something similar like:

 class LineItem{
      String v1;
      public String getValue1(){ return v1; }
      public void setValue1(String v){ v1 = v; }
 }


FLEXGRIDInfo fg = new FLEXGRIDInfo(adapter);
fg.clearColumnStructure();
LineItem item = new LineItem();

fg.addFieldColumn(“value1”, “100”, “Value1”, “transparentbackground;true”);

fg.getLines().add(item);

In general I understand the principal, but where is the real flexibility ? As much as I understood, the first parameter of the addFieldColumn method is used for the mapping to the JavaBean (LineItem) method. But this is fixed, so I have to have a Bean with the getter/setter “getValue1/setValue1”. I have to know this during implementation.

What I need is a more flexible way where even the colmuns and the “bean” can be created during runtime (some kind of dynamic mapping).

Does anyone know how to do this ?

Your help is very appreciated.

Thanks, Rob.

Well, I don’t know if I can help you because I use the FlexLineInfo control. But there, I use the IDynamicAccess interface for getting my values…

You can see the code of the layout and adapter here: http://tech.forums.softwareag.com/viewtopic.php?t=5060

In the value class, the method

getPropertyValue (String position)

returns the corresponding values…

Hope, I could help you…

H. Johannes

This helps,

Thanks Johannes.

No problem :slight_smile:

One additional comment: the flexibility of FLEXGRID is…:

(1) The arrangement of columns is defined by the adapter, not by the layout
(2) Moving/resizing columns is automatically included (without FLEXGRID this is not very easy to implement…)

Bjoern