Package org.eclipse.nebula.widgets.nattable.coordinate

Examples of org.eclipse.nebula.widgets.nattable.coordinate.Range


        GridRectangle gridRange;

        // One first-dimension slice starting at the second
        // dimension selection.
        gridRange = new GridRectangle();
        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition
                + direction);
        gridRange.secondDim = new Range(secondDimPosition, secondDimEnd);
        gridRanges.add(gridRange);

        // One or more first-dimension slices to the wrapping boundary.
        gridRange = new GridRectangle();
        gridRange.firstDim = new Range(firstDimPosition + direction,
                firstDimEnd);
        gridRange.secondDim = new Range(secondDimStart, secondDimEnd);
        gridRanges.add(gridRange);

        // We're done if wrapping is not enabled or if we've already covered the
        // whole table.
        if (!wrapSearch || firstDimPosition == firstDimStart
                && secondDimPosition == secondDimStart) {
            return gridRanges;
        }

        // One or more first-dimension slices after wrapping, up to the
        // first-dimension slice with the starting point.
        gridRange = new GridRectangle();
        gridRange.firstDim = new Range(firstDimStart, firstDimPosition);
        gridRange.secondDim = new Range(secondDimStart, secondDimEnd);
        gridRanges.add(gridRange);

        // One first-dimension slice ending at the second-dimension selection.
        gridRange = new GridRectangle();
        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition
                + direction);
        gridRange.secondDim = new Range(secondDimStart, secondDimPosition);
        gridRanges.add(gridRange);

        return gridRanges;
    }
View Full Code Here


import org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff.DiffTypeEnum;

public class ColumnResizeEvent extends ColumnStructuralChangeEvent {

    public ColumnResizeEvent(ILayer layer, int columnPosition) {
        super(layer, new Range(columnPosition, columnPosition + 1));
    }
View Full Code Here

import org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff.DiffTypeEnum;

public class RowResizeEvent extends RowStructuralChangeEvent {

    public RowResizeEvent(ILayer layer, int rowPosition) {
        super(layer, new Range(rowPosition, rowPosition + 1));
    }
View Full Code Here

                    - offset;
            if (afterAddRowPosition < afterDeleteRowPosition) {
                afterDeleteRowPosition += cumulativeAddSize;
            }
            rowDiffs.add(new StructuralDiff(DiffTypeEnum.DELETE,
                    beforeFromRowPositionRange, new Range(
                            afterDeleteRowPosition, afterDeleteRowPosition)));
            offset += beforeFromRowPositionRange.size();
        }
        Range beforeAddRange = new Range(beforeToRowPosition,
                beforeToRowPosition);
        offset = 0;
        for (Range beforeFromRowPositionRange : beforeFromRowPositionRanges) {
            int size = beforeFromRowPositionRange.size();
            rowDiffs.add(new StructuralDiff(DiffTypeEnum.ADD, beforeAddRange,
                    new Range(afterAddRowPosition + offset, afterAddRowPosition
                            + offset + size)));
            offset += size;
        }

        return rowDiffs;
View Full Code Here

                    - offset;
            if (afterAddColumnPosition < afterDeleteColumnPosition) {
                afterDeleteColumnPosition += cumulativeAddSize;
            }
            columnDiffs.add(new StructuralDiff(DiffTypeEnum.DELETE,
                    beforeFromColumnPositionRange, new Range(
                            afterDeleteColumnPosition,
                            afterDeleteColumnPosition)));
            offset += beforeFromColumnPositionRange.size();
        }
        Range beforeAddRange = new Range(beforeToColumnPosition,
                beforeToColumnPosition);
        offset = 0;
        for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) {
            int size = beforeFromColumnPositionRange.size();
            columnDiffs.add(new StructuralDiff(DiffTypeEnum.ADD,
                    beforeAddRange, new Range(afterAddColumnPosition + offset,
                            afterAddColumnPosition + offset + size)));
            offset += size;
        }

        return columnDiffs;
