Class TableColumnFactory


public final class TableColumnFactory extends AbstractItemFactory<TableColumnFactory, TableColumn, Table>
This class provides a convenient shorthand for creating and initializing TableColumn. This offers several benefits over creating TableColumn normal way:
  • The same factory can be used many times to create several TableColumn instances
  • The setters on TableColumnFactory all return "this", allowing them to be chained
  • TableColumnFactory accepts a Lambda for SelectionEvent (see onSelect(Consumer))
Example usage:
TableColumn column = TableColumnFactory.newTableColumn(SWT.CENTER) //
                .text("Table Column") //
                .onSelect(event -> columnClicked(event)) //
                .create(table);

The above example creates a table column, sets text, registers a SelectionListener and finally creates the table column in "table".

TableColumnFactory factory = TableColumnFactory.newTableColumn(SWT.CENTER).onSelect(event -> columnClicked(event));
factory.text("Column 1").create(table);
factory.text("Column 2").create(table);
factory.text("Column 3").create(table);

The above example creates three table columns using the same instance of factory.

Since:
3.18
  • Method Details