Package pivot.wtk

Examples of pivot.wtk.Orientation


    @Override
    public void setSize(int width, int height) {
        if (selectionChangeTransition != null) {
            if (!matchSelectedCardSize) {
                CardPane cardPane = (CardPane)getComponent();
                Orientation orientation = cardPane.getOrientation();

                if ((orientation == Orientation.HORIZONTAL && width != getWidth())
                    || (orientation == Orientation.VERTICAL && height != getHeight())) {
                    selectionChangeTransition.end();
                    selectionChangeTransition = null;
View Full Code Here


                if (selectedCard != null) {
                    preferredWidth = selectedCard.getPreferredWidth(height);
                }
            } else {
                int selectedIndex = cardPane.getSelectedIndex();
                Orientation orientation = cardPane.getOrientation();

                if (selectedIndex != -1
                    || orientation == Orientation.HORIZONTAL) {
                    for (Component card : cardPane) {
                        preferredWidth = Math.max(preferredWidth, card.getPreferredWidth(height));
                    }
                }
            }
        } else {
            float percentComplete = selectionChangeTransition.getPercentComplete();

            Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();
            int previousWidth = (previousSelectedCard == null) ? 0 : previousSelectedCard.getWidth();

            Component selectedCard = selectionChangeTransition.getSelectedCard();
            int width = (selectedCard == null) ? 0 : selectedCard.getWidth();

            Orientation orientation = cardPane.getOrientation();

            if (!matchSelectedCardSize
                && orientation == Orientation.HORIZONTAL) {
                preferredWidth = Math.max(previousWidth, width);
            } else {
View Full Code Here

                if (selectedCard != null) {
                    preferredHeight = selectedCard.getPreferredHeight(width);
                }
            } else {
                int selectedIndex = cardPane.getSelectedIndex();
                Orientation orientation = cardPane.getOrientation();

                if (selectedIndex != -1
                    || orientation == Orientation.VERTICAL) {
                    for (Component card : cardPane) {
                        preferredHeight = Math.max(preferredHeight, card.getPreferredHeight(width));
                    }
                }
            }
        } else {
            float percentComplete = selectionChangeTransition.getPercentComplete();

            Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();
            int previousHeight = (previousSelectedCard == null) ? 0 : previousSelectedCard.getHeight();

            Component selectedCard = selectionChangeTransition.getSelectedCard();
            int height = (selectedCard == null) ? 0 : selectedCard.getHeight();

            Orientation orientation = cardPane.getOrientation();

            if (!matchSelectedCardSize
                && orientation == Orientation.VERTICAL) {
                preferredHeight = Math.max(previousHeight, height);
            } else {
View Full Code Here

                } else {
                    preferredSize = selectedCard.getPreferredSize();
                }
            } else {
                preferredSize = new Dimensions(0, 0);
                Orientation orientation = cardPane.getOrientation();

                int selectedIndex = cardPane.getSelectedIndex();
                for (Component card : cardPane) {
                    Dimensions cardSize = card.getPreferredSize();

                    if (selectedIndex != -1
                        || orientation == Orientation.HORIZONTAL) {
                        preferredSize.width = Math.max(cardSize.width, preferredSize.width);
                    }

                    if (selectedIndex != -1
                        || orientation == Orientation.VERTICAL) {
                        preferredSize.height = Math.max(cardSize.height, preferredSize.height);
                    }
                }
            }
        } else {
            float percentComplete = selectionChangeTransition.getPercentComplete();

            int previousWidth;
            int previousHeight;
            Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();

            if (previousSelectedCard == null) {
                previousWidth = 0;
                previousHeight = 0;
            } else {
                previousWidth = previousSelectedCard.getWidth();
                previousHeight = previousSelectedCard.getHeight();
            }

            int width;
            int height;
            Component selectedCard = selectionChangeTransition.getSelectedCard();

            if (selectedCard == null) {
                width = 0;
                height = 0;
            } else {
                width = selectedCard.getWidth();
                height = selectedCard.getHeight();
            }

            int preferredWidth = 0;
            int preferredHeight = 0;

            Orientation orientation = cardPane.getOrientation();

            if (!matchSelectedCardSize
                && orientation == Orientation.HORIZONTAL) {
                preferredWidth = Math.max(previousWidth, width);
            } else {
View Full Code Here

        } else {
            if (matchSelectedCardSize) {
                Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();
                Component selectedCard = selectionChangeTransition.getSelectedCard();

                Orientation orientation = cardPane.getOrientation();

                if (selectionChangeTransition.isRunning()) {
                    for (Component card : cardPane) {
                        // Center old and new cards and ensure they are visible
                        if (card == previousSelectedCard
                            || card == selectedCard) {
                            int x = (orientation == Orientation.VERTICAL) ?
                                0 : Math.round((float)(width - card.getWidth()) / 2);
                            int y = (orientation == Orientation.HORIZONTAL) ?
                                0 : Math.round((float)(height - card.getHeight()) / 2);

                            card.setLocation(x, y);
                            card.setVisible(true);
                        } else {
                            card.setVisible(false);
                        }
                    }
                } else {
                    if (previousSelectedCard != null) {
                        previousSelectedCard.setSize(previousSelectedCard.getPreferredSize());
                    }

                    if (selectedCard != null) {
                        selectedCard.setSize(selectedCard.getPreferredSize());
                        selectedCard.setVisible(true);
                    }
                }
            } else {
                if (selectionChangeTransition.isRunning()) {
                    int previousSelectedIndex = selectionChangeTransition.previousSelectedIndex;
                    int selectedIndex = selectionChangeTransition.selectedIndex;

                    if (previousSelectedIndex != -1
                        && selectedIndex != -1) {
                        float percentComplete = selectionChangeTransition.getEasedSlidePercentComplete();

                        int direction = Integer.signum(previousSelectedIndex - selectedIndex);

                        int dx = (int)((float)width * percentComplete) * direction;
                        int dy = (int)((float)height * percentComplete) * direction;

                        Orientation orientation = cardPane.getOrientation();

                        for (int i = 0, n = cardPane.getLength(); i < n; i++) {
                            Component card = cardPane.get(i);

                            if (i == previousSelectedIndex) {
                                if (orientation == Orientation.HORIZONTAL) {
                                    card.setLocation(dx, 0);
                                } else {
                                    card.setLocation(0, dy);
                                }

                                card.setVisible(true);
                            } else if (i == selectedIndex) {
                                if (orientation == Orientation.HORIZONTAL) {
                                    card.setLocation(-width * direction + dx, 0);
                                } else {
                                    card.setLocation(0, -height * direction + dy);
                                }

                                card.setVisible(true);
                            } else {
                                card.setVisible(false);
                            }
                        }
                    }
                } else {
                    Component selectedCard = selectionChangeTransition.getSelectedCard();
                    Orientation orientation = cardPane.getOrientation();

                    if (selectedCard != null) {
                        if (orientation == Orientation.HORIZONTAL) {
                            for (Component card : cardPane) {
                                height = Math.max(height, card.getPreferredHeight(width));
View Full Code Here

    public Vote previewSelectedIndexChange(final CardPane cardPane, final int selectedIndex) {
        Vote vote = Vote.APPROVE;

        if (cardPane.isShowing()) {
            if (selectionChangeTransition == null) {
                Orientation orientation = cardPane.getOrientation();

                if (matchSelectedCardSize
                    || orientation != null) {
                    int previousSelectedIndex = cardPane.getSelectedIndex();
View Full Code Here

    public void resume() {
    }

    private void updateFlowPaneState() {
        Orientation orientation = null;
        if (horizontalOrientationButton.isSelected()) {
            orientation = Orientation.HORIZONTAL;
        } else if (verticalOrientationButton.isSelected()) {
            orientation = Orientation.VERTICAL;
        }
View Full Code Here

        }

        public void paint(Graphics2D graphics) {
            SplitPane splitPane = (SplitPane)TerraSplitPaneSkin.this.getComponent();

            Orientation orientation = splitPane.getOrientation();

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

            int imageWidth, imageHeight;
View Full Code Here

        public boolean mouseMove(Component component, int x, int y) {
            boolean consumed = super.mouseMove(component, x, y);

            if (Mouse.getCapturer() == component) {
                SplitPane splitPane = (SplitPane)TerraSplitPaneSkin.this.getComponent();
                Orientation orientation = splitPane.getOrientation();

                // Calculate the would-be new split location
                int splitLocation;
                if (orientation == Orientation.HORIZONTAL) {
                    splitLocation = component.getX() + x - dragOffset;
View Full Code Here

            SplitPane splitPane = (SplitPane)TerraSplitPaneSkin.this.getComponent();

            if (button == Mouse.Button.LEFT
                && !splitPane.isLocked()) {
                Orientation orientation = splitPane.getOrientation();

                if (useShadow) {
                    // Add the shadow to the split pane and lay it out
                    shadow = new SplitterShadow();
                    splitPane.add(shadow);
View Full Code Here

TOP

Related Classes of pivot.wtk.Orientation

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.