Search in sources :

Example 1 with DataLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.

the class BlinkLayerTest method getPropertyChangeListener.

/**
 * Listen for updates and put them in the {@link UpdateEventsCache}.
 * BlinkLayer needs this cache to be updated in order to work.
 */
private PropertyChangeListener getPropertyChangeListener() {
    return new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            PropertyUpdateEvent<BlinkingRowDataFixture> updateEvent = new PropertyUpdateEvent<BlinkingRowDataFixture>(new DataLayerFixture(), (BlinkingRowDataFixture) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue());
            BlinkLayerTest.this.layerUnderTest.handleLayerEvent(updateEvent);
        }
    };
}
Also used : BlinkingRowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) PropertyUpdateEvent(org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent)

Example 2 with DataLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.

the class ChooseColumnsFromCategoriesCommandHandlerTest method setup.

@Before
public void setup() {
    this.hideShowLayerFixture = new ColumnHideShowLayerFixture();
    this.commandHandler = new ChooseColumnsFromCategoriesCommandHandler(this.hideShowLayerFixture, new ColumnHeaderLayerFixture(), new DataLayerFixture(), new ColumnCategoriesModelFixture());
}
Also used : ColumnHeaderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture) ColumnHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) ColumnCategoriesModelFixture(org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture) Before(org.junit.Before)

Example 3 with DataLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.

the class CommandPropagationTest method shouldPropagateToUnderlyingLayer.

@Test
public void shouldPropagateToUnderlyingLayer() {
    LayerCommandFixture command = new LayerCommandFixture();
    this.layer.doCommand(command);
    Assert.assertTrue(command.getTargetLayer() instanceof DataLayerFixture);
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Test(org.junit.Test)

Example 4 with DataLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.

the class ShowColumnPositionsEventDiffTest method before.

@Before
public void before() {
    this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
    this.hideShowLayer = new ColumnHideShowLayer(this.dataLayer);
    this.viewportLayer = new ViewportLayer(this.hideShowLayer);
    this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 800, 400);
        }
    });
    this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
    this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
    this.event = new ShowColumnPositionsEvent(this.dataLayer, Arrays.asList(new Integer[] { 2, 4, 7, 8, 9 }));
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) ShowColumnPositionsEvent(org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent) Before(org.junit.Before)

Example 5 with DataLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.

the class ShowRowPositionsEventDiffTest method before.

@Before
public void before() {
    this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
    this.hideShowLayer = new RowHideShowLayer(this.dataLayer);
    this.viewportLayer = new ViewportLayer(this.hideShowLayer);
    this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 800, 400);
        }
    });
    this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
    this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
    this.event = new ShowRowPositionsEvent(this.dataLayer, Arrays.asList(new Integer[] { 2, 4, 7, 8, 9 }));
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer) Before(org.junit.Before)

Aggregations

DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)57 Test (org.junit.Test)28 Before (org.junit.Before)27 BaseDataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture)11 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)7 Rectangle (org.eclipse.swt.graphics.Rectangle)7 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)6 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)6 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)5 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)5 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)4 ColumnOverrideLabelAccumulator (org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)3 LayerCommandFixture (org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture)3 ColumnGroupModelFixture (org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture)3 Properties (java.util.Properties)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)2 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)2 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)2 RowHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer)2