Package org.eclipse.nebula.widgets.nattable.grid.layer

Examples of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer


        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer,
                rowGroupHeaderLayer, columnHeaderLayer);

        // Grid
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
                rowGroupHeaderLayer, cornerLayer);

        NatTable natTable = new NatTable(parent, gridLayer, false);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
View Full Code Here


        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                filterRowHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // set the group by header on top of the grid
        CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
        final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(
View Full Code Here

        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                filterRowHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, gridLayer, false);
View Full Code Here

    /**
     * These sequence of actions were causing a nasty bug in AutoResize
     */
    @Test
    public void autoResizeOneColumn() throws Exception {
        GridLayer gridLayer = new DummyGridLayerStack();
        setClientAreaProvider(gridLayer);

        // Resize column
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 2, 10));
        assertEquals(10, gridLayer.getColumnWidthByPosition(2));

        // Auto resize the one column
        InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(
                gridLayer, 2, configRegistry, gcFactory);
        gridLayer.doCommand(command);
        // Note: the actual resized width is platform specific (font
        // dependency),
        // hence we can't compare against a fixed value.
        int columnWidth = gridLayer.getColumnWidthByPosition(2);
        assertTrue(columnWidth > 10);

        // Reorder columns
        gridLayer.doCommand(new ColumnReorderCommand(gridLayer, 2, 1));
        assertEquals(columnWidth, gridLayer.getColumnWidthByPosition(1));

        // Select all columns
        gridLayer.doCommand(new SelectAllCommand());

        // Resize all selected columns
        command = new InitializeAutoResizeColumnsCommand(gridLayer, 1,
                configRegistry, gcFactory);
        gridLayer.doCommand(command);

        for (int columnPosition = 1; columnPosition <= 20; columnPosition++) {
            assertTrue(
                    "column "
                            + columnPosition
                            + " should have been resized, but it is still its original width",
                    gridLayer.getColumnWidthByPosition(columnPosition) != 100);
        }
    }
View Full Code Here

     * resized.
     */
    @Test
    public void shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected()
            throws Exception {
        GridLayer gridLayer = new DefaultGridLayer(
                RowDataListFixture.getList(),
                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap());
        setClientAreaProvider(gridLayer);

        // Resize grid column 1, 2
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 1, 10));
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 2, 10));
        assertEquals(10, gridLayer.getColumnWidthByPosition(1));
        assertEquals(10, gridLayer.getColumnWidthByPosition(2));

        // Fully select columns 1, 2
        SelectionLayer selectionLayer = ((DefaultBodyLayerStack) gridLayer
                .getBodyLayer()).getSelectionLayer();
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                true, false));
        assertEquals(2, selectionLayer.getFullySelectedColumnPositions().length);

        // Resize grid column 5
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 5, 10));
        assertEquals(10, gridLayer.getColumnWidthByPosition(5));

        // Auto resize column 5
        InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(
                gridLayer, 5, configRegistry, gcFactory);
        gridLayer.doCommand(command);

        // Columns 1 and 2 should not be resized
        assertEquals(10, gridLayer.getColumnWidthByPosition(1));
        assertEquals(10, gridLayer.getColumnWidthByPosition(2));
        assertTrue(gridLayer.getColumnWidthByPosition(5) > 10);
    }
View Full Code Here

        CornerLayer cornerLayer = new CornerLayer(
                new DataLayer(new DefaultCornerDataProvider(colDataProvider,
                        rowDataProvider)), rowHeaderLayer, colHeader);

        GridLayer grid = new GridLayer(viewportLayer, colHeader,
                rowHeaderLayer, cornerLayer);
        natTable = new NatTable(new Shell(), grid);
        natTable.setSize(600, 400);
    }
View Full Code Here

                new DefaultCornerDataProvider(columnHeaderDataProvider,
                        rowHeaderDataProvider)), rowHeaderLayer,
                columnHeaderLayer);

        // create the grid layer composed with the prior created layer stacks
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);

        final NatTable natTable = new NatTable(parent, gridLayer);

        // Events are fired whenever selection occurs. These can be use to
View Full Code Here

        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                filterRowHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, gridLayer, false);
View Full Code Here

        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                filterRowHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // set the group by header on top of the grid
        CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
        final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(
View Full Code Here

        Assert.assertEquals(80, viewport.getHeight());
    }

    @Test
    public void initRowHeaderHeight() throws Exception {
        GridLayer gridLayer = new GridLayerFixture();
        gridLayer.doCommand(new InitializeClientAreaCommandFixture());

        ILayer rowHeader = gridLayer.getRowHeaderLayer();
        // Only visible rows are counted
        Assert.assertEquals(100, rowHeader.getHeight());
        Assert.assertEquals(40, rowHeader.getWidth());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer

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.