本文整理了Java中org.eclipse.swt.widgets.Tree.setSortDirection()
方法的一些代码示例,展示了Tree.setSortDirection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.setSortDirection()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:setSortDirection
[英]Sets the direction of the sort indicator for the receiver. The value can be one of UP
, DOWN
or NONE
.
[中]设置接收器分拣指示器的方向。该值可以是UP
、DOWN
或NONE
中的一个。
代码示例来源: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.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.platform/org.eclipse.swt.examples
void resetSortState (final Tree tree) {
tree.setSortDirection (SWT.NONE);
TreeColumn [] columns = tree.getColumns();
for (TreeColumn column : columns) {
SelectionListener listener = (SelectionListener)column.getData("SortListener"); //$NON-NLS-1$
if (listener != null) column.removeSelectionListener(listener);
}
}
代码示例来源: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.setSortDirection(SWT.NONE);
filesViewer.setComparator(null);
return;
if (reversed.booleanValue()) {
comparator = order.descending();
tree.setSortDirection(SWT.DOWN);
} else {
comparator = order;
tree.setSortDirection(SWT.UP);
代码示例来源: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.pde/org.eclipse.pde.ui
fTree.getTree().setSortDirection(fTree.getTree().getSortDirection());
if (fFilterButton.getSelection()) {
fTree.addFilter(fSelectedOnlyFilter);
代码示例来源:origin: org.xworker/xworker_swt
tree.setSortColumn(column);
if("DESC".equals(pageInfo.getDir())){
tree.setSortDirection(SWT.DOWN);
}else{
tree.setSortDirection(SWT.UP);
代码示例来源: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.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/org.eclipse.wst.server.ui
column.addSelectionListener(getHeaderListener(0));
treeTable.setSortColumn(column);
treeTable.setSortDirection(SWT.UP);
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
commandNameColumn.setText(NewKeysPreferenceMessages.CommandNameColumn_Text);
tree.setSortColumn(commandNameColumn);
tree.setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN);
commandNameColumn
.addSelectionListener(new ResortColumn(comparator, commandNameColumn, viewer, COMMAND_NAME_COLUMN));
内容来源于网络,如有侵权,请联系作者删除!