Changes

Jump to: navigation, search

Teams Winter 2011/team1/RCP/Create RPC Application

401 bytes added, 13:38, 4 March 2011
no edit summary
4.5 Add new method:<br/>
<pre>
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) { SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { comparator.setColumn(index); int dir = viewer.getTable().getSortDirection(); if (viewer.getTable().getSortColumn() == column) { dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; } else { dir = SWT.DOWN; } viewer.getTable().setSortDirection(dir); viewer.getTable().setSortColumn(column); viewer.refresh(); } }; return selectionAdapter; }</pre></br/>4.6 Run the application. Click on a column header, the table should be sorted according to the content of this column.<br/>There will also appear a sort-direction in the top of the column:<br/>[[Image: Create3.png | 400px]]<br/>
final int index) {  SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { comparator.setColumn(index); int dir = viewer.getTable().getSortDirection(); if (viewer= 5.getTableAdd Filter(Search).getSortColumn() == column) { dir = dir Option == SWT.UP ? SWT.DOWN : SWT.UP; } else {  dir = SWT.DOWN; } viewer.getTable().setSortDirection(dir); viewer.getTable().setSortColumn(column); viewer5.refresh(); } }; return selectionAdapter; }</pre>1
1
edit

Navigation menu