Search in sources :

Example 6 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProviderTest method settingAValueFiresUpdateEvent.

@Test
public void settingAValueFiresUpdateEvent() {
    final LayerListenerFixture listener = new LayerListenerFixture();
    this.columnHeaderLayer.addLayerListener(listener);
    this.dataProvider.setDataValue(3, 1, "testValue");
    assertEquals(1, listener.getEventsCount());
    assertNotNull(listener.getReceivedEvent(FilterAppliedEvent.class));
}
Also used : FilterAppliedEvent(org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) Test(org.junit.Test)

Example 7 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProviderTest method loadingStateFiresUpdateEvent.

@Test
public void loadingStateFiresUpdateEvent() {
    final LayerListenerFixture listener = new LayerListenerFixture();
    this.columnHeaderLayer.addLayerListener(listener);
    Properties properties = new Properties();
    properties.put("prefix" + FilterRowDataLayer.PERSISTENCE_KEY_FILTER_ROW_TOKENS, "1:testValue|3:testValue|");
    this.dataProvider.loadState("prefix", properties);
    assertEquals(1, listener.getEventsCount());
    assertNotNull(listener.getReceivedEvent(FilterAppliedEvent.class));
}
Also used : FilterAppliedEvent(org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture) Properties(java.util.Properties) Test(org.junit.Test)

Example 8 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture 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 9 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture 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)

Aggregations

LayerListenerFixture (org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture)9 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)6 Test (org.junit.Test)6 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 DataLayerFixture (org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture)3 FilterAppliedEvent (org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent)3 Before (org.junit.Before)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 DefaultFilterRowConfiguration (org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration)2 Properties (java.util.Properties)1 BlinkingRowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture)1 NatTableFixture (org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture)1 MultiColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand)1 ILayerEvent (org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent)1