Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Rollup$RollupListenerList


    @Override
    public void install(Component component) {
        super.install(component);

        Rollup rollup = (Rollup)component;

        // Add the rollup button
        rollupButton = new RollupButton();
        rollup.add(rollupButton);

        // Initialize state
        headingChanged(rollup, null);
        contentChanged(rollup, null);
        collapsibleChanged(rollup);
View Full Code Here


        collapsibleChanged(rollup);
    }

    @Override
    public int getPreferredWidth(int height) {
        Rollup rollup = (Rollup)getComponent();

        Component heading = rollup.getHeading();
        Component content = rollup.getContent();

        int preferredWidth = 0;

        if (heading != null) {
            preferredWidth = heading.getPreferredWidth(-1);
        }

        if (content != null
            && (rollup.isExpanded()
                || (expandTransition != null
                    && !expandTransition.isReversed()))) {
            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(-1));
        }
View Full Code Here

        return preferredWidth;
    }

    @Override
    public int getPreferredHeight(int width) {
        Rollup rollup = (Rollup)getComponent();

        Component heading = rollup.getHeading();
        Component content = rollup.getContent();

        int preferredHeight = 0;

        // Calculate our internal width constraint
        if (fill && width >= 0) {
            width = Math.max(width - rollupButton.getPreferredWidth(-1) - buffer, 0);
        } else {
            width = -1;
        }

        if (heading != null) {
            preferredHeight += heading.getPreferredHeight(width);
        }

        if (content != null) {
            if (expandTransition == null) {
                if (rollup.isExpanded()) {
                    preferredHeight += spacing + content.getPreferredHeight(width);
                }
            } else {
                float scale = expandTransition.getScale();
                preferredHeight += (int)(scale * (spacing + content.getPreferredHeight(width)));
View Full Code Here

        return preferredHeight;
    }

    @Override
    public int getBaseline(int width, int height) {
        Rollup rollup = (Rollup)getComponent();
        Component heading = rollup.getHeading();

        int baseline = -1;

        if (heading != null) {
            int headingWidth, headingHeight;
View Full Code Here

        return baseline;
    }

    @Override
    public void layout() {
        Rollup rollup = (Rollup)getComponent();

        Component heading = rollup.getHeading();
        Component content = rollup.getContent();

        Dimensions rollupButtonSize = rollupButton.getPreferredSize();
        rollupButton.setSize(rollupButtonSize.width, rollupButtonSize.height);

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

        if (heading != null) {
            int headingWidth, headingHeight;
            if (fill) {
                headingWidth = justifiedWidth;
                headingHeight = heading.getPreferredHeight(headingWidth);
            } else {
                Dimensions headingPreferredSize = heading.getPreferredSize();
                headingWidth = headingPreferredSize.width;
                headingHeight = headingPreferredSize.height;
            }

            heading.setLocation(x, y);
            heading.setSize(headingWidth, headingHeight);

            y += headingHeight + spacing;
        }

        if (content != null) {
            if (rollup.isExpanded()
                || (expandTransition != null
                && !expandTransition.isReversed())) {
                int contentWidth, contentHeight;
                if (fill) {
                    contentWidth = justifiedWidth;
View Full Code Here

        if (spacing < 0) {
            throw new IllegalArgumentException("spacing is negative.");
        }
        this.spacing = spacing;

        Rollup rollup = (Rollup)getComponent();
        if (rollup.isExpanded()) {
            invalidateComponent();
        }
    }
View Full Code Here

            // No-op
        }

        @Override
        public void paint(Graphics2D graphics) {
            Rollup rollup = (Rollup)TerraRollupSkin.this.getComponent();

            graphics.setStroke(new BasicStroke(0));
            if (rollup.isEnabled()) {
                graphics.setPaint(buttonColor);
            } else {
                graphics.setPaint(disabledButtonColor);
            }
            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

            if (rollup.isCollapsible()) {
                if (rollup.isExpanded()) {
                    // Paint the collapse image
                    int[] xPoints = {0, 3, 6};
                    int[] yPoints = {0, 6, 0};
                    graphics.fillPolygon(xPoints, yPoints, 3);
                    graphics.drawPolygon(xPoints, yPoints, 3);
View Full Code Here

            }
        }

        @Override
        public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
            Rollup rollup = (Rollup)TerraRollupSkin.this.getComponent();
            rollup.setExpanded(!rollup.isExpanded());
            return true;
        }
View Full Code Here

    @Override
    public void install(Component component) {
        super.install(component);

        Rollup rollup = (Rollup)component;

        // Add the rollup button
        rollupButton = new RollupButton();
        rollup.add(rollupButton);

        // Initialize state
        headingChanged(rollup, null);
        contentChanged(rollup, null);
        collapsibleChanged(rollup);
View Full Code Here

        collapsibleChanged(rollup);
    }

    @Override
    public int getPreferredWidth(int height) {
        Rollup rollup = (Rollup)getComponent();

        Component heading = rollup.getHeading();
        Component content = rollup.getContent();

        int preferredWidth = 0;

        if (heading != null) {
            preferredWidth = heading.getPreferredWidth(-1);
        }

        if (content != null
            && (rollup.isExpanded()
                || (expandTransition != null
                    && !expandTransition.isReversed()))) {
            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(-1));
        }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Rollup$RollupListenerList

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.