Java 类org.eclipse.swt.widgets.TableColumn 实例源码

项目:n4js    文件:TableViewerBuilder.java   
@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;
}
项目:eZooKeeper    文件:DataModelFormPage.java   
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;
}
项目:eZooKeeper    文件:DataModelFormPage.java   
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);
        }
    }
}
项目:eZooKeeper    文件:BaseElementType.java   
@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);
        }
    }
}
项目:eZooKeeper    文件:ZnodeAclComposite.java   
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);
                }
            }
        }
    }
项目:eZooKeeper    文件:BaseZnodeModelTableFormPage.java   
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);
    }
}
项目:neoscada    文件:MonitorsViewTable.java   
@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 ) );
}
项目:neoscada    文件:EventViewTable.java   
@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 ) );
    }
}
项目:neoscada    文件:QueryDataView.java   
@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 () );
}
项目:neoscada    文件:QueryDataView.java   
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;
    }
}
项目:neoscada    文件:SecurityEditor.java   
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 );
}
项目:gw4e.project    文件:TableHelper.java   
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());

    }
项目:Hydrograph    文件:ExcelFormattingDialog.java   
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();
}
项目:Hydrograph    文件:HeaderAndDataFormattingDialog.java   
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;
}
项目:Hydrograph    文件:ELTSchemaGridWidget.java   
/**
 * 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);
             }
         }
     }

 });
}
项目:Hydrograph    文件:ExportAction.java   
@Override
public void run() {
    ViewDataPreferencesVO viewDataPreferencesVO = debugDataViewer.getViewDataPreferences();
    delimiter = viewDataPreferencesVO.getDelimiter();
    quoteCharactor = viewDataPreferencesVO.getQuoteCharactor();
    headerEnabled = viewDataPreferencesVO.getIncludeHeaders();
    TableViewer tableViewer = debugDataViewer.getTableViewer();
    List<RowData> eachRowData = getListOfRowData(tableViewer);
    List<String[]> exportedfileDataList = new ArrayList<String[]>();
    TableColumn[] columns = tableViewer.getTable().getColumns();
    if (headerEnabled != null) {
        addHeadersInList(tableViewer, exportedfileDataList, columns);
    }
    addRowsDataInList(tableViewer, eachRowData, exportedfileDataList);
    FileDialog fileDialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.SAVE);
    String filePath = getPathOfFileDialog(fileDialog);
    writeDataInFile(exportedfileDataList, filePath);
}
项目:Tarski    文件:SelectionWizardPage.java   
/**
 * Create contents of the wizard.
 * 
 * @param parent
 */
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NULL);

  setControl(container);
  container.setLayout(new GridLayout(1, false));

  TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);
  table = tableViewer.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

  tableViewer.setContentProvider(ArrayContentProvider.getInstance());
  tableViewer.setInput(candidateList);
  tableViewer.setLabelProvider(new MarkerColumn());
  // auto size columns
  TableColumn[] columns = tableViewer.getTable().getColumns();
  for (int i = 0; i < columns.length; i++) {
    columns[i].pack();
  }
}
项目:libraries    文件:TableViewerFactory.java   
private void createColumns(final TableViewer tableViewer) {
  final String[] titles = { "Icon", "Name", "Small", "Medium", "Large", "Source", "Class" };
  final int[] bounds = { 40, 200, 60, 60, 60, 200, 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);
}
项目:libraries    文件:ColumnSelectionListener.java   
@Override
public void widgetSelected(final SelectionEvent e) {
  final Table table = this.column.getParent();
  final TableColumn sortColumn = table.getSortColumn();
  if (sortColumn == null || !sortColumn.equals(this.column)) {
    table.setSortColumn(this.column);
    table.setSortDirection(SWT.NONE);
  }
  switch (table.getSortDirection()) {
    case SWT.NONE: {
      table.setSortDirection(SWT.DOWN);
      break;
    }
    case SWT.DOWN: {
      table.setSortDirection(SWT.UP);
      break;
    }
    case SWT.UP: {
      table.setSortDirection(SWT.NONE);
      break;
    }
  }
  this.viewer.refresh();
}
项目:libraries    文件:RelationsTableViewerFactory.java   
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 ) );

}
项目:TranskribusSwtGui    文件:HtrTableLabelProvider.java   
@Override
public String getColumnText(Object element, int columnIndex) {
    //logger.trace("get column text: "+element+" id: "+columnIndex);

    if (element instanceof TrpHtr) {
        TrpHtr htr = (TrpHtr) element;

        TableColumn column = table.getColumn(columnIndex);
        String ct = column.getText();

        if (ct.equals(HtrTableWidget.HTR_NAME_COL)) {
            return htr.getName();
        } else if (ct.equals(HtrTableWidget.HTR_LANG_COL)) {
            return htr.getLanguage();
        } else if (ct.equals(HtrTableWidget.HTR_ID_COL)) {
            return ""+htr.getHtrId();
        } else if (ct.equals(HtrTableWidget.HTR_CREATOR_COL)) {
            return htr.getUserName() == null ? "Unknown" : htr.getUserName();
        }
    }
    return "i am error";
}
项目:libraries    文件:TypesTableViewerFactory.java   
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);
}
项目:libraries    文件:ColumnSelectionListener.java   
@Override
public void widgetSelected(final SelectionEvent e) {
  final Table table = this.column.getParent();
  final TableColumn sortColumn = table.getSortColumn();
  if (sortColumn == null || !sortColumn.equals(this.column)) {
    table.setSortColumn(this.column);
    table.setSortDirection(SWT.NONE);
  }
  switch (table.getSortDirection()) {
    case SWT.NONE: {
      table.setSortDirection(SWT.DOWN);
      break;
    }
    case SWT.DOWN: {
      table.setSortDirection(SWT.UP);
      break;
    }
    case SWT.UP: {
      table.setSortDirection(SWT.NONE);
      break;
    }
  }
  this.viewer.refresh();
}
项目:TranskribusSwtGui    文件:KwsHitTableLabelProvider.java   
@Override
public String getColumnText(Object element, int columnIndex) {
    //logger.trace("get column text: "+element+" id: "+columnIndex);

    if (element instanceof TrpKwsHit) {
        TrpKwsHit hit = (TrpKwsHit) element;

        TableColumn column = table.getColumn(columnIndex);
        String ct = column.getText();

        if (ct.equals(KwsHitTableWidget.KWS_CONF_COL)) {
            return DF.format(hit.getConfidence());
        } else if (ct.equals(KwsHitTableWidget.KWS_PAGE_COL)) {
            return ""+hit.getPageNr();
        } else if (ct.equals(KwsHitTableWidget.KWS_TEXT_COL)) {
            return hit.getTranscription();
        } else if (ct.equals(KwsHitTableWidget.KWS_PREVIEW_COL)) {
            if(!icons.containsKey(hit)) {
                return "Loading...";
            } else {
                return "";
            }
        }
    }
    return "i am error";
}
项目:team-explorer-everywhere    文件:SelectChangesetsWizardPage.java   
private void addColumns() {
    // Columns
    final TableLayout mergeTableLayout = new TableLayout();
    table.setLayout(mergeTableLayout);

    mergeTableLayout.addColumnData(new ColumnWeightData(15, 10, true));
    final TableColumn changesetTableColumn = new TableColumn(table, SWT.NONE);
    changesetTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameChangeset")); //$NON-NLS-1$

    mergeTableLayout.addColumnData(new ColumnWeightData(25, 10, true));
    final TableColumn changeTableColumn = new TableColumn(table, SWT.NONE);
    changeTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameDate")); //$NON-NLS-1$

    mergeTableLayout.addColumnData(new ColumnWeightData(15, 10, true));
    final TableColumn userTableColumn = new TableColumn(table, SWT.NONE);
    userTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameUser")); //$NON-NLS-1$

    mergeTableLayout.addColumnData(new ColumnWeightData(35, 10, true));
    final TableColumn commentTableColumn = new TableColumn(table, SWT.FILL);
    commentTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameComment")); //$NON-NLS-1$
}
项目:team-explorer-everywhere    文件:WorkItemList.java   
private void createTableColumns(final Table table) {
    final TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(Messages.getString("WorkItemList.ColumnNameType")); //$NON-NLS-1$
    column1.setResizable(true);

    final TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(Messages.getString("WorkItemList.ColumnNameId")); //$NON-NLS-1$
    column2.setResizable(true);

    final TableColumn column3 = new TableColumn(table, SWT.NONE);
    column3.setText(Messages.getString("WorkItemList.ColumnNameTitle")); //$NON-NLS-1$
    column3.setResizable(true);

    final TableColumn column4 = new TableColumn(table, SWT.NONE);
    column4.setText(Messages.getString("WorkItemList.ColumnNameState")); //$NON-NLS-1$
    column4.setResizable(true);
    if (forHistoryDetails == false) {
        final TableColumn column5 = new TableColumn(table, SWT.NONE);
        column5.setText(Messages.getString("WorkItemList.ColumnNameAction")); //$NON-NLS-1$
        column5.setResizable(true);
    }
}
项目:team-explorer-everywhere    文件:BranchesPropertiesControl.java   
private void createTableColumns(final Table table) {
    final TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

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

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

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

}
项目:team-explorer-everywhere    文件:StatusPropertiesTab.java   
private void createTableColumns(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("StatusPropertiesTab.ColumNameUser")); //$NON-NLS-1$
    column1.setResizable(true);

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

    tableLayout.addColumnData(new ColumnWeightData(1, true));
    final TableColumn column3 = new TableColumn(table, SWT.NONE);
    column3.setText(Messages.getString("StatusPropertiesTab.ColumnNameWorkspace")); //$NON-NLS-1$
    column3.setResizable(true);
}
项目:TranskribusSwtGui    文件:MyTableCombo.java   
/**
 * 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);
        }
    }
}
项目:TranskribusSwtGui    文件:JobOverviewLabelProvider.java   
@Override public Color getForeground(Object element, int columnIndex) {
    if (element instanceof TrpJobStatus) {
        TrpJobStatus job = (TrpJobStatus) element;

        TableColumn column = table.getColumn(columnIndex);
        String ct = column.getText();

        if (ct.equals(JobOverviewWidget.STATE_COL)) {
            if (job.getState().equals(TrpJobStatus.FINISHED)) {
                return Colors.getSystemColor(SWT.COLOR_DARK_GREEN);
            }
            else if (job.getState().equals(TrpJobStatus.FAILED)) {
                return Colors.getSystemColor(SWT.COLOR_RED);
            }
            else {
                return Colors.getSystemColor(SWT.COLOR_DARK_YELLOW);
            }
        }
    }       

    return null;
}
项目:team-explorer-everywhere    文件:TableViewerSorter.java   
/**
 * Called to set the column and direction decorations on the specified
 * {@link Table}. Subclasses may override. The base class implementation
 * uses reflection to attempt to call the <code>setSortColumn</code> and
 * <code>setSortDirection</code> methods that were added in Eclipse 3.2.
 *
 * @param table
 *        the {@link Table} to decorate
 * @param sortColumn
 *        the column that should be marked as the sort column
 * @param direction
 *        the direction ({@link SWT#UP} or {@link SWT#DOWN}) to use in the
 *        decoration
 */
