Have BeanTableFormat implement TableColumnConfigurer and act as proxy

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Have BeanTableFormat implement TableColumnConfigurer and act as proxy

philk
In my dynamic glazedlists framework where you can plug filters/matchers and eventlists during runtime I would like to add a TableColumnConfigurer dynamically. So far to do that I would have to develop my own TableFormat and let it extend TableColumnConfigurer. But since the BeanTableFormat is so handy I would like to continue using it. Since its an internal class I cannot extend it from the outside. So I would like to ask for a change of the default implementation to implement TableColumnConfigurer by default and then act as a proxy so that I can set the real TableColumnConfigurer from outside.

BeanTableFormat implements ... TableColumnConfigurer {

  public void setTableColumnConfigurer(tc) {
    this.tc = tc;
    iterate over columns if they already exist and apply new tc if tc != null;
  }
 
  void configure(TableColumn tableColumn, int column) {
    if (this.tc != null) this.tc.configure(tableColumn, column);
  }
};

Now writing this and thinking about it, I would have no change to actually *set* the TCC when I get back the BeanTableFormat from GlazedLists.tableFormat() since TableFormat does not have method called "setTableColumnConfigurer" and I cannot cast the returned tableformat to BeanTableFormat since its an internal class.

Do you have any idea on how to *use* BeanTableFormat and TableColumnConfigurer together? Maybe have a special public class SWTBeanTableFormat that extends the BeanTableFormat as described above and is retured by GlazedListsSWT.tableFormat() instead of GlazedLists.tableFormat()?