Examples of LayerListenerFixture


Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        LayerAssert.assertLayerEquals(expectedLayer, reorderLayer);
    }

    @Test
    public void shouldLoadstateFromProperties() throws Exception {
        LayerListenerFixture listener = new LayerListenerFixture();
        reorderLayer.addLayerListener(listener);

        Properties testProperties = new Properties();
        testProperties.put(
                ColumnReorderLayer.PERSISTENCE_KEY_COLUMN_INDEX_ORDER,
                "0,1,3,2,");

        reorderLayer.loadState("", testProperties);

        Assert.assertEquals(0, reorderLayer.getColumnIndexByPosition(0));
        Assert.assertEquals(1, reorderLayer.getColumnIndexByPosition(1));
        Assert.assertEquals(3, reorderLayer.getColumnIndexByPosition(2));
        Assert.assertEquals(2, reorderLayer.getColumnIndexByPosition(3));

        Assert.assertTrue(listener
                .containsInstanceOf(ColumnStructuralRefreshEvent.class));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        reorderLayer = new RowReorderLayer(dataLayer);
    }

    @Test
    public void shouldLoadstateFromProperties() throws Exception {
        LayerListenerFixture listener = new LayerListenerFixture();
        reorderLayer.addLayerListener(listener);

        Properties testProperties = new Properties();
        testProperties.put(RowReorderLayer.PERSISTENCE_KEY_ROW_INDEX_ORDER,
                "0,1,3,2,");

        reorderLayer.loadState("", testProperties);

        Assert.assertEquals(0, reorderLayer.getRowIndexByPosition(0));
        Assert.assertEquals(1, reorderLayer.getRowIndexByPosition(1));
        Assert.assertEquals(3, reorderLayer.getRowIndexByPosition(2));
        Assert.assertEquals(2, reorderLayer.getRowIndexByPosition(3));

        Assert.assertTrue(listener
                .containsInstanceOf(RowStructuralRefreshEvent.class));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

    private LayerListenerFixture listener;

    @Before
    public void setup() {
        nattable = new NatTableFixture();
        listener = new LayerListenerFixture();
        nattable.addLayerListener(listener);
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

                new DataLayerFixture());
    }

    @Test
    public void shouldThrowAReorderColumnEvent() {
        LayerListenerFixture listenerFixture = new LayerListenerFixture();
        columnReorderLayer.addLayerListener(listenerFixture);
        columnReorderLayer.reorderColumnPosition(3, 1);

        assertEquals(1, listenerFixture.getEventsCount());
        assertNotNull(listenerFixture
                .getReceivedEvent(ColumnReorderEvent.class));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(
                new DataLayerFixture(20, 10, 100, 20));
        NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer);

        // Add listener
        LayerListenerFixture listenerFixture = new LayerListenerFixture();
        natTableFixture.addLayerListener(listenerFixture);

        assertEquals(6, natTableFixture.getColumnCount());
        assertEquals(1, natTableFixture.getColumnIndexByPosition(1));

        // Move to outside the visible range
        List<Integer> columnToMove = Arrays.asList(1, 2, 3);
        int destinationPosition = 10;
        natTableFixture.doCommand(new MultiColumnReorderCommand(
                natTableFixture, columnToMove, destinationPosition));

        // Ensure that the event propagates to the top
        assertEquals(1, listenerFixture.getEventsCount());
        assertNotNull(listenerFixture
                .getReceivedEvent(ColumnReorderEvent.class));
        assertEquals(4, natTableFixture.getColumnIndexByPosition(1));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

                new DataLayerFixture(10, 10, 100, 20));
        NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer,
                1000, 400, true);

        // Add listener
        LayerListenerFixture listenerFixture = new LayerListenerFixture();
        natTableFixture.addLayerListener(listenerFixture);

        assertEquals(10, natTableFixture.getColumnCount());

        // hide some columns
        natTableFixture.doCommand(new MultiColumnHideCommand(natTableFixture,
                new int[] { 2, 5, 8 }));

        assertEquals(7, natTableFixture.getColumnCount());

        List<Integer> columnToMove = Arrays.asList(3, 4, 6, 7);
        int destinationPosition = 0;
        natTableFixture.doCommand(new MultiColumnReorderCommand(underlyingLayer
                .getColumnReorderLayer(), columnToMove, destinationPosition));

        // verify the event
        ColumnReorderEvent event = (ColumnReorderEvent) listenerFixture
                .getReceivedEvent(ColumnReorderEvent.class);
        assertNotNull(event);

        assertTrue(StructuralChangeEventHelper
                .isReorder(event.getColumnDiffs()));
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        rowReorderLayer = new BaseRowReorderLayerFixture(new DataLayerFixture());
    }

    @Test
    public void shouldThrowAReorderRowEvent() {
        LayerListenerFixture listenerFixture = new LayerListenerFixture();
        rowReorderLayer.addLayerListener(listenerFixture);
        rowReorderLayer.reorderRowPosition(3, 1);

        Assert.assertEquals(1, listenerFixture.getEventsCount());
        Assert.assertNotNull(listenerFixture
                .getReceivedEvent(RowReorderEvent.class));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(
                new RowReorderLayer(new DataLayerFixture(10, 10, 100, 20)));
        NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer);

        // Add listener
        LayerListenerFixture listenerFixture = new LayerListenerFixture();
        natTableFixture.addLayerListener(listenerFixture);

        Assert.assertEquals(10, natTableFixture.getRowCount());
        Assert.assertEquals(1, natTableFixture.getRowIndexByPosition(1));

        // Move to outside the visible range
        List<Integer> rowsToMove = Arrays.asList(1, 2, 3);
        int destinationPosition = 10;
        natTableFixture.doCommand(new MultiRowReorderCommand(natTableFixture,
                rowsToMove, destinationPosition));

        // Ensure that the event propagates to the top
        Assert.assertEquals(1, listenerFixture.getEventsCount());
        Assert.assertNotNull(listenerFixture
                .getReceivedEvent(RowReorderEvent.class));
        Assert.assertEquals(4, natTableFixture.getRowIndexByPosition(1));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        assertEquals(6, filterList.size());
    }

    @Test
    public void settingAValueFiresUpdateEvent() {
        final LayerListenerFixture listener = new LayerListenerFixture();
        columnHeaderLayer.addLayerListener(listener);
        dataProvider.setDataValue(3, 1, "testValue");

        assertEquals(1, listener.getEventsCount());
        assertNotNull(listener.getReceivedEvent(FilterAppliedEvent.class));
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture

        layerUnderTest = new GlazedListsEventLayer<RowDataFixture>(
                new DataLayerFixture(), listFixture);
        layerUnderTest.setTestMode(true);

        listenerFixture = new LayerListenerFixture();
        layerUnderTest.addLayerListener(listenerFixture);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.