Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Bounds


            super.stateChanged(button, previousState);
            invalidateComponent();
        }

        public Bounds getCloseTriggerBounds() {
            Bounds bounds = null;

            // Include an extra 2 pixels around the trigger for ease of use
            switch (tabOrientation) {
                case HORIZONTAL: {
                    bounds = new Bounds(getWidth() - (CLOSE_TRIGGER_SIZE + buttonPadding.right + 1) - 2,
                        (getHeight() - CLOSE_TRIGGER_SIZE) / 2 - 2,
                        CLOSE_TRIGGER_SIZE + 4, CLOSE_TRIGGER_SIZE + 4);
                    break;
                }

                case VERTICAL: {
                    bounds = new Bounds((getWidth() - CLOSE_TRIGGER_SIZE) / 2 - 2,
                        getHeight() - (CLOSE_TRIGGER_SIZE + buttonPadding.bottom + 1) - 2,
                        CLOSE_TRIGGER_SIZE + 4, CLOSE_TRIGGER_SIZE + 4);
                    break;
                }
View Full Code Here


    @Override
    public void paint(Graphics2D graphics) {
        TabPane tabPane = (TabPane)getComponent();

        Bounds tabPaneBounds = tabPane.getBounds();

        // Call the base class to paint the background
        super.paint(graphics);

        // Paint the content background and border
        int x = 0;
        int y = 0;
        int width = 0;
        int height = 0;

        switch (tabOrientation) {
            case HORIZONTAL: {
                x = 0;
                y = Math.max(tabButtonPanorama.getY() + tabButtonPanorama.getHeight() - 1, 0);
                width = tabPaneBounds.width;
                height = Math.max(tabPaneBounds.height - y, 0);

                break;
            }

            case VERTICAL: {
                x = Math.max(tabButtonPanorama.getX() + tabButtonPanorama.getWidth() - 1, 0);
                y = 0;
                width = Math.max(tabPaneBounds.width - x, 0);
                height = tabPaneBounds.height;

                break;
            }

            default: {
                break;
            }
        }

        TabButton activeTabButton;
        if (selectionChangeTransition == null) {
            activeTabButton = (TabButton)tabButtonGroup.getSelection();
        } else {
            activeTabButton = (TabButton)tabButtonBoxPane.get(selectionChangeTransition.index);
        }

        if (activeTabButton != null) {
            Bounds contentBounds = new Bounds(x, y, width, height);

            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

            // Paint the background
View Full Code Here

        if (verticalScrollBar.isVisible()) {
            width -= verticalScrollBar.getWidth();
        }

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

        int scrollTop = scrollPane.getScrollTop();

        if (view != null
            && view.isShowing()
            && isOptimizeScrolling()) {
            Bounds blitArea = view.getVisibleArea();

            int blitX = blitArea.x + view.getX();
            int blitY = blitArea.y + view.getY();
            int blitWidth = blitArea.width;
            int blitHeight = blitArea.height;

            if (rowHeader != null) {
                // Blit the row header as well
                int rowHeaderWidth = rowHeader.getWidth();
                blitX -= rowHeaderWidth;
                blitWidth += rowHeaderWidth;
            }

            int deltaScrollTop = scrollTop - previousScrollTop;
            blitY += Math.max(deltaScrollTop, 0);
            blitHeight -= Math.abs(deltaScrollTop);

            Graphics2D graphics = scrollPane.getGraphics();
            graphics.copyArea(blitX, blitY, blitWidth, blitHeight, 0, -deltaScrollTop);

            scrollPane.setConsumeRepaint(true);

            try {
                view.setLocation(view.getX(), columnHeaderHeight - scrollTop);

                if (rowHeader != null) {
                    rowHeader.setLocation(0, columnHeaderHeight - scrollTop);
                }
            } finally {
                scrollPane.setConsumeRepaint(false);
            }

            boolean repaintAllViewport = scrollPane.isRepaintAllViewport();
            if (!repaintAllViewport) {
                scrollPane.repaint(blitX, (columnHeaderHeight + (deltaScrollTop > 0 ? blitHeight : 0)),
                    blitWidth, Math.abs(deltaScrollTop), true);
            } else {
                Bounds viewportBounds = getViewportBounds();
                scrollPane.repaint(viewportBounds.x, viewportBounds.y,
                    viewportBounds.width, viewportBounds.height, true);
            }

        } else {
View Full Code Here

        int scrollLeft = scrollPane.getScrollLeft();

        if (view != null
            && view.isShowing()
            && isOptimizeScrolling()) {
            Bounds blitArea = view.getVisibleArea();

            int blitX = blitArea.x + view.getX();
            int blitY = blitArea.y + view.getY();
            int blitWidth = blitArea.width;
            int blitHeight = blitArea.height;

            if (columnHeader != null) {
                // Blit the column header as well
                int columnHeaderHeight = columnHeader.getHeight();
                blitY -= columnHeaderHeight;
                blitHeight += columnHeaderHeight;
            }

            int deltaScrollLeft = scrollLeft - previousScrollLeft;
            blitX += Math.max(deltaScrollLeft, 0);
            blitWidth -= Math.abs(deltaScrollLeft);

            Graphics2D graphics = scrollPane.getGraphics();
            graphics.copyArea(blitX, blitY, blitWidth, blitHeight, -deltaScrollLeft, 0);

            scrollPane.setConsumeRepaint(true);
            try {
                view.setLocation(rowHeaderWidth - scrollLeft, view.getY());

                if (columnHeader != null) {
                    columnHeader.setLocation(rowHeaderWidth - scrollLeft, 0);
                }
            } finally {
                scrollPane.setConsumeRepaint(false);
            }

            boolean repaintAllViewport = scrollPane.isRepaintAllViewport();
            if (!repaintAllViewport) {
                scrollPane.repaint(rowHeaderWidth + (deltaScrollLeft > 0 ? blitWidth : 0), blitY,
                    Math.abs(deltaScrollLeft), blitHeight, true);
            } else {
                Bounds viewportBounds = getViewportBounds();
                scrollPane.repaint(viewportBounds.x, viewportBounds.y,
                    viewportBounds.width, viewportBounds.height, true);
            }
        } else {
            if (view != null) {
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

        return index;
    }

    @Override
    public Bounds getItemBounds(int index) {
        return new Bounds(0, getItemY(index), getWidth(), getItemHeight(index));
    }
View Full Code Here

        ListView listView = (ListView)getComponent();

        if (highlightedIndex != -1
            && listView.getSelectMode() != ListView.SelectMode.NONE
            && showHighlight) {
            Bounds itemBounds = getItemBounds(highlightedIndex);
            repaintComponent(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height);
        }

        highlightedIndex = -1;
        editIndex = -1;
View Full Code Here

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

        if (highlightedIndex != -1) {
            Bounds itemBounds = getItemBounds(highlightedIndex);

            highlightedIndex = -1;

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

        }
    }

    @Override
    public Bounds getClientArea() {
        return new Bounds(0, 0, getWidth(), getHeight());
    }
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.