protected void setSortColumnAndDirection(final Table table, final TableColumn sortColumn, final int direction) {
    try {
        final Class tableClass = table.getClass();

        final Method setSortColumn = tableClass.getMethod("setSortColumn", new Class[] //$NON-NLS-1$
        {
            TableColumn.class
        });
        final Method setSortDirection = tableClass.getMethod("setSortDirection", new Class[] //$NON-NLS-1$
        {
            Integer.TYPE
        });

        setSortColumn.invoke(table, new Object[] {
            sortColumn
        });
        setSortDirection.invoke(table, new Object[] {
            new Integer(direction)
        });
    } catch (final Exception e) {

    }
}
项目:team-explorer-everywhere    文件:TableColumnWidthsPersistence.java   
/**
 * Restores table column widths. Users of this class should have already
 * added some mappings before calling this method. Any persisted widths
 * whose keys do not correspond to indices into the {@link Table}'s columns
 * will be ignored.
 */
public void restore() {
    final Preferences node = getPreferencesNode(key);

    for (final Iterator it = mappings.keySet().iterator(); it.hasNext();) {
        final String columnKey = (String) it.next();
        final int ix = getIndexForKey(columnKey);
        if (ix == -1) {
            continue;
        }
        final TableColumn tableColumn = table.getColumn(ix);
        final int persistedWidth = node.getInt(columnKey, -1);
        if (persistedWidth != -1) {
            tableColumn.setWidth(persistedWidth);
        }
    }
}
项目:TranskribusSwtGui    文件:KwsResultTableLabelProvider.java   
@Override
public String getColumnText(Object element, int columnIndex) {
    //logger.trace("get column text: "+element+" id: "+columnIndex);

    if (element instanceof TrpKwsResultTableEntry) {
        TrpKwsResultTableEntry res = (TrpKwsResultTableEntry) element;

        TableColumn column = table.getColumn(columnIndex);
        String ct = column.getText();

        if (ct.equals(KwsResultTableWidget.KWS_CREATED_COL)) {
            return CoreUtils.DATE_FORMAT_USER_FRIENDLY.format(res.getCreated());
        } else if (ct.equals(KwsResultTableWidget.KWS_STATUS_COL)) {
            return res.getStatus();
        } else if (ct.equals(KwsResultTableWidget.KWS_SCOPE_COL)) {
            return res.getScope();
        } else if (ct.equals(KwsResultTableWidget.KWS_DURATION_COL)) {
            return res.getDuration();
        } else if (ct.equals(KwsResultTableWidget.KWS_QUERY_COL)) {
            return res.getQuery();
        }
    }
    return "i am error";
}
项目:TranskribusSwtGui    文件:FeatureTableLabelProvider.java   
@Override public String getColumnText(Object element, int columnIndex) {
    if (element instanceof EdFeature) {
        EdFeature feat = (EdFeature) element;

        TableColumn column = table.getColumn(columnIndex);
        String ct = column.getText();

        if (ct.equals(EditDeclManagerDialog.FEAT_TITLE_COL)) {
            return feat.getTitle();
        } else if (ct.equals(EditDeclManagerDialog.FEAT_DESC_COL)) {
            return feat.getDescription();
        } else if (ct.equals(EditDeclManagerDialog.FEAT_ID_COL)) {
            return ""+feat.getFeatureId();
        }  else if (ct.equals(EditDeclManagerDialog.FEAT_COL_ID_COL)) {
            final Integer colId = feat.getColId();
            if(colId != null){
                return ""+feat.getColId();
            } else {
                return "preset";
            }
        }
    }

    return "i am error";
}
项目:ermaster-k    文件:IndexTabWrapper.java   
private void initTable(Composite parent) {
    GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.heightHint = 200;

    this.indexTable = new Table(parent, SWT.BORDER | SWT.HIDE_SELECTION);

    this.indexTable.setHeaderVisible(true);
    this.indexTable.setLayoutData(gridData);
    this.indexTable.setLinesVisible(true);

    CompositeFactory.createTableColumn(this.indexTable,
            "label.column.name", -1);
    TableColumn separatorColumn = CompositeFactory.createTableColumn(
            this.indexTable, "", 3);
    separatorColumn.setResizable(false);
}
项目:ermasterr    文件:RelationByExistingColumnsDialog.java   
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"));
}
项目:ermasterr    文件:IndexTabWrapper.java   
private void initTable(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.heightHint = 200;

    indexTable = new Table(parent, SWT.BORDER | SWT.HIDE_SELECTION);

    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(gridData);
    indexTable.setLinesVisible(true);

    CompositeFactory.createTableColumn(indexTable, "label.column.name", -1);
    final TableColumn separatorColumn = CompositeFactory.createTableColumn(indexTable, "", 3);
    separatorColumn.setResizable(false);
}
项目:TranskribusSwtGui    文件:EditDeclTableLabelProvider.java   
@Override public String getColumnText(Object element, int columnIndex) {
        if (element instanceof EdFeature) {
            EdFeature feat = (EdFeature) element;

            TableColumn column = table.getColumn(columnIndex);
            String ct = column.getText();

            if (ct.equals(EditDeclManagerDialog.EDT_DECL_TITLE_COL)) {
                return feat.getTitle();
            } else if (ct.equals(EditDeclManagerDialog.EDT_DECL_DESC_COL)) {
                return feat.getDescription();
            } else if (ct.equals(EditDeclManagerDialog.EDT_DECL_ID_COL)) {
                return ""+feat.getFeatureId();
            }  else if (ct.equals(EditDeclManagerDialog.EDT_DECL_OPT_COL)) {
                List<EdOption> opts = feat.getOptions();
                for(EdOption o : opts){
//                  logger.debug(o.getText());
                    if(o.isSelected()) return o.getText();
                }
            }
        }

        return "i am error";
    }
项目:ermasterr    文件:ExportToTranslationDictionaryDialog.java   
private void createTable(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.heightHint = 150;
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    dictionaryTable = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI);
    dictionaryTable.setHeaderVisible(true);
    dictionaryTable.setLinesVisible(true);
    dictionaryTable.setLayoutData(gridData);

    parent.pack();

    final int width = dictionaryTable.getBounds().width;

    final TableColumn physicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);
    physicalNameTableColumn.setText(ResourceString.getResourceString("label.physical.name"));
    physicalNameTableColumn.setWidth(width / 2 - 5);

    final TableColumn logicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);

    logicalNameTableColumn.setText(ResourceString.getResourceString("label.logical.name"));
    logicalNameTableColumn.setWidth(width / 2 - 5);
}
项目:code    文件:ObjectTreeView.java   
private void createMenuItem(Menu parent, final TableColumn column) {
    final MenuItem itemName = new MenuItem(parent, SWT.CHECK);
    itemName.setText(column.getText());
    itemName.setSelection(column.getResizable());
    itemName.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            if (itemName.getSelection()) {
                column.setWidth(150);
                column.setResizable(true);
            } else {
                column.setWidth(0);
                column.setResizable(false);
            }
        }
    });

}