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

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


        this.selectionsLock.readLock().lock();
        try {
            for (Selections<T>.Row row : this.selections.getRows()) {
                int rowPosition = getRowPositionByRowObject(row.getRowObject());
                if (isRowVisible(rowPosition)) {
                    visiblySelectedRowPositions.add(new Range(rowPosition,
                            rowPosition + 1));
                }
            }
        } finally {
            this.selectionsLock.readLock().unlock();
View Full Code Here


    private final SelectionLayer selectionLayer;

    public ColumnSelectionEvent(SelectionLayer selectionLayer,
            int columnPosition) {
        super(selectionLayer, new Range(columnPosition, columnPosition + 1));
        this.selectionLayer = selectionLayer;
    }
View Full Code Here

            // if there are no row diffs, it seems to be a complete refresh
            if (event.getRowDiffs() == null) {
                Collection<Rectangle> rectangles = event
                        .getChangedPositionRectangles();
                for (Rectangle rectangle : rectangles) {
                    Range changedRange = new Range(rectangle.y, rectangle.y
                            + rectangle.height);
                    if (selectedRowModified(changedRange)) {
                        selectionLayer.updateSelection();
                        break;
                    }
View Full Code Here

        Collection<Range> localColumnPositionRanges = new ArrayList<Range>();

        int offset = getColumnPositionOffset(layoutCoordinate.x);
        for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) {
            localColumnPositionRanges.add(new Range(
                    offset + underlyingColumnPositionRange.start,
                    offset + underlyingColumnPositionRange.end));
        }

        return localColumnPositionRanges;
View Full Code Here

        Collection<Range> localRowPositionRanges = new ArrayList<Range>();

        int offset = getRowPositionOffset(layoutCoordinate.y);
        for (Range underlyingRowPositionRange : underlyingRowPositionRanges) {
            localRowPositionRanges.add(new Range(
                    offset + underlyingRowPositionRange.start,
                    offset + underlyingRowPositionRange.end));
        }

        return localRowPositionRanges;
View Full Code Here

            int rightOffset = 0;

            for (StructuralDiff columnDiff : columnDiffs) {
                switch (columnDiff.getDiffType()) {
                    case ADD:
                        Range afterPositionRange = columnDiff
                                .getAfterPositionRange();
                        if (afterPositionRange.start < topLeftPosition.columnPosition) {
                            leftOffset += afterPositionRange.size();
                        }
                        if (afterPositionRange.start <= bottomRightPosition.columnPosition) {
                            rightOffset += afterPositionRange.size();
                        }
                        break;
                    case DELETE:
                        Range beforePositionRange = columnDiff
                                .getBeforePositionRange();
                        if (beforePositionRange.start < topLeftPosition.columnPosition) {
                            leftOffset -= Math.min(beforePositionRange.end,
                                    topLeftPosition.columnPosition + 1)
                                    - beforePositionRange.start;
                        }
                        if (beforePositionRange.start <= bottomRightPosition.columnPosition) {
                            rightOffset -= Math.min(beforePositionRange.end,
                                    bottomRightPosition.columnPosition + 1)
                                    - beforePositionRange.start;
                        }
                        break;
                }
            }

            topLeftPosition.columnPosition += leftOffset;
            bottomRightPosition.columnPosition += rightOffset;
        }

        Collection<StructuralDiff> rowDiffs = event.getRowDiffs();
        if (rowDiffs != null) {
            int leftOffset = 0;
            int rightOffset = 0;

            for (StructuralDiff rowDiff : rowDiffs) {
                switch (rowDiff.getDiffType()) {
                    case ADD:
                        Range afterPositionRange = rowDiff
                                .getAfterPositionRange();
                        if (afterPositionRange.start < topLeftPosition.rowPosition) {
                            leftOffset += afterPositionRange.size();
                        }
                        if (afterPositionRange.start <= bottomRightPosition.rowPosition) {
                            rightOffset += afterPositionRange.size();
                        }
                        break;
                    case DELETE:
                        Range beforePositionRange = rowDiff
                                .getBeforePositionRange();
                        if (beforePositionRange.start < topLeftPosition.rowPosition) {
                            leftOffset -= Math.min(beforePositionRange.end,
                                    topLeftPosition.rowPosition + 1)
                                    - beforePositionRange.start;
View Full Code Here

            ILayer sourceUnderlyingLayer,
            Collection<Range> underlyingColumnPositionRanges) {
        Collection<Range> localColumnPositionRanges = new ArrayList<Range>();

        for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) {
            localColumnPositionRanges.add(new Range(
                    underlyingToLocalColumnPosition(sourceUnderlyingLayer,
                            underlyingColumnPositionRange.start),
                    underlyingToLocalColumnPosition(sourceUnderlyingLayer,
                            underlyingColumnPositionRange.end)));
        }
View Full Code Here

            ILayer sourceUnderlyingLayer,
            Collection<Range> underlyingRowPositionRanges) {
        Collection<Range> localRowPositionRanges = new ArrayList<Range>();

        for (Range underlyingRowPositionRange : underlyingRowPositionRanges) {
            localRowPositionRanges.add(new Range(underlyingToLocalRowPosition(
                    sourceUnderlyingLayer, underlyingRowPositionRange.start),
                    underlyingToLocalRowPosition(sourceUnderlyingLayer,
                            underlyingRowPositionRange.end)));
        }
View Full Code Here

public class RangeTest {

    @Test
    public void range() throws Exception {
        // 1 cell
        Range range = new Range(2, 3);

        assertTrue(range.contains(2));
        assertFalse(range.contains(3));
    }
View Full Code Here

        assertFalse(range.contains(3));
    }

    @Test
    public void testEquality() throws Exception {
        assertTrue(new Range(3, 10).equals(new Range(3, 10)));
        assertFalse(new Range(3, 10).equals(new Range(3, 11)));
    }
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.