本文整理匯總了Java中org.eclipse.swt.widgets.TableColumn.setImage方法的典型用法代碼示例。如果您正苦於以下問題:Java TableColumn.setImage方法的具體用法?Java TableColumn.setImage怎麽用?Java TableColumn.setImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TableColumn
的用法示例。
在下文中一共展示了TableColumn.setImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createStepsTable
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
/**
* Create the steps table.
*
* @param composite
* the parent layout composite
* @param workItem
* the test case work item
*
* @return the allocated table viewer
*/
private TableViewer createStepsTable(final Composite composite, final WorkItem workItem) {
final TableViewer viewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
GridDataBuilder.newInstance().align(SWT.FILL, SWT.FILL).grab(true, true).span(1, 1).minHeight(75).applyTo(
viewer.getTable());
final Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
tableLayout.addColumnData(new ColumnPixelData(60, true));
final TableColumn column1 = new TableColumn(table, SWT.NONE);
column1.setImage(TestStepUtil.imageHelper.getImage("images/common/attachment.gif")); //$NON-NLS-1$
column1.setResizable(true);
tableLayout.addColumnData(new ColumnWeightData(10, true));
final TableColumn column2 = new TableColumn(table, SWT.NONE);
column2.setText(Messages.getString("TestStepsControl.ColumnNameAction")); //$NON-NLS-1$
column2.setResizable(true);
tableLayout.addColumnData(new ColumnWeightData(8, true));
final TableColumn column3 = new TableColumn(table, SWT.NONE);
column3.setText(Messages.getString("TestStepsControl.ColumnNameExpectedResult")); //$NON-NLS-1$
column3.setResizable(true);
viewer.setContentProvider(new TestStepContentProvider());
viewer.setLabelProvider(new TestStepLabelProvider());
viewer.setInput(workItem);
return viewer;
}
示例2: setupTable
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
/**
* Creates {@link TableColumn}s for the specified {@link Table} based on the
* specified {@link TableColumnData} array.
*
* @param table
* the {@link Table} to create columns for (must not be
* <code>null</code>)
* @param headerVisible
* <code>true</code> if the {@link Table}'s header should be visible
* @param linesVisible
* <code>true</code> if the {@link Table}'s lines should be visible
* @param persistenceKey
* a persistence key used to save and restore column widths, or
* <code>null</code> if no column width persistence should be done
* @param columnData
* the {@link TableColumnData} array that controls the number and
* kind of columns that are created (must not be <code>null</code>
* and must not contain <code>null</code> elements)
*/
public static void setupTable(
final Table table,
final boolean headerVisible,
final boolean linesVisible,
final String persistenceKey,
final TableColumnData[] columnData) {
Check.notNull(table, "table"); //$NON-NLS-1$
Check.notNull(columnData, "columnData"); //$NON-NLS-1$
table.setHeaderVisible(headerVisible);
table.setLinesVisible(linesVisible);
TableColumnWidthsPersistence persistenceStore = null;
/* Clear any existing columns */
final TableColumn[] existingColumns = table.getColumns();
for (int i = 0; i < existingColumns.length; i++) {
existingColumns[i].dispose();
}
boolean persist = false;
for (int i = 0; i < columnData.length; i++) {
if (columnData[i] == null) {
throw new IllegalArgumentException("columnData[" + i + "] is null"); //$NON-NLS-1$ //$NON-NLS-2$
}
final TableColumn column = new TableColumn(table, columnData[i].style);
if (columnData[i].text != null) {
column.setText(columnData[i].text);
}
if (columnData[i].image != null) {
column.setImage(columnData[i].image);
}
column.setResizable(columnData[i].resizeable);
if (columnData[i].persistenceKey != null) {
persist = true;
}
}
if (persist && persistenceKey != null) {
persistenceStore = new TableColumnWidthsPersistence(table, persistenceKey);
for (int i = 0; i < columnData.length; i++) {
if (columnData[i].persistenceKey != null) {
persistenceStore.addMapping(columnData[i].persistenceKey, i);
}
}
}
table.setLayout(new PersistentTableLayout(columnData, persistenceStore));
table.layout(true);
}