Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Component


    }

    @Override
    public int getPreferredHeight(int width) {
        Expander expander = (Expander)getComponent();
        Component content = expander.getContent();

        int preferredHeight = titleBarTablePane.getPreferredHeight(-1);

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

            int contentWidth = -1;
            if (width >= 0) {
                contentWidth = Math.max(width - (2 + padding.left + padding.right), 0);
            }

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

        preferredHeight += 2;

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()
View Full Code Here

    }

    @Override
    public int getBaseline(int width, int height) {
        Expander expander = (Expander)getComponent();
        Component content = expander.getContent();

        int baseline = -1;

        if (content != null) {
            int titleBarWidth = Math.max(width - 2, 0);
View Full Code Here

    }

    @Override
    public void layout() {
        Expander expander = (Expander)getComponent();
        Component content = expander.getContent();

        int width = getWidth();
        int height = getHeight();

        int titleBarHeight = titleBarTablePane.getPreferredHeight(-1);
        titleBarTablePane.setSize(Math.max(width - 2, 0), titleBarHeight);
        titleBarTablePane.setLocation(1, 1);

        if (content != null) {
            int contentWidth = Math.max(width - (2 + padding.left + padding.right), 0);
            int contentHeight = Math.max(height - (3 + padding.top + padding.bottom + titleBarHeight), 0);

            clipDecorator.setSize(contentWidth, contentHeight);
            content.setSize(contentWidth, content.getPreferredHeight(contentWidth));

            int contentX = 1 + padding.left;
            int contentY = 2 + padding.top + titleBarHeight;
            content.setLocation(contentX, contentY);
        }
    }
View Full Code Here

        }

        @Override
        public void start(TransitionListener transitionListener) {
            Expander expander = (Expander)getComponent();
            Component content = expander.getContent();
            content.getDecorators().add(clipDecorator);

            expander.setEnabled(false);

            super.start(transitionListener);
        }
View Full Code Here

        }

        @Override
        public void stop() {
            Expander expander = (Expander)getComponent();
            Component content = expander.getContent();
            content.getDecorators().remove(clipDecorator);

            expander.setEnabled(true);

            super.stop();
        }
View Full Code Here

        alert.getAlertListeners().add(this);

        // Load the alert content
        BXMLSerializer bxmlSerializer = new BXMLSerializer();

        Component content;
        try {
            content = (Component)bxmlSerializer.readObject(TerraAlertSkin.class,
                "terra_alert_skin.bxml");
        } catch(Exception exception) {
            throw new RuntimeException(exception);
View Full Code Here

    public void bodyChanged(Alert alert, Component previousBody) {
        if (previousBody != null) {
            messageBoxPane.remove(previousBody);
        }

        Component body = alert.getBody();
        if (body != null) {
            messageBoxPane.add(body);
        }
    }
View Full Code Here

        prompt.getPromptListeners().add(this);

        // Load the prompt content
        BXMLSerializer bxmlSerializer = new BXMLSerializer();

        Component content;
        try {
            content = (Component)bxmlSerializer.readObject(TerraPromptSkin.class,
                "terra_prompt_skin.bxml");
        } catch(Exception exception) {
            throw new RuntimeException(exception);
View Full Code Here

    public void bodyChanged(Prompt prompt, Component previousBody) {
        if (previousBody != null) {
            messageBoxPane.remove(previousBody);
        }

        Component body = prompt.getBody();
        if (body != null) {
            messageBoxPane.add(body);
        }
    }
View Full Code Here

TOP

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

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.