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

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


        return getVerticalCellEdge(layer, clickPt, -1);
    }

    public static CellEdgeEnum getVerticalCellEdge(ILayer layer, Point clickPt,
            int handleHeight) {
        ILayerCell cell = layer.getCellByPosition(
                layer.getColumnPositionByX(clickPt.x),
                layer.getRowPositionByY(clickPt.y));
        return getVerticalCellEdge(cell.getBounds(), clickPt, handleHeight);
    }
View Full Code Here


    @Override
    public boolean matches(NatTable natTable, MouseEvent event,
            LabelStack regionLabels) {
        if (regionLabels != null && regionLabels.hasLabel(GridRegion.BODY)
                && event.button == this.button) {
            ILayerCell cell = natTable.getCellByPosition(
                    natTable.getColumnPositionByX(event.x),
                    natTable.getRowPositionByY(event.y));

            // Bug 407598: only perform a check if the click in the body region
            // was performed on a cell
            // cell == null can happen if the viewport is quite large and
            // contains not enough cells to fill it.
            if (cell != null) {
                ICellEditor cellEditor = natTable.getConfigRegistry()
                        .getConfigAttribute(EditConfigAttributes.CELL_EDITOR,
                                DisplayMode.EDIT,
                                cell.getConfigLabels().getLabels());
                if (this.cellEditorClass.isInstance(cellEditor)) {
                    return true;
                }
            }
        }
View Full Code Here

            LabelStack regionLabels) {
        if (super.matches(natTable, event, regionLabels)) {
            int columnPosition = natTable.getColumnPositionByX(event.x);
            int rowPosition = natTable.getRowPositionByY(event.y);

            ILayerCell cell = natTable.getCellByPosition(columnPosition,
                    rowPosition);

            // Bug 407598: only perform a check if the click in the body region
            // was performed on a cell
            // cell == null can happen if the viewport is quite large and
            // contains not enough cells to fill it.
            if (cell != null) {
                IConfigRegistry configRegistry = natTable.getConfigRegistry();
                ICellPainter cellPainter = cell.getLayer().getCellPainter(
                        columnPosition, rowPosition, cell, configRegistry);

                GC gc = new GC(natTable.getDisplay());
                try {
                    Rectangle adjustedCellBounds = natTable.getLayerPainter()
                            .adjustCellBounds(columnPosition, rowPosition,
                                    cell.getBounds());

                    ICellPainter clickedCellPainter = cellPainter
                            .getCellPainterAt(event.x, event.y, cell, gc,
                                    adjustedCellBounds, configRegistry);
                    if (clickedCellPainter != null) {
View Full Code Here

                .hasLabel(this.regionLabel))) && event.button == this.button) {

            // Bug 446866: if modifier keys are pressed (e.g. CTRL or SHIFT to
            // perform multi-selections) do NOT open editors.
            if (event.stateMask == SWT.NONE) {
                ILayerCell cell = natTable.getCellByPosition(
                        natTable.getColumnPositionByX(event.x),
                        natTable.getRowPositionByY(event.y));

                // Bug 407598: only perform a check if the click in the body
                // region was performed on a cell
                // cell == null can happen if the viewport is quite large and
                // contains not enough cells to fill it.
                if (cell != null) {
                    ICellEditor cellEditor = natTable.getConfigRegistry()
                            .getConfigAttribute(
                                    EditConfigAttributes.CELL_EDITOR,
                                    DisplayMode.EDIT,
                                    cell.getConfigLabels().getLabels());

                    if (cellEditor != null
                            && cellEditor.activateAtAnyPosition()) {
                        // if there is a cell editor configured for the cell
                        // that was clicked on, the match is found
View Full Code Here

    }

    private void setCellImage(NatTable natTable) {
        int columnPosition = natTable.getColumnPositionByX(currentEvent.x);
        int rowPosition = natTable.getRowPositionByY(currentEvent.y);
        ILayerCell cell = natTable.getCellByPosition(columnPosition,
                rowPosition);

        Rectangle cellBounds = cell.getBounds();
        xOffset = currentEvent.x - cellBounds.x;
        yOffset = currentEvent.y - cellBounds.y;
        Image image = new Image(natTable.getDisplay(), cellBounds.width,
                cellBounds.height);

        GC gc = new GC(image);
        IConfigRegistry configRegistry = natTable.getConfigRegistry();
        ICellPainter cellPainter = cell.getLayer().getCellPainter(
                columnPosition, rowPosition, cell, configRegistry);
        if (cellPainter != null) {
            cellPainter.paintCell(cell, gc, new Rectangle(0, 0,
                    cellBounds.width, cellBounds.height), configRegistry);
        }
View Full Code Here

                        DisplayMode.NORMAL,
                        layer.getConfigLabelsByPosition(columnPosition,
                                rowPosition).getLabels());
        Object dataValue = null;
        if (displayConverter != null) {
            ILayerCell cell = layer.getCellByPosition(columnPosition,
                    rowPosition);
            if (cell != null) {
                dataValue = displayConverter.canonicalToDisplayValue(cell,
                        configRegistry, cell.getDataValue());
            }
        }

        // Compare with valueToMatch
        if (dataValue instanceof Comparable<?>) {
View Full Code Here

     */
    private static int getPreferredColumnWidth(ILayer layer,
            int columnPosition, IConfigRegistry configRegistry, GC gc) {
        ICellPainter painter;
        int maxWidth = 0;
        ILayerCell cell;

        for (int rowPosition = 0; rowPosition < layer.getRowCount(); rowPosition++) {
            cell = layer.getCellByPosition(columnPosition, rowPosition);
            if (cell != null) {
                boolean atEndOfCellSpan = cell.getOriginColumnPosition()
                        + cell.getColumnSpan() - 1 == columnPosition;
                if (atEndOfCellSpan) {
                    painter = layer.getCellPainter(cell.getColumnPosition(),
                            cell.getRowPosition(), cell, configRegistry);
                    if (painter != null) {
                        int preferredWidth = painter.getPreferredWidth(cell,
                                gc, configRegistry);

                        // Adjust width
                        Rectangle bounds = cell.getBounds();
                        bounds.width = preferredWidth;
                        Rectangle adjustedCellBounds = cell
                                .getLayer()
                                .getLayerPainter()
                                .adjustCellBounds(columnPosition, rowPosition,
                                        bounds);
                        preferredWidth += preferredWidth
                                - adjustedCellBounds.width;

                        if (cell.getColumnSpan() > 1) {
                            int columnStartX = layer
                                    .getStartXOfColumnPosition(columnPosition);
                            int cellStartX = layer
                                    .getStartXOfColumnPosition(cell
                                            .getOriginColumnPosition());
                            preferredWidth = Math.max(0, preferredWidth
                                    - (columnStartX - cellStartX));
                        }

View Full Code Here

    private static int getPreferredRowHeight(ILayer layer, int rowPosition,
            IConfigRegistry configRegistry, GC gc) {
        int maxHeight = 0;
        ICellPainter painter;
        ILayerCell cell;

        for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) {
            cell = layer.getCellByPosition(columnPosition, rowPosition);
            if (cell != null) {
                boolean atEndOfCellSpan = cell.getOriginRowPosition()
                        + cell.getRowSpan() - 1 == rowPosition;
                if (atEndOfCellSpan) {
                    painter = layer.getCellPainter(cell.getColumnPosition(),
                            cell.getRowPosition(), cell, configRegistry);
                    if (painter != null) {
                        int preferredHeight = painter.getPreferredHeight(cell,
                                gc, configRegistry);

                        // Adjust height
                        Rectangle bounds = cell.getBounds();
                        bounds.height = preferredHeight;
                        Rectangle adjustedCellBounds = cell
                                .getLayer()
                                .getLayerPainter()
                                .adjustCellBounds(columnPosition, rowPosition,
                                        bounds);
                        preferredHeight += preferredHeight
                                - adjustedCellBounds.height;

                        if (cell.getColumnSpan() > 1) {
                            int rowStartY = layer
                                    .getStartYOfRowPosition(rowPosition);
                            int cellStartY = layer.getStartYOfRowPosition(cell
                                    .getOriginRowPosition());
                            preferredHeight = Math.max(0, preferredHeight
                                    - (rowStartY - cellStartY));
                        }
View Full Code Here

        if (!blinkingEnabled) {
            return getUnderlyingLayer().getConfigLabelsByPosition(
                    columnPosition, rowPosition);
        }

        ILayerCell cell = underlyingLayer.getCellByPosition(columnPosition,
                rowPosition);

        int columnIndex = getUnderlyingLayer().getColumnIndexByPosition(
                columnPosition);
        String columnProperty = columnPropertyResolver
View Full Code Here

    private String getTextForSelection(PositionCoordinate selection) {
        if (selectionLayer == null || selection == null
                || selection.columnPosition == SelectionLayer.NO_SELECTION) {
            return ""; //$NON-NLS-1$
        }
        final ILayerCell cell = selectionLayer.getCellByPosition(
                selection.columnPosition, selection.rowPosition);
        return cell == null ? "" : cell.getDataValue().toString(); //$NON-NLS-1$
    }
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.