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

            TabPane tabPane = (TabPane)TerraTabPaneSkin.this.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;

                    if (tabPane.isCloseable()
                        && tabButton.isSelected()) {
                        preferredWidth += CLOSE_TRIGGER_SIZE + buttonSpacing;
                    }

                    break;
                }

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

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

                    if (tabPane.isCloseable()
                        && tabButton.isSelected()) {
                        preferredHeight += CLOSE_TRIGGER_SIZE + buttonSpacing;
                    }

                    break;
                }

                default: {
                    break;
                }
            }

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

        } else {
           preferredWidth = DEFAULT_THICKNESS;
           preferredHeight = DEFAULT_LENGTH;
        }

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

                if (selectedTab == null
                    && selectionChangeTransition == null) {
                    preferredWidth = getPreferredTabWidth(-1) + (padding.left + padding.right + 2);
                    preferredHeight = 1;
                } else {
                    Dimensions preferredTabSize = getPreferredTabSize();
                    preferredWidth = preferredTabSize.width + (padding.left + padding.right + 2);
                    preferredHeight = preferredTabSize.height + (padding.top + padding.bottom);

                    if (selectionChangeTransition != null) {
                        float scale = selectionChangeTransition.getScale();
                        preferredHeight = (int)(preferredHeight * scale);
                    }

                    preferredHeight += 2;
                }

                int buttonAreaPreferredWidth = tabButtonPanorama.getPreferredWidth(-1);
                if (corner != null) {
                    buttonAreaPreferredWidth += corner.getPreferredWidth(-1);
                    preferredHeight += Math.max(corner.getPreferredHeight(-1),
                        Math.max(tabButtonPanorama.getPreferredHeight(-1) - 1, 0));
                    buttonAreaPreferredWidth += 2; // space between corner and panorama
                } else {
                    preferredHeight += Math.max(tabButtonPanorama.getPreferredHeight(-1) - 1, 0);
                }

                preferredWidth = Math.max(preferredWidth, buttonAreaPreferredWidth);

                break;
            }

            case VERTICAL: {
                if (selectedTab == null
                    && selectionChangeTransition == null) {
                    preferredWidth = 1;
                    preferredHeight = getPreferredTabHeight(-1) + (padding.top + padding.bottom + 2);
                } else {
                    Dimensions preferredTabSize = getPreferredTabSize();

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

                    if (selectionChangeTransition != null) {
                        float scale = selectionChangeTransition.getScale();
                        preferredWidth = (int)(preferredWidth * scale);
                    }

                    preferredWidth += 2;
                }

                int buttonAreaPreferredHeight = tabButtonPanorama.getPreferredHeight(-1);
                if (corner != null) {
                    buttonAreaPreferredHeight += corner.getPreferredHeight(-1);
                    preferredWidth += Math.max(corner.getPreferredWidth(-1),
                        Math.max(tabButtonPanorama.getPreferredWidth(-1) - 1, 0));
                    buttonAreaPreferredHeight += 2; // space between corner and panorama
                } else {
                    preferredWidth += Math.max(tabButtonPanorama.getPreferredWidth(-1) - 1, 0);
                }

                preferredHeight = Math.max(preferredHeight, buttonAreaPreferredHeight);

                break;
            }

            default: {
                preferredWidth = 0;
                preferredHeight = 0;
            }
        }

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

        int preferredTabWidth = 0;
        int preferredTabHeight = 0;

        TabPane tabPane = (TabPane)getComponent();
        for (Component tab : tabPane.getTabs()) {
            Dimensions preferredSize = tab.getPreferredSize();
            preferredTabWidth = Math.max(preferredTabWidth, preferredSize.width);
            preferredTabHeight = Math.max(preferredTabHeight, preferredSize.height);
        }

        return new Dimensions(preferredTabWidth, preferredTabHeight);
    }
View Full Code Here

        int tabY = 0;
        int tabWidth = 0;
        int tabHeight = 0;

        Component corner = tabPane.getCorner();
        Dimensions buttonPanoramaSize = tabButtonPanorama.getPreferredSize();

        switch (tabOrientation) {
            case HORIZONTAL: {
                int buttonPanoramaWidth = Math.min(width, buttonPanoramaSize.width);
                int buttonPanoramaHeight = buttonPanoramaSize.height;
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        Expander expander = (Expander)getComponent();
        Component content = expander.getContent();

        Dimensions titleBarSize = titleBarTablePane.getPreferredSize();

        int preferredWidth = titleBarSize.width;
        int preferredHeight = titleBarSize.height;

        if (content != null) {
            Dimensions contentSize = content.getPreferredSize();

            preferredWidth = Math.max(contentSize.width + (padding.left + padding.right),
                preferredWidth);

            if (expander.isExpanded()
                || expandTransition != null) {
                // Title bar border is only drawn when expander is expanded
                // or expanding
                preferredHeight += 1;

                if (expandTransition == null) {
                    preferredHeight += (padding.top + padding.bottom + contentSize.height);
                } else {
                    float scale = expandTransition.getScale();
                    preferredHeight += (int)(scale * (padding.top + padding.bottom
                        + contentSize.height));
                }
            }
        }

        preferredWidth += 2;
        preferredHeight += 2;

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

        public void run() {
            MenuPopup menuPopup = (MenuPopup)getComponent();
            Display display = menuPopup.getDisplay();

            Point location = menuPopup.getLocation();
            Dimensions size = menuPopup.getSize();

            int x = location.x;
            if (x + size.width > display.getWidth()) {
                x -= size.width;
            }
View Full Code Here

            ScrollBarPolicy verticalPolicy = scrollPane.getVerticalScrollBarPolicy();

            if (verticalPolicy != ScrollBarPolicy.FILL) {
                // Get the unconstrained preferred size of the view
                Dimensions preferredViewSize = view.getPreferredSize();

                // If the policy is FILL_TO_CAPACITY, and the sum of the
                // unconstrained preferred heights of the view and the column
                // header is less than the height constraint, apply the FILL
                // policy; otherwise, apply the AUTO policy
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.