org.eclipse.jface.viewers.TableLayout类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.eclipse.jface.viewers.TableLayout类的一些代码示例,展示了TableLayout类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableLayout类的具体详情如下:
包路径:org.eclipse.jface.viewers.TableLayout
类名称:TableLayout

TableLayout介绍

[英]A layout for a table. Call addColumnData to add columns. The TableLayout ColumnLayoutData is only valid until the table is resized. To keep the proportions constant when the table is resized see TableColumnLayout
[中]桌子的布局。致电addColumnData添加列。TableLayout ColumnLayoutData仅在调整表的大小之前有效。要在调整表格大小时保持比例不变,请参见TableColumnLayout

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

private void restoreDefaultColumnWidths(){
  TableLayout layout = new TableLayout();
  for (int i = 0; i < variableTableColumnLayouts.length; i++) {
    layout.addColumnData(variableTableColumnLayouts[i]);
  }
  variableTable.getTable().setLayout(layout);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

Item[] tableColumns = getColumns(c);
int size = Math.min(columns.size(), tableColumns.length);
int[] widths = new int[size];
  setWidth(tableColumns[i], widths[i]);

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

/**
 * @see IClasspathTableOwner#createAvailableJARsViewer(Composite)
 */
public CheckboxTableViewer createAvailableJARsViewer(Composite parent) {
  int flags = SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
  Table table = new Table(parent, flags);
  CheckboxTableViewer availableJARsViewer = new CheckboxTableViewer(table);
  // set up table layout
  TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
  tableLayout.addColumnData(new ColumnWeightData(200, true));
  tableLayout.addColumnData(new ColumnWeightData(200, true));
  table.setLayout(tableLayout);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  
  // do not create sorter otherwise order will go wrong
  //availableJARsViewer.setSorter(new ViewerSorter());
  
  // table columns
  TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
  fileNameColumn.setText(ManifestUIResourceHandler.JAR_Module_UI_);
  fileNameColumn.setResizable(true);
  TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
  projectColumn.setText(ManifestUIResourceHandler.Project_UI_);
  projectColumn.setResizable(true);
  tableLayout.layout(table, true);
  return availableJARsViewer;
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

private void addProjectSection(Composite composite) {
    
    table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    tableViewer = new TableViewer(table);
    table.setLayout(new TableLayout());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 300;
    table.setLayoutData(data);
    tableViewer.setContentProvider(new ProjectContentProvider());
    tableViewer.setLabelProvider(new ExportProjectSetLabelProvider());
  }

代码示例来源:origin: org.eclipse.neoscada.hmi/org.eclipse.scada.da.ui.widgets

protected void applyInitialColWidth ( final TableLayout tableLayout )
{
  if ( this.initialColWidth != null && !this.initialColWidth.isEmpty () && this.viewer != null && this.initialColWidth.size () != this.viewer.getTree ().getColumnCount () )
  {
    for ( final Integer w : this.initialColWidth )
    {
      tableLayout.addColumnData ( new ColumnPixelData ( w, true ) );
    }
  }
  else
  {
    tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
    tableLayout.addColumnData ( new ColumnWeightData ( 100, true ) );
    tableLayout.addColumnData ( new ColumnWeightData ( 100, true ) );
    tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
    tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

table.setLayout(new TableLayout());
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 300;

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public CheckboxTableViewer createavailableComponentsViewer(Composite parent) {
  int flags = SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
  Table table = new Table(parent, flags);
  availableComponentsViewer = new CheckboxTableViewer(table);
  // set up table layout
  TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
  tableLayout.addColumnData(new ColumnWeightData(200, true));
  tableLayout.addColumnData(new ColumnWeightData(200, true));
  table.setLayout(tableLayout);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  availableComponentsViewer.setSorter(null);
  // table columns
  TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
  fileNameColumn.setText(ManifestUIResourceHandler.JAR_Module_UI_); 
  fileNameColumn.setResizable(true);
  TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
  projectColumn.setText(ManifestUIResourceHandler.Project_UI_); 
  projectColumn.setResizable(true);
  tableLayout.layout(table, true);
  return availableComponentsViewer;
}

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.converter

protected void addEPackagesTableColumns(CheckboxTableViewer ePackagesTableViewer)
{
 ePackagesTableViewer.setColumnProperties(new String []{ "a", "b" });
 Table table = ePackagesTableViewer.getTable();
 table.setHeaderVisible(true);
 TableLayout tableLayout = (TableLayout)table.getLayout();
 TableColumn packageColumn = new TableColumn(table, SWT.NONE);
 tableLayout.addColumnData(new ColumnWeightData(1, true));
 packageColumn.setText(getEPackageColumnLabel());
 packageColumn.setResizable(true);
 TableColumn dataColumn = new TableColumn(table, SWT.NONE);
 tableLayout.addColumnData(new ColumnWeightData(1, true));
 dataColumn.setText(getEPackageDataColumnLabel());
 dataColumn.setResizable(true);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Creates a new table control with one column.
 *
 * @param parent the parent control
 * @param style style bits
 * @return a new table control
 */
protected static Table createTable(Composite parent, int style) {
  Table table = new Table(parent, SWT.CHECK | style);
  // Although this table column is not needed, and can cause resize problems,
  // it can't be removed since this would be a breaking change against R1.0.
  // See bug 6643 for more details.
  new TableColumn(table, SWT.NONE);
  TableLayout layout = new TableLayout();
  layout.addColumnData(new ColumnWeightData(100));
  table.setLayout(layout);
  return table;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

private void addProjectSection(Composite composite) {
  table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
  tableViewer = new TableViewer(table);
  table.setLayout(new TableLayout());
  GridData data = new GridData(GridData.FILL_BOTH);
  data.heightHint = 300;
  table.setLayoutData(data);
  tableViewer.setContentProvider(new ProjectContentProvider());
  tableViewer.setLabelProvider(new ExportProjectSetLabelProvider());
  tableViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

/**
 * Creates the columns for the history table.
 */
private void createColumns(Table table, TableLayout layout, TableViewer viewer) {
  SelectionListener headerListener = getColumnListener(viewer);
  // revision
  TableColumn col = new TableColumn(table, SWT.NONE);
  col.setResizable(true);
  col.setText(TeamUIMessages.GenericHistoryTableProvider_Revision);
  col.addSelectionListener(headerListener);
  layout.addColumnData(new ColumnWeightData(20, true));
  // creation date
  col = new TableColumn(table, SWT.NONE);
  col.setResizable(true);
  col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
  col.addSelectionListener(headerListener);
  layout.addColumnData(new ColumnWeightData(20, true));
  // author
  col = new TableColumn(table, SWT.NONE);
  col.setResizable(true);
  col.setText(TeamUIMessages.GenericHistoryTableProvider_Author);
  col.addSelectionListener(headerListener);
  layout.addColumnData(new ColumnWeightData(20, true));
  //comment
  col = new TableColumn(table, SWT.NONE);
  col.setResizable(true);
  col.setText(TeamUIMessages.GenericHistoryTableProvider_Comment);
  col.addSelectionListener(headerListener);
  layout.addColumnData(new ColumnWeightData(50, true));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

Item[] tableColumns = getColumns(c);
int size = Math.min(columns.size(), tableColumns.length);
int[] widths = new int[size];
  setWidth(tableColumns[i], widths[i]);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Creates a new table control with one column.
 *
 * @param parent the parent control
 * @param style style bits
 * @return a new table control
 */
protected static Table createTable(Composite parent, int style) {
  Table table = new Table(parent, SWT.CHECK | style);
  // Although this table column is not needed, and can cause resize problems,
  // it can't be removed since this would be a breaking change against R1.0.
  // See bug 6643 for more details.
  new TableColumn(table, SWT.NONE);
  TableLayout layout = new TableLayout();
  layout.addColumnData(new ColumnWeightData(100));
  table.setLayout(layout);
  return table;
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

/**
 * Create a TreeViewer that can be used to display a list of IFile instances.
 * This method provides the labels and sorter but does not provide a content provider
 * 
 * @param parent
 * @return TableViewer
 */
public TreeViewer createTree(Composite parent) {
  Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
  tree.setHeaderVisible(true);
  tree.setLinesVisible(false);
  
  GridData data = new GridData(GridData.FILL_BOTH);
  tree.setLayoutData(data);
  TableLayout layout = new TableLayout();
  tree.setLayout(layout);
  this.viewer = new TreeViewer(tree);
  
  createColumns(tree, layout);
  viewer.setLabelProvider(new LocalHistoryLabelProvider());
  // By default, reverse sort by revision. 
  // If local filter is on sort by date
  HistoryComparator sorter = new HistoryComparator(COL_DATE);
  sorter.setReversed(false);
  viewer.setComparator(sorter);
  
  return viewer;
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

col.setText(TeamUIMessages.GenericHistoryTableProvider_Revision); 
col.addSelectionListener(headerListener);
layout.addColumnData(new ColumnWeightData(20, true));
col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime); 
col.addSelectionListener(headerListener);
layout.addColumnData(new ColumnWeightData(20, true));
col.setText(TeamUIMessages.GenericHistoryTableProvider_Author); 
col.addSelectionListener(headerListener);
layout.addColumnData(new ColumnWeightData(20, true));
col.setText(TeamUIMessages.GenericHistoryTableProvider_Comment); 
col.addSelectionListener(headerListener);
layout.addColumnData(new ColumnWeightData(50, true));

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

Item[] tableColumns = getColumns(c);
int size = Math.min(columns.size(), tableColumns.length);
int[] widths = new int[size];
  setWidth(tableColumns[i], widths[i]);

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Creates a new table control with one column.
 *
 * @param parent the parent control
 * @param style style bits
 * @return a new table control
 */
protected static Table createTable(Composite parent, int style) {
  Table table = new Table(parent, SWT.CHECK | style);
  // Although this table column is not needed, and can cause resize problems,
  // it can't be removed since this would be a breaking change against R1.0.
  // See bug 6643 for more details.
  new TableColumn(table, SWT.NONE);
  TableLayout layout = new TableLayout();
  layout.addColumnData(new ColumnWeightData(100));
  table.setLayout(layout);
  return table;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

/**
 * Create a TreeViewer that can be used to display a list of IFile instances.
 * This method provides the labels and sorter but does not provide a content provider
 *
 * @param parent
 * @return TableViewer
 */
public TreeViewer createTree(Composite parent) {
  Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
  tree.setHeaderVisible(true);
  tree.setLinesVisible(false);
  GridData data = new GridData(GridData.FILL_BOTH);
  tree.setLayoutData(data);
  TableLayout layout = new TableLayout();
  tree.setLayout(layout);
  this.viewer = new TreeViewer(tree);
  createColumns(tree, layout);
  viewer.setLabelProvider(new LocalHistoryLabelProvider());
  // By default, reverse sort by revision.
  // If local filter is on sort by date
  HistoryComparator sorter = new HistoryComparator(COL_DATE);
  sorter.setReversed(false);
  viewer.setComparator(sorter);
  return viewer;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

/**
 * Creates the columns for the history table.
 */
private void createColumns(Tree tree, TableLayout layout) {
  SelectionListener headerListener = new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      // column selected - need to sort
      int column = viewer.getTree().indexOf((TreeColumn) e.widget);
      HistoryComparator oldSorter = (HistoryComparator) viewer.getComparator();
      if (oldSorter != null && column == oldSorter.getColumnNumber()) {
        oldSorter.setReversed(!oldSorter.isReversed());
        viewer.refresh();
      } else {
        viewer.setComparator(new HistoryComparator(column));
      }
    }
  };
  // creation date
  TreeColumn col = new TreeColumn(tree, SWT.NONE);
  col.setResizable(true);
  col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
  col.addSelectionListener(headerListener);
  layout.addColumnData(new ColumnWeightData(20, true));
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void initializeTable(Table table) {
  table.setHeaderVisible(true);
  TableColumn column = new TableColumn(table, SWT.NULL);
  column.setText(PDEUIMessages.TemplateSelectionPage_column_name);
  column.setResizable(true);
  column = new TableColumn(table, SWT.NULL);
  column.setText(PDEUIMessages.TemplateSelectionPage_column_point);
  column.setResizable(true);
  TableLayout layout = new TableLayout();
  layout.addColumnData(new ColumnWeightData(50));
  layout.addColumnData(new ColumnWeightData(50));
  table.setLayout(layout);
}

相关文章