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

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


    public LabelStack getConfigLabelsByPosition(int columnPosition,
            int rowPosition) {
        LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition,
                rowPosition);

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

            if (cellRectangle.contains(getSelectionAnchor().columnPosition,
                    getSelectionAnchor().rowPosition)) {
                labelStack
                        .addLabel(SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
View Full Code Here


public class TreeExpandCollapseAction implements IMouseAction {

    public void run(NatTable natTable, MouseEvent event) {
        int c = natTable.getColumnPositionByX(event.x);
        int r = natTable.getRowPositionByY(event.y);
        ILayerCell cell = natTable.getCellByPosition(c, r);
        int index = cell.getLayer()
                .getRowIndexByPosition(cell.getRowPosition());
        TreeExpandCollapseCommand command = new TreeExpandCollapseCommand(index);
        natTable.doCommand(command);
    }
View Full Code Here

     *            The coordinates of the cell on which the tick update should be
     *            executed
     */
    private void updateSingleCell(TickUpdateCommand command,
            PositionCoordinate selectedPosition) {
        ILayerCell cell = selectionLayer.getCellByPosition(
                selectedPosition.columnPosition, selectedPosition.rowPosition);

        IConfigRegistry configRegistry = command.getConfigRegistry();

        IEditableRule editableRule = configRegistry.getConfigAttribute(
                EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, cell
                        .getConfigLabels().getLabels());

        IDataValidator validator = configRegistry.getConfigAttribute(
                EditConfigAttributes.DATA_VALIDATOR, DisplayMode.EDIT, cell
                        .getConfigLabels().getLabels());

        if (editableRule.isEditable(cell, configRegistry)) {
            // process the tick update
            Object newValue = getNewCellValue(command, cell);
View Full Code Here

    @Override
    protected String getText(Event event) {
        int col = natTable.getColumnPositionByX(event.x);
        int row = natTable.getRowPositionByY(event.y);

        ILayerCell cell = natTable.getCellByPosition(col, row);
        if (cell != null) {
            // if the registered cell painter is the PasswordCellPainter, there
            // will be no tooltip
            ICellPainter painter = natTable.getConfigRegistry()
                    .getConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                            DisplayMode.NORMAL,
                            cell.getConfigLabels().getLabels());
            if (isVisibleContentPainter(painter)) {
                String tooltipValue = CellDisplayConversionUtils
                        .convertDataType(cell, natTable.getConfigRegistry());

                if (tooltipValue.length() > 0) {
View Full Code Here

    }

    @Override
    public boolean matches(NatTable natTable, MouseEvent event,
            LabelStack regionLabels) {
        ILayerCell cell = natTable.getCellByPosition(
                natTable.getColumnPositionByX(event.x),
                natTable.getRowPositionByY(event.y));

        if (cell == null)
            return false;

        return (super.matches(natTable, event, regionLabels) && ObjectUtils
                .isNotNull(cell.getDataValue()));
    }
View Full Code Here

        return new LayerCell(this, columnPosition, rowPosition, dataCell);
    }

    @Override
    public Rectangle getBoundsByPosition(int columnPosition, int rowPosition) {
        ILayerCell cell = getCellByPosition(columnPosition, rowPosition);
        return super.getBoundsByPosition(cell.getOriginColumnPosition(),
                cell.getOriginRowPosition());
    }
View Full Code Here

                cell.getOriginRowPosition());
    }

    @Override
    public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
        ILayerCell cell = getCellByPosition(columnIndex, rowIndex);
        for (int i = 0; i < cell.getColumnSpan(); i++) {
            for (int j = 0; j < cell.getRowSpan(); j++) {
                super.setDataValue(cell.getOriginColumnPosition() + i,
                        cell.getOriginRowPosition() + j, newValue);
            }
        }
    }
View Full Code Here

                return new LayerCell(this,
                        getStartPositionOfGroup(columnPosition), rowPosition,
                        columnPosition, rowPosition,
                        getColumnSpan(columnPosition), 1);
            } else {
                ILayerCell underlyingCell = columnGroupHeaderLayer
                        .getCellByPosition(columnPosition, rowPosition);
                return new LayerCell(this,
                        underlyingCell.getOriginColumnPosition(),
                        underlyingCell.getOriginRowPosition(), columnPosition,
                        rowPosition, underlyingCell.getColumnSpan(),
                        underlyingCell.getRowSpan() + 1);
            }
        } else if (rowPosition == 1) {
            ILayerCell underlyingCell = columnGroupHeaderLayer
                    .getCellByPosition(columnPosition, rowPosition - 1);
            boolean partOfAGroup = model.isPartOfAGroup(bodyColumnIndex);
            return new LayerCell(this,
                    underlyingCell.getOriginColumnPosition(),
                    underlyingCell.getOriginRowPosition()
                            + (partOfAGroup ? 1 : 0), columnPosition,
                    rowPosition, underlyingCell.getColumnSpan(),
                    underlyingCell.getRowSpan() + (partOfAGroup ? 0 : 1));
        } else if (rowPosition == 2) {
            ILayerCell underlyingCell = columnGroupHeaderLayer
                    .getCellByPosition(columnPosition, rowPosition - 1);
            boolean partOfAGroup = model.isPartOfAGroup(bodyColumnIndex)
                    || columnGroupHeaderLayer.isColumnInGroup(bodyColumnIndex);
            return new LayerCell(this,
                    underlyingCell.getOriginColumnPosition(),
                    underlyingCell.getOriginRowPosition()
                            + (partOfAGroup ? 1 : 0), columnPosition,
                    rowPosition, underlyingCell.getColumnSpan(),
                    underlyingCell.getRowSpan() + (partOfAGroup ? 0 : 1));
        }
        return null;
    }
View Full Code Here

    }

    // Cell features

    public ILayerCell getCellByPosition(int columnPosition, int rowPosition) {
        ILayerCell cell = underlyingLayer.getCellByPosition(rowPosition,
                columnPosition);
        if (cell != null)
            return new InvertedLayerCell(cell);
        else
            return null;
View Full Code Here

        return new LayerCell(this, columnPosition, rowPosition);
    }

    @Override
    public Rectangle getBoundsByPosition(int columnPosition, int rowPosition) {
        ILayerCell cell = getCellByPosition(columnPosition, rowPosition);
        ILayer cellLayer = cell.getLayer();

        int xOffset = -1;
        int yOffset = -1;
        int width = 0;
        int height = 0;
        {
            int column = cell.getOriginColumnPosition();
            int end = column + cell.getColumnSpan();
            for (; column < end; column++) {
                int columnOffset = cellLayer.getStartXOfColumnPosition(column);
                if (column < cellLayer.getColumnCount()) {
                    xOffset = columnOffset;
                    break;
                }
            }
            for (; column < end; column++) {
                width += cellLayer.getColumnWidthByPosition(column);
            }
        }
        {
            int row = cell.getOriginRowPosition();
            int end = row + cell.getRowSpan();
            for (; row < end; row++) {
                int rowOffset = cellLayer.getStartYOfRowPosition(row);
                if (row < cellLayer.getRowCount()) {
                    yOffset = rowOffset;
                    break;
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

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.