Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Bounds


        public int getInsertionPoint(int x, int y) {
            int offset = -1;

            for (int i = 0, n = getLength(); i < n; i++) {
                NodeView nodeView = get(i);
                Bounds nodeViewBounds = nodeView.getBounds();

                if (y >= nodeViewBounds.y
                    && y < nodeViewBounds.y + nodeViewBounds.height) {
                    offset = nodeView.getInsertionPoint(x - nodeView.getX(), y - nodeView.getY())
                        + nodeView.getOffset();
View Full Code Here


                    terminatorY = 0;
                } else {
                    terminatorY = height - terminatorHeight;
                }

                terminatorBounds = new Bounds(x, terminatorY,
                    PARAGRAPH_TERMINATOR_WIDTH, terminatorHeight);

                // Ensure that the paragraph is visible even when empty
                width += terminatorBounds.width;
                height = Math.max(height, terminatorBounds.height);
View Full Code Here

                            if (offset < getCharacterCount() - 1) {
                                offset--;
                            }
                        } else {
                            for (NodeView nodeView : row.nodeViews) {
                                Bounds nodeViewBounds = nodeView.getBounds();

                                if (nodeViewBounds.contains(x, y)) {
                                    offset = nodeView.getInsertionPoint(x - nodeView.getX(), y - nodeView.getY())
                                        + nodeView.getOffset();
                                    break;
                                }
                            }
View Full Code Here

                    && i < n) {
                    // Find the node view that contains x and get the insertion point from it
                    Row row = rows.get(i);

                    for (NodeView nodeView : row.nodeViews) {
                        Bounds bounds = nodeView.getBounds();
                        if (x >= bounds.x
                            && x < bounds.x + bounds.width) {
                            offset = nodeView.getNextInsertionPoint(x - nodeView.getX(), -1, direction)
                                + nodeView.getOffset();
                            break;
View Full Code Here

            return Math.max(rows.getLength(), 1);
        }

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

            if (offset == getCharacterCount() - 1) {
                bounds = terminatorBounds;
            } else {
                bounds = super.getCharacterBounds(offset);
View Full Code Here

        if (borderColor != null) {
            graphics.setPaint(borderColor);
            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
        }

        Bounds contentBounds = new Bounds(padding.left + 1, padding.top + 1,
            Math.max(width - (padding.left + padding.right + spacing + TRIGGER_WIDTH + 2), 0),
            Math.max(height - (padding.top + padding.bottom + 2), 0));

        // Paint the content
        Button.DataRenderer dataRenderer = menuButton.getDataRenderer();
        dataRenderer.render(menuButton.getButtonData(), menuButton, highlighted);
        dataRenderer.setSize(contentBounds.width, contentBounds.height);

        Graphics2D contentGraphics = (Graphics2D)graphics.create();
        contentGraphics.translate(contentBounds.x, contentBounds.y);
        contentGraphics.clipRect(0, 0, contentBounds.width, contentBounds.height);
        dataRenderer.paint(contentGraphics);
        contentGraphics.dispose();

        // Paint the trigger
        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + TRIGGER_WIDTH), 0),
            0, TRIGGER_WIDTH, Math.max(height - (padding.top - padding.bottom), 0));

        GeneralPath triggerIconShape = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        triggerIconShape.moveTo(0, 0);
        triggerIconShape.lineTo(3, 3);
View Full Code Here

                    int width = getWidth();
                    int height = getHeight();

                    int x0;
                    if (selectionRange.start > characterRange.start) {
                        Bounds leadingSelectionBounds = getCharacterBounds(selectionRange.start - documentOffset);
                        x0 = leadingSelectionBounds.x;
                    } else {
                        x0 = 0;
                    }

                    int x1;
                    if (selectionRange.end < characterRange.end) {
                        Bounds trailingSelectionBounds = getCharacterBounds(selectionRange.end - documentOffset);
                        x1 = trailingSelectionBounds.x + trailingSelectionBounds.width;
                    } else {
                        x1 = width;
                    }
View Full Code Here

        @Override
        public Bounds getCharacterBounds(int offset) {
            Shape glyphBounds = glyphVector.getGlyphLogicalBounds(offset);
            Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();

            return new Bounds((int)Math.floor(glyphBounds2D.getX()), 0,
                (int)Math.ceil(glyphBounds2D.getWidth()), getHeight());
        }
View Full Code Here

            return 0;
        }

        @Override
        public Bounds getCharacterBounds(int offset) {
            return new Bounds(0, 0, getWidth(), getHeight());
        }
View Full Code Here

    /**
     * Repositions the popup to be located over the row being edited.
     */
    private void reposition() {
        // Get the cell bounds
        Bounds cellBounds = tableView.getCellBounds(rowIndex, columnIndex);
        tableView.scrollAreaToVisible(cellBounds);
        cellBounds = tableView.getVisibleArea(cellBounds);
        Point displayCoordinates = tableView.mapPointToAncestor(tableView.getDisplay(),
            cellBounds.x, cellBounds.y);

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.