Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Component


            if (metadata.isRowVisible(i)) {
                GridPane.Row row = rows.get(i);

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

                    if (component != null
                        && component.isVisible()) {
                        component.setLocation(componentX, componentY);
                        component.setSize(cellWidth, cellHeight);
                    }

                    if (metadata.isColumnVisible(j)) {
                        componentX += (cellWidth + horizontalSpacing);
                    }
View Full Code Here


            for (int i = 0; i < rowCount; i++) {
                GridPane.Row row = rows.get(i);

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

                    if (component != null
                        && component.isVisible()) {
                        if (!visibleRows[i]) {
                            visibleRowCount++;
                            visibleRows[i] = true;
                        }
View Full Code Here

        CardPane cardPane = (CardPane)getComponent();

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

    public int getBaseline(int width, int height) {
        int baseline = -1;

        if (sizeToSelection) {
            CardPane cardPane = (CardPane)getComponent();
            Component selectedCard = cardPane.getSelectedCard();

            if (selectedCard != null) {
                int cardWidth = Math.max(width - (padding.left + padding.right), 0);
                int cardHeight = Math.max(height - (padding.top + padding.bottom), 0);

                baseline = selectedCard.getBaseline(cardWidth, cardHeight);

                if (baseline != -1) {
                    baseline += padding.top;
                }
            }
View Full Code Here

        }

        super.componentInserted(container, index);

        CardPane cardPane = (CardPane)container;
        Component card = cardPane.get(index);
        card.setVisible(false);

        if (cardPane.getLength() == 1) {
            cardPane.setSelectedIndex(0);
        }
View Full Code Here

        }

        super.componentsRemoved(container, index, removed);

        for (int i = 0, n = removed.getLength(); i < n; i++){
            Component card = removed.get(i);
            card.setVisible(true);
        }

        invalidateComponent();
    }
View Full Code Here

    @Override
    public void selectedIndexChanged(CardPane cardPane, int previousSelectedIndex) {
        int selectedIndex = cardPane.getSelectedIndex();
        if (selectedIndex != -1) {
            Component selectedCard = cardPane.get(selectedIndex);
            selectedCard.setVisible(true);
        }

        if (previousSelectedIndex != -1) {
            Component previousSelectedCard = cardPane.get(previousSelectedIndex);
            previousSelectedCard.setVisible(false);
        }

        if (selectedIndex == -1
            || previousSelectedIndex == -1
            || sizeToSelection) {
View Full Code Here

            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            if (height != -1) {
                height = Math.max(height - (topThickness + thickness) -
                    padding.top - padding.bottom, 0);
            }

            preferredWidth = content.getPreferredWidth(height);
        }

        preferredWidth += (padding.left + padding.right) + (thickness * 2);

        return preferredWidth;
View Full Code Here

            && title.length() > 0) {
            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            if (width != -1) {
                width = Math.max(width - (thickness * 2)
                    - padding.left - padding.right, 0);
            }

            preferredHeight = content.getPreferredHeight(width);
        }

        preferredHeight += (padding.top + padding.bottom) + (topThickness + thickness);

        return preferredHeight;
View Full Code Here

        Border border = (Border)getComponent();
        int topThickness = thickness;

        // Delegate baseline calculation to the content component
        Component content = border.getContent();
        if (content != null) {
            String title = border.getTitle();
            if (title != null
                && title.length() > 0) {
                LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
                topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
            }

            int clientWidth = Math.max(width - (thickness * 2)
                - (padding.left + padding.right), 0);
            int clientHeight = Math.max(height - (topThickness + thickness) -
                (padding.top + padding.bottom), 0);

            baseline = content.getBaseline(clientWidth, clientHeight);
        }

        // Include top padding value and top border thickness
        if (baseline != -1) {
            baseline += (padding.top + topThickness);
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.