Package pivot.wtk

Examples of pivot.wtk.Dimensions


        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        Dimensions preferredSize;

        CardPane cardPane = (CardPane)getComponent();

        if (selectionChangeTransition == null) {
            if (matchSelectedCardSize) {
                Component selectedCard = cardPane.getSelectedCard();
                if (selectedCard == null) {
                    preferredSize = new Dimensions(0, 0);
                } else {
                    preferredSize = selectedCard.getPreferredSize();
                }
            } else {
                preferredSize = new Dimensions(0, 0);
                Orientation orientation = cardPane.getOrientation();

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

                    if (selectedIndex != -1
                        || orientation == Orientation.HORIZONTAL) {
                        preferredSize.width = Math.max(cardSize.width, preferredSize.width);
                    }

                    if (selectedIndex != -1
                        || orientation == Orientation.VERTICAL) {
                        preferredSize.height = Math.max(cardSize.height, preferredSize.height);
                    }
                }
            }
        } else {
            float percentComplete = selectionChangeTransition.getPercentComplete();

            int previousWidth;
            int previousHeight;
            Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();

            if (previousSelectedCard == null) {
                previousWidth = 0;
                previousHeight = 0;
            } else {
                previousWidth = previousSelectedCard.getWidth();
                previousHeight = previousSelectedCard.getHeight();
            }

            int width;
            int height;
            Component selectedCard = selectionChangeTransition.getSelectedCard();

            if (selectedCard == null) {
                width = 0;
                height = 0;
            } else {
                width = selectedCard.getWidth();
                height = selectedCard.getHeight();
            }

            int preferredWidth = 0;
            int preferredHeight = 0;

            Orientation orientation = cardPane.getOrientation();

            if (!matchSelectedCardSize
                && orientation == Orientation.HORIZONTAL) {
                preferredWidth = Math.max(previousWidth, width);
            } else {
                preferredWidth = previousWidth + (int)((float)(width - previousWidth)
                    * percentComplete);
            }

            if (!matchSelectedCardSize
                && orientation == Orientation.VERTICAL) {
                preferredHeight = Math.max(previousHeight, height);
            } else {
                preferredHeight = previousHeight + (int)((float)(height - previousHeight)
                    * percentComplete);
            }

            preferredSize = new Dimensions(preferredWidth, preferredHeight);
        }

        return preferredSize;
    }
View Full Code Here


                Display display = menuButton.getDisplay();

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

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

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

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }
View Full Code Here

        this.width = width;
        this.height = height;
    }

    public Dimensions getPreferredSize() {
        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }
View Full Code Here

            if (i > 0) {
                preferredHeight += sectionSpacing;
            }
        }

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

    }

    @Override
    public Dimensions getPreferredSize() {
        // TODO Optimize
        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }
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

        return preferredHeight;
    }

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

        }

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

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

            + spacing * 2;

        int preferredHeight = Math.max(BUTTON_DIAMETER,
            dataRenderer.getPreferredHeight(-1));

        return new Dimensions(preferredWidth, preferredHeight);
    }
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.