本文整理匯總了Java中org.eclipse.swt.widgets.TableColumn類的典型用法代碼示例。如果您正苦於以下問題:Java TableColumn類的具體用法?Java TableColumn怎麽用?Java TableColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TableColumn類屬於org.eclipse.swt.widgets包,在下文中一共展示了TableColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTableSection
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
protected Section createTableSection(ScrolledForm form, Composite client, FormToolkit toolkit, String title,
Image image, int sectionStyle, int tableStyle, String[] columnTitles, int[] columnAlignments) {
Section section = createSection(form, client, toolkit, title, image, sectionStyle);
Table table = toolkit.createTable(section, tableStyle);
for (int i = 0; i < columnTitles.length; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setText(columnTitles[i]);
column.setAlignment(columnAlignments[i]);
}
table.setHeaderVisible(true);
table.setLinesVisible(true);
section.setClient(table);
return section;
}
示例2: createViewer
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
@Override
protected TableViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout, final int style) {
final TableViewer viewer = new TableViewer(parent, style);
final Table table = viewer.getTable();
table.setLinesVisible(linesVisible);
table.setHeaderVisible(headerVisible);
int columnIndex = 0;
for (final String columnLabel : columnLabels) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, NONE);
final TableColumn column = viewerColumn.getColumn();
columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
column.setText(columnLabel);
column.setMoveable(moveable);
columnIndex++;
}
return viewer;
}
示例3: packTable
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
protected void packTable(Table table, int[] columnWidths) {
if (table == null) {
return;
}
table.pack();
TableColumn[] columns = table.getColumns();
for (int i = 0; i < columns.length; i++) {
int columnWidth = columnWidths[i];
if (columnWidth == SWT.DEFAULT) {
columns[i].pack();
}
else {
columns[i].setWidth(columnWidth);
}
}
}
示例4: packTable
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
@Override
public void packTable(Table table) {
table.pack();
TableColumn[] columns = table.getColumns();
int[] columnWidths = getColumnWidths();
for (int i = 0; i < columns.length; i++) {
int columnWidth = columnWidths[i];
if (columnWidth == SWT.DEFAULT) {
columns[i].pack();
}
else {
columns[i].setWidth(columnWidth);
}
}
}
示例5: fixLayout
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
private void fixLayout() {
Table table = getTable();
// HACK to get the removed item to disappear.
table.pack();
layout(true);
int[] columnWidths = TABLE_COLUMN_WIDTHS;
TableColumn[] columns = table.getColumns();
for (int i = 0; i < columns.length; i++) {
if (columnWidths == null) {
columns[i].pack();
}
else {
int columnWidth = columnWidths[i];
if (columnWidth == SWT.DEFAULT) {
columns[i].pack();
}
else {
columns[i].setWidth(columnWidth);
}
}
}
}
示例6: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
protected void createTableColumns() {
Table table = getTable();
if (table == null) {
return;
}
String[] titles = getTableColumnTitles();
if (titles != null && titles.length > 0) {
int[] columnAlignments = getTableColumnAlignments();
for (int i = 0; i < titles.length; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setText(titles[i]);
if (columnAlignments != null) {
column.setAlignment(columnAlignments[i]);
}
}
table.setHeaderVisible(true);
}
}
示例7: widgetSelected
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
@Override
public void widgetSelected ( final SelectionEvent e )
{
final Table table = this.tableViewer.getTable ();
final TableColumn newColumn = (TableColumn)e.widget;
final TableColumn currentColumn = table.getSortColumn ();
final int currentDir = table.getSortDirection ();
int newDir = SWT.UP;
if ( newColumn == currentColumn )
{
newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
}
else
{
table.setSortColumn ( newColumn );
}
table.setSortDirection ( newDir );
this.tableViewer.setSorter ( new Sorter ( (Columns)newColumn.getData ( COLUMN_KEY ), newDir ) );
}
示例8: widgetSelected
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
@Override
public void widgetSelected ( final SelectionEvent e )
{
final Table table = this.tableViewer.getTable ();
final TableColumn newColumn = (TableColumn)e.widget;
final TableColumn currentColumn = table.getSortColumn ();
final EventTableColumn column = (EventTableColumn)newColumn.getData ( COLUMN_KEY );
if ( column == EventTableColumn.reservedColumnSourceTimestamp || column == EventTableColumn.reservedColumnEntryTimestamp )
{
final int currentDir = table.getSortDirection ();
int newDir = SWT.UP;
if ( newColumn == currentColumn )
{
newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
}
else
{
table.setSortColumn ( newColumn );
}
table.setSortDirection ( newDir );
this.tableViewer.setSorter ( new EventTableSorter ( column, newDir ) );
}
}
示例9: createPartControl
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
@Override
public void createPartControl ( final Composite parent )
{
addListener ();
parent.setLayout ( new FillLayout () );
this.table = new Table ( parent, SWT.FULL_SELECTION );
this.table.setHeaderVisible ( true );
this.indexCol = new TableColumn ( this.table, SWT.NONE );
this.indexCol.setText ( Messages.QueryDataView_ColIndex );
this.indexCol.setWidth ( 50 );
this.qualityCol = new TableColumn ( this.table, SWT.NONE );
this.qualityCol.setText ( Messages.QueryDataView_ColQuality );
this.qualityCol.setWidth ( 75 );
this.manualCol = new TableColumn ( this.table, SWT.NONE );
this.manualCol.setText ( Messages.QueryDataView_ColManual );
this.manualCol.setWidth ( 75 );
this.invalidColor = JFaceColors.getErrorBackground ( getDisplay () );
}
示例10: clearDataSize
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
private void clearDataSize ()
{
this.table.clearAll ();
for ( final TableColumn col : this.columns.values () )
{
col.dispose ();
}
this.columns.clear ();
if ( this.countCol != null )
{
this.countCol.dispose ();
this.countCol = null;
}
if ( this.infoCol != null )
{
this.infoCol.dispose ();
this.infoCol = null;
}
}
示例11: createColumns
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
protected void createColumns ( final Table table )
{
final TableColumn typeFilterColumn = new TableColumn ( table, SWT.NONE );
typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$
typeFilterColumn.setResizable ( true );
typeFilterColumn.setWidth ( 200 );
final TableColumn idFilterColumn = new TableColumn ( table, SWT.NONE );
idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$
idFilterColumn.setResizable ( true );
idFilterColumn.setWidth ( 200 );
final TableColumn actionFilterColumn = new TableColumn ( table, SWT.NONE );
actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$
actionFilterColumn.setResizable ( true );
actionFilterColumn.setWidth ( 200 );
}
示例12: handleEvent
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
public static void handleEvent(Event event) {
Table table = (Table) event.widget;
int columnCount = table.getColumnCount();
if (columnCount == 0)
return;
Rectangle area = table.getClientArea();
int totalAreaWdith = area.width;
int lineWidth = table.getGridLineWidth();
int totalGridLineWidth = (columnCount - 1) * lineWidth;
int totalColumnWidth = 0;
for (TableColumn column : table.getColumns()) {
totalColumnWidth = totalColumnWidth + column.getWidth();
}
int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth);
TableColumn lastCol = table.getColumns()[columnCount - 1];
lastCol.setWidth(diff + lastCol.getWidth());
}
示例13: createSourceTable
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
private void createSourceTable(SashForm sashForm) {
avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table_1 = avaliableFieldTableViewer.getTable();
table_1.setLinesVisible(true);
table_1.setHeaderVisible(true);
avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
return ((List) inputElement).toArray();
}
});
avaliableFieldTableViewer.setInput(schemaFields);
TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE);
TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn();
tblclmnNewColumn_2.setWidth(196);
tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER);
tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider());
attachDragListener();
}
示例14: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
private TableViewer createTableColumns(Composite tableComposite) {
TableViewer tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
excelFormatterTable = tableViewer.getTable();
excelFormatterTable.setHeaderVisible(true);
excelFormatterTable.setLinesVisible(true);
excelFormatterTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn parameterNameColumn = tableViewerColumn.getColumn();
parameterNameColumn.setWidth(254);
parameterNameColumn.setText(Messages.PARAMETER_NAME);
tableViewerColumn.setLabelProvider(new ParameterNameLabelProvider());
TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn parameterValueColumn = tableViewerColumn_1.getColumn();
parameterValueColumn.setWidth(251);
parameterValueColumn.setText(Messages.PARAMETER_VALUE);
tableViewerColumn_1.setLabelProvider(new ParameterValueLabelProvider());
return tableViewer;
}
示例15: arrangeTableViewerColumns
import org.eclipse.swt.widgets.TableColumn; //導入依賴的package包/類
/**
* Arrange the columns size in equal ratio
*/
private void arrangeTableViewerColumns() {
tableViewerComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
int totalWidth = tableViewer.getTable().getColumnCount() * COLUMN_WIDTH;
int widthDifference = tableViewerComposite.getSize().x - totalWidth;
if (widthDifference > 0) {
widthDifference = widthDifference / tableViewer.getTable().getColumnCount();
for (TableColumn tableColumn : tableViewer.getTable().getColumns()) {
tableColumn.setWidth(COLUMN_WIDTH+widthDifference);
}
}
}
});
}