Search in sources :

Example 41 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class DefaultGlazedListsFilterStrategyTest method init.

@BeforeClass
public static void init() {
    // initialize the collection with a big amount of values
    filterList = new FilterList<>(GlazedLists.eventList(PersonService.getFixedPersons()));
    for (int i = 1; i < 1000; i++) {
        filterList.addAll(PersonService.getFixedPersons());
    }
    configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(configRegistry);
    new DefaultFilterRowConfiguration().configureRegistry(configRegistry);
    columnHeaderLayer = new DataLayerFixture(5, 2, 100, 50);
    dataProvider = new FilterRowDataProvider<>(new DefaultGlazedListsFilterStrategy<>(filterList, new ReflectiveColumnPropertyAccessor<Person>(personPropertyNames), configRegistry), columnHeaderLayer, columnHeaderLayer.getDataProvider(), configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) DefaultFilterRowConfiguration(org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration) DataLayerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) BeforeClass(org.junit.BeforeClass)

Example 42 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry 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 43 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class SortIntegrationTest method setup.

@Before
public void setup() {
    EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList().subList(0, 4));
    ConfigRegistry configRegistry = new ConfigRegistry();
    this.gridLayerStack = new GlazedListsGridLayer<RowDataFixture>(GlazedLists.threadSafeList(eventList), RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap(), configRegistry);
    this.nattable = new NatTableFixture(this.gridLayerStack, false);
    this.nattable.setConfigRegistry(configRegistry);
    this.nattable.addConfiguration(new DefaultNatTableStyleConfiguration());
    this.nattable.addConfiguration(new DefaultSortConfiguration());
    this.nattable.configure();
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) DefaultSortConfiguration(org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration) NatTableFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Before(org.junit.Before)

Example 44 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class DefaultGlazedListsStaticFilterStrategyTest method init.

@BeforeClass
public static void init() {
    // initialize the collection with a big amount of values
    filterList = new FilterList<>(GlazedLists.eventList(PersonService.getFixedPersons()));
    for (int i = 1; i < 1000; i++) {
        filterList.addAll(PersonService.getFixedPersons());
    }
    configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(configRegistry);
    new DefaultFilterRowConfiguration().configureRegistry(configRegistry);
    columnHeaderLayer = new DataLayerFixture(5, 2, 100, 50);
    filterStrategy = new DefaultGlazedListsStaticFilterStrategy<>(filterList, new ReflectiveColumnPropertyAccessor<Person>(personPropertyNames), configRegistry);
    dataProvider = new FilterRowDataProvider<>(filterStrategy, columnHeaderLayer, columnHeaderLayer.getDataProvider(), configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) DefaultFilterRowConfiguration(org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration) DataLayerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) BeforeClass(org.junit.BeforeClass)

Example 45 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProviderTest 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<>(GlazedLists.eventList(RowDataListFixture.getList()));
    this.dataProvider = new FilterRowDataProvider<>(new DefaultGlazedListsFilterStrategy<>(this.filterList, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()), this.configRegistry), this.columnHeaderLayer, this.columnHeaderLayer.getDataProvider(), this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) 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) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Before(org.junit.Before)

Aggregations

ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)92 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)72 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)61 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)54 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)54 HashMap (java.util.HashMap)40 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)38 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)38 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)34 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)34 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)33 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)33 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)33 GridLayout (org.eclipse.swt.layout.GridLayout)33 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)32 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)31 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)31 Composite (org.eclipse.swt.widgets.Composite)31 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)28 SelectionEvent (org.eclipse.swt.events.SelectionEvent)28