Examples of ILayerCell


Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

            if (cellDataArray != null) {
                Color originalColor = gc.getForeground();

                for (int i = 0; i < cellDataArray.length; i++) {
                    ILayerCell subCell = createSubLayerCell(cell,
                            cellDataArray[i]);

                    int subCellHeight = getSubCellHeight(subCell, gc,
                            configRegistry);
                    Rectangle subCellBounds = new Rectangle(bounds.x, subGridY,
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

            IConfigRegistry configRegistry) {
        Object[] cellDataArray = getDataAsArray(cell);
        if (cellDataArray != null) {
            int width = 0;
            for (Object data : cellDataArray) {
                ILayerCell subCell = createSubLayerCell(cell, data);
                width = Math.max(width, this.getInternalPainter()
                        .getPreferredWidth(subCell, gc, configRegistry));
            }
            return width;
        }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

            IConfigRegistry configRegistry) {
        Object[] cellDataArray = getDataAsArray(cell);
        if (cellDataArray != null) {
            int height = 0;
            for (Object data : cellDataArray) {
                ILayerCell subCell = createSubLayerCell(cell, data);
                height += this.getInternalPainter().getPreferredHeight(subCell,
                        gc, configRegistry);
            }
            // add number of items-1 to calculate the pixels for grid lines
            height += cellDataArray.length;
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    protected void moveLastSelectedLeft(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) {
        if (this.selectionLayer.hasColumnSelection()) {
            this.lastSelectedCellPosition = this.selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask);
            ILayerCell lastSelectedCell = this.selectionLayer.getCellByPosition(
                    this.lastSelectedCellPosition.columnPosition,
                    this.lastSelectedCellPosition.rowPosition);
            if (lastSelectedCell != null) {
                int stepSize = traversalStrategy.getStepCount();
                this.newSelectedColumnPosition = (stepSize >= 0) ? (lastSelectedCell.getOriginColumnPosition() - stepSize) : 0;

                this.newSelectedRowPosition = this.lastSelectedCellPosition.rowPosition;

                // boolean flag to stop traversal if calculated target is
                // invalid needed to avoid endless loop if there are no further
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    protected void moveLastSelectedRight(final ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) {
        if (this.selectionLayer.hasColumnSelection()) {
            this.lastSelectedCellPosition = this.selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask);
            ILayerCell lastSelectedCell = this.selectionLayer.getCellByPosition(
                    this.lastSelectedCellPosition.columnPosition,
                    this.lastSelectedCellPosition.rowPosition);
            if (lastSelectedCell != null) {
                int stepSize = traversalStrategy.getStepCount();
                this.newSelectedColumnPosition = (stepSize >= 0)
                        ? (lastSelectedCell.getOriginColumnPosition() + lastSelectedCell.getColumnSpan() - 1 + stepSize)
                                : (this.selectionLayer.getColumnCount() - 1);

                this.newSelectedRowPosition = this.lastSelectedCellPosition.rowPosition;

                // boolean flag to stop traversal if calculated target is
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    protected void moveLastSelectedUp(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) {
        if (this.selectionLayer.hasRowSelection()) {
            this.lastSelectedCellPosition = this.selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask);
            ILayerCell lastSelectedCell = this.selectionLayer.getCellByPosition(
                    this.lastSelectedCellPosition.columnPosition,
                    this.lastSelectedCellPosition.rowPosition);
            if (lastSelectedCell != null) {
                int stepSize = traversalStrategy.getStepCount();
                this.newSelectedColumnPosition = this.lastSelectedCellPosition.columnPosition;

                this.newSelectedRowPosition = (stepSize >= 0) ? lastSelectedCell.getOriginRowPosition() - stepSize : 0;

                // boolean flag to stop traversal if calculated target is
                // invalid needed to avoid endless loop if there are no further
                // valid traversal targets
                boolean stopTraversalOnInvalid = false;
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    protected void moveLastSelectedDown(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) {
        if (this.selectionLayer.hasRowSelection()) {
            this.lastSelectedCellPosition = this.selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask);
            ILayerCell lastSelectedCell = this.selectionLayer.getCellByPosition(
                    this.lastSelectedCellPosition.columnPosition,
                    this.lastSelectedCellPosition.rowPosition);
            if (lastSelectedCell != null) {
                int stepSize = traversalStrategy.getStepCount();
                this.newSelectedColumnPosition = this.lastSelectedCellPosition.columnPosition;

                this.newSelectedRowPosition = (stepSize >= 0)
                        ? lastSelectedCell.getOriginRowPosition() + lastSelectedCell.getRowSpan() - 1 + stepSize
                        : this.selectionLayer.getRowCount() - 1;

                // boolean flag to stop traversal if calculated target is
                // invalid needed to avoid endless loop if there are no further
                // valid traversal targets
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    public boolean isCellPositionSelected(int columnPosition, int rowPosition) {
        this.selectionsLock.readLock().lock();

        try {
            ILayerCell cell = this.selectionLayer.getCellByPosition(columnPosition,
                    rowPosition);
            if (cell != null) {
                Rectangle cellRectangle = new Rectangle(
                        cell.getOriginColumnPosition(),
                        cell.getOriginRowPosition(), cell.getColumnSpan(),
                        cell.getRowSpan());

                for (Rectangle selectionRectangle : this.selections) {
                    if (selectionRectangle.intersects(cellRectangle))
                        return true;
                }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

    @Override
    public boolean isCellPositionSelected(int columnPosition, int rowPosition) {
        this.selectionsLock.readLock().lock();

        try {
            ILayerCell cell = this.selectionLayer.getCellByPosition(columnPosition,
                    rowPosition);
            int cellOriginRowPosition = cell.getOriginRowPosition();

            for (int candidateRowPosition = cellOriginRowPosition; candidateRowPosition < cellOriginRowPosition
                    + cell.getRowSpan(); candidateRowPosition++) {
                Serializable rowId = getRowIdByPosition(candidateRowPosition);

                int cellOriginColumnPosition = cell.getOriginColumnPosition();
                for (int candidateColumnPosition = cellOriginColumnPosition; candidateColumnPosition < cellOriginColumnPosition
                        + cell.getColumnSpan(); candidateColumnPosition++) {
                    if (this.selections.isSelected(rowId, candidateColumnPosition)) {
                        return true;
                    }

                }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

        applyBorderStyle(gc, configRegistry);

        // Draw horizontal borders
        for (int columnPosition = columnPositionOffset; columnPosition < columnPositionOffset
                + positionRectangle.width; columnPosition++) {
            ILayerCell previousCell = null;
            ILayerCell currentCell = null;
            ILayerCell afterCell = null;
            for (int rowPosition = rowPositionOffset; rowPosition < rowPositionOffset
                    + positionRectangle.height; rowPosition++) {
                currentCell = natLayer.getCellByPosition(columnPosition,
                        rowPosition);
                afterCell = natLayer.getCellByPosition(columnPosition,
                        rowPosition + 1);

                if (currentCell != null) {
                    Rectangle currentCellBounds = currentCell.getBounds();

                    if (isSelected(currentCell)) {
                        int x0 = currentCellBounds.x - 1;
                        int x1 = currentCellBounds.x + currentCellBounds.width
                                - 1;

                        int y = currentCellBounds.y - 1;

                        if (previousCell != null) {
                            Rectangle previousCellBounds = previousCell
                                    .getBounds();
                            x0 = Math.max(x0, previousCellBounds.x - 1);
                            x1 = Math.min(x1, previousCellBounds.x
                                    + previousCellBounds.width - 1);
                        }

                        if (previousCell == null || !isSelected(previousCell))
                            gc.drawLine(x0, y, x1, y);

                        // check after
                        if (afterCell == null || !isSelected(afterCell)) {
                            Rectangle cellBounds = afterCell != null ? afterCell
                                    .getBounds() : currentCell.getBounds();

                            y = currentCellBounds.y + currentCellBounds.height
                                    - 1;

                            x0 = Math.max(x0, cellBounds.x - 1);
                            x1 = Math.min(x1, cellBounds.x + cellBounds.width
                                    - 1);

                            gc.drawLine(x0, y, x1, y);
                        }
                    } else {
                        // check if previous was selected to not override the
                        // border again
                        // this is necessary because of single cell updates
                        if (positionRectangle.width == 2
                                || positionRectangle.height == 2) {
                            if (afterCell != null && isSelected(afterCell)) {
                                Rectangle afterCellBounds = afterCell
                                        .getBounds();

                                int x0 = Math.max(afterCellBounds.x - 1,
                                        currentCellBounds.x - 1);
                                int x1 = Math.min(afterCellBounds.x
                                        + afterCellBounds.width - 1,
                                        currentCellBounds.x
                                                + currentCellBounds.width - 1);

                                int y = currentCellBounds.y
                                        + currentCellBounds.height - 1;
                                gc.drawLine(x0, y, x1, y);
                            }
                        }
                    }
                }
                previousCell = currentCell;
            }
        }

        // Draw vertical borders
        for (int rowPosition = rowPositionOffset; rowPosition < rowPositionOffset
                + positionRectangle.height; rowPosition++) {
            ILayerCell previousCell = null;
            ILayerCell currentCell = null;
            ILayerCell afterCell = null;
            for (int columnPosition = columnPositionOffset; columnPosition < columnPositionOffset
                    + positionRectangle.width; columnPosition++) {
                currentCell = natLayer.getCellByPosition(columnPosition,
                        rowPosition);
                afterCell = natLayer.getCellByPosition(columnPosition + 1,
                        rowPosition);

                if (currentCell != null) {
                    Rectangle currentCellBounds = currentCell.getBounds();

                    if (isSelected(currentCell)) {
                        int y0 = currentCellBounds.y - 1;
                        int y1 = currentCellBounds.y + currentCellBounds.height
                                - 1;

                        int x = currentCellBounds.x - 1;

                        if (previousCell != null) {
                            Rectangle previousCellBounds = previousCell
                                    .getBounds();
                            y0 = Math.max(y0, previousCellBounds.y - 1);
                            y1 = Math.min(y1, previousCellBounds.y
                                    + previousCellBounds.height - 1);
                        }

                        if (previousCell == null || !isSelected(previousCell))
                            gc.drawLine(x, y0, x, y1);

                        // check after
                        if (afterCell == null || !isSelected(afterCell)) {
                            Rectangle cellBounds = afterCell != null ? afterCell
                                    .getBounds() : currentCell.getBounds();

                            x = currentCellBounds.x + currentCellBounds.width
                                    - 1;

                            y0 = Math.max(y0, cellBounds.y - 1);
                            y1 = Math.min(y1, cellBounds.y + cellBounds.height
                                    - 1);

                            gc.drawLine(x, y0, x, y1);
                        }
                    } else {
                        // check if previous was selected to not override the
                        // border again
                        // this is necessary because of single cell updates
                        // check if previous was selected to not override the
                        // border again
                        // this is necessary because of single cell updates
                        if (positionRectangle.width == 2
                                || positionRectangle.height == 2) {
                            if (afterCell != null && isSelected(afterCell)) {
                                Rectangle afterCellBounds = afterCell
                                        .getBounds();

                                int y0 = Math.max(afterCellBounds.y - 1,
                                        currentCellBounds.y - 1);
                                int y1 = Math.min(afterCellBounds.y
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.