Search in sources :

Example 16 with RowDataFixture

use of org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture in project nebula.widgets.nattable by eclipse.

the class GlazedListsEventLayerTest method setup.

@Before
public void setup() {
    this.listFixture = GlazedLists.eventList(RowDataListFixture.getList());
    this.layerUnderTest = new GlazedListsEventLayer<RowDataFixture>(new DataLayerFixture(), this.listFixture);
    this.layerUnderTest.setTestMode(true);
    this.listenerFixture = new LayerListenerFixture();
    this.layerUnderTest.addLayerListener(this.listenerFixture);
}
Also used : DataLayerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) BlinkingRowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture) Before(org.junit.Before)

Example 17 with RowDataFixture

use of org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture 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);
}
Also used : ILayerEvent(org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent) ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) NatTableFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) MultiColumnHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand) Test(org.junit.Test)

Example 18 with RowDataFixture

use of org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture in project nebula.widgets.nattable by eclipse.

the class RowSelectionIntegrationTest method setMultipleSelectionViaProvider.

@Test
public void setMultipleSelectionViaProvider() {
    this.selectionProvider.setSelection(new StructuredSelection(new RowDataFixture[] { this.eventListFixture.get(1), this.eventListFixture.get(3) }));
    assertEquals(2, this.selectionLayer.getFullySelectedRowPositions().length);
    this.selectionProvider.setSelection(new StructuredSelection(new RowDataFixture[] { this.eventListFixture.get(5), this.eventListFixture.get(7) }));
    assertEquals(2, this.selectionLayer.getFullySelectedRowPositions().length);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Test(org.junit.Test)

Example 19 with RowDataFixture

use of org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture in project nebula.widgets.nattable by eclipse.

the class RowSelectionIntegrationTest method shouldClearSelectionOnSetEmpty.

@Test
public void shouldClearSelectionOnSetEmpty() {
    LayerListenerFixture listener = new LayerListenerFixture();
    this.nattable.addLayerListener(listener);
    this.selectionProvider.setSelection(new StructuredSelection(new RowDataFixture[] { this.eventListFixture.get(1), this.eventListFixture.get(3) }));
    assertEquals(2, this.selectionLayer.getFullySelectedRowPositions().length);
    assertEquals(1, listener.getEventsCount());
    this.selectionProvider.setSelection(StructuredSelection.EMPTY);
    assertEquals(0, this.selectionLayer.getFullySelectedRowPositions().length);
    assertEquals(2, listener.getEventsCount());
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Test(org.junit.Test)

Example 20 with RowDataFixture

use of org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture in project nebula.widgets.nattable by eclipse.

the class RowSelectionIntegrationTest method setSingleSelectionViaProvider.

@Test
public void setSingleSelectionViaProvider() {
    this.selectionProvider.setSelection(new StructuredSelection(new RowDataFixture[] { this.eventListFixture.get(1) }));
    assertEquals(1, this.selectionLayer.getFullySelectedRowPositions().length);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Test(org.junit.Test)

Aggregations

RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)46 Test (org.junit.Test)24 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)18 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)13 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)13 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)13 Before (org.junit.Before)13 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)12 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)10 IRowIdAccessor (org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor)8 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)8 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture)6 HeaderMenuConfiguration (org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)5 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)5 RowStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)5 SelectRowsCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand)5 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)4