use of org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand in project nebula.widgets.nattable by eclipse.
the class SortColumnAction method run.
@Override
public void run(NatTable natTable, MouseEvent event) {
int columnPosition = ((NatEventData) event.data).getColumnPosition();
natTable.doCommand(new SortColumnCommand(natTable, columnPosition, this.accumulate));
}
use of org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand in project nebula.widgets.nattable by eclipse.
the class RowSelectionIntegrationTest method shouldPreserveRowSelectionOnSort.
@Test
public void shouldPreserveRowSelectionOnSort() throws Exception {
assertEquals(0, this.selectionLayer.getFullySelectedRowPositions().length);
// Unsorted order - Ford motor at top
assertEquals("B Ford Motor", this.nattable.getDataValueByPosition(2, 1).toString());
assertEquals("A Alphabet Co.", this.nattable.getDataValueByPosition(2, 2).toString());
assertEquals("C General Electric Co", this.nattable.getDataValueByPosition(2, 3).toString());
// Select 'Ford Motor'
this.nattable.doCommand(new SelectRowsCommand(this.nattable, 1, 1, false, false));
assertEquals("B Ford Motor", getSelected().getSecurity_description());
// Sort
this.nattable.doCommand(new SortColumnCommand(this.nattable, 2, false));
// Sorted order - Alphabet co. at top
assertEquals("A Alphabet Co.", this.nattable.getDataValueByPosition(2, 1).toString());
assertEquals("B Ford Motor", this.nattable.getDataValueByPosition(2, 2).toString());
assertEquals("C General Electric Co", this.nattable.getDataValueByPosition(2, 3).toString());
// Ford motor still selected
assertEquals("B Ford Motor", getSelected().getSecurity_description());
}
Aggregations