use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.
the class FreezeLayerTest method testReorderInInteriorColumn.
@Test
public void testReorderInInteriorColumn() {
this.hideShowLayer.doCommand(new ColumnReorderCommand(this.hideShowLayer, 5, 2));
Assert.assertEquals(4, this.freezeLayer.getColumnCount());
Assert.assertEquals(1, this.freezeLayer.getColumnIndexByPosition(0));
Assert.assertEquals(5, this.freezeLayer.getColumnIndexByPosition(1));
Assert.assertEquals(2, this.freezeLayer.getColumnIndexByPosition(2));
Assert.assertEquals(3, this.freezeLayer.getColumnIndexByPosition(3));
}
use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.
the class FreezeLayerTest method testReorderingIntoTopLeftCoordinate.
@Test
public void testReorderingIntoTopLeftCoordinate() {
this.hideShowLayer.doCommand(new ColumnReorderCommand(this.hideShowLayer, 5, 1));
Assert.assertEquals(4, this.freezeLayer.getColumnCount());
Assert.assertEquals(5, this.freezeLayer.getColumnIndexByPosition(0));
Assert.assertEquals(1, this.freezeLayer.getColumnIndexByPosition(1));
Assert.assertEquals(2, this.freezeLayer.getColumnIndexByPosition(2));
Assert.assertEquals(3, this.freezeLayer.getColumnIndexByPosition(3));
}
use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method shouldRestructureFrozenArea.
@Test
public void shouldRestructureFrozenArea() {
final ReorderListener reorderListener = new ReorderListener();
this.viewportLayer.addLayerListener(reorderListener);
// Scroll the viewport to the first column
this.viewportLayer.resetOrigin(this.viewportLayer.getStartXOfColumnPosition(0), this.viewportLayer.getStartYOfRowPosition(0));
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(1));
assertEquals(1, this.viewportLayer.getColumnIndexByPosition(0));
this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 3, 3, false, false));
this.compositeFreezeLayer.doCommand(new FreezeSelectionCommand());
// Move right edge out of frozen area
assertEquals(2, this.freezeLayer.getColumnCount());
this.compositeFreezeLayer.doCommand(new ColumnReorderCommand(this.compositeFreezeLayer, 1, 3));
assertEquals(1, this.freezeLayer.getColumnCount());
}
use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.
the class HierarchicalTreeLayerTest method testReorderInLevel.
@Test
public void testReorderInLevel() {
this.treeLayer.doCommand(new ColumnReorderCommand(this.treeLayer, 1, 3));
assertEquals(1, this.treeLayer.getColumnIndexByPosition(1));
assertEquals(0, this.treeLayer.getColumnIndexByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.
the class ColumnGroupsCommandHandlerTest method shouldCreateColumnGroupAfterReordering.
@Test
public void shouldCreateColumnGroupAfterReordering() {
// Reorder column to first position
this.selectionLayer.doCommand(new ColumnReorderCommand(this.selectionLayer, 9, 0));
// Select first column position
this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 0, 0, false, false));
final String columnGroupName = "Test Group";
this.handler.loadSelectedColumnsIndexesWithPositions();
this.handler.handleGroupColumnsCommand(columnGroupName);
Assert.assertEquals(columnGroupName, getColumnGroupNameForIndex(9));
Assert.assertEquals(9, getColumnIndexesInGroup(9).get(0).intValue());
}
Aggregations