use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class ColumnStructuralChangeEventIntegrationTest method shouldUpdateHiddenOnInsertAndDelete.
@Test
public void shouldUpdateHiddenOnInsertAndDelete() {
DefaultBodyLayerStack body = this.grid.getBodyLayer();
ColumnHideShowLayer hideShowLayer = body.getColumnHideShowLayer();
body.doCommand(new MultiColumnHideCommand(body, new int[] { 2, 3, 5 }));
assertEquals("[2, 3, 5]", hideShowLayer.getHiddenColumnIndexes().toString());
this.provider.setColumnCount(7);
this.grid.getBodyDataLayer().fireLayerEvent(new ColumnInsertEvent(this.grid.getBodyDataLayer(), 3));
assertEquals("[2, 4, 6]", hideShowLayer.getHiddenColumnIndexes().toString());
this.provider.setColumnCount(6);
this.grid.getBodyDataLayer().fireLayerEvent(new ColumnDeleteEvent(this.grid.getBodyDataLayer(), 3));
assertEquals("[2, 3, 5]", hideShowLayer.getHiddenColumnIndexes().toString());
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class ColumnStructuralChangeEventIntegrationTest method shouldUpdateOnInsertAndDelete.
@Test
public void shouldUpdateOnInsertAndDelete() {
DefaultBodyLayerStack body = this.grid.getBodyLayer();
ColumnReorderLayer reorderLayer = body.getColumnReorderLayer();
ColumnHideShowLayer hideShowLayer = body.getColumnHideShowLayer();
body.doCommand(new ColumnReorderCommand(body, 3, 6));
body.doCommand(new ColumnReorderCommand(body, 3, 5));
body.doCommand(new MultiColumnHideCommand(body, new int[] { 2, 3, 5 }));
assertEquals("[0, 1, 2, 5, 4, 3]", reorderLayer.getColumnIndexOrder().toString());
assertEquals("[2, 3, 5]", hideShowLayer.getHiddenColumnIndexes().toString());
this.provider.setColumnCount(7);
this.grid.getBodyDataLayer().fireLayerEvent(new ColumnInsertEvent(this.grid.getBodyDataLayer(), 3));
assertEquals("[0, 1, 2, 3, 6, 5, 4]", reorderLayer.getColumnIndexOrder().toString());
assertEquals("[2, 4, 6]", hideShowLayer.getHiddenColumnIndexes().toString());
this.provider.setColumnCount(6);
this.grid.getBodyDataLayer().fireLayerEvent(new ColumnDeleteEvent(this.grid.getBodyDataLayer(), 3));
assertEquals("[0, 1, 2, 5, 4, 3]", reorderLayer.getColumnIndexOrder().toString());
assertEquals("[2, 3, 5]", hideShowLayer.getHiddenColumnIndexes().toString());
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class ColumnStructuralChangeEventIntegrationTest method shouldUpdateOnInsert.
@Test
public void shouldUpdateOnInsert() {
DefaultBodyLayerStack body = this.grid.getBodyLayer();
ColumnReorderLayer reorderLayer = body.getColumnReorderLayer();
ColumnHideShowLayer hideShowLayer = body.getColumnHideShowLayer();
body.doCommand(new ColumnReorderCommand(body, 3, 6));
body.doCommand(new ColumnReorderCommand(body, 3, 5));
body.doCommand(new MultiColumnHideCommand(body, new int[] { 2, 3, 5 }));
assertEquals("[0, 1, 2, 5, 4, 3]", reorderLayer.getColumnIndexOrder().toString());
assertEquals("[2, 3, 5]", hideShowLayer.getHiddenColumnIndexes().toString());
this.provider.setColumnCount(7);
this.grid.getBodyDataLayer().fireLayerEvent(new ColumnInsertEvent(this.grid.getBodyDataLayer(), 3));
assertEquals("[0, 1, 2, 3, 6, 5, 4]", reorderLayer.getColumnIndexOrder().toString());
assertEquals("[2, 4, 6]", hideShowLayer.getHiddenColumnIndexes().toString());
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class HideMultipleColumnsIntegrationTest method hideAllColumnsWithColumnGroupsEnabled.
/**
* Exposing bug: http://nattable.org/jira/browse/NTBL-471
*/
@Test
public void hideAllColumnsWithColumnGroupsEnabled() throws Exception {
BodyLayerStackFixture<RowDataFixture> bodyLayerStackFixture = new BodyLayerStackFixture<RowDataFixture>(GlazedLists.eventList(RowDataListFixture.getList()), new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()), new ConfigRegistry());
NatTableFixture natTableFixture = new NatTableFixture(bodyLayerStackFixture);
LayerListenerFixture listenerFixture = new LayerListenerFixture();
natTableFixture.addLayerListener(listenerFixture);
Assert.assertEquals(37, bodyLayerStackFixture.getBodyDataProvider().getColumnCount());
Assert.assertEquals(6, natTableFixture.getColumnCount());
MultiColumnHideCommand hideAllCommand = new MultiColumnHideCommand(natTableFixture, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 });
natTableFixture.doCommand(hideAllCommand);
Assert.assertEquals(1, listenerFixture.getEventsCount());
ILayerEvent receivedEvent = listenerFixture.getReceivedEvent(HideColumnPositionsEvent.class);
Assert.assertNotNull(receivedEvent);
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowColumnBothRegionsFreezeAll.
@Test
public void testFreezeHideShowColumnBothRegionsFreezeAll() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeColumnCommand(this.compositeFreezeLayer, 1));
assertEquals(2, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(3, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(200, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiColumnHideCommand(this.compositeFreezeLayer, new int[] { 0, 1, 2 }));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(2, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllColumnsCommand());
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
reset();
}
Aggregations