Search in sources :

Example 26 with ColumnReorderCommand

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));
}
Also used : ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) Test(org.junit.Test)

Example 27 with ColumnReorderCommand

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));
}
Also used : ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) Test(org.junit.Test)

Example 28 with ColumnReorderCommand

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());
}
Also used : SelectCellCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand) ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) Test(org.junit.Test)

Example 29 with ColumnReorderCommand

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));
}
Also used : ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) MultiColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand) Test(org.junit.Test)

Example 30 with ColumnReorderCommand

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());
}
Also used : SelectColumnCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand) ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) Test(org.junit.Test)

Aggregations

ColumnReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand)42 Test (org.junit.Test)39 MultiColumnReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand)22 ColumnInsertEvent (org.eclipse.nebula.widgets.nattable.layer.event.ColumnInsertEvent)4 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)4 ColumnReorderLayer (org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer)4 ColumnResizeCommand (org.eclipse.nebula.widgets.nattable.resize.command.ColumnResizeCommand)3 RenameColumnHeaderEvent (org.eclipse.nebula.widgets.nattable.columnRename.event.RenameColumnHeaderEvent)2 ILayerCommand (org.eclipse.nebula.widgets.nattable.command.ILayerCommand)2 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)2 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)2 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)2 ColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand)2 MultiColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand)2 ColumnDeleteEvent (org.eclipse.nebula.widgets.nattable.layer.event.ColumnDeleteEvent)2 SelectCellCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 RenameColumnHeaderCommand (org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand)1