Package org.eclipse.nebula.widgets.nattable.test.fixture

Examples of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture


    NatTableFixture nattable;
    private LayerListenerFixture listener;

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


        bodyDataProvider = new ListDataProvider<RowDataFixture>(listFixture,
                new ReflectiveColumnPropertyAccessor<RowDataFixture>(
                        RowDataListFixture.getPropertyNames()));

        GridLayerFixture gridLayer = new GridLayerFixture(bodyDataProvider);
        nattable = new NatTableFixture(gridLayer, false);

        bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        selectionLayer = gridLayer.getBodyLayer().getSelectionLayer();
    }
View Full Code Here

     */
    @Test
    public void reorderEventMustPropagateToTheTop() throws Exception {
        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

    @Test
    public void reorderMultipleNotConsecutiveColumnsInHiddenState() {
        DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(
                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()));

        assertEquals(7, natTableFixture.getColumnCount());

        assertEquals(0, underlyingLayer.getColumnReorderLayer()
                .getColumnPositionByIndex(3));
        assertEquals(1, underlyingLayer.getColumnReorderLayer()
                .getColumnPositionByIndex(4));
View Full Code Here

    @Test
    public void reorderEventMustPropagateToTheTop() throws Exception {
        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

                .eventList(RowDataListFixture.getList(10));

        GlazedListsGridLayer<RowDataFixture> gridLayer = new GlazedListsGridLayer<RowDataFixture>(
                eventListFixture, RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap(), configRegistry);
        nattable = new NatTableFixture(gridLayer, false);
        nattable.setConfigRegistry(configRegistry);

        selectionLayer = gridLayer.getBodyLayerStack().getSelectionLayer();
        bodyDataProvider = gridLayer.getBodyDataProvider();
        selectionProvider = new RowSelectionProvider<RowDataFixture>(
View Full Code Here

        gridLayerStack = new GlazedListsGridLayer<RowDataFixture>(
                GlazedLists.threadSafeList(eventList),
                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap(), configRegistry);

        nattable = new NatTableFixture(gridLayerStack, false);
        nattable.setConfigRegistry(configRegistry);
        nattable.addConfiguration(new DefaultNatTableStyleConfiguration());
        nattable.addConfiguration(new DefaultSortConfiguration());
        nattable.configure();
    }
View Full Code Here

                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);
View Full Code Here

        this.viewportLayer.setRegionName(GridRegion.BODY);

        this.viewportLayer.addConfiguration(new DefaultEditBindings());
        this.viewportLayer.addConfiguration(new DefaultEditConfiguration());

        this.natTable = new NatTableFixture(this.viewportLayer);

        this.natTable.enableEditingOnAllCells();
        this.natTable.getConfigRegistry().registerConfigAttribute(
                EditConfigAttributes.CELL_EDITABLE_RULE,
                IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, NOT_EDITABLE);
View Full Code Here

public class VisualChangeEventConflaterTest {

    @Test
    public void shouldAccumulateEvents() throws Exception {
        NatTableFixture natTable = new NatTableFixture();
        VisualChangeEventConflater conflater = new VisualChangeEventConflater(
                natTable);
        EventConflaterChain chain = new EventConflaterChain();
        chain.add(conflater);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture

Copyright © 2018 www.massapicom. 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.