Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Bounds


                x += westButtonWidth;
                width -= westButtonWidth;
            }
        }

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


        // Paint the content
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_OFF);

        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));
        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();

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

        // Paint the border
        if (borderColorLocal != null) {
            graphics.setPaint(borderColorLocal);
            graphics.setStroke(new BasicStroke(1));
            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1,
                CORNER_RADIUS, CORNER_RADIUS));
        }

        // Paint the focus state
        if (menuButton.isFocused()
            && !toolbar) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
            graphics.setStroke(dashStroke);
            graphics.setColor(this.borderColor);
            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0),
                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));
        }

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

        // Paint the trigger
        GeneralPath triggerIconShape = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        triggerIconShape.moveTo(0, 0);
        triggerIconShape.lineTo(3, 3);
        triggerIconShape.lineTo(6, 0);
        triggerIconShape.closePath();

        Graphics2D triggerGraphics = (Graphics2D)graphics.create();
        triggerGraphics.setStroke(new BasicStroke(0));
        triggerGraphics.setPaint(colorLocal);

        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + TRIGGER_WIDTH), 0),
            0, TRIGGER_WIDTH, Math.max(height - (padding.top - padding.bottom), 0));
        int tx = triggerBounds.x + (triggerBounds.width - triggerIconShape.getBounds().width) / 2;
        int ty = triggerBounds.y + (triggerBounds.height - triggerIconShape.getBounds().height) / 2;
        triggerGraphics.translate(tx, ty);
View Full Code Here

            // Draw the border
            graphics.setPaint(titleBarBorderColorLocal);
            GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 2);

            // Draw the content area
            Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2,
                width, height - (titleBarHeight + 2));
            graphics.setPaint(contentBorderColor);
            GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y,
                contentAreaRectangle.width, contentAreaRectangle.height);
View Full Code Here

        int titleBarHeight = titleBarTablePane.getHeight();

        Frame frame = (Frame)getComponent();
        boolean maximized = frame.isMaximized();

        Bounds clientArea;
        if (maximized
            && !getShowWindowControls()) {
            clientArea = new Bounds(0, 0, width, height);
        } else {
            clientArea = new Bounds(0, titleBarHeight + 2, width, height - (titleBarHeight + 2));
        }

        return clientArea;
    }
View Full Code Here

        Frame frame = (Frame)getComponent();
        boolean maximized = frame.isMaximized();

        if (button == Mouse.Button.LEFT
            && !maximized) {
            Bounds titleBarBounds = titleBarTablePane.getBounds();

            if (titleBarBounds.contains(x, y)) {
                dragOffset = new Point(x, y);
                Mouse.capture(component);
            } else {
                if (resizable && x > resizeHandle.getX() && y > resizeHandle.getY()) {
                    resizeOffset = new Point(getWidth() - x, getHeight() - y);
View Full Code Here

            if (selectedRanges.getLength() > 0) {
                int rangeStart = selectedRanges.get(0).start;
                int rangeEnd = selectedRanges.get(selectedRanges.getLength() - 1).end;

                Bounds selectionBounds = getItemBounds(rangeStart);
                selectionBounds = selectionBounds.union(getItemBounds(rangeEnd));

                Bounds visibleSelectionBounds = listView.getVisibleArea(selectionBounds);
                if (visibleSelectionBounds != null
                    && visibleSelectionBounds.height < selectionBounds.height) {
                    listView.scrollAreaToVisible(selectionBounds);
                }
            }
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 (highlightIndex != -1
            && listView.getSelectMode() != ListView.SelectMode.NONE
            && showHighlight) {
            Bounds itemBounds = getItemBounds(highlightIndex);
            repaintComponent(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height);
        }

        highlightIndex = -1;
        selectIndex = -1;
View Full Code Here

        return consumed;
    }

    private Bounds getCheckboxBounds(int itemIndex) {
        Bounds itemBounds = getItemBounds(itemIndex);

        int checkboxHeight = CHECKBOX.getHeight();
        return new Bounds(checkboxPadding.left,
            itemBounds.y + (itemBounds.height - checkboxHeight) / 2,
            CHECKBOX.getWidth(),
            checkboxHeight);
    }
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 (highlightIndex != -1) {
            Bounds itemBounds = getItemBounds(highlightIndex);

            highlightIndex = -1;

            if (listView.getSelectMode() != ListView.SelectMode.NONE
                && showHighlight) {
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.