本文整理汇总了Java中org.eclipse.swt.widgets.TableColumn.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumn.setWidth方法的具体用法?Java TableColumn.setWidth怎么用?Java TableColumn.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TableColumn
的用法示例。
在下文中一共展示了TableColumn.setWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 );
}
示例2: 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());
}
示例3: 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();
}
示例4: 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;
}
示例5: createColumns
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void createColumns(final TableViewer tableViewer) {
final String[] titles = { "Relation", "Type", "Name" };
final int[] bounds = { 120, 100, 200 };
for (int i = 0; i < titles.length; i++) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewer.setSorter(new TableViewerSorter(titles));
viewerColumn.setLabelProvider(new TableCellLabelProvider());
final TableColumn column = viewerColumn.getColumn();
column.addSelectionListener(new ColumnSelectionListener(column, tableViewer));
column.setText(titles[i]);
column.setWidth(bounds[i]);
column.setResizable(true);
column.setMoveable(false);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE);
// Object[] projectsToSelect = openProjects.toArray();
// IViewPart view = window.getActivePage().showView( "org.eclipse.jdt.ui.PackageExplorer" );
// view.getSite().getSelectionProvider().setSelection( new StructuredSelection( projectsToSelect ) );
}
示例6: createColumns
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void createColumns(final TableViewer tableViewer) {
final String[] titles = { "Class" };
final int[] bounds = { 120, 100, 200 };
for (int i = 0; i < titles.length; i++) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewer.setSorter(new TableViewerSorter(titles));
viewerColumn.setLabelProvider(new TableCellLabelProvider());
final TableColumn column = viewerColumn.getColumn();
column.addSelectionListener(new ColumnSelectionListener(column, tableViewer));
column.setText(titles[i]);
column.setWidth(bounds[i]);
column.setResizable(true);
column.setMoveable(false);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE);
}
示例7: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
/**
* @param stateTable
*/
public static void createTableColumns(Table stateTable, ResultPage page)
{
// create table headers
for (int i = 0; i < columnTitles.length; i++)
{
TableColumn column = new TableColumn(stateTable, SWT.NULL);
column.setWidth(columnWidths[i]);
column.setText(columnTitles[i]);
// The following statement attaches a listener to the column
// header. See the ResultPageColumnListener comments.
column.addSelectionListener(new ResultPageColumnListener(i, page));
}
}
示例8: createComparisonTable
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void createComparisonTable(final Composite composite) {
final GridData tableGridData = new GridData();
tableGridData.horizontalSpan = 2;
tableGridData.heightHint = 100;
tableGridData.horizontalAlignment = GridData.FILL;
tableGridData.grabExcessHorizontalSpace = true;
comparisonTable = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
comparisonTable.setLayoutData(tableGridData);
comparisonTable.setHeaderVisible(true);
comparisonTable.setLinesVisible(true);
composite.pack();
final int width = comparisonTable.getBounds().width;
final TableColumn referencedColumn = new TableColumn(comparisonTable, SWT.NONE);
referencedColumn.setWidth(width / 2);
referencedColumn.setText(ResourceString.getResourceString("label.reference.column"));
final TableColumn foreignKeyColumn = new TableColumn(comparisonTable, SWT.NONE);
foreignKeyColumn.setWidth(width / 2);
foreignKeyColumn.setText(ResourceString.getResourceString("label.foreign.key"));
}
示例9: defineColumnsInternal
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
/**
* Defines what columns the drop down table will have.
*
* @param columnHeaders
* @param columnBounds
*/
private void defineColumnsInternal(String[] columnHeaders, int[] columnBounds, int totalColumnsToBeCreated) {
checkWidget();
int totalColumnHeaders = columnHeaders == null ? 0 : columnHeaders.length;
int totalColBounds = columnBounds == null ? 0 : columnBounds.length;
if (totalColumnsToBeCreated > 0) {
for (int index = 0; index < totalColumnsToBeCreated; index++) {
TableColumn column = new TableColumn(table, SWT.NONE);
if (index < totalColumnHeaders) {
column.setText(columnHeaders[index]);
}
if (index < totalColBounds) {
column.setWidth(columnBounds[index]);
}
column.setResizable(true);
column.setMoveable(true);
}
}
}
示例10: setDataSize
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void setDataSize ( final int entries, final Set<String> valueTypes )
{
clearDataSize ();
this.colNames = valueTypes.toArray ( new String[0] );
for ( final String valueType : valueTypes )
{
final TableColumn col = new TableColumn ( this.table, SWT.NONE );
col.setText ( valueType );
col.setWidth ( 100 );
col.setAlignment ( SWT.RIGHT );
this.columns.put ( valueType, col );
}
this.countCol = new TableColumn ( this.table, SWT.NONE );
this.countCol.setText ( Messages.QueryDataView_ColValues );
this.countCol.setWidth ( 40 );
this.infoCol = new TableColumn ( this.table, SWT.NONE );
this.infoCol.setText ( Messages.QueryDataView_ColInfo );
this.infoCol.setWidth ( 150 );
this.table.clearAll ();
this.table.setItemCount ( entries );
for ( int i = 0; i < entries; i++ )
{
final TableItem item = this.table.getItem ( i );
item.setBackground ( this.invalidColor );
item.setText ( 0, String.format ( Messages.QueryDataView_Format_Index, i ) );
}
}
示例11: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
public void createTableColumns(Table table, String[] fields, int width) {
for (String field : fields) {
TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
tableColumn.setText(field);
tableColumn.setWidth(width);
// tableColumn.pack();
}
table.setHeaderVisible(true);
table.setLinesVisible(true);
}
示例12: addControlListener
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void addControlListener(Table table, TableColumn tableColumn) {
ControlListener controlistener= new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
for (TableColumn column : table.getColumns()) {
column.setWidth(table.getSize().x / table.getColumnCount() - (4 - table.getColumnCount()));
}
}
};
table.addControlListener(controlistener);
}
示例13: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
public static void createTableColumns(Table table, String[] fields) {
for (String field : fields) {
TableColumn tableColumn = new TableColumn(table, SWT.FILL);
tableColumn.setText(field);
tableColumn.setWidth(100);
tableColumn.pack();
}
table.setHeaderVisible(true);
table.setLinesVisible(true);
}
示例14: createTableViewerColumn
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(bound);
column.setResizable(true);
column.setMoveable(true);
return viewerColumn;
}
示例15: createSourceTable
import org.eclipse.swt.widgets.TableColumn; //导入方法依赖的package包/类
private void createSourceTable(Composite composite_2) {
sourceTable = new Table(composite_2, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
sourceTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
if(sourceTable.getSelection().length==1){
addNewProperty(targetTableViewer, sourceTable.getSelection()[0].getText());
enableControlButtons();
}
}
});
GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
gd_table.widthHint = 221;
gd_table.heightHint = 407;
sourceTable.setLayoutData(gd_table);
sourceTable.setHeaderVisible(true);
sourceTable.setLinesVisible(true);
TableColumn sourceTableColumnFieldName = new TableColumn(sourceTable, SWT.LEFT);
if(OSValidator.isMac()){
sourceTableColumnFieldName.setWidth(212);
}else{
sourceTableColumnFieldName.setWidth(202);
}
sourceTableColumnFieldName.setText(Messages.AVAILABLE_FIELDS_HEADER);
getSourceFieldsFromPropagatedSchema(sourceTable);
dragSource = new DragSource(sourceTable, DND.DROP_MOVE);
dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
// Set the data to be the first selected item's text
event.data = formatDataToTransfer(sourceTable.getSelection());
}
});
}