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

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


     * Check if any column belongs to a group. If yes, add all columns in that
     * group. Assumes that the 'toLocation' is not inside another group
     */
    @Override
    protected boolean doCommand(ReorderColumnsAndGroupsCommand command) {
        final ILayer underlyingLayer = columnGroupReorderLayer
                .getUnderlyingLayer();
        List<String> groupsProcessed = new ArrayList<String>();

        List<Integer> fromColumnPositions = command.getFromColumnPositions();
        List<Integer> fromColumnPositionsWithGroupColumns = new ArrayList<Integer>();

        for (Integer fromColumnPosition : fromColumnPositions) {
            int fromColumnIndex = underlyingLayer
                    .getColumnIndexByPosition(fromColumnPosition.intValue());

            ColumnGroupModel model = columnGroupReorderLayer.getModel();
            if (model.isPartOfAGroup(fromColumnIndex)) {
                String groupName = model.getColumnGroupByIndex(fromColumnIndex)
                        .getName();
                if (!groupsProcessed.contains(groupName)) {
                    groupsProcessed.add(groupName);
                    fromColumnPositionsWithGroupColumns
                            .addAll(columnGroupReorderLayer
                                    .getColumnGroupPositions(fromColumnIndex));
                }
            } else {
                fromColumnPositionsWithGroupColumns.add(fromColumnPosition);
            }
        }

        return underlyingLayer.doCommand(new MultiColumnReorderCommand(
                columnGroupReorderLayer, fromColumnPositionsWithGroupColumns,
                command.getToColumnPosition(), command.isReorderToLeftEdge()));
    }
View Full Code Here


        if (fromColumnPosition == -1 || toColumnPosition == -1) {
            System.err
                    .println("Invalid reorder positions, fromPosition: " + fromColumnPosition + ", toPosition: " + toColumnPosition); //$NON-NLS-1$ //$NON-NLS-2$
        }
        ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer();
        int fromColumnIndex = underlyingLayer
                .getColumnIndexByPosition(fromColumnPosition);
        int toColumnIndex = underlyingLayer
                .getColumnIndexByPosition(toColumnPosition);

        MoveDirectionEnum moveDirection = ColumnGroupUtils.getMoveDirection(
                fromColumnPosition, toColumnPosition);

        String leftEdgeGroupName = null;
        String rightEdgeGroupName = null;

        if (MoveDirectionEnum.RIGHT == moveDirection) {
            rightEdgeGroupName = movedToLeftEdgeOfAGroup(toColumnPosition,
                    toColumnIndex);
        }
        if (MoveDirectionEnum.LEFT == moveDirection) {
            leftEdgeGroupName = movedToRightEdgeOfAGroup(toColumnPosition,
                    toColumnIndex);
        }

        if (updateModel(fromColumnIndex, toColumnIndex, leftEdgeGroupName,
                rightEdgeGroupName)) {
            return underlyingLayer.doCommand(command);
        } else {
            return false;
        }
    }
View Full Code Here

    @Override
    protected boolean doCommand(MultiColumnReorderCommand command) {
        int toColumnPosition = command.getToColumnPosition();

        ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer();
        int toColumnIndex = underlyingLayer
                .getColumnIndexByPosition(toColumnPosition);

        List<Integer> fromColumnPositions = command.getFromColumnPositions();

        ColumnGroupModel model = columnGroupReorderLayer.getModel();

        if (updateModel(underlyingLayer, toColumnIndex, fromColumnPositions,
                model)) {
            return underlyingLayer.doCommand(command);
        } else {
            return false;
        }
    }
View Full Code Here

        SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();

        // Column header
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(
                new DefaultColumnHeaderDataLayer(columnHeaderDataProvider),
                bodyLayer, selectionLayer);

        // Row header
        IDataProvider rowHeaderDataProvider = new DefaultSummaryRowHeaderDataProvider(
                bodyLayer.getDataLayer().getDataProvider(), "\u2211");
        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

                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);

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
View Full Code Here

                freezeLayer, bodyLayer.getViewportLayer(), selectionLayer);

        // Column header
        final IDataProvider columnHeaderDataProvider = new DummyColumnHeaderDataProvider(
                bodyDataProvider);
        final ILayer columnHeaderLayer = new ColumnHeaderLayer(
                new DefaultColumnHeaderDataLayer(columnHeaderDataProvider),
                compositeFreezeLayer, selectionLayer);

        // Row header
        final IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        final ILayer rowHeaderLayer = new RowHeaderLayer(
                new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                compositeFreezeLayer, selectionLayer);

        // Corner
        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
View Full Code Here

        // Corner

        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                defaultColumnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer,
                rowGroupHeaderLayer, columnHeaderLayer);

        // Grid
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
                rowGroupHeaderLayer, cornerLayer);
View Full Code Here

        DummyColumnHeaderDataProvider columnHeaderDataProvider = new DummyColumnHeaderDataProvider(
                bodyDataProvider);
        DataLayer columnHeaderDataLayer = new DataLayer(
                columnHeaderDataProvider);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                viewportLayer, selectionLayer);

        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DataLayer rowHeaderDataLayer = new DataLayer(rowHeaderDataProvider);
        rowHeaderDataLayer.setDefaultColumnWidth(40);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer);

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

        GridLayer compositeLayer = new GridLayer(viewportLayer,
View Full Code Here

    public Control createExampleControl(Composite parent) {
        // Setup the layer stack
        final MyDataProvider myDataProvider = new MyDataProvider();
        SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(
                myDataProvider));
        ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
                new DummyColumnHeaderDataProvider(myDataProvider)),
                selectionLayer, selectionLayer);

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
View Full Code Here

        final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());

        // Corner

        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                defaultColumnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                sndGroup);

        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, sndGroup,
                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.