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

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

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

Tree.getSortDirection介绍

[英]Returns the direction of the sort indicator for the receiver. The value will be one of UP, DOWN or NONE.
[中]返回接收器排序指示器的方向。该值将是UPDOWNNONE中的一个。

代码示例

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

private static String getSortDirection( Tree tree ) {
 String result = "none";
 if( tree.getSortDirection() == SWT.UP ) {
  result = "up";
 } else if( tree.getSortDirection() == SWT.DOWN ) {
  result = "down";
 }
 return result;
}

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

/**
 * Return the sort direction.
 *
 * @return boolean
 */
public boolean getSortAscending() {
  return viewer.getTree().getSortDirection() == SWT.TOP;
}

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

static String getSortDirection( final TreeColumn column ) {
 String result = null;
 Tree tree = column.getParent();
 if( tree.getSortColumn() == column ) {
  if( tree.getSortDirection() == SWT.UP ) {
   result = "up";
  } else if( tree.getSortDirection() == SWT.DOWN ) {
   result = "down";
  }
 }
 return result;
}

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

private void handleColumn(TreeColumn tc, int sortDirn) {
  Tree tree = fTree.getTree();
  tree.setSortColumn(tc);
  if (sortDirn == 0) {
    switch (tree.getSortDirection()) {
      case SWT.DOWN :
        sortDirn = SWT.UP;
        break;
      case SWT.UP :
      default :
        sortDirn = SWT.DOWN;
    }
  }
  tree.setSortDirection(sortDirn);
  int sortOrder = sortDirn == SWT.UP ? -1 : 1;
  int sortColumn = ((Integer) tc.getData(COLUMN_ID)).intValue();
  fTree.setComparator(new TreeSorter(sortColumn, sortOrder));
  saveSortOrder();
}

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

private void saveSortOrder() {
  PDEPreferencesManager prefs = new PDEPreferencesManager(IPDEUIConstants.PLUGIN_ID);
  Tree tree = fTree.getTree();
  TreeColumn column = tree.getSortColumn();
  int index = column == null ? 0 : ((Integer) tree.getSortColumn().getData(COLUMN_ID)).intValue();
  prefs.setValue(IPreferenceConstants.FEATURE_SORT_COLUMN, index + 1);
  int sortOrder = column == null ? 0 : tree.getSortDirection();
  prefs.setValue(IPreferenceConstants.FEATURE_SORT_ORDER, sortOrder);
  prefs.savePluginPreferences();
}

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

fTree.getTree().setSortDirection(fTree.getTree().getSortDirection());
if (fFilterButton.getSelection()) {
  fTree.addFilter(fSelectedOnlyFilter);

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

int currentDirection = tree.getSortDirection();
switch (currentDirection) {
case SWT.NONE:

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

/**
 * Sets the initial sort indicator state and adds a listener
 * to cycle through sort states and columns.
 */
void initializeSortState (final Tree tree) {
  /* Reset to known state: 'down' on column 0. */
  tree.setSortDirection (SWT.DOWN);
  TreeColumn [] columns = tree.getColumns();
  for (int i = 0; i < columns.length; i++) {
    TreeColumn column = columns[i];
    if (i == 0) tree.setSortColumn(column);
    SelectionListener listener = widgetSelectedAdapter(e -> {
      int sortDirection = SWT.DOWN;
      if (e.widget == tree.getSortColumn()) {
        /* If the sort column hasn't changed, cycle down -> up -> none. */
        switch (tree.getSortDirection ()) {
        case SWT.DOWN: sortDirection = SWT.UP; break;
        case SWT.UP: sortDirection = SWT.NONE; break;
        }
      } else {
        tree.setSortColumn((TreeColumn)e.widget);
      }
      tree.setSortDirection (sortDirection);
    });
    column.addSelectionListener(listener);
    column.setData("SortListener", listener);	//$NON-NLS-1$
  }
}

相关文章

Tree类方法