Search in sources :

Example 26 with RowDataFixture

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

the class FilterRowHeaderCompositeTest method setup.

@Before
public void setup() {
    this.columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50);
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
    new DefaultFilterRowConfiguration().configureRegistry(this.configRegistry);
    this.filterList = new FilterList<RowDataFixture>(GlazedLists.eventList(RowDataListFixture.getList()));
    this.layerUnderTest = new FilterRowHeaderComposite<RowDataFixture>(new DefaultGlazedListsFilterStrategy<RowDataFixture>(this.filterList, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()), this.configRegistry), this.columnHeaderLayer, this.columnHeaderLayer.getDataProvider(), this.configRegistry);
    this.listener = new LayerListenerFixture();
    this.layerUnderTest.addLayerListener(this.listener);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) DataLayerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture) DefaultFilterRowConfiguration(org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Before(org.junit.Before)

Example 27 with RowDataFixture

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

the class ListDataProviderPerformanceTest method performanceOfListDataProvider.

// Bench marked ~ 65 milliseconds. Intel 2GHZ, 2GB Ram
@Test
public void performanceOfListDataProvider() throws Exception {
    List<RowDataFixture> largeList = RowDataListFixture.getList(26000);
    Assert.assertTrue(largeList.size() > 25000);
    this.layer = new DefaultGridLayer(largeList, RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap());
}
Also used : RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Test(org.junit.Test)

Example 28 with RowDataFixture

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

the class ListDataProviderPerformanceTest method performanceOfGlazedListDataProvider.

// Bench marked ~ 45 milliseconds. Intel 2GHZ, 2GB Ram
@Test
public void performanceOfGlazedListDataProvider() throws Exception {
    String[] propertyNames = RowDataListFixture.getPropertyNames();
    Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
    List<RowDataFixture> largeList = RowDataListFixture.getList(26000);
    Assert.assertTrue(largeList.size() > 25000);
    IDataProvider glazedListsDataProvider = new GlazedListsDataProvider<RowDataFixture>(GlazedLists.eventList(largeList), new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames));
    IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
    this.layer = new DefaultGridLayer(glazedListsDataProvider, columnHeaderDataProvider);
}
Also used : IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) GlazedListsDataProvider(org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Test(org.junit.Test)

Example 29 with RowDataFixture

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

the class RowSelectionIntegrationTest method shouldClearSelectionOnSetEmptyOnAdd.

@Test
public void shouldClearSelectionOnSetEmptyOnAdd() {
    this.selectionProvider.setAddSelectionOnSet(true);
    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 30 with RowDataFixture

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

the class RowSelectionIntegrationTest method setMultipleSelectionViaProviderWithAdd.

@Test
public void setMultipleSelectionViaProviderWithAdd() {
    this.selectionProvider.setAddSelectionOnSet(true);
    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(4, 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