use of org.eclipse.swt.widgets.TableColumn in project cogtool by cogtool.
the class DictionaryEditorView method layOutWidgets.
protected void layOutWidgets(Composite parent) {
nameLabel = new Label(parent, SWT.NONE);
dictTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
dictTable.setLinesVisible(true);
dictTable.setHeaderVisible(true);
dictTable.setEnabled(true);
dictTable.addListener(SWT.MeasureItem, new Listener() {
public void handleEvent(Event event) {
event.height = OSUtils.MACOSX ? 28 : 25;
}
});
TableColumn goalColumn = new TableColumn(dictTable, SWT.NONE);
goalColumn.setText(GOAL_HEADER);
goalColumn.setResizable(true);
goalColumn.setWidth(DictionaryEditorView.COL_WIDTH);
TableColumn searchColumn = new TableColumn(dictTable, SWT.NONE);
searchColumn.setText(SEARCH_HEADER);
searchColumn.setResizable(true);
searchColumn.setWidth(DictionaryEditorView.COL_WIDTH);
TableColumn similarityColumn = new TableColumn(dictTable, SWT.RIGHT);
similarityColumn.setText(SIMIL_HEADER);
similarityColumn.setResizable(true);
similarityColumn.setWidth(DictionaryEditorView.COL_WIDTH);
TableColumn algColumn = new TableColumn(dictTable, SWT.NONE);
algColumn.setText(ALG_HEADER);
algColumn.setResizable(false);
algColumn.setWidth(DictionaryEditorView.COL_WIDTH);
TableColumn dateColumn = new TableColumn(dictTable, SWT.NONE);
dateColumn.setText(DATE_HEADER);
dateColumn.setResizable(true);
dateColumn.setWidth(DictionaryEditorView.COL_WIDTH);
urlLabel = new Label(parent, SWT.NONE);
urlLabel.setText(SITE_LABEL);
urlText = new View.PerformActionText(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected boolean doChangeAction() {
return performChangeURL();
}
};
urlText.setEnabled(false);
spaceLabel = new Label(parent, SWT.NONE);
spaceLabel.setText(SPACE_LABEL);
spaceCombo = new View.PerformActionCombo(parent, SWT.DROP_DOWN | SWT.BORDER) {
@Override
protected boolean doChangeAction() {
return performChangeSpace();
}
};
spaceCombo.setItems(LSASimilarity.KNOWN_SPACES);
spaceCombo.setEnabled(false);
FormData formData = new FormData();
formData.left = new FormAttachment(0, 5);
formData.top = new FormAttachment(0, 5);
nameLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, 20);
formData.top = new FormAttachment(nameLabel, 5);
formData.right = new FormAttachment(100, -20);
formData.height = 350;
dictTable.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, 5);
formData.top = new FormAttachment(dictTable, 5);
spaceLabel.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(spaceLabel, 5);
formData.top = new FormAttachment(dictTable, 5);
spaceCombo.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(urlLabel, 5);
formData.top = new FormAttachment(spaceCombo, 5, SWT.BOTTOM);
formData.right = new FormAttachment(100, -15);
urlText.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, 5);
formData.top = new FormAttachment(urlText.getOuter(), 0, SWT.CENTER);
formData.right = new FormAttachment(spaceLabel, 0, SWT.RIGHT);
urlLabel.setLayoutData(formData);
}
use of org.eclipse.swt.widgets.TableColumn in project otertool by wuntee.
the class GuiWorkshop method addColumnSorter.
public static void addColumnSorter(final Table table, TableColumn column, final int index, final String[] dataKeys) {
Listener sortListener = new Listener() {
public void handleEvent(Event e) {
TableItem[] items = table.getItems();
Collator collator = Collator.getInstance(Locale.getDefault());
TableColumn column = (TableColumn) e.widget;
for (int i = 1; i < items.length; i++) {
String value1 = items[i].getText(index);
for (int j = 0; j < i; j++) {
String value2 = items[j].getText(index);
if (table.getSortDirection() == SWT.UP || table.getSortDirection() == SWT.NONE && collator.compare(value1, value2) < 0) {
String[] values = new String[table.getColumnCount()];
for (int k = 0; k < table.getColumnCount(); k++) {
values[k] = items[i].getText(k);
}
// Get data from list item
Map<String, Object> dataMap = new HashMap<String, Object>();
for (String key : dataKeys) {
dataMap.put(key, items[i].getData(key));
}
items[i].dispose();
TableItem item = new TableItem(table, SWT.NONE, j);
item.setText(values);
// Set data for new item
for (String key : dataMap.keySet()) {
item.setData(key, dataMap.get(key));
}
items = table.getItems();
break;
} else if (table.getSortDirection() == SWT.DOWN && collator.compare(value1, value2) > 0) {
String[] values = new String[table.getColumnCount()];
for (int k = 0; k < table.getColumnCount(); k++) {
values[k] = items[i].getText(k);
}
// Get data from list item
Map<String, Object> dataMap = new HashMap<String, Object>();
for (String key : dataKeys) {
dataMap.put(key, items[i].getData(key));
}
items[i].dispose();
TableItem item = new TableItem(table, SWT.NONE, j);
item.setText(values);
// Set data for new item
for (String key : dataMap.keySet()) {
item.setData(key, dataMap.get(key));
}
items = table.getItems();
break;
}
}
}
if (table.getSortDirection() == SWT.NONE || table.getSortDirection() == SWT.UP) {
table.setSortDirection(SWT.DOWN);
} else {
table.setSortDirection(SWT.UP);
}
table.setSortColumn(column);
}
};
column.addListener(SWT.Selection, sortListener);
}
use of org.eclipse.swt.widgets.TableColumn in project otertool by wuntee.
the class LoadApkFromDeviceDialog method createContents.
/**
* Create contents of the dialog.
*/
private void createContents() {
shlSelectApk = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
shlSelectApk.setSize(592, 486);
shlSelectApk.setText("Select APK");
shlSelectApk.setLayout(new GridLayout(1, false));
table = new Table(shlSelectApk, SWT.BORDER | SWT.FULL_SELECTION);
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent arg0) {
result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
shlSelectApk.close();
}
});
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setBounds(0, 0, 3, 19);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TableColumn tblclmnApk = new TableColumn(table, SWT.NONE);
tblclmnApk.setWidth(240);
tblclmnApk.setText("APK");
final TableColumn tblclmnPackage = new TableColumn(table, SWT.NONE);
tblclmnPackage.setWidth(338);
tblclmnPackage.setText("Package");
final String[] keys = { PACKAGE_BEAN };
GuiWorkshop.addColumnSorter(table, tblclmnApk, 0, keys);
GuiWorkshop.addColumnSorter(table, tblclmnPackage, 1, keys);
Composite composite = new Composite(shlSelectApk, SWT.NONE);
composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
composite.setBounds(0, 0, 64, 64);
GridLayout gl_composite = new GridLayout(2, false);
gl_composite.verticalSpacing = 0;
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
gl_composite.horizontalSpacing = 0;
composite.setLayout(gl_composite);
Button btnLoad = new Button(composite, SWT.NONE);
btnLoad.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelection().length == 0) {
GuiWorkshop.messageError(shlSelectApk, "Please Select an APK to load.");
} else {
result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
shlSelectApk.close();
}
}
});
btnLoad.setText("Load");
Button btnCancel = new Button(composite, SWT.NONE);
btnCancel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
result = null;
shlSelectApk.close();
}
});
btnCancel.setText("Cancel");
}
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);
}
Aggregations