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

Examples of org.eclipse.nebula.widgets.nattable.layer.ILayer


        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                columnHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);
View Full Code Here


        // build the row header layer
        IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyLayer.getBodyDataProvider());
        DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        final ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());

        // build the column header layer
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        final DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        final AbstractLayer columnHeaderLayer = new ColumnHeaderLayer(
                columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());

        // Use this special layer painter that supports rendering of split
        // viewports although
        // the ColumnHeaderLayer is not split. Here is some custom calculation
        // included that
        // might not work correctly in case there are column groups or other
        // spanning involved.
        columnHeaderLayer.setLayerPainter(new CellLayerPainter() {
            @Override
            protected boolean isClipLeft(int position) {
                // check position-1 because of the row header column count
                // as the body is a composite layer, the default transformation
                // for the grid is not working correctly
                int index = LayerUtil.convertColumnPosition(columnHeaderLayer,
                        position - 1, columnHeaderDataLayer);
                return (index > SPLIT_COLUMN_INDEX);
            }

            @Override
            protected void paintCell(ILayerCell cell, GC gc,
                    IConfigRegistry configRegistry) {
                ILayer layer = cell.getLayer();
                int columnPosition = cell.getColumnPosition();
                int rowPosition = cell.getRowPosition();
                ICellPainter cellPainter = layer.getCellPainter(columnPosition,
                        rowPosition, cell, configRegistry);
                Rectangle adjustedCellBounds = layer.getLayerPainter()
                        .adjustCellBounds(columnPosition, rowPosition,
                                cell.getBounds());
                if (cellPainter != null) {
                    Rectangle originalClipping = gc.getClipping();

                    int startX = getStartXOfColumnPosition(columnPosition);
                    int startY = getStartYOfRowPosition(rowPosition);

                    int endX = getStartXOfColumnPosition(cell
                            .getOriginColumnPosition() + cell.getColumnSpan());
                    int endY = getStartYOfRowPosition(cell
                            .getOriginRowPosition() + cell.getRowSpan());

                    // correct position of first column in right region
                    // find the last visible column in left region
                    int viewportBorderX = bodyLayer.getViewportLayerLeft()
                            .getClientAreaWidth() + rowHeaderLayer.getWidth();
                    if (isClipLeft(columnPosition) && startX < viewportBorderX) {
                        startX = viewportBorderX;
                    }
                    if (!isClipLeft(columnPosition - 1)
                            && startX > viewportBorderX) {
                        startX = viewportBorderX;
                    }
                    if (isClipLeft(cell.getOriginColumnPosition()
                            + cell.getColumnSpan())
                            && endX < viewportBorderX) {
                        endX = viewportBorderX;
                    }

                    Rectangle cellClipBounds = originalClipping
                            .intersection(new Rectangle(startX, startY, endX
                                    - startX, endY - startY));
                    gc.setClipping(cellClipBounds
                            .intersection(adjustedCellBounds));

                    cellPainter.paintCell(cell, gc, adjustedCellBounds,
                            configRegistry);

                    gc.setClipping(originalClipping);
                }
            }
        });

        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        final ILayer cornerLayer = new CornerLayer(cornerDataLayer,
                rowHeaderLayer, columnHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayer, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);
View Full Code Here

    public static void main(String[] args) throws Exception {
        StandaloneNatExampleRunner.run(new CompositeDataLayerExample());
    }

    public Control createExampleControl(Composite parent) {
        ILayer dataLayer = new DataLayer(new DummyBodyDataProvider(1000000,
                1000000));

        CompositeLayer compositeLayer = new CompositeLayer(1, 1);
        compositeLayer.setChildLayer(GridRegion.BODY, dataLayer, 0, 0);
View Full Code Here

        SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();

        // Column header
        this.columnHeaderDataLayer = columnHeaderDataLayer;
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayer, selectionLayer);

        // Row header
        this.rowHeaderDataLayer = rowHeaderDataLayer;
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, selectionLayer);

        // Corner
        this.cornerDataLayer = cornerDataLayer;
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                columnHeaderLayer);

        setBodyLayer(bodyLayer);
        setColumnHeaderLayer(columnHeaderLayer);
        setRowHeaderLayer(rowHeaderLayer);
View Full Code Here

                    configRegistry);

            // Row header
            IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                    bodyLayer.getDataLayer().getDataProvider());
            ILayer rowHeaderLayer = new RowHeaderLayer(
                    new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                    bodyLayer, selectionLayer);

            // Corner
            ILayer cornerLayer = new CornerLayer(new DataLayer(
                    new DefaultCornerDataProvider(columnHeaderDataProvider,
                            rowHeaderDataProvider)), rowHeaderLayer,
                    columnHeaderLayer);

            setBodyLayer(bodyLayer);
View Full Code Here

            // enabled)
            int contentHeight = (fontHeight * numberOfNewLines) + (spacing * 2);
            int contentToCellDiff = (cell.getBounds().width - rectangle.width);

            if ((contentHeight > rectangle.width) && calculateByTextHeight) {
                ILayer layer = cell.getLayer();
                layer.doCommand(new ColumnResizeCommand(layer, cell
                        .getColumnPosition(), contentHeight + contentToCellDiff));
            }

            if (text != null && text.length() > 0) {

View Full Code Here

    @Override
    protected void setNewMinLength(ILayerCell cell, int contentHeight) {
        int cellLength = cell.getBounds().height;
        if (cellLength < contentHeight) {

            ILayer layer = cell.getLayer();
            layer.doCommand(new RowResizeCommand(layer, cell.getRowPosition(),
                    contentHeight));
        }
    }
View Full Code Here

        // build the column header layer
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayerStack, bodyLayerStack.getSelectionLayer());

        // add sorting
        SortHeaderLayer<ExtendedPersonWithAddress> sortHeaderLayer = new SortHeaderLayer<ExtendedPersonWithAddress>(
                columnHeaderLayer,
                new GlazedListsSortModel<ExtendedPersonWithAddress>(
                        bodyLayerStack.getSortedList(), columnPropertyAccessor,
                        configRegistry, columnHeaderDataLayer), false);

        // connect sortModel to GroupByDataLayer to support sorting by group by
        // summary values
        bodyLayerStack.getBodyDataLayer().setSortModel(
                sortHeaderLayer.getSortModel());

        // build the row header layer
        IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyLayerStack.getBodyDataProvider());
        DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayerStack, bodyLayerStack.getSelectionLayer());

        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                sortHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack, sortHeaderLayer,
                rowHeaderLayer, cornerLayer);
View Full Code Here

        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                columnHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);
View Full Code Here

        // build the column header layer
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                viewportLayer, selectionLayer);

        // build the row header layer
        IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer);

        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                columnHeaderLayer);

        // build the grid layer
        return new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer,
                cornerLayer);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.ILayer

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.