View Full Code Here

                                    .getMinimumOrigin().getX());
                }
                for (StructuralDiff columnDiff : columnDiffs) {
                    switch (columnDiff.getDiffType()) {
                        case ADD:
                            Range afterPositionRange = columnDiff
                                    .getAfterPositionRange();
                            if (minimumOriginColumnPosition > 0) {
                                for (int i = afterPositionRange.start; i < afterPositionRange.end; i++) {
                                    if (i < minimumOriginColumnPosition) {
                                        minimumOriginColumnPosition++;
                                    }
                                }
                            }
                            break;
                        case DELETE:
                            Range beforePositionRange = columnDiff
                                    .getBeforePositionRange();
                            if (minimumOriginColumnPosition > 0) {
                                for (int i = beforePositionRange.start; i < beforePositionRange.end; i++) {
                                    if (i < minimumOriginColumnPosition) {
                                        columnOffset -= 1;
                                    }
                                }
                            }
                            break;
                    }
                }
            }

            int minimumOriginColumn = minimumOriginColumnPosition
                    + columnOffset;

            // in case of split viewports we use the min column position instead
            // of the calculated value
            if (viewportLayer.getMinColumnPosition() >= 0) {
                minimumOriginColumn = viewportLayer.getMinColumnPosition();
            }

            // if the new origin is out of range (e.g. the last column in the
            // viewport is moved
            // to the frozen region, the minimum origin need to be updated in
            // another way
            int startX = scrollableLayer
                    .getStartXOfColumnPosition(minimumOriginColumn);
            if (startX < 0 && minimumOriginColumnPosition > 0) {
                int columnCount = scrollableLayer.getColumnCount();
                if (columnCount == 0) {
                    // special case when all columns are hidden
                    startX = 0;
                } else {
                    startX = scrollableLayer
                            .getStartXOfColumnPosition(columnCount - 1)
                            + scrollableLayer
                                    .getColumnWidthByPosition(columnCount - 1);
                }
            }

            viewportLayer.setMinimumOriginX(startX);
        }

        if (event.isVerticalStructureChanged()) {
            viewportLayer.invalidateVerticalStructure();

            int rowOffset = 0;
            int minimumOriginRowPosition = viewportLayer
                    .getMinimumOriginRowPosition();

            Collection<StructuralDiff> rowDiffs = event.getRowDiffs();
            if (rowDiffs != null) {
                if (minimumOriginRowPosition < 0) {
                    // this is for handling of hide/show behaviour
                    // the value can only be -1 in case the row for which the
                    // minimum origin was set before
                    // was hidden, so we try to determine the correct value now
                    // if it is shown again
                    minimumOriginRowPosition = scrollableLayer
                            .getRowPositionByY(viewportLayer.getMinimumOrigin()
                                    .getY());
                }
                for (StructuralDiff rowDiff : rowDiffs) {
                    switch (rowDiff.getDiffType()) {
                        case ADD:
                            Range afterPositionRange = rowDiff
                                    .getAfterPositionRange();
                            if (minimumOriginRowPosition > 0) {
                                for (int i = afterPositionRange.start; i < afterPositionRange.end; i++) {
                                    if (i < minimumOriginRowPosition) {
                                        minimumOriginRowPosition++;
                                    }
                                }
                            }
                            break;
                        case DELETE:
                            Range beforePositionRange = rowDiff
                                    .getBeforePositionRange();
                            if (minimumOriginRowPosition > 0) {
                                for (int i = beforePositionRange.start; i < beforePositionRange.end; i++) {
                                    if (i < minimumOriginRowPosition) {
                                        rowOffset -= 1;
View Full Code Here

        try {
            for (Rectangle r : this.selections) {
                if (r.y < rowCount) {
                    int height = (r.y + r.height <= rowCount) ? r.height
                            : rowCount - r.y;
                    selectedRowsRange.add(new Range(r.y, r.y + height));
                }
            }
        } finally {
            this.selectionsLock.readLock().unlock();
        }

        ArrayList<Range> ranges = new ArrayList<Range>(selectedRowsRange);
        Range.sortByStart(ranges);
        List<Range> uniqueRanges = new ArrayList<Range>();

        // Adjust for overlaps - between consecutive selections
        for (int i = 0; i < ranges.size(); i++) {
            if (i > 0) {
                Range previousRange = ranges.get(i - 1);
                Range currentRange = ranges.get(i);
                if (previousRange.overlap(currentRange)
                        || (previousRange.end == currentRange.start)) {
                    int largerRangeEnd = (previousRange.end > currentRange.end) ? previousRange.end
                            : currentRange.end;
                    uniqueRanges.get(uniqueRanges.size() - 1).end = largerRangeEnd;
View Full Code Here

            selectionLayer.clear(false);
            selectionLayer.selectCell(0, rowPosition, withShiftMask,
                    withControlMask);
            selectionLayer.selectRegion(0, rowPosition, Integer.MAX_VALUE, 1);
            selectionLayer.moveSelectionAnchor(columnPosition, rowPosition);
            changedRowRanges.add(new Range(rowPosition, rowPosition + 1));
        } else if (bothShiftAndControl(withShiftMask, withControlMask)) {
            changedRowRanges.add(selectRowWithShiftKey(rowPosition));
        } else if (isShiftOnly(withShiftMask, withControlMask)) {
            changedRowRanges.add(selectRowWithShiftKey(rowPosition));
        } else if (isControlOnly(withShiftMask, withControlMask)) {
View Full Code Here

            }
            selectionLayer.selectRegion(0, rowPosition, Integer.MAX_VALUE, 1);
            selectionLayer.moveSelectionAnchor(columnPosition, rowPosition);
        }

        return new Range(rowPosition, rowPosition + 1);
    }
View Full Code Here

            }
        }
        selectionLayer.selectRegion(0, startRowPosition, Integer.MAX_VALUE,
                numOfRowsToIncludeInRegion);

        return new Range(startRowPosition, startRowPosition
                + numOfRowsToIncludeInRegion);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.coordinate.Range

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.