Package pivot.wtk

Examples of pivot.wtk.Component$ComponentDecoratorListenerList


        int maxScrollTop = 0;

        Panorama panorama = (Panorama)getComponent();
        int height = getHeight();

        Component view = panorama.getView();
        if (view != null) {
            maxScrollTop = Math.max(view.getHeight() - height, 0);
        }

        return maxScrollTop;
    }
View Full Code Here


        int maxScrollLeft = 0;

        Panorama panorama = (Panorama)getComponent();
        int width = getWidth();

        Component view = panorama.getView();
        if (view != null) {
            maxScrollLeft = Math.max(view.getWidth() - width, 0);
        }

        return maxScrollLeft;
    }
View Full Code Here

        updateScrollButtonVisibility();
    }

    // Viewport events
    public void scrollTopChanged(Viewport panorama, int previousScrollTop) {
        Component view = panorama.getView();
        if (view != null) {
            int maxScrollTop = getMaxScrollTop();
            int scrollTop = Math.min(panorama.getScrollTop(), maxScrollTop);
            view.setLocation(view.getX(), -scrollTop);
            updateScrollButtonVisibility();
        }
    }
View Full Code Here

            updateScrollButtonVisibility();
        }
    }

    public void scrollLeftChanged(Viewport panorama, int previousScrollLeft) {
        Component view = panorama.getView();
        if (view != null) {
            int maxScrollLeft = getMaxScrollLeft();
            int scrollLeft = Math.min(panorama.getScrollLeft(), maxScrollLeft);
            view.setLocation(-scrollLeft, view.getY());
            updateScrollButtonVisibility();
        }
    }
View Full Code Here

        Prompt prompt = (Prompt)component;
        prompt.getPromptListeners().add(this);

        // Load the prompt content
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content = null;

        try {
            content = (Component)wtkxSerializer.readObject(getClass().getResource("prompt_skin.wtkx"));
        } catch(Exception exception) {
            throw new RuntimeException(exception);
        }

        prompt.setContent(content);

        // Set the type image
        TerraTheme theme = (TerraTheme)Theme.getTheme();

        ImageView typeImageView = (ImageView)wtkxSerializer.getObjectByName("typeImageView");
        typeImageView.setImage(theme.getMessageIcon(prompt.getMessageType()));

        // Set the message
        Label messageLabel = (Label)wtkxSerializer.getObjectByName("messageLabel");
        String message = prompt.getMessage();
        messageLabel.setText(message);

        // Set the body
        FlowPane messageFlowPane = (FlowPane)wtkxSerializer.getObjectByName("messageFlowPane");
        Component body = prompt.getBody();
        if (body != null) {
            messageFlowPane.add(body);
        }

        // Add the option buttons
