java类org.eclipse.jface.viewers.TableLayout的实例源码

LocalHistoryTableProvider.java 文件源码 项目:eclipse-utility 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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(true);

    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;
}
AttributesPart.java 文件源码 项目:neoscada 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void createPart ( final Composite parent )
{
    super.createPart ( parent );

    this.viewer = new TableViewer ( parent, SWT.FULL_SELECTION );

    final TableLayout tableLayout = new TableLayout ();

    final TableViewerColumn col1 = new TableViewerColumn ( this.viewer, SWT.NONE );
    col1.getColumn ().setText ( Messages.AttributesPart_NameLabel );
    tableLayout.addColumnData ( new ColumnWeightData ( 50 ) );

    final TableViewerColumn col2 = new TableViewerColumn ( this.viewer, SWT.NONE );
    col2.getColumn ().setText ( Messages.AttributesPart_TypeLabel );
    tableLayout.addColumnData ( new ColumnWeightData ( 20 ) );

    final TableViewerColumn col3 = new TableViewerColumn ( this.viewer, SWT.NONE );
    col3.getColumn ().setText ( Messages.AttributesPart_ValueLabel );
    tableLayout.addColumnData ( new ColumnWeightData ( 50 ) );

    this.viewer.getTable ().setHeaderVisible ( true );
    this.viewer.getTable ().setLayout ( tableLayout );

    ViewerSupport.bind ( this.viewer, this.entries, new IValueProperty[] { PojoProperties.value ( "name" ), PojoProperties.value ( "type" ), PojoProperties.value ( "value" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    this.viewer.setComparator ( new ViewerComparator () );
}
BaseWITComponentControl.java 文件源码 项目:team-explorer-everywhere 阅读 17 收藏 0 点赞 0 评论 0
private void createTableColumns(final Table table) {
    table.setLinesVisible(false);
    table.setHeaderVisible(true);

    final TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    final String[] columnNames = getTableColumnNames();
    for (int i = 0; i < columnNames.length; i++) {
        tableLayout.addColumnData(new ColumnWeightData(1, true));
        final TableColumn column1 = new TableColumn(table, SWT.NONE);
        column1.setText(columnNames[i]);
        column1.setResizable(true);
    }
}
TestStepsControl.java 文件源码 项目:team-explorer-everywhere 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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;
}
TestStepsControl.java 文件源码 项目:team-explorer-everywhere 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Create the parameter data table. The table is collapsed if there are no
 * columns defined in the work item.
 *
 * @param parent
 *        The parent layout composite.
 * @param workItem
 *        The test case work item.
 *
 * @return The allocated table viewer
 */
private TableViewer createDataTable(final Composite parent, final WorkItem workItem) {
    final Label label = new Label(parent, SWT.NONE);
    label.setText(Messages.getString("TestStepsControl.ParameterValuesLabelText")); //$NON-NLS-1$

    final TableViewer dataViewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
    final Table dataTable = dataViewer.getTable();
    GridDataBuilder.newInstance().align(SWT.FILL, SWT.FILL).grab(true, true).span(1, 1).minHeight(75).applyTo(
        dataTable);

    dataTable.setHeaderVisible(true);
    dataTable.setLinesVisible(true);
    final TableLayout layout = new TableLayout();
    dataTable.setLayout(layout);

    final ParamDataTable[] paramDataTables = getParamDataTables();
    if (paramDataTables.length > 0) {
        sash.setMaximizedControl(null);
        updateDataTableColumns(dataViewer, paramDataTables[0].getColumnNames());
    } else {
        sash.setMaximizedControl(stepsTable.getTable());
    }

    dataViewer.setContentProvider(new ParamDataContentProvider());
    dataViewer.setLabelProvider(new ParamDataLabelProvider());
    dataViewer.setInput(workItem);

    return dataViewer;
}
AdvancedPropertiesTab.java 文件源码 项目:team-explorer-everywhere 阅读 19 收藏 0 点赞 0 评论 0
public AdvancedPropertiesControl(final Composite parent, final int style) {
    super(parent, style);

    final FillLayout layout = new FillLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.spacing = getSpacing();
    setLayout(layout);

    table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    final TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(Messages.getString("AdvancedPropertiesTab.ColumnNameProperty")); //$NON-NLS-1$
    column1.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(Messages.getString("AdvancedPropertiesTab.ColumnNameValue")); //$NON-NLS-1$
    column2.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column3 = new TableColumn(table, SWT.NONE);
    column3.setText(Messages.getString("AdvancedPropertiesTab.ColumnNameSource")); //$NON-NLS-1$
    column3.setResizable(true);
}
FileControl.java 文件源码 项目:team-explorer-everywhere 阅读 11 收藏 0 点赞 0 评论 0
private void addTableColumns(final Table table) {
    final TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(Messages.getString("FileControl.ColumNameName")); //$NON-NLS-1$
    column1.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(Messages.getString("FileControl.ColumnNamePendingChange")); //$NON-NLS-1$
    column2.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column3 = new TableColumn(table, SWT.NONE);
    column3.setText(Messages.getString("FileControl.ColumnNameUser")); //$NON-NLS-1$
    column3.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column4 = new TableColumn(table, SWT.NONE);
    column4.setText(Messages.getString("FileControl.ColumnNameLatest")); //$NON-NLS-1$
    column4.setResizable(true);

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column5 = new TableColumn(table, SWT.NONE);
    column5.setText(Messages.getString("FileControl.ColumnNameLastCheckin")); //$NON-NLS-1$
    column5.setResizable(true);
}
RepositorySelectionPage.java 文件源码 项目:subclipse 阅读 21 收藏 0 点赞 0 评论 0
/**
    * Creates the table for the repositories
    */
protected TableViewer createTable(Composite parent, int span) {
    Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
    data.horizontalSpan = span;
    table.setLayoutData(data);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, true));
    table.setLayout(layout);
    TableColumn col = new TableColumn(table, SWT.NONE);
    col.setResizable(true);

    return new TableViewer(table);
}
CheckoutWizardLocationPage.java 文件源码 项目:subclipse 阅读 15 收藏 0 点赞 0 评论 0
/**
    * Creates the table for the repositories
    */
protected TableViewer createTable(Composite parent, int span) {
    Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
    data.horizontalSpan = span;
    table.setLayoutData(data);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, true));
    table.setLayout(layout);
    TableColumn col = new TableColumn(table, SWT.NONE);
    col.setResizable(true);

    return new TableViewer(table);
}
ChangePathsTableProvider.java 文件源码 项目:subclipse 阅读 19 收藏 0 点赞 0 评论 0
public ChangePathsTableProvider(Composite parent, IContentProvider contentProvider) {
  super(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);

  TableLayout layout = new TableLayout();
  GridData data = new GridData(GridData.FILL_BOTH);

  Table table = (Table) getControl();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(data);    
  table.setLayout(layout);
  table.addDisposeListener(new DisposeListener() {
    public void widgetDisposed(DisposeEvent e) {
      if(currentPathFont != null) {
        currentPathFont.dispose();
      }
    }
  });

  createColumns(table, layout);

  setLabelProvider(new ChangePathLabelProvider());
  setContentProvider(contentProvider);

  ChangePathsSorter sorter = new ChangePathsSorter(COL_PATH);
  setSorter(sorter);
  table.setSortDirection(SWT.UP);
}


问题


面经


文章

微信
公众号

扫码关注公众号