Re: 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

Re: Have BeanTableFormat implement TableColumnConfigurer and act as proxy

Hi Phil,

sorry for the long delay, I'm pretty busy with a lot of other stuff lately.

BeanTableFormat is usable for both SWT and Swing worlds, whereas
TableColumnConfigurer is only needed for SWT, so BeanTableFormat cannot
implement TableColumnConfigurer.
I'm hesitant to create and add a SWT-specific TableFormat interface and/or implementation,
unless there is high demand for it.

Currently, I'd recommend to create your own TableFormat-wrapper, something like:

public class MyTableFormatWrapper implements
    WritableTableFormat, AdvancedTableFormat, TableItemConfigurer {

  public MyTableFormatWrapper (TableFormat tableFormatToWrap, TableItemConfigurer ticToWrap) {... }

  //... implement interfaces by delegating to tableFormatToWrap and ticToWrap


Then use it like that:

TableItemConfigurer tic = ...;
TableFormat tf = GlazedLists.tableFormat(...);
TableFormat tfWrapper = new MyTableFormatWrapper(tf, tic);
EventTableViewer viewer = new EventTableViewer(..., tfWrapper);

Hope this helps,

> 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) {
> = tc;
>     iterate over columns if they already exist and apply new tc if tc !=
> null;
>   }
>   void configure(TableColumn tableColumn, int column) {
>     if ( != null), 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()?
> --
> View this message in context:
> Sent from the GlazedLists - Dev mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!*

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]