Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Bounds


        return rowCount;
    }

    @Override
    public Bounds getCharacterBounds(int offset) {
        Bounds characterBounds;

        if (documentView == null) {
            characterBounds = null;
        } else {
            characterBounds = documentView.getCharacterBounds(offset);

            if (characterBounds != null) {
                characterBounds = characterBounds.translate(margin.left, margin.top);
            }
        }

        return characterBounds;
    }
View Full Code Here


        return characterBounds;
    }

    private void scrollCharacterToVisible(int offset) {
        TextArea textArea = (TextArea)getComponent();
        Bounds characterBounds = getCharacterBounds(offset);

        if (characterBounds != null) {
            textArea.scrollAreaToVisible(characterBounds.x, characterBounds.y,
                characterBounds.width, characterBounds.height);
        }
View Full Code Here

        /**
         * Repositions this editor popup to be over the row being edited.
         */
        private void reposition() {
            // Calculate the visible bounds of the row
            Bounds bounds = tableView.getRowBounds(rowIndex);
            tableView.scrollAreaToVisible(bounds);
            bounds = tableView.getVisibleArea(bounds);
            Point displayCoordinates = tableView.mapPointToAncestor(tableView.getDisplay(),
                bounds.x, bounds.y);

View Full Code Here

    }

    @Override
    public Bounds getRowBounds(int row) {
        if (rowHeights == null) {
            return new Bounds(0, 0, 0, 0);
        }

        if (row < 0
            || row >= rowHeights.length) {
            throw new IndexOutOfBoundsException(String.valueOf(row));
        }

        int rowY = padding.top;

        for (int i = 0; i < row; i++) {
            rowY += rowHeights[i] + verticalSpacing;
        }

        return new Bounds(0, rowY, getWidth(), rowHeights[row]);
    }
View Full Code Here

    }

    @Override
    public Bounds getColumnBounds(int column) {
        if (columnWidths == null) {
            return new Bounds(0, 0, 0, 0);
        }

        if (column < 0
            || column >= columnWidths.length) {
            throw new IndexOutOfBoundsException(String.valueOf(column));
        }

        int columnX = padding.left;

        for (int j = 0; j < column; j++) {
            columnX += columnWidths[j] + horizontalSpacing;
        }

        return new Bounds(columnX, 0, columnWidths[column], getHeight());
    }
View Full Code Here

        return offset;
    }

    public Bounds getCharacterBounds(int offset) {
        Bounds characterBounds = null;

        if (glyphVector != null) {
            Shape glyphBounds = glyphVector.getGlyphLogicalBounds(offset);
            Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();

            int x = (int)Math.floor(glyphBounds2D.getX()) + padding.left - scrollLeft + 1;
            int y = padding.top + 1;
            int width = (int)Math.ceil(glyphBounds2D.getWidth());
            int height = getHeight() - (padding.top + padding.bottom + 2);

            characterBounds = new Bounds(x, y, width, height);
        }

        return characterBounds;
    }
View Full Code Here

        repaintComponent();
    }

    private void scrollCharacterToVisible(int offset) {
        int width = getWidth();
        Bounds characterBounds = getCharacterBounds(offset);

        if (characterBounds != null) {
            int glyphX = characterBounds.x - (padding.left + 1) + scrollLeft;

            if (characterBounds.x < padding.left + 1) {
View Full Code Here

        int selectionLength = textInput.getSelectionLength();

        TextNode textNode = textInput.getTextNode();
        int n = textNode.getCharacterCount();

        Bounds leadingSelectionBounds;
        if (selectionStart < n) {
            leadingSelectionBounds = getCharacterBounds(selectionStart);
        } else {
            // The insertion point is after the last character
            int x;
            if (n == 0) {
                x = padding.left - scrollLeft + 1;
            } else {
                Rectangle2D textBounds = glyphVector.getLogicalBounds();
                x = (int)Math.ceil(textBounds.getWidth()) + (padding.left - scrollLeft + 1);
            }

            int y = padding.top + 1;

            leadingSelectionBounds = new Bounds(x, y, 0, height - (padding.top + padding.bottom + 2));
        }

        caret = leadingSelectionBounds.toRectangle();
        caret.width = 1;

        if (selectionLength > 0) {
            Bounds trailingSelectionBounds = getCharacterBounds(selectionStart
                + selectionLength - 1);
            selection = new Rectangle(leadingSelectionBounds.x, leadingSelectionBounds.y,
                trailingSelectionBounds.x + trailingSelectionBounds.width - leadingSelectionBounds.x,
                trailingSelectionBounds.y + trailingSelectionBounds.height - leadingSelectionBounds.y);
        } else {
View Full Code Here

    @Override
    public boolean contains(int x, int y) {
        // TODO Perform hit testing on the glyph vectors themselves

        Bounds bounds = getBounds();

        return (x >= 0
            && x < bounds.width
            && y >= 0
            && y < bounds.height);
View Full Code Here

        graphics.fillRect(0, 0, width, height);

        // Paint the border
        graphics.setPaint(borderColor);

        Bounds contentBounds = new Bounds(0, 0,
            Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
            contentBounds.width + 1, contentBounds.height + 1);

        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 0), 0, TRIGGER_WIDTH,
            Math.max(height - 1, 0));
        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
            triggerBounds.width + 1, triggerBounds.height + 1);

        // Paint the content
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Bounds

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.