Package pivot.wtk

Examples of pivot.wtk.Dimensions


        return preferredHeight;
    }

    public void layout() {
        Rollup rollup = (Rollup)getComponent();
        Dimensions rollupButtonSize = rollupButton.getPreferredSize();
        rollupButton.setSize(rollupButtonSize);

        int x = rollupButtonSize.width + buffer;
        int y = 0;
        int justifiedWidth = Math.max(getWidth() - rollupButtonSize.width - buffer, 0);

        Component firstComponent = null;

        for (int i = 0, n = rollup.getLength(); i < n; i++) {
            Component component = rollup.get(i);

            if (component == rollupButton) {
                // Ignore "private" component
                continue;
            }

            if (firstComponent == null) {
                firstComponent = component;
            }

            if ((component == firstComponent
                || rollup.isExpanded())
                && component.isDisplayable()) {
                // We lay this child out and make sure it's painted.
                component.setVisible(true);

                int componentWidth, componentHeight;
                if (justify) {
                    componentWidth = justifiedWidth;
                    componentHeight = component.getPreferredHeight(componentWidth);
                } else {
                    Dimensions componentPreferredSize = component.getPreferredSize();
                    componentWidth = componentPreferredSize.width;
                    componentHeight = componentPreferredSize.height;
                }

                component.setLocation(x, y);
View Full Code Here


        public Dimensions getPreferredSize() {
            RollupButton rollupButton = (RollupButton)getComponent();
            Button.DataRenderer dataRenderer = rollupButton.getDataRenderer();
            dataRenderer.render(rollupButton.getButtonData(), rollupButton, false);
            Dimensions contentSize = dataRenderer.getPreferredSize();
            return new Dimensions(contentSize.width, contentSize.height);
        }
View Full Code Here

            // Paint the content
            Button.DataRenderer dataRenderer = rollupButton.getDataRenderer();
            dataRenderer.render(rollupButton.getButtonData(), rollupButton, false);

            Dimensions contentSize = dataRenderer.getPreferredSize();
            dataRenderer.setSize(contentSize.width, contentSize.height);
            dataRenderer.paint(graphics);
        }
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        // TODO Optimize by performing calculations here
        int preferredWidth = getPreferredWidth(-1);
        int preferredHeight = getPreferredHeight(preferredWidth);
        return new Dimensions(preferredWidth, preferredHeight);
    }
View Full Code Here

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        // TODO Optimize
        return new Dimensions(this.getPreferredWidth(-1),
            this.getPreferredHeight(-1));
    }
View Full Code Here

                    Component content = listViewPopup.getContent();

                    // Ensure that the popup remains within the bounds of the display
                    Point buttonLocation = listButton.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

        PushButton pushButton = (PushButton)getComponent();
        Button.DataRenderer dataRenderer = pushButton.getDataRenderer();

        dataRenderer.render(pushButton.getButtonData(), pushButton, false);

        Dimensions preferredContentSize = dataRenderer.getPreferredSize();

        int preferredWidth = preferredContentSize.width
            + padding.left + padding.right + 2;

        int preferredHeight = preferredContentSize.height
            + padding.top + padding.bottom + 2;

        // Adjust for preferred aspect ratio
        if (!Float.isNaN(preferredAspectRatio)) {
            if (preferredAspectRatio >= 1) {
                if ((float)preferredWidth / (float)preferredHeight < preferredAspectRatio) {
                    preferredWidth = (int)((float)preferredHeight * preferredAspectRatio);
                }
            } else {
                if ((float)preferredWidth / (float)preferredHeight > preferredAspectRatio) {
                    preferredHeight = (int)((float)preferredWidth / preferredAspectRatio);
                }
            }
        }

        return new Dimensions(preferredWidth, preferredHeight);
    }
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 x = buttonLocation.x;
                if (popupSize.width > width
                    && x + popupSize.width > displaySize.width) {
                    x = buttonLocation.x + width - popupSize.width;
View Full Code Here

        int preferredWidth = 0;

        Palette palette = (Palette)getComponent();
        Component content = palette.getContent();

        Dimensions preferredTitleBarSize = titleBarFlowPane.getPreferredSize();
        preferredWidth = preferredTitleBarSize.width;

        if (content != null
            && content.isDisplayable()) {
            if (height != -1) {
View Full Code Here

        int preferredHeight = 0;

        Palette palette = (Palette)getComponent();
        Component content = palette.getContent();

        Dimensions preferredTitleBarSize = titleBarFlowPane.getPreferredSize();

        preferredWidth = preferredTitleBarSize.width;
        preferredHeight = preferredTitleBarSize.height;

        if (content != null
            && content.isDisplayable()) {
            Dimensions preferredContentSize = content.getPreferredSize();

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

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

        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.