Package pivot.wtk

Examples of pivot.wtk.Dimensions


        }

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

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


    public Dimensions getPreferredSize() {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        return (image == null) ? new Dimensions(0, 0) : new Dimensions(image.getWidth(),
            image.getHeight());
    }
View Full Code Here

        if (image != null) {
            int width = getWidth();
            int height = getHeight();

            Dimensions imageSize = image.getSize();

            if (horizontalAlignment == HorizontalAlignment.JUSTIFY) {
                imageX = 0;
                scaleX = (float)width / (float)imageSize.width;
            } else {
View Full Code Here

                Component content = calendarPopup.getContent();

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

                Dimensions displaySize = display.getSize();
                Dimensions popupSize = content.getPreferredSize();
                int popupHeight = popupSize.height;

                int x = buttonLocation.x;
                if (popupSize.width > width
                    && x + popupSize.width > displaySize.width) {
View Full Code Here

    public int getPreferredWidth(int height) {
        int preferredWidth = 0;

        if (sizeToSelection
            || height == -1) {
            Dimensions preferredSize = getPreferredSize();
            preferredWidth = preferredSize.width;
        } else {
            CardPane cardPane = (CardPane)getComponent();
            for (Component card : cardPane) {
                preferredWidth = Math.max(preferredWidth, card.getPreferredWidth(height));
View Full Code Here

    public int getPreferredHeight(int width) {
        int preferredHeight = 0;

        if (sizeToSelection
            || width == -1) {
            Dimensions preferredSize = getPreferredSize();
            preferredHeight = preferredSize.height;
        } else {
            CardPane cardPane = (CardPane)getComponent();
            for (Component card : cardPane) {
                preferredHeight = Math.max(preferredHeight, card.getPreferredHeight(width));
View Full Code Here

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        Dimensions preferredSize;

        CardPane cardPane = (CardPane)getComponent();

        if (sizeToSelection) {
            if (selectionChangeTransition == null) {
                Component selectedCard = cardPane.getSelectedCard();

                if (selectedCard == null) {
                    preferredSize = new Dimensions(0, 0);
                } else {
                    preferredSize = selectedCard.getPreferredSize();
                }
            } else {
                float percentComplete = selectionChangeTransition.getPercentComplete();

                int previousWidth;
                int previousHeight;
                if (selectionChangeTransition.fromCard == null) {
                    previousWidth = 0;
                    previousHeight = 0;
                } else {
                    Dimensions fromSize = selectionChangeTransition.fromCard.getPreferredSize();
                    previousWidth = fromSize.width;
                    previousHeight = fromSize.height;
                }

                int width;
                int height;
                if (selectionChangeTransition.toCard == null) {
                    width = 0;
                    height = 0;
                } else {
                    Dimensions toSize = selectionChangeTransition.toCard.getPreferredSize();
                    width = toSize.width;
                    height = toSize.height;
                }

                int preferredWidth = previousWidth + (int)((float)(width - previousWidth) * percentComplete);
                int preferredHeight = previousHeight + (int)((float)(height - previousHeight) * percentComplete);

                preferredSize = new Dimensions(preferredWidth, preferredHeight);
            }
        } else {
            int preferredWidth = 0;
            int preferredHeight = 0;

            for (Component card : cardPane) {
                Dimensions cardSize = card.getPreferredSize();

                preferredWidth = Math.max(cardSize.width, preferredWidth);
                preferredHeight = Math.max(cardSize.height, preferredHeight);
            }

            preferredSize = new Dimensions(preferredWidth, preferredHeight);
        }

        return preferredSize;
    }
View Full Code Here

        if (documentView == null) {
            preferredWidth = 0;
            preferredHeight = 0;
        } else {
            documentView.setBreakWidth(Integer.MAX_VALUE);
            Dimensions preferredSize = documentView.getSize();
            preferredWidth = preferredSize.width + (margin.left + margin.right);
            preferredHeight = preferredSize.height + (margin.top + margin.bottom);
        }

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

        public Dimensions getSize(boolean validate) {
            if (validate) {
                validate();
            }

            return new Dimensions(width, height);
        }
View Full Code Here

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        // TODO Optimize by performing calcuations locally
        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }
View Full Code Here

TOP

Related Classes of 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.