@Test public void testSetTableFormat() { final EventList<Color> source = GlazedLists.eventList(RGB); final TableFormat<Color> tableFormat = new ColorTableFormat(); final Table table = new Table(getShell(), SWT.CHECK); DefaultEventTableViewer<Color> viewer = new DefaultEventTableViewer<>(source, table, tableFormat); checkColorTableFormatColumns(table); checkColorTableFormatItems(viewer); final TableFormat<Color> newTableFormat = GlazedLists.tableFormat(new String[] { "green", "red"}, new String[] { "GREEN", "RED", }); viewer.setTableFormat(newTableFormat); assertEquals(2, table.getColumnCount()); assertEquals("GREEN", table.getColumn(0).getText()); assertEquals(SWT.LEFT, table.getColumn(0).getAlignment()); assertEquals(80, table.getColumn(0).getWidth()); assertEquals(true, table.getColumn(0).getResizable()); assertEquals(null, table.getColumn(0).getToolTipText()); assertEquals("RED", table.getColumn(1).getText()); assertEquals(SWT.LEFT, table.getColumn(1).getAlignment()); assertEquals(80, table.getColumn(1).getWidth()); assertEquals(true, table.getColumn(1).getResizable()); assertEquals(null, table.getColumn(1).getToolTipText()); assertEquals(3, viewer.getTable().getItemCount()); assertEquals(3, viewer.getSourceList().size()); Color elem = viewer.getSourceList().get(0); TableItem item = viewer.getTable().getItem(0); assertEquals(String.valueOf(elem.getGreen()), item.getText(0)); assertEquals(String.valueOf(elem.getRed()), item.getText(1)); elem = viewer.getSourceList().get(1); item = viewer.getTable().getItem(1); assertEquals(String.valueOf(elem.getGreen()), item.getText(0)); assertEquals(String.valueOf(elem.getRed()), item.getText(1)); elem = viewer.getSourceList().get(2); item = viewer.getTable().getItem(2); assertEquals(String.valueOf(elem.getGreen()), item.getText(0)); assertEquals(String.valueOf(elem.getRed()), item.getText(1)); viewer.setTableFormat(tableFormat); checkColorTableFormatColumns(table); checkColorTableFormatItems(viewer); viewer.dispose(); }
public void setTableFormat(TableFormat<? super E> tableFormat) { if (tableFormat == null) { throw new IllegalArgumentException("TableFormat may not be null"); } this.tableFormat = tableFormat; table.setRedraw(false); removeTableColumns(); initTable(); this.tableHandler.redraw(); table.setRedraw(true); }
DefaultEventTableViewer implements ListEventListener<E> { public void setTableFormat(TableFormat<? super E> tableFormat) { if (tableFormat == null) { throw new IllegalArgumentException("TableFormat may not be null"); } this.tableFormat = tableFormat; table.setRedraw(false); removeTableColumns(); initTable(); this.tableHandler.redraw(); table.setRedraw(true); } }
DefaultEventTableViewer implements ListEventListener<E> { public void setTableFormat(TableFormat<? super E> tableFormat) { if (tableFormat == null) { throw new IllegalArgumentException("TableFormat may not be null"); } this.tableFormat = tableFormat; table.setRedraw(false); removeTableColumns(); initTable(); this.tableHandler.redraw(); table.setRedraw(true); } DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat);  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer); protected  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer, boolean disposeSource); }
DefaultEventTableViewer implements ListEventListener<E> { public void setTableFormat(TableFormat<? super E> tableFormat) { if (tableFormat == null) { throw new IllegalArgumentException("TableFormat may not be null"); } this.tableFormat = tableFormat; table.setRedraw(false); removeTableColumns(); initTable(); this.tableHandler.redraw(); table.setRedraw(true); } DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat);  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer); protected  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer, boolean disposeSource); TableFormat<? super E> getTableFormat(); void setTableFormat(TableFormat<? super E> tableFormat); TableItemConfigurer<? super E> getTableItemConfigurer(); void setTableItemConfigurer(TableItemConfigurer<? super E> tableItemConfigurer); Table getTable(); void setCheckedOnly(boolean checkedOnly); boolean getCheckedOnly(); List<E> getAllChecked(); EventList<E> getSourceList(); EventList<E> getDeselected(); EventList<E> getTogglingDeselected(); EventList<E> getSelected(); EventList<E> getTogglingSelected(); @Override void listChanged(ListEvent listChanges); void invertSelection(); void dispose(); }
DefaultEventTableViewer implements ListEventListener<E> { public void setTableFormat(TableFormat<? super E> tableFormat) { if (tableFormat == null) { throw new IllegalArgumentException("TableFormat may not be null"); } this.tableFormat = tableFormat; table.setRedraw(false); removeTableColumns(); initTable(); this.tableHandler.redraw(); table.setRedraw(true); } DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat);  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer); protected  DefaultEventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat,
            TableItemConfigurer<? super E> tableItemConfigurer, boolean disposeSource); TableFormat<? super E> getTableFormat(); void setTableFormat(TableFormat<? super E> tableFormat); TableItemConfigurer<? super E> getTableItemConfigurer(); void setTableItemConfigurer(TableItemConfigurer<? super E> tableItemConfigurer); Table getTable(); void setCheckedOnly(boolean checkedOnly); boolean getCheckedOnly(); List<E> getAllChecked(); EventList<E> getSourceList(); EventList<E> getDeselected(); EventList<E> getTogglingDeselected(); EventList<E> getSelected(); EventList<E> getTogglingSelected(); @Override void listChanged(ListEvent listChanges); void invertSelection(); void dispose();  }