Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Dimensions


            GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext,
                new int[] {missingGlyphCode});
            Rectangle2D textBounds = missingGlyphVector.getLogicalBounds();

            Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext);
            averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()),
                (int)Math.ceil(maxCharBounds.getHeight()));

            invalidateComponent();
        }
    }
View Full Code Here


    public abstract int getBaseline();

    public abstract void paint(Graphics2D g);

    public Dimensions getSize() {
        return new Dimensions(width, height);
    }
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        Window window = (Window)getComponent();
        Component content = window.getContent();

        return (content != null) ? content.getPreferredSize() : new Dimensions(0, 0);
    }
View Full Code Here

    public Dimensions getPreferredSize(int breakWidth) {
        int width = 0;
        int height = 0;

        for (TextPaneSkinNodeView nodeView : this) {
            Dimensions childDimensions = nodeView.getPreferredSize(breakWidth);

            width = Math.max(width, childDimensions.width);
            height += childDimensions.height;
        }

        return new Dimensions(width, height);
    }
View Full Code Here

    public Dimensions getPreferredSize(int breakWidth) {
        ComponentNode componentNode = (ComponentNode) getNode();
        Component component = componentNode.getComponent();

        if (component == null) {
            return new Dimensions(0, 0);
        }
        return new Dimensions(component.getPreferredWidth(), component.getPreferredHeight());
    }
View Full Code Here

        int preferredHeight = 0;

        StackPane stackPane = (StackPane)getComponent();

        for (Component component : stackPane) {
            Dimensions preferredCardSize = component.getPreferredSize();

            preferredWidth = Math.max(preferredWidth,
                preferredCardSize.width);

            preferredHeight = Math.max(preferredHeight,
                preferredCardSize.height);
        }

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

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

            for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
                Component component = row.get(j);

                if (component != null
                    && component.isVisible()) {
                    Dimensions d = component.getPreferredSize();
                    preferredCellHeight = Math.max(preferredCellHeight, d.height);
                    preferredCellWidth = Math.max(preferredCellWidth, d.width);
                }
            }
        }

        // The preferred width of the grid pane is the sum of the column
        // widths, plus padding and spacing

        int preferredWidth = padding.left + padding.right
            + metadata.visibleColumnCount * preferredCellWidth;

        if (metadata.visibleColumnCount > 1) {
            preferredWidth += (metadata.visibleColumnCount - 1) * horizontalSpacing;
        }

        // The preferred height of the grid pane is the sum of the row
        // heights, plus padding and spacing

        int preferredHeight = padding.top + padding.bottom
            + metadata.visibleRowCount * preferredCellHeight;

        if (metadata.visibleRowCount > 1) {
            preferredHeight += (metadata.visibleRowCount - 1) * verticalSpacing;
        }

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

        preferredWidth += (padding.left + padding.right);

        LineMetrics lm = font.getLineMetrics("", fontRenderContext);
        int preferredHeight = (int)Math.ceil(lm.getHeight()) + (padding.top + padding.bottom);

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

        if (sizeToSelection) {
            if (selectionChangeTransition == null) {
                Component selectedCard = cardPane.getSelectedCard();

                if (selectedCard != null) {
                    Dimensions cardSize = selectedCard.getPreferredSize();
                    preferredWidth = cardSize.width;
                    preferredHeight = cardSize.height;
                }
            } else {
                float percentComplete = selectionChangeTransition.getPercentComplete();

                int previousWidth;
                int previousHeight;
                if (selectionChangeTransition.fromCard == null) {
                    previousWidth = 0;
                    previousHeight = 0;
                } else {
                    Dimensions fromSize = selectionChangeTransition.fromCard.getPreferredSize();
                    previousWidth = fromSize.width;
                    previousHeight = fromSize.height;
                }

                int width;
                int height;
                if (selectionChangeTransition.toCard == null) {
                    width = 0;
                    height = 0;
                } else {
                    Dimensions toSize = selectionChangeTransition.toCard.getPreferredSize();
                    width = toSize.width;
                    height = toSize.height;
                }

                preferredWidth = previousWidth + (int)((width - previousWidth) * percentComplete);
                preferredHeight = previousHeight + (int)((height - previousHeight) * percentComplete);
            }
        } else {
            for (Component card : cardPane) {
                Dimensions cardSize = card.getPreferredSize();

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

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

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