org.eclipse.swt.widgets.Table.setSortColumn()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(172)

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

Table.setSortColumn介绍

[英]Sets the column used by the sort indicator for the receiver. A null value will clear the sort indicator. The current sort column is cleared before the new column is set.
[中]设置排序指示器用于接收器的列。空值将清除排序指示器。在设置新列之前,将清除当前排序列。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * @param sortable the sortable to set
 */
public void setSortable( boolean sortable ) {
 this.sortable = sortable;
 if ( !sortable ) {
  table.setSortColumn( null );
 } else {
  table.setSortColumn( table.getColumn( sortfield ) );
 }
}

代码示例来源:origin: caoxinyu/RedisClient

private void refreshOrder() {
  clientOrder = Order.Ascend;
  clientOrderBy = OrderBy.NAME;
  updateOrder();
  updateOrderby();
  table.setSortColumn(null);
}

代码示例来源:origin: caoxinyu/RedisClient

private void columnSelected() {
  TreeItem[] items = tree.getSelection();
  if (items.length > 0) {
    if (clientOrder == Order.Ascend) {
      table.setSortDirection(SWT.UP);
    } else {
      table.setSortDirection(SWT.DOWN);
    }
    if (clientOrderBy == OrderBy.NAME)
      table.setSortColumn(tblclmnName);
    else if (clientOrderBy == OrderBy.TYPE)
      table.setSortColumn(tblclmnType);
    else
      table.setSortColumn(tblclmnSize);
    ContainerKeyInfo info = new ContainerKeyInfo();
    parseContainer(items[0], info);
    updateOrder();
    updateOrderby();
    tableItemOrderSelected(info);
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

table.setSortColumn( table.getColumn( sortfield ) );
table.setSortDirection( sortingDescending ? SWT.DOWN : SWT.UP );

代码示例来源:origin: pentaho/pentaho-kettle

table.setSortColumn( table.getColumn( sortfield ) );
table.setSortDirection( sortingDescending ? SWT.DOWN : SWT.UP );

代码示例来源:origin: tvrenamer/tvrenamer

private void setSortColumn() {
  TableColumn sortColumn = CURRENT_FILE_FIELD.getTableColumn();
  if (sortColumn == null) {
    logger.warning("could not find preferred sort column");
  } else {
    swtTable.setSortColumn(sortColumn);
    swtTable.setSortDirection(SWT.UP);
  }
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * Updates the SWT table to indicate sorting icon on the primary sort column.
 */
protected final void updateTableSortColumn() {
  final List<Integer> sortedColumns = getSortingColumns();
  if (sortedColumns.isEmpty()) {
    // no columns sorted
    table.setSortColumn(null);
    table.setSortDirection(SWT.NONE);
  } else {
    // make GL primary sort column the SWT table sort column
    final int primaryColumnIndex = sortedColumns.get(0).intValue();
    final int sortDirection = isColumnReverse(primaryColumnIndex) ? SWT.DOWN : SWT.UP;
    table.setSortColumn(table.getColumn(primaryColumnIndex));
    table.setSortDirection(sortDirection);
  }
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * Updates the SWT table to indicate sorting icon on the primary sort column.
 */
protected final void updateTableSortColumn() {
  final List<Integer> sortedColumns = getSortingColumns();
  if (sortedColumns.isEmpty()) {
    // no columns sorted
    table.setSortColumn(null);
    table.setSortDirection(SWT.NONE);
  } else {
    // make GL primary sort column the SWT table sort column
    final int primaryColumnIndex = sortedColumns.get(0).intValue();
    final int sortDirection = isColumnReverse(primaryColumnIndex) ? SWT.DOWN : SWT.UP;
    table.setSortColumn(table.getColumn(primaryColumnIndex));
    table.setSortDirection(sortDirection);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/**
 * Updates the SWT table to indicate sorting icon on the primary sort column.
 */
protected final void updateTableSortColumn() {
  final List<Integer> sortedColumns = getSortingColumns();
  if (sortedColumns.isEmpty()) {
    // no columns sorted
    table.setSortColumn(null);
    table.setSortDirection(SWT.NONE);
  } else {
    // make GL primary sort column the SWT table sort column
    final int primaryColumnIndex = sortedColumns.get(0).intValue();
    final int sortDirection = isColumnReverse(primaryColumnIndex) ? SWT.DOWN : SWT.UP;
    table.setSortColumn(table.getColumn(primaryColumnIndex));
    table.setSortDirection(sortDirection);
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void widgetSelected(SelectionEvent e) {
    boolean ascending = comparator.setField(table.indexOf(tc));
    try {
      table.setSortColumn(tc);
      table.setSortDirection(ascending ? SWT.UP : SWT.DOWN);
    } catch (NoSuchMethodError ignore) {
      // Ignore Pre 3.0
    }
    pluginIFs.sort(comparator);
    table.clearAll();
  }
});

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void handleEvent(Event e) {
    // determine new sort column and direction
    TableColumn sortColumn = subscriptionsList.getSortColumn();
    TableColumn currentColumn = (TableColumn) e.widget;
    int dir = subscriptionsList.getSortDirection();
    if (sortColumn == currentColumn) {
      dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
    } else {
      subscriptionsList.setSortColumn(currentColumn);
      dir = SWT.DOWN;
    }
    subscriptionsList.setSortDirection(dir);
    sortAndRefresh();
  }
};

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui

private void resetTableDisplay () {
  try {
    issuesModel.setIssues(session.getIssues());
    tblIssues.setSortColumn(null); // Reset the sort column
    displayType = cbDisplay.getSelectionIndex();
    issueType = cbTypes.getSelectionIndex();
    
    issuesModel.updateTable(0, displayType, issueType);
    updateCurrentIssue();
  }
  catch ( Throwable e ) {
    Dialogs.showError(shell, "Error resetting the table.\n"+e.getMessage(), null);
  }
  
}

代码示例来源:origin: cbeust/testng-eclipse

@Override
 public void widgetSelected(SelectionEvent e) {
  if (tableSorter != null) {
   tableSorter.setColumn(index);
  }
  int dir = table.getSortDirection();
  if (table.getSortColumn() == column) {
   dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
  } else {
   dir = SWT.DOWN;
  }
  table.setSortDirection(dir);
  table.setSortColumn(column);
  result.refresh();        }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor

@Override
  public void widgetSelected(SelectionEvent e) {
    fViewerComparator.setColumn(fColumnIndex);
    int dir= fViewerComparator.getDirection();
    fTableViewer.getTable().setSortDirection(dir);
    fTableViewer.getTable().setSortColumn(fTableColumn);
    fTableViewer.refresh();
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e.nls

private void updateSortIcon() {
 int index = m_tableModel.getSortIndex();
 if (index < 0) {
  index = NlsTable.INDEX_COLUMN_KEYS;
  m_tableModel.setSortIndex(index);
 }
 TableColumn col = m_table.getColumn(index);
 if (col == null) {
  return;
 }
 else if (col.equals(m_sortColumn)) {
  int sortDir = SWT.UP;
  if (m_table.getSortDirection() == SWT.UP) {
   sortDir = SWT.DOWN;
  }
  m_table.setSortDirection(sortDir);
 }
 else {
  m_sortColumn = col;
  m_table.setSortColumn(m_sortColumn);
  m_table.setSortDirection(SWT.UP);
 }
}

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

@Override
  public void widgetSelected(SelectionEvent e) {
    fViewerComparator.setColumn(fColumnIndex);
    int dir= fViewerComparator.getDirection();
    fTableViewer.getTable().setSortDirection(dir);
    fTableViewer.getTable().setSortColumn(fTableColumn);
    fTableViewer.refresh();
  }
}

代码示例来源:origin: openaudible/openaudible

public void setSortColumn(final TableColumn ftc, String name, boolean reverse) {
  SWTAsync.assertGUI();
  
  if (ftc != null) {
    if (!GUI.isMac()) {
      table.setSortDirection(!reverse ? SWT.UP : SWT.DOWN);
      table.setSortColumn(ftc);
      if (name != null)
        ftc.setText(name);
      
    } else {
      if (name != null)
        // ftc.setText(name + (reverse?" (reverse)":""));
        ftc.setText(name);
      
    }
    
  } else
    table.setSortDirection(SWT.NONE);
}

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

/**
 * Sets the sorting direction for this sorter to use
 * 
 * @param direction
 */
public void setDirection(int direction) {
  this.column.getParent().setSortColumn(this.column);
  this.direction = direction;
  this.column.getParent().setSortDirection(this.direction);
  if (this.cviewer.getComparator() == this) {
    this.cviewer.refresh();
  } else {
    this.cviewer.setComparator(this);
  }
}

代码示例来源:origin: openaudible/openaudible

public void setSortColumn(final TableColumn ftc, String name, boolean reverse) {
  SWTAsync.assertGUI();
  
  if (ftc != null) {
    if (!GUI.isMac()) {
      table.setSortDirection(!reverse ? SWT.UP : SWT.DOWN);
      table.setSortColumn(ftc);
      if (name != null)
        ftc.setText(name);
      
    } else {
      if (name != null)
        // ftc.setText(name + (reverse?" (reverse)":""));
        ftc.setText(name);
      
    }
    
  } else
    table.setSortDirection(SWT.NONE);
}

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

/**
 * Update the sort information on both the comparator and the table.
 *
 * @param columnIndex
 *            the index to sort by
 * @since 3.4
 */
private void updateTableSorting(final int columnIndex) {
  TableComparator comparator = (TableComparator) vendorInfo
      .getComparator();
  // toggle direction if it's the same column
  if (columnIndex == comparator.getSortColumn()) {
    comparator.setAscending(!comparator.isAscending());
  }
  comparator.setSortColumn(columnIndex);
  vendorInfo.getTable().setSortColumn(
      vendorInfo.getTable().getColumn(columnIndex));
  vendorInfo.getTable().setSortDirection(
      comparator.isAscending() ? SWT.UP : SWT.DOWN);
  vendorInfo.refresh(false);
}

相关文章

Table类方法