Search in sources :

Example 31 with ColumnReorderCommand

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

the class ColumnGroupReorderLayerTest method shouldNotMoveColumnBetweenGroupsIfEitherGroupIsUnbreakable.

@Test
public void shouldNotMoveColumnBetweenGroupsIfEitherGroupIsUnbreakable() {
    setGroupUnBreakable(3);
    ColumnReorderCommand command = new ColumnReorderCommand(this.layer, 3, 1);
    this.layer.doCommand(command);
    this.modelFixture.assertUnchanged();
}
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 32 with ColumnReorderCommand

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

the class ColumnGroupReorderLayerTest method shouldDragLeftAndRemoveColumnFromGroup.

@Test
public void shouldDragLeftAndRemoveColumnFromGroup() {
    // Drag left out of group
    ColumnReorderCommand command = new ColumnReorderCommand(this.layer, 3, 2);
    this.layer.doCommand(command);
    assertNull(this.modelFixture.getColumnGroupByIndex(3));
    assertNull(this.modelFixture.getColumnGroupByIndex(2));
    assertEquals(1, getColumnIndexesInGroup(4).size());
}
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 33 with ColumnReorderCommand

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

the class ColumnGroupReorderLayerTest method shouldDragRightAndAddColumnToGroup.

@Test
public void shouldDragRightAndAddColumnToGroup() {
    final int fromColumnIndex = 2;
    final int toColumnIndex = 4;
    // Drag right into group
    ColumnReorderCommand command = new ColumnReorderCommand(this.layer, fromColumnIndex, toColumnIndex);
    this.layer.doCommand(command);
    assertEquals(ColumnGroupModelFixture.TEST_GROUP_2, this.modelFixture.getColumnGroupByIndex(fromColumnIndex).getName());
    assertEquals(ColumnGroupModelFixture.TEST_GROUP_2, this.modelFixture.getColumnGroupByIndex(toColumnIndex).getName());
    assertEquals(ColumnGroupModelFixture.TEST_GROUP_2, this.modelFixture.getColumnGroupByIndex(4).getName());
    assertEquals(3, getColumnIndexesInGroup(fromColumnIndex).size());
}
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 34 with ColumnReorderCommand

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

the class ColumnGroupReorderLayerTest method shouldDragRightAndKeepColumnInGroup.

@Test
public void shouldDragRightAndKeepColumnInGroup() {
    // Index in CG: 0,1
    // Drag 0 -> 1
    assertEquals(2, getColumnIndexesInGroup(0).size());
    // Drag right out of group
    ColumnReorderCommand command = new ColumnReorderCommand(this.layer, 0, 2);
    this.layer.doCommand(command);
    assertEquals(2, getColumnIndexesInGroup(1).size());
    assertNotNull(this.modelFixture.getColumnGroupByIndex(0));
    assertEquals(ColumnGroupModelFixture.TEST_GROUP_1, this.modelFixture.getColumnGroupByIndex(1).getName());
}
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 35 with ColumnReorderCommand

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

the class ColumnGroupReorderLayerTest method shouldReorderEntireColumnGroupAndAddAColumnToCollapsedGroup.

@Test
public void shouldReorderEntireColumnGroupAndAddAColumnToCollapsedGroup() {
    collapse(3);
    this.layer.reorderColumnGroup(3, 13);
    assertEquals(3, this.reorderLayer.getColumnIndexByPosition(11));
    assertEquals(4, this.reorderLayer.getColumnIndexByPosition(12));
    this.layer.doCommand(new ColumnReorderCommand(this.layer, 16, 12));
    assertEquals(3, getColumnIndexesInGroup(3).size());
}
Also used : ColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand) MultiColumnReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand) 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