use of org.talend.designer.scd.model.Type3Field in project tdi-studio-se by Talend.
the class Type3Section method createContents.
@Override
protected void createContents(Composite composite) {
inputColumns = scdManager.getInputColumnNames();
outputColumns = scdManager.getOutputColumnNames();
tableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
table.setLayoutData(gd);
TableViewerColumn currentColumn = new TableViewerColumn(tableViewer, SWT.NONE);
currentColumn.getColumn().setText(CURRENT_HEADER);
currentColumn.getColumn().setWidth(200);
// currentColumn.setEditingSupport(new Type3EditingSupport(tableViewer, 0));
TableViewerColumn previousColumn = new TableViewerColumn(tableViewer, SWT.NONE);
previousColumn.getColumn().setText(PREVIOUS_HEADER);
previousColumn.getColumn().setWidth(200);
previousColumn.setEditingSupport(new Type3EditingSupport(tableViewer, 1));
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setContentProvider(new ContentProvider());
table.addListener(SWT.EraseItem, new Listener() {
public void handleEvent(Event event) {
event.detail &= ~SWT.HOT;
GC gc = event.gc;
TableItem item = (TableItem) event.item;
Color background = gc.getBackground();
Type3Field field = (Type3Field) item.getData();
if (StringUtils.isNotEmpty(field.getPreviousValue())) {
gc.setBackground(table.getDisplay().getSystemColor(SWT.COLOR_WHITE));
} else {
gc.setBackground(ERROR_COLOR);
event.detail &= ~SWT.SELECTED;
}
gc.fillRectangle(table.getClientArea());
gc.setBackground(background);
event.detail &= ~SWT.BACKGROUND;
}
});
}
Aggregations