TableItemConfigurer should be a parameter for EventTableViewer

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

TableItemConfigurer should be a parameter for EventTableViewer

philk
When creating the EventTableViewer on a table it starts to render all items with the default TableItemConfigurer. When you set a new TableItemConfigurer after creating the EventTableViewer it is rendered twice. I propose to introduce 2 new constructors where you can supply your TableItemConfigurer right from the beginning. It would not break existing code. The 2 already defined ctors could call the new ctors with the TableItemConfigurer.DEFAULT argument.

public EventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat, TableItemConfigurer tableItemConfigurer) {
  this.tableItemConfigurer = tableItemConfigurer;
}

public EventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat) {
    this(source,table,tableFormat, TableItemConfigurer.DEFAULT);
}

public EventTableViewer(EventList<E> source, Table table, String[] propertyNames, String[] columnLabels, TableItemConfigurer tableItemConfigurer) {
  this(source, table, (TableFormat<E>)GlazedLists.tableFormat(propertyNames, columnLabels), tableItemConfigurer);
}