View Full Code Here

        if (expandTransition == null
        || tabOrientation == Orientation.VERTICAL) {
          preferredWidth = 0;

            Component selectedTab = tabPane.getSelectedTab();
            Component corner = tabPane.getCorner();

            switch (tabOrientation) {
                case HORIZONTAL: {
                    if (height != -1) {
                        if (corner != null
                            && corner.isDisplayable()) {
                            height = Math.max(height - Math.max(corner.getPreferredHeight(-1),
                                Math.max(buttonPanorama.getPreferredHeight(-1) - 1, 0)), 0);
                        } else {
                            height = Math.max(height - (buttonPanorama.getPreferredHeight(-1) - 1), 0);
                        }

                        height = Math.max(height - (padding.top + padding.bottom + 2), 0);
                    }

                    if (selectedTab != null) {
                        for (Component tab : tabPane.getTabs()) {
                            preferredWidth = Math.max(preferredWidth,
                                tab.getPreferredWidth(height));
                        }

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

                    int buttonAreaPreferredWidth = buttonPanorama.getPreferredWidth(-1);

                    if (corner != null
                        && corner.isDisplayable()) {
                        buttonAreaPreferredWidth += corner.getPreferredWidth(-1);
                    }

                    preferredWidth = Math.max(preferredWidth,
                        buttonAreaPreferredWidth);

                    break;
                }

                case VERTICAL: {
                    if (height != -1) {
                        height = Math.max(height - (padding.top + padding.bottom + 2), 0);
                    }

                    if (selectedTab != null) {
                      if (expandTransition == null) {
                          int contentWidth = 0;
                            for (Component tab : tabPane.getTabs()) {
                                contentWidth = Math.max(contentWidth,
                                    tab.getPreferredWidth(height));
                            }

                            preferredWidth += (padding.left + padding.right + contentWidth);
                      } else {
                            float scale = expandTransition.getScale();
                            preferredWidth += (int)(scale * (float)(padding.left + padding.right
                            + selectedTab.getWidth()));
                      }

                        preferredWidth += 2;
                    } else {
                        preferredWidth += 1;
                    }

                    if (corner != null
                        && corner.isDisplayable()) {
                        preferredWidth += Math.max(corner.getPreferredWidth(-1),
                            Math.max(buttonPanorama.getPreferredWidth(-1) - 1, 0));
                    } else {
                        preferredWidth += Math.max(buttonPanorama.getPreferredWidth(-1) - 1, 0);
                    }

View Full Code Here

        Orientation tabOrientation = tabPane.getTabOrientation();

        if (expandTransition == null
        || tabOrientation == Orientation.HORIZONTAL) {
          preferredHeight = 0;
            Component selectedTab = tabPane.getSelectedTab();
            Component corner = tabPane.getCorner();

            switch (tabOrientation) {
                case HORIZONTAL: {
                    if (width != -1) {
                        width = Math.max(width - (padding.left + padding.right + 2), 0);
                    }

                    if (selectedTab != null) {
                      if (expandTransition == null) {
                        int contentHeight = 0;
                            for (Component tab : tabPane.getTabs()) {
                              contentHeight = Math.max(contentHeight,
                                    tab.getPreferredHeight(width));
                            }

                            preferredHeight += (padding.top + padding.bottom + contentHeight);
                      } else {
                        float scale = expandTransition.getScale();
                            preferredHeight += (int)(scale * (float)(padding.top + padding.bottom
                            + selectedTab.getHeight()));
                      }

                        preferredHeight += 2;
                    } else {
                        preferredHeight += 1;
                    }

                    if (corner != null
                        && corner.isDisplayable()) {
                        preferredHeight += Math.max(corner.getPreferredHeight(-1),
                            Math.max(buttonPanorama.getPreferredHeight(-1) - 1, 0));
                    } else {
                        preferredHeight += Math.max(buttonPanorama.getPreferredHeight(-1) - 1, 0);
                    }

                    break;
                }

                case VERTICAL: {
                    if (width != -1) {
                        if (corner != null
                            && corner.isDisplayable()) {
                            width = Math.max(width - Math.max(corner.getPreferredWidth(-1),
                                Math.max(buttonPanorama.getPreferredWidth(-1) - 1, 0)), 0);
                        } else {
                            width = Math.max(width - (buttonPanorama.getPreferredWidth(-1) - 1), 0);
                        }

                        width = Math.max(width - (padding.left + padding.right + 2), 0);
                    }

                    if (selectedTab != null) {
                        for (Component tab : tabPane.getTabs()) {
                            preferredHeight = Math.max(preferredHeight,
                                tab.getPreferredHeight(width));
                        }

                        preferredHeight += (padding.top + padding.bottom + 2);
                    }

                    int buttonAreaPreferredHeight = buttonPanorama.getPreferredHeight(-1);

                    if (corner != null
                        && corner.isDisplayable()) {
                        buttonAreaPreferredHeight += corner.getPreferredHeight(-1);
                    }

                    preferredHeight = Math.max(preferredHeight,
                        buttonAreaPreferredHeight);

View Full Code Here

        int tabX = 0;
        int tabY = 0;
        int tabWidth = 0;
        int tabHeight = 0;

        Component selectedTab = tabPane.getSelectedTab();
        Component corner = tabPane.getCorner();

        Dimensions buttonPanoramaSize;
        if (expandTransition == null) {
          buttonPanoramaSize = buttonPanorama.getPreferredSize();
        } else {
          buttonPanoramaSize = buttonPanorama.getSize();
        }

        Orientation tabOrientation = tabPane.getTabOrientation();
        switch (tabOrientation) {
            case HORIZONTAL: {
                int buttonPanoramaWidth = Math.min(width,
                    buttonPanoramaSize.width);
                int buttonPanoramaHeight = buttonPanoramaSize.height;
                int buttonPanoramaX = 0;
                int buttonPanoramaY = 0;

                if (corner != null) {
                    if (corner.isDisplayable()) {
                        int cornerWidth = width - buttonPanoramaWidth;
                        int cornerHeight = Math.max(corner.getPreferredHeight(-1), buttonPanoramaSize.height - 1);
                        int cornerX = buttonPanoramaWidth;
                        int cornerY = Math.max(buttonPanoramaHeight - cornerHeight - 1, 0);

                        buttonPanoramaY = Math.max(cornerHeight - buttonPanoramaHeight + 1, 0);

                        corner.setVisible(true);
                        corner.setLocation(cornerX, cornerY);
                        corner.setSize(cornerWidth, cornerHeight);
                    } else {
                        corner.setVisible(false);
                    }
                }

                buttonPanorama.setLocation(buttonPanoramaX, buttonPanoramaY);
                buttonPanorama.setSize(buttonPanoramaWidth, buttonPanoramaHeight);

                tabX = padding.left + 1;
                tabY = padding.top + buttonPanoramaY + buttonPanoramaHeight;
                tabWidth = Math.max(width - (padding.left + padding.right + 2), 0);
                tabHeight = Math.max(height - (padding.top + padding.bottom
                    + buttonPanoramaY + buttonPanoramaHeight + 1), 0);

                break;
            }

            case VERTICAL: {
                int buttonPanoramaWidth = buttonPanoramaSize.width;
                int buttonPanoramaHeight = Math.min(height,
                    buttonPanoramaSize.height);
                int buttonPanoramaX = 0;
                int buttonPanoramaY = 0;

                if (corner != null) {
                    if (corner.isDisplayable()) {
                        int cornerWidth = corner.getPreferredWidth(-1);
                        int cornerHeight = height - buttonPanoramaHeight;
                        int cornerX = Math.max(buttonPanoramaWidth - cornerWidth - 1, 0);
                        int cornerY = buttonPanoramaHeight;

                        buttonPanoramaX = Math.max(cornerWidth - buttonPanoramaWidth + 1, 0);

                        corner.setVisible(true);
                        corner.setLocation(cornerX, cornerY);
                        corner.setSize(cornerWidth, cornerHeight);
                    } else {
                        corner.setVisible(false);
                    }
                }

                buttonPanorama.setLocation(buttonPanoramaX, buttonPanoramaY);
                buttonPanorama.setSize(buttonPanoramaWidth, buttonPanoramaHeight);
View Full Code Here

        expandTransition.stop();
        expandTransition = null;
      }

        // Create a new button for the tab
        Component tab = tabPane.getTabs().get(index);
        TabButton tabButton = new TabButton(new ButtonData(TabPane.getIcon(tab),
            TabPane.getName(tab)));
        tabButton.setGroup(tabButtonGroup);

        buttonFlowPane.insert(tabButton, index);
View Full Code Here

        }

        @Override
        public void start(TransitionListener transitionListener) {
          TabPane tabPane = (TabPane)getComponent();
          Component selectedTab = tabPane.getSelectedTab();
          selectedTab.getDecorators().add(clipDecorator);

          int selectedIndex = tabPane.getSelectedIndex();
          TabButton tabButton = (TabButton)buttonFlowPane.get(selectedIndex);
          tabButton.active = true;
View Full Code Here

TOP

Related Classes of pivot.wtk.Component$ComponentDecoratorListenerList

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.