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

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

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

Tree.getSortColumn介绍

[英]Returns the column which shows the sort indicator for the receiver. The value may be null if no column shows the sort indicator.
[中]返回显示接收器排序指示器的列。如果没有列显示排序指示符,则该值可能为空。

代码示例

代码示例来源: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.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.rap/org.eclipse.rap.rwt

@Override
 public void run() {
  renderProperty( tree, PROP_TOP_ITEM_INDEX, getTopItemIndex( tree ), ZERO );
  renderProperty( tree, PROP_SCROLL_LEFT, getScrollLeft( tree ), ZERO );
  if( tree.getSelectionCount() > 0 ) {
   renderProperty( tree, PROP_FOCUS_ITEM, getFocusItem( tree ), null );
  }
  renderProperty( tree, PROP_SELECTION, getSelection( tree ), DEFAULT_SELECTION );
  renderProperty( tree, PROP_SORT_COLUMN, tree.getSortColumn(), null );
 }
} );

代码示例来源: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.egit/ui

Tree tree = column.getParent();
if (column == tree.getSortColumn()) {
  int currentDirection = tree.getSortDirection();
  switch (currentDirection) {

代码示例来源: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.rap/org.eclipse.rap.rwt

@Override
public void preserveValues( Tree tree ) {
 preserveProperty( tree, PROP_ITEM_COUNT, tree.getItemCount() );
 preserveProperty( tree, PROP_ITEM_HEIGHT, tree.getItemHeight() );
 preserveProperty( tree, PROP_ITEM_METRICS, getItemMetrics( tree ) );
 preserveProperty( tree, PROP_COLUMN_COUNT, tree.getColumnCount() );
 preserveProperty( tree, PROP_COLUMN_ORDER, getColumnOrder( tree ) );
 preserveProperty( tree, PROP_FIXED_COLUMNS, getFixedColumns( tree ) );
 preserveProperty( tree, PROP_TREE_COLUMN, getTreeColumn( tree ) );
 preserveProperty( tree, PROP_HEADER_HEIGHT, tree.getHeaderHeight() );
 preserveProperty( tree, PROP_HEADER_VISIBLE, tree.getHeaderVisible() );
 preserveProperty( tree, PROP_HEADER_FOREGROUND, tree.getHeaderForeground() );
 preserveProperty( tree, PROP_HEADER_BACKGROUND, tree.getHeaderBackground() );
 preserveProperty( tree, PROP_LINES_VISIBLE, tree.getLinesVisible() );
 preserveProperty( tree, PROP_TOP_ITEM_INDEX, getTopItemIndex( tree ) );
 preserveProperty( tree, PROP_FOCUS_ITEM, getFocusItem( tree ) );
 preserveProperty( tree, PROP_SCROLL_LEFT, getScrollLeft( tree ) );
 preserveProperty( tree, PROP_SELECTION, getSelection( tree ) );
 preserveProperty( tree, PROP_SORT_DIRECTION, getSortDirection( tree ) );
 preserveProperty( tree, PROP_SORT_COLUMN, tree.getSortColumn() );
 preserveProperty( tree, PROP_ENABLE_CELL_TOOLTIP, CellToolTipUtil.isEnabledFor( tree ) );
 preserveProperty( tree, PROP_CELL_TOOLTIP_TEXT, null );
}

相关文章

Tree类方法