use of org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand in project nebula.widgets.nattable by eclipse.
the class RenameColumnIntegrationTest method shouldUpdateRenamedColumnOnDeleteMultipleColumnRanges.
@Test
public void shouldUpdateRenamedColumnOnDeleteMultipleColumnRanges() {
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
this.natTableFixture.doCommand(new RenameColumnHeaderCommand(this.natTableFixture, 5, TEST_COLUMN_NAME));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(5, 0).toString());
// simulate deletion of a column
this.provider.setColumnCount(this.provider.getColumnCount() - 3);
this.grid.getColumnHeaderDataLayer().fireLayerEvent(new ColumnDeleteEvent(this.grid.getBodyDataLayer(), new Range(1, 3), new Range(6, 7)));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(3, 0).toString());
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
}
use of org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand in project nebula.widgets.nattable by eclipse.
the class RenameColumnIntegrationTest method shouldUpdateRenamedColumnOnDeleteOneColumn.
@Test
public void shouldUpdateRenamedColumnOnDeleteOneColumn() {
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
this.natTableFixture.doCommand(new RenameColumnHeaderCommand(this.natTableFixture, 5, TEST_COLUMN_NAME));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(5, 0).toString());
// simulate deletion of a column
this.provider.setColumnCount(this.provider.getColumnCount() - 1);
this.grid.getColumnHeaderDataLayer().fireLayerEvent(new ColumnDeleteEvent(this.grid.getBodyDataLayer(), 0));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(4, 0).toString());
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
}
use of org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand in project nebula.widgets.nattable by eclipse.
the class RenameColumnIntegrationTest method shouldUpdateRenamedColumnOnAddingMultipleColumnRanges.
@Test
public void shouldUpdateRenamedColumnOnAddingMultipleColumnRanges() {
this.natTableFixture.doCommand(new TurnViewportOffCommand());
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
this.natTableFixture.doCommand(new RenameColumnHeaderCommand(this.natTableFixture, 5, TEST_COLUMN_NAME));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(5, 0).toString());
// simulate deletion of a column
this.provider.setColumnCount(this.provider.getColumnCount() + 3);
this.grid.getColumnHeaderDataLayer().fireLayerEvent(new ColumnInsertEvent(this.grid.getBodyDataLayer(), new Range(1, 3), new Range(7, 8)));
assertEquals(TEST_COLUMN_NAME, this.natTableFixture.getDataValueByPosition(7, 0).toString());
assertEquals("Column 5", this.natTableFixture.getDataValueByPosition(5, 0).toString());
}
use of org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand in project nebula.widgets.nattable by eclipse.
the class RenameColumnIntegrationTest method shouldRenameColumnHeader.
@Test
public void shouldRenameColumnHeader() {
String originalColumnHeader = this.natTableFixture.getDataValueByPosition(2, 0).toString();
assertEquals("Column 2", originalColumnHeader);
this.natTableFixture.doCommand(new RenameColumnHeaderCommand(this.natTableFixture, 2, TEST_COLUMN_NAME));
String renamedColumnHeader = this.natTableFixture.getDataValueByPosition(2, 0).toString();
assertEquals(TEST_COLUMN_NAME, renamedColumnHeader);
assertEquals(1, this.listener.getEventsCount());
RenameColumnHeaderEvent event = (RenameColumnHeaderEvent) this.listener.getReceivedEvent(RenameColumnHeaderEvent.class);
assertEquals(new Range(2, 3), event.getColumnPositionRanges().iterator().next());
}
use of org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand in project nebula.widgets.nattable by eclipse.
the class RenameColumnIntegrationTest method shouldRenameColumnHeaderForReorderedColumn.
@Test
public void shouldRenameColumnHeaderForReorderedColumn() {
String originalColumnHeader = this.natTableFixture.getDataValueByPosition(2, 0).toString();
assertEquals("Column 2", originalColumnHeader);
this.natTableFixture.doCommand(new ColumnReorderCommand(this.natTableFixture, 1, 5));
originalColumnHeader = this.natTableFixture.getDataValueByPosition(2, 0).toString();
assertEquals("Column 3", originalColumnHeader);
this.natTableFixture.doCommand(new RenameColumnHeaderCommand(this.natTableFixture, 2, TEST_COLUMN_NAME));
String renamedColumnHeader = this.natTableFixture.getDataValueByPosition(2, 0).toString();
assertEquals(TEST_COLUMN_NAME, renamedColumnHeader);
assertEquals(2, this.listener.getEventsCount());
RenameColumnHeaderEvent event = (RenameColumnHeaderEvent) this.listener.getReceivedEvent(RenameColumnHeaderEvent.class);
assertEquals(new Range(2, 3), event.getColumnPositionRanges().iterator().next());
}
Aggregations