Examples of CardPane


Examples of org.apache.pivot.wtk.CardPane

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

        CardPane cardPane = (CardPane)component;
        cardPane.getCardPaneListeners().add(this);
    }
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

    @Override
    public int getPreferredWidth(int height) {
        int preferredWidth = 0;

        CardPane cardPane = (CardPane)getComponent();

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

                if (selectedCard != null) {
                    preferredWidth = selectedCard.getPreferredWidth(height);
                }
            } else {
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

    @Override
    public int getPreferredHeight(int width) {
        int preferredHeight = 0;

        CardPane cardPane = (CardPane)getComponent();

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

                if (selectedCard != null) {
                    preferredHeight = selectedCard.getPreferredHeight(width);
                }
            } else {
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

    @Override
    public Dimensions getPreferredSize() {
        int preferredWidth = 0;
        int preferredHeight = 0;

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

Examples of org.apache.pivot.wtk.CardPane

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

Examples of org.apache.pivot.wtk.CardPane

    @Override
    public void layout() {
        // Set the size of all components to match the size of the card pane,
        // minus padding
        CardPane cardPane = (CardPane)getComponent();
        int width = Math.max(getWidth() - (padding.left + padding.right), 0);
        int height = Math.max(getHeight() - (padding.top + padding.bottom), 0);

        for (Component card : cardPane) {
            card.setLocation(padding.left, padding.top);
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

            selectionChangeTransition.end();
        }

        super.componentInserted(container, index);

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

        if (cardPane.getLength() == 1) {
            cardPane.setSelectedIndex(0);
        }

        invalidateComponent();
    }
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

            if (selectionChangeTransition != null) {
                selectionChangeTransition.start(new TransitionListener() {
                    @Override
                    public void transitionCompleted(Transition transition) {
                        CardPane cardPaneLocal = (CardPane)getComponent();

                        SelectionChangeTransition selectionChangeTransitionLocal =
                            (SelectionChangeTransition)transition;

                        int selectedIndexLocal = cardPaneLocal.indexOf(selectionChangeTransitionLocal.toCard);
                        cardPaneLocal.setSelectedIndex(selectedIndexLocal);
                        CardPaneSkin.this.selectionChangeTransition = null;
                    }
                });
            }
        }
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

            super(selectionChangeDuration, selectionChangeRate, false);

            this.from = from;
            this.to = to;

            CardPane cardPane = (CardPane)getComponent();
            fromCard = (from == -1) ? null : cardPane.get(from);
            toCard = (to == -1) ? null : cardPane.get(to);

            int length = cardPane.getLength();
            if (circular
                && length >= 3) {
                if (from == length - 1
                    && to == 0) {
                    direction = 1;
View Full Code Here

Examples of org.apache.pivot.wtk.CardPane

        // add some sleep to let users see the warning messages in console ...
        Thread.sleep(2000);


        final CardPane cardPane = new CardPane();
        cardPane.getStyles().put("selectionChangeEffect", CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE);

        final Window window = new Window(cardPane);
        window.open(display);

        DesktopApplicationContext.scheduleRecurringCallback(new Runnable() {
            @Override
            public void run() {
                Thread.currentThread().setName("switcher-thread");

                System.out.println("Run num " + num++)// temp


                /*
                //
                // method 1:
                //
                // Seems to be working just fine
                final GridPane grid = new GridPane(3);
                grid.getRows().add(createGridRow());
                grid.getRows().add(createGridRow());
                grid.getRows().add(createGridRow());
                 */


                //
                // method 2:
                //
                try {
                    // Before the fixes for PIVOT-861 (part two) it was causing out of memory ...
                    //
                    // Note that this has been moved to another issue, but the problem is due to the usage
                    // of dataRenderer tags (and then instancing ButtonDataRenderer) in the loaded bxml,
                    // so probably even this test will be updated ...
                    //
                    final GridPane grid = (GridPane) new BXMLSerializer().readObject(Pivot894.class, "btn_grid.bxml");

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Iterator<Component> iterator = cardPane.iterator();
                            List<Component> deprecated = new ArrayList<Component>();
                            while (iterator.hasNext()) {
                                Component card = iterator.next();
                                if (!card.isShowing()) {
                                    deprecated.add(card);
                                }
                            }

                            for (Component card : deprecated) {
                                cardPane.remove(card);
                            }

                            cardPane.setSelectedIndex(cardPane.add(grid));

                            System.out.println(cardPane.getSelectedIndex());
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.