Package org.eclipse.nebula.widgets.nattable.reorder

Examples of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer


                .run(new ViewportSelectionReorderDataLayerExample());
    }

    public Control createExampleControl(Composite parent) {
        return new NatTable(parent, new ViewportLayer(new SelectionLayer(
                new ColumnReorderLayer(new DataLayer(new DummyBodyDataProvider(
                        500, 1000000))))));
    }
View Full Code Here


    private ColumnReorderLayer columnReorderLayer;

    @Before
    public void setUp() {
        underlyingLayer = new BaseDataLayerFixture(4, 4);
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
    }
View Full Code Here

     *          --------------------
     *  Position   0   1  2  3 ... 20
     */
    public void reorderMultipleColumnsLargeArrayToEdges() throws Exception {

        ColumnReorderLayer reorderLayer = new ColumnReorderLayer(
                new BaseDataLayerFixture(20, 20));

        List<Integer> fromColumnPositions = Arrays.asList(new Integer[] { 10,
                11, 12, 13 });

        reorderLayer.reorderMultipleColumnPositions(fromColumnPositions, 0);

        assertEquals(10, reorderLayer.getColumnIndexByPosition(0));
        assertEquals(11, reorderLayer.getColumnIndexByPosition(1));
        assertEquals(12, reorderLayer.getColumnIndexByPosition(2));
        assertEquals(13, reorderLayer.getColumnIndexByPosition(3));
        assertEquals(0, reorderLayer.getColumnIndexByPosition(4));

        fromColumnPositions = Arrays.asList(new Integer[] { 8, 9, 10, 11 });

        reorderLayer.reorderMultipleColumnPositions(fromColumnPositions, 8);

        assertEquals(4, reorderLayer.getColumnIndexByPosition(8));
        assertEquals(5, reorderLayer.getColumnIndexByPosition(9));
        assertEquals(6, reorderLayer.getColumnIndexByPosition(10));
        assertEquals(7, reorderLayer.getColumnIndexByPosition(11));

        fromColumnPositions = Arrays.asList(new Integer[] { 8, 9, 10, 11 });

        reorderLayer.reorderMultipleColumnPositions(fromColumnPositions,
                reorderLayer.getColumnCount());

        /*
         * System.out.println("\n"); // See output for idea on what is going on
         * for (int i = 0; i < reorderLayer.getColumnCount(); i++)
         * System.out.println(i + "\t" +
         * reorderLayer.getColumnIndexByPosition(i));
         */

        assertEquals(7, reorderLayer.getColumnIndexByPosition(19));
        assertEquals(6, reorderLayer.getColumnIndexByPosition(18));
        assertEquals(5, reorderLayer.getColumnIndexByPosition(17));
        assertEquals(4, reorderLayer.getColumnIndexByPosition(16));
    }
View Full Code Here

        assertEquals(4, reorderLayer.getColumnIndexByPosition(16));
    }

    @Test
    public void commandPassedOnToParentIfCannotBeHandled() throws Exception {
        ColumnReorderLayer reorderLayer = new ColumnReorderLayer(
                new DataLayerFixture());
        assertFalse(reorderLayer.doCommand(new LayerCommandFixture()));
    }
View Full Code Here

        assertFalse(reorderLayer.doCommand(new LayerCommandFixture()));
    }

    @Test
    public void canHandleColumnReorderCommand() throws Exception {
        ColumnReorderLayer reorderLayer = new ColumnReorderLayer(
                new DataLayerFixture());
        ColumnReorderCommand reorderCommand = new ColumnReorderCommand(
                reorderLayer, 0, 2);
        assertTrue(reorderLayer.doCommand(reorderCommand));
    }
View Full Code Here

    }

    @Test
    public void getWidthForReorderedColumns() throws Exception {
        underlyingLayer = new DataLayerFixture();
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);

        // 0 1 2 3 4 - see DataLayerFixture
        columnReorderLayer.reorderColumnPosition(0, 5);

        // 1 2 3 4 0
View Full Code Here

    @SuppressWarnings("boxing")
    @Test
    public void getWidthForMultipleColumnsReordering() throws Exception {
        underlyingLayer = new DataLayerFixture();
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);

        // 0 1 2 3 4 - see DataLayerFixture
        columnReorderLayer.reorderMultipleColumnPositions(Arrays.asList(1, 2),
                5);
View Full Code Here

    }

    @Test
    public void getStartXForReorderedColumn() throws Exception {
        underlyingLayer = new DataLayerFixture();
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);

        // 0 1 2 3 4 - see DataLayerFixture
        columnReorderLayer.reorderColumnPosition(0, 5);

        // Index: 1 2 3 4 0 Width: 100 35 100 80 150
View Full Code Here

    }

    @Test
    public void getConfigLabelsByPosition() throws Exception {
        DataLayer underlyingLayer = new DataLayerFixture();
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
        ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                underlyingLayer);
        registerCellStyleAccumulators(underlyingLayer, columnLabelAccumulator);

        columnLabelAccumulator.registerColumnOverrides(4, "INDEX_4_LABEL");
View Full Code Here

    public Control createExampleControl(Composite parent) {
        DummyBodyDataProvider bodyDataProvider = new DummyBodyDataProvider(200,
                1000000);
        SelectionLayer selectionLayer = new SelectionLayer(
                new ColumnReorderLayer(new DataLayer(bodyDataProvider)));
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
                new DummyColumnHeaderDataProvider(bodyDataProvider)),
                viewportLayer, selectionLayer);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer

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.