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

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

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

Table.setSortDirection介绍

[英]Sets the direction of the sort indicator for the receiver. The value can be one of UP, DOWN or NONE.
[中]设置接收器分拣指示器的方向。该值可以是UPDOWNNONE中的一个。

代码示例

代码示例来源: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.setSortDirection( sortingDescending ? SWT.DOWN : SWT.UP );

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

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.anwiba.eclipse/net.anwiba.eclipse.project.dependencies

@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();
 }
}

代码示例来源: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: 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: 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: 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.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: 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: org.eclipse.equinox.p2/ui

void columnSelected(TableColumn tc) {
  TableColumn[] cols = table.getColumns();
  for (int i = 0; i < cols.length; i++) {
    if (cols[i] == tc) {
      if (i != comparator.getSortKey()) {
        comparator.setSortKey(i);
        table.setSortColumn(tc);
        comparator.sortAscending();
        table.setSortDirection(SWT.UP);
      } else {
        if (comparator.isAscending()) {
          table.setSortDirection(SWT.DOWN);
          comparator.sortDescending();
        } else {
          table.setSortDirection(SWT.UP);
          comparator.sortAscending();
        }
      }
      repositoryViewer.refresh();
      break;
    }
  }
}

代码示例来源: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.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: org.eclipse.platform/org.eclipse.swt.examples

table.setSortDirection(SWT.DOWN);
  for (int i = 0; i < data.length; i++) {
    items[i].setText(data[i]);
} else {
  table.setSortDirection(SWT.UP);
  int j = data.length -1;
  for (int i = 0; i < data.length; i++) {

代码示例来源: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: 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类方法