Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Dimensions


     * because it will never be called to use them.
     */
    public class TabButtonSkin extends ButtonSkin {
        @Override
        public int getPreferredWidth(int height) {
            Dimensions preferredSize = getPreferredSize();
            return preferredSize.width;
        }
View Full Code Here


            return preferredSize.width;
        }

        @Override
        public int getPreferredHeight(int width) {
            Dimensions preferredSize = getPreferredSize();
            return preferredSize.height;
        }
View Full Code Here

            TabButton tabButton = (TabButton)getComponent();

            Button.DataRenderer dataRenderer = tabButton.getDataRenderer();
            dataRenderer.render(tabButton.getButtonData(), tabButton, false);

            Dimensions preferredContentSize = dataRenderer.getPreferredSize();

            int preferredWidth = 0;
            int preferredHeight = 0;
            switch (tabOrientation) {
                case HORIZONTAL: {
                    preferredWidth = preferredContentSize.width
                        + buttonPadding.left + buttonPadding.right + 2;

                    preferredHeight = preferredContentSize.height
                        + buttonPadding.top + buttonPadding.bottom + 2;

                    break;
                }

                case VERTICAL: {
                    preferredWidth = preferredContentSize.height
                        + buttonPadding.top + buttonPadding.bottom + 2;

                    preferredHeight = preferredContentSize.width
                        + buttonPadding.left + buttonPadding.right + 2;

                    break;
                }
            }

            Dimensions preferredSize = new Dimensions(preferredWidth, preferredHeight);
            return preferredSize;
        }
View Full Code Here

        Sheet sheet = (Sheet)getComponent();
        Component content = sheet.getContent();

        if (content != null) {
            Dimensions preferredContentSize = content.getPreferredSize();
            preferredWidth = preferredContentSize.width;
            preferredHeight = preferredContentSize.height;
        }

        preferredWidth += (padding.left + padding.right + 2);
        preferredHeight += (padding.top + padding.bottom + 2);

        Dimensions preferredSize = new Dimensions(preferredWidth, preferredHeight);

        return preferredSize;
    }
View Full Code Here

        ListButton listButton = (ListButton)getComponent();
        Button.DataRenderer dataRenderer = listButton.getDataRenderer();

        // Determine the preferred width and height of the current button data
        dataRenderer.render(listButton.getButtonData(), listButton, false);
        Dimensions contentSize = dataRenderer.getPreferredSize();
        int preferredWidth = contentSize.width;
        int preferredHeight = contentSize.height + padding.top + padding.bottom + 2;

        // The preferred width of the button is the max. width of the rendered
        // content plus padding and the trigger width
        List<?> listData = listButton.getListData();
        for (Object item : listData) {
            dataRenderer.render(item, listButton, false);
            preferredWidth = Math.max(preferredWidth, dataRenderer.getPreferredWidth(-1));
        }

        preferredWidth += TRIGGER_WIDTH + padding.left + padding.right + 2;

        return new Dimensions(preferredWidth, preferredHeight);
    }
View Full Code Here

                    }

                    // Ensure that the popup remains within the bounds of the display
                    Point buttonLocation = listButton.mapPointToAncestor(display, 0, 0);

                    Dimensions displaySize = display.getSize();

                    listViewPopup.setPreferredSize(-1, -1);
                    Dimensions popupSize = listViewPopup.getPreferredSize();
                    int popupWidth = Math.max(popupSize.width, listButton.getWidth() - TRIGGER_WIDTH - 1);
                    int popupHeight = popupSize.height;

                    int x = buttonLocation.x;
                    if (popupWidth > width
View Full Code Here

        // If meter has no content, its preferred size is hard coded by the class
        preferredWidth = Math.max(preferredWidth, DEFAULT_WIDTH);
        preferredHeight = Math.max(preferredHeight, DEFAULT_HEIGHT);

        Dimensions preferredSize;
        if (meter.getOrientation() == Orientation.HORIZONTAL) {
            preferredSize = new Dimensions(preferredWidth, preferredHeight);
        } else {
            preferredSize = new Dimensions(preferredHeight, preferredWidth);
        }

        return preferredSize;
    }
View Full Code Here

            if (display != null) {
                Bounds decoratedBounds = sheet.getDecoratedBounds();
                display.repaint(decoratedBounds.x, decoratedBounds.y,
                    decoratedBounds.width, decoratedBounds.height + dy);

                Dimensions size = sheet.getPreferredSize();
                dy = -(int)(size.height * scale);
                translationDecorator.setY(dy);

                display.repaint(decoratedBounds.x, decoratedBounds.y,
                    decoratedBounds.width, decoratedBounds.height + dy);
View Full Code Here

        }

        preferredWidth += margin.left + margin.right;
        preferredHeight += margin.top + margin.bottom;

        return new Dimensions(preferredWidth, preferredHeight);
    }
View Full Code Here

        GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext,
            new int[] {missingGlyphCode});
        Rectangle2D textBounds = missingGlyphVector.getLogicalBounds();

        Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext);
        averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()),
            (int)Math.ceil(maxCharBounds.getHeight()));

        invalidateComponent();
    }
View Full Code Here

TOP

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

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.