Search in sources :

Example 1 with ColumnReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testReorderInLevelWithoutLevelHeader.

@Test
public void testReorderInLevelWithoutLevelHeader() {
    this.treeLayer.setShowTreeLevelHeader(false);
    this.treeLayer.doCommand(new ColumnReorderCommand(this.treeLayer, 0, 2));
    assertEquals(1, this.treeLayer.getColumnIndexByPosition(0));
    assertEquals(0, this.treeLayer.getColumnIndexByPosition(1));
}
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 2 with ColumnReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testLevelHeaderCanNotBeReordered.

@Test
public void testLevelHeaderCanNotBeReordered() {
    this.treeLayer.doCommand(new ColumnReorderCommand(this.treeLayer, 0, 2));
    assertEquals(-1, this.treeLayer.getColumnIndexByPosition(0));
    assertEquals(0, this.treeLayer.getColumnIndexByPosition(1));
    assertEquals(1, this.treeLayer.getColumnIndexByPosition(2));
    assertEquals(-1, this.treeLayer.getColumnIndexByPosition(3));
}
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 3 with ColumnReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testNoReorderBetweenLevelsWithoutLevelHeader.

@Test
public void testNoReorderBetweenLevelsWithoutLevelHeader() {
    this.treeLayer.setShowTreeLevelHeader(false);
    this.treeLayer.doCommand(new ColumnReorderCommand(this.treeLayer, 1, 3));
    // nothing should have changed because that reorder is not allowed
    assertEquals(0, this.treeLayer.getColumnIndexByPosition(0));
    assertEquals(1, this.treeLayer.getColumnIndexByPosition(1));
}
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 4 with ColumnReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testNoReorderBetweenLevels.

@Test
public void testNoReorderBetweenLevels() {
    this.treeLayer.doCommand(new ColumnReorderCommand(this.treeLayer, 2, 5));
    // nothing should have changed because that reorder is not allowed
    assertEquals(0, this.treeLayer.getColumnIndexByPosition(1));
    assertEquals(1, 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 5 with ColumnReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand in project nebula.widgets.nattable by eclipse.

the class FreezeLayerTest method testReorderingRightBottomCornerOutOfFrozenArea.

@Test
public void testReorderingRightBottomCornerOutOfFrozenArea() {
    this.hideShowLayer.doCommand(new ColumnReorderCommand(this.hideShowLayer, 3, 5));
    Assert.assertEquals(2, this.freezeLayer.getColumnCount());
    Assert.assertEquals(2, this.freezeLayer.getBottomRightPosition().columnPosition);
    Assert.assertEquals(1, this.freezeLayer.getColumnIndexByPosition(0));
    Assert.assertEquals(2, this.freezeLayer.getColumnIndexByPosition(1));
}
Also used : 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