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

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

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

Tree.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

protected void setSort( int i ) {
 if ( sortColumn == i ) {
  ascending = !ascending;
 } else {
  sortColumn = i;
  ascending = true;
 }
 if ( sortColumn >= 0 && sortColumn < 5 ) {
  TreeColumn column = wTree.getColumn( sortColumn );
  wTree.setSortColumn( column );
  wTree.setSortDirection( ascending ? SWT.UP : SWT.DOWN );
 }
 refreshTree();
}

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

protected void setSort( int i ) {
 if ( sortColumn == i ) {
  ascending = !ascending;
 } else {
  sortColumn = i;
  ascending = true;
 }
 if ( sortColumn >= 0 && sortColumn < 5 ) {
  TreeColumn column = wTree.getColumn( sortColumn );
  wTree.setSortColumn( column );
  wTree.setSortDirection( ascending ? SWT.UP : SWT.DOWN );
 }
 refreshTree();
}

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

private void setColumnSorting(TreeColumn column, int order) {
  fTree.setSortColumn(column);
  fTree.setSortDirection(order == ASCENDING ? SWT.UP : SWT.DOWN);
}

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

private void setColumnSorting(TreeColumn column, int order) {
  fTree.setSortColumn(column);
  fTree.setSortDirection(order == ASCENDING ? SWT.UP : SWT.DOWN);
}

代码示例来源: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.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$
  }
}

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

/**
 * Update the direction indicator as column is now the primary column.
 *
 * @param column
 * @field {@link MarkerField}
 */
void updateDirectionIndicator(TreeColumn column, MarkerField field) {
  viewer.getTree().setSortColumn(column);
  if (builder.getSortDirection(field) == MarkerComparator.ASCENDING) {
    viewer.getTree().setSortDirection(SWT.UP);
  } else {
    viewer.getTree().setSortDirection(SWT.DOWN);
  }
}

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

/**
 * Update the direction indicator as column is now the primary column.
 * 
 * @param column
 */
protected void updateDirectionIndicator(TreeColumn column) {
  getTree().setSortColumn(column);
  if (((ServerViewerComparator) getComparator()).getTopPriorityDirection() == ServerViewerComparator.ASCENDING)
    getTree().setSortDirection(SWT.UP);
  else
    getTree().setSortDirection(SWT.DOWN);
}

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

tree.setSortColumn(null);
  tree.setSortDirection(SWT.NONE);
  filesViewer.setComparator(null);
  return;
tree.setSortColumn(column);

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

fTree.getTree().setSortColumn(fTree.getTree().getSortColumn());
fTree.getTree().setSortDirection(fTree.getTree().getSortDirection());
if (fFilterButton.getSelection()) {

代码示例来源:origin: org.eclipse.equinox.p2.ui.sdk/scheduler

protected void updateTableSorting(int columnIndex) {
  TreeViewerComparator comparator = (TreeViewerComparator) viewer.getComparator();
  // toggle direction if it's the same column
  if (columnIndex == comparator.getSortColumn()) {
    comparator.setAscending(!comparator.isAscending());
  }
  comparator.setSortColumn(columnIndex);
  viewer.getTree().setSortColumn(viewer.getTree().getColumn(columnIndex));
  viewer.getTree().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN);
  viewer.refresh(false);
}

代码示例来源:origin: org.xworker/xworker_swt

PageInfo pageInfo = PageInfo.getPageInfo(store.get("pageInfo"));
if(pageInfo.getSort() != null && pageInfo.getSort().equals(column.getData("name"))){
  tree.setSortColumn(column);
  if("DESC".equals(pageInfo.getDir())){
    tree.setSortDirection(SWT.DOWN);

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

@Override
  public void widgetSelected(SelectionEvent e) {
    if (comparator.getSortColumn() == column) {
      comparator.setAscending(!comparator.isAscending());
      viewer.getTree().setSortDirection(
          comparator.isAscending() ? SWT.UP : SWT.DOWN);
    } else {
      viewer.getTree().setSortColumn(treeColumn);
      comparator.setSortColumn(column);
    }
    try {
      viewer.getTree().setRedraw(false);
      viewer.refresh();
    } finally {
      viewer.getTree().setRedraw(true);
    }
  }
}

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

treeColumn.setToolTipText(ControlExample.getResourceString("Tooltip", columnTitle));
tree1.setSortColumn(tree1.getColumn(0));

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

column.setWidth(cols[0]);
column.addSelectionListener(getHeaderListener(0));
treeTable.setSortColumn(column);
treeTable.setSortDirection(SWT.UP);

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

tree.setSortColumn(commandNameColumn);
tree.setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN);
commandNameColumn

相关文章

Tree类方法