use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class AddArrayIndexForParentsDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
FillLayout layout = new FillLayout();
// layout.horizontalSpacing = 1;
// layout.numColumns = 1;
GridData data = new GridData(GridData.FILL_BOTH);
createDialogArea.setLayout(layout);
createDialogArea.setLayoutData(data);
table = new TableViewer(createDialogArea, SWT.FULL_SELECTION | SWT.BORDER);
new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[0]);
table.getTable().getColumn(0).pack();
new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[1]);
table.getTable().getColumn(1).pack();
table.getTable().setHeaderVisible(true);
table.getTable().setLinesVisible(true);
table.setContentProvider(new IndexContentProvider());
table.setLabelProvider(new IndexLabelProvider());
table.setInput(arrayIndexList);
table.setColumnProperties(COLUMN_NAME);
CellEditor[] editors = new CellEditor[2];
editors[0] = null;
editors[1] = new TextCellEditor(table.getTable());
table.setCellEditors(editors);
table.setCellModifier(new ICellModifier() {
public boolean canModify(Object element, String property) {
if (property.equals(COLUMN_NAME[0]))
return false;
return true;
}
public Object getValue(Object element, String property) {
ArrayIndexList index = (ArrayIndexList) element;
if (property.equals(COLUMN_NAME[1])) {
if (index.getIndexNum() != null) {
return index.getIndexNum();
} else {
return "";
}
}
return null;
}
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
ArrayIndexList index = (ArrayIndexList) element;
if (property.equals(COLUMN_NAME[1]))
index.setIndexNum((String) value);
table.refresh();
}
});
return createDialogArea;
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class VersionManagementPage method createItemTableColumns.
@Override
protected void createItemTableColumns() {
TableColumn itemColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
itemColumn.setText(Messages.getString("VersionManagementDialog.Items"));
itemColumn.setWidth(110);
TableColumn oldVersionColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
oldVersionColumn.setText(Messages.getString("VersionManagementDialog.Version"));
oldVersionColumn.setWidth(60);
TableColumn versionColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
versionColumn.setText(Messages.getString("VersionManagementDialog.NewVersion"));
versionColumn.setWidth(82);
final TableColumn delColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
delColumn.setText("");
delColumn.setWidth(26);
delColumn.setResizable(false);
versionColumn.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
if (!isFixedVersion()) {
refreshTableItems();
}
}
});
itemTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkButtonsState();
}
});
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class StatusConfirmSettingDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
TableViewer viewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.minimumHeight = 200;
data.heightHint = 200;
data.minimumWidth = 350;
data.widthHint = 350;
viewer.getControl().setLayoutData(data);
final Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn column = new TableColumn(table, SWT.NONE);
//$NON-NLS-1$
column.setText(Messages.getString("VersionManagementDialog.Items"));
column.setWidth(140);
column = new TableColumn(table, SWT.NONE);
//$NON-NLS-1$
column.setText(Messages.getString("StatusManagementDialog.Status"));
column.setWidth(120);
column = new TableColumn(table, SWT.NONE);
//$NON-NLS-1$
column.setText(Messages.getString("StatusManagementDialog.NewStatus"));
column.setWidth(90);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new ITableLabelProvider() {
public Image getColumnImage(Object element, int columnIndex) {
RepositoryObject object = (RepositoryObject) element;
if (columnIndex == 0) {
ERepositoryObjectType itemType = object.getRepositoryObjectType();
return getItemsImage(CoreImageProvider.getIcon(itemType));
}
return null;
}
public String getColumnText(Object element, int columnIndex) {
RepositoryObject object = (RepositoryObject) element;
switch(columnIndex) {
case 0:
return object.getLabel();
case 1:
return statusHelper.getStatusLabel(object.getProperty().getOldStatusCode());
case 2:
if (object.getStatusCode().equals(object.getProperty().getOldStatusCode())) {
//$NON-NLS-1$
return "-";
}
return statusHelper.getStatusLabel(object.getStatusCode());
default:
}
return null;
}
public void addListener(ILabelProviderListener listener) {
}
public void dispose() {
}
public boolean isLabelProperty(Object element, String property) {
return false;
}
public void removeListener(ILabelProviderListener listener) {
}
});
viewer.setInput(modifiedVersionItems);
for (TableItem item : table.getItems()) {
RepositoryObject object = (RepositoryObject) item.getData();
// if (!object.getOldVersion().equals(object.getNewVersion())) {
item.setForeground(2, Display.getDefault().getSystemColor(SWT.COLOR_RED));
// }
}
return composite;
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class BusinessAssignmentComposite method createControls.
public void createControls(Composite parent) {
composite = widgetFactory.createFlatFormComposite(parent);
adapterFactory = new BusinessItemProviderAdapterFactory();
tableViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
tableViewer.setLabelProvider(new RepositoryFactoryProxyLabelProvider(adapterFactory));
Table table = tableViewer.getTable();
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final String[] columnProperties = new String[] { Messages.getString("AssignmentPropertySection.Type"), Messages.getString("AssignmentPropertySection.Name"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Messages.getString("AssignmentPropertySection.Comment") };
TableColumn column1 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnPixelData(125, true));
column1.setText(columnProperties[0]);
TableColumn column2 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnPixelData(125, true));
column2.setText(columnProperties[1]);
TableColumn column3 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnWeightData(1, 150, true));
column3.setText(columnProperties[2]);
tableViewer.setColumnProperties(columnProperties);
final IItemPropertyDescriptor itemPropertyDescriptor = getItemPropertyDescriptor();
tableViewer.setCellModifier(new ICellModifier() {
@Override
public boolean canModify(Object element, String property) {
return property.equals(columnProperties[2]);
}
@Override
public Object getValue(Object element, String property) {
return EmfPropertyHelper.getValue(itemPropertyDescriptor, element);
}
@Override
public void modify(Object element, String property, Object value) {
if (element instanceof TableItem) {
TableItem tableItem = (TableItem) element;
itemPropertyDescriptor.setPropertyValue(tableItem.getData(), value);
}
}
});
CellEditor[] cellEditors = new CellEditor[3];
cellEditors[2] = new TextCellEditor(table);
tableViewer.setCellEditors(cellEditors);
// createKeyListener(table);
createSelectionListener();
createPopupMenu();
createDoubleClickListener();
handleLayout(parent, table, column1, column2, column3);
}
use of org.eclipse.swt.widgets.TableColumn in project ACS by ACS-Community.
the class ArchivingListPart method postConstruct.
@PostConstruct
public void postConstruct(Composite parent, IEventBroker eventBroker) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
// buildCustomToolBar(parent);
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
/*
* "Time "+timeStamp+" "+m_channelName+" "+component+" "+count+"
* "+channelEventCount+" " +" "+evtTypeName+"
* "+evtCounter.get(evtTypeName)
*/
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new TimeStampLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Timestamp");
col.setWidth(190);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new EventSourceLabelProvider());
col = tvcol.getColumn();
col.setText("Device");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new BaciParameterLabelProvider());
col = tvcol.getColumn();
col.setText("Property");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 3);
tvcol.setLabelProvider(new BaciPropertyValueLabelProvider());
col = tvcol.getColumn();
col.setText("Value");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new ArchivingListContentProvider(em));
viewer.setInput(new Object());
pel = new PopulateEventList(logger, viewer, new StatusLineWriter(eventBroker), em.getArchQueue(), "Monitor points");
eventListThread = pel.getThreadForEventList();
eventListThread.start();
}
Aggregations