use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class MultiSchemasShadowProcessPreview method checkSelectedIndex.
private void checkSelectedIndex(int... selectedColumnIndex) {
if (selectedColumnIndex == null) {
selectedColumnIndex = new int[] { 0 };
}
table.setRedraw(false);
for (int i = 0; i < table.getColumnCount(); i++) {
final TableColumn tc = table.getColumn(i);
if (i == selectedColumnIndex[0]) {
// default selected column is from
tc.setImage(ImageProvider.getImage(EImage.CHECKED_ICON));
// component
} else {
tc.setImage(ImageProvider.getImage(EImage.UNCHECKED_ICON));
}
}
table.setHeaderVisible(true);
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class HL7OutputUI method addSchemaViewer.
private void addSchemaViewer(final Composite mainComposite, final int width, final int height) {
// Group Schema Viewer
final Group group = Form.createGroup(mainComposite, 1, "Linker Source", height);
// add by wzhang. add a combo for tFileOutputMSXML.
createCombo(group);
schemaViewer = new TableViewer(group);
// schemaViewer.set
// schemaViewer.getTable().setBackground(schemaViewer.getTable().getDisplay().getSystemColor(SWT.COLOR_WHITE));
HL7OutputTableViewerProvider provider = new HL7OutputTableViewerProvider();
schemaViewer.setContentProvider(provider);
schemaViewer.setLabelProvider(provider);
GridData data2 = new GridData(GridData.FILL_BOTH);
Table table = schemaViewer.getTable();
// see bug 7087
if (canModify || isRespo) {
table.setEnabled(false);
}
// table.setLinesVisible(true);
table.setHeaderVisible(true);
TableColumn column1 = new TableColumn(table, SWT.LEFT);
column1.setText("Schema List");
column1.setWidth(100);
table.setLayoutData(data2);
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class StatusEditor method createTable.
@Override
protected Table createTable(Composite parent) {
Table contextTable = new Table(parent, SWT.BORDER | SWT.SINGLE);
contextTable.setLinesVisible(true);
contextTable.setHeaderVisible(true);
TableColumn colName = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colName.setText(Messages.getString("StatusEditor.codeColumnTitle"));
colName.setWidth(60);
TableColumn colValue = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colValue.setText(Messages.getString("StatusEditor.labelColumnTitle"));
colValue.setWidth(150);
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
parent.setEnabled(false);
}
return contextTable;
}
use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method addItemTableViewer.
private void addItemTableViewer(Composite rightComposite) {
Composite composite = new Composite(rightComposite, SWT.NONE);
composite.setLayout(new GridLayout());
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
addItemsOption(composite);
itemTable = new Table(composite, SWT.MULTI | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(itemTable);
itemTable.setHeaderVisible(true);
itemTable.setLinesVisible(true);
//
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("StatusManagementDialog.Status"));
oldVersionColumn.setWidth(90);
TableColumn versionColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
versionColumn.setText(Messages.getString("StatusManagementDialog.NewStatus"));
versionColumn.setWidth(92);
final TableColumn delColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
delColumn.setText("");
delColumn.setWidth(26);
delColumn.setResizable(false);
versionColumn.addControlListener(new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
//
}
@Override
public void controlResized(ControlEvent e) {
if (!isFixedstatus()) {
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 ProcessVersionComposite method addSortListener.
/**
* DOC Administrator Comment method "addSortListener".
*
* @param table
* @param column1
* @param column2
* @param column3
*/
private void addSortListener(final Table table, final TableColumn column1, final TableColumn column2, final TableColumn column3, final TableColumn column4) {
Listener sortListener = new Listener() {
private int direction = 1;
@Override
public void handleEvent(Event e) {
final TableColumn column = (TableColumn) e.widget;
if (column == table.getSortColumn()) {
direction = -direction;
}
if (direction == 1) {
table.setSortDirection(SWT.DOWN);
} else {
table.setSortDirection(SWT.UP);
}
table.setSortColumn(column);
tableViewer.setSorter(new ViewerSorter() {
int index = 0;
@Override
public void sort(Viewer viewer, Object[] elements) {
while (index < table.getColumns().length && table.getColumn(index) != column) {
index++;
}
super.sort(viewer, elements);
}
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
ITableLabelProvider labelProvider = (ITableLabelProvider) tableViewer.getLabelProvider();
String columnText = labelProvider.getColumnText(e1, index) != null ? labelProvider.getColumnText(e1, index) : //$NON-NLS-1$
"";
String columnText2 = labelProvider.getColumnText(e2, index) != null ? labelProvider.getColumnText(e2, index) : //$NON-NLS-1$
"";
return getComparator().compare(columnText, columnText2) * direction;
}
});
}
};
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
/*
* (non-Javadoc)
*
* @seeorg.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.
* SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
ProcessVersionComposite.this.selection = event.getSelection();
if (getParentWizard() != null) {
((WizardPage) getParentWizard()).setPageComplete(true);
}
}
});
column1.addListener(SWT.Selection, sortListener);
column2.addListener(SWT.Selection, sortListener);
column3.addListener(SWT.Selection, sortListener);
column4.addListener(SWT.Selection, sortListener);
table.setSortColumn(column1);
table.setSortDirection(SWT.DOWN);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
if (getParentWizard() == null) {
ITreeContextualAction editPropertiesAction = getEditPropertiesAction(EditPropertiesAction.class);
if (editPropertiesAction != null) {
editPropertiesAction.run();
}
}
}
});
}
Aggregations