Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Bounds


        return columnIndex;
    }

    @Override
    public Bounds getRowBounds(int rowIndex) {
        return new Bounds(0, getRowY(rowIndex), getWidth(), getRowHeight(rowIndex));
    }
View Full Code Here


        int columnX = 0;
        for (int i = 0; i < columnIndex; i++) {
            columnX += (columnWidths.get(i) + 1);
        }

        return new Bounds(columnX, 0, columnWidths.get(columnIndex), getHeight());
    }
View Full Code Here

            cellX += (columnWidths.get(i) + 1);
        }

        int rowHeight = getRowHeight(rowIndex);

        return new Bounds(cellX, rowIndex * (rowHeight + 1), columnWidths.get(columnIndex), rowHeight);
    }
View Full Code Here

    public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount,
        int wheelRotation, int x, int y) {
        TableView tableView = (TableView)getComponent();

        if (highlightedIndex != -1) {
            Bounds rowBounds = getRowBounds(highlightedIndex);

            highlightedIndex = -1;

            if (tableView.getSelectMode() != TableView.SelectMode.NONE
                && showHighlight) {
View Full Code Here

        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            TextArea textArea = (TextArea)getComponent();

            Bounds visibleArea = textArea.getVisibleArea();
            visibleArea = new Bounds(visibleArea.x, visibleArea.y,
                visibleArea.width, visibleArea.height);

            if (y >= visibleArea.y
                && y < visibleArea.y + visibleArea.height) {
                // Stop the scroll selection timer
View Full Code Here

                    } else {
                        // Get next insertion point from right edge of trailing selection
                        // character
                        from = selectionStart + selectionLength - 1;

                        Bounds trailingSelectionBounds = getCharacterBounds(from);
                        x = trailingSelectionBounds.x + trailingSelectionBounds.width;
                    }

                    int offset = getNextInsertionPoint(x, from, Direction.FORWARD);
View Full Code Here

            TextArea textArea = (TextArea)getComponent();

            // Update the caret
            int selectionStart = textArea.getSelectionStart();

            Bounds leadingSelectionBounds = getCharacterBounds(selectionStart);
            caret = leadingSelectionBounds.toRectangle();
            caret.width = 1;

            // Update the selection
            int selectionLength = textArea.getSelectionLength();

            if (selectionLength > 0) {
                int selectionEnd = selectionStart + selectionLength - 1;
                Bounds trailingSelectionBounds = getCharacterBounds(selectionEnd);
                selection = new Area();

                int firstRowIndex = getRowIndex(selectionStart);
                int lastRowIndex = getRowIndex(selectionEnd);
View Full Code Here

            // Redraw the region currently occupied by this view
            repaint();
        }

        public Bounds getBounds() {
            return new Bounds(x, y, width, height);
        }
View Full Code Here

        }

        @Override
        public void paint(Graphics2D graphics) {
            // Determine the paint bounds
            Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight());
            Rectangle clipBounds = graphics.getClipBounds();
            if (clipBounds != null) {
                paintBounds = paintBounds.intersect(new Bounds(clipBounds));
            }

            for (NodeView nodeView : nodeViews) {
                Bounds nodeViewBounds = nodeView.getBounds();

                // Only paint node views that intersect the current clip rectangle
                if (nodeViewBounds.intersects(paintBounds)) {
                    // Create a copy of the current graphics context and
                    // translate to the node view's coordinate system
                    Graphics2D nodeViewGraphics = (Graphics2D)graphics.create();
                    nodeViewGraphics.translate(nodeViewBounds.x, nodeViewBounds.y);
View Full Code Here

            }
        }

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

            for (int i = 0, n = nodeViews.getLength(); i < n; i++) {
                NodeView nodeView = nodeViews.get(i);
                int nodeViewOffset = nodeView.getOffset();
                int characterCount = nodeView.getCharacterCount();

                if (offset >= nodeViewOffset
                    && offset < nodeViewOffset + characterCount) {
                    characterBounds = nodeView.getCharacterBounds(offset - nodeViewOffset);

                    if (characterBounds != null) {
                        characterBounds = characterBounds.translate(nodeView.getX(), nodeView.getY());
                    }

                    break;
                }
            }

            if (characterBounds != null) {
                characterBounds = characterBounds.intersect(0, 0, getWidth(), getHeight());
            }

            return characterBounds;
        }
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.