Package pivot.wtk

Examples of pivot.wtk.Panorama


    public TerraMenuPopupSkin() {
        TerraTheme theme = (TerraTheme)Theme.getTheme();
        setBackgroundColor((Color)null);

        panorama = new Panorama();
        panorama.getStyles().put("buttonBackgroundColor", Color.WHITE);

        border = new Border(panorama);

        border.getStyles().put("color", theme.getColor(7));
View Full Code Here


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

        Panorama panorama = (Panorama)component;
        panorama.getViewportListeners().add(this);

        // Add scroll arrow link buttons and attach mouse listeners
        // to them; the mouse handlers should call setScrollTop() and
        // setScrollLeft() on the panorama as appropriate
        panorama.add(northButton);
        northButton.getComponentMouseListeners().add(buttonMouseListener);

        panorama.add(southButton);
        southButton.getComponentMouseListeners().add(buttonMouseListener);

        panorama.add(eastButton);
        eastButton.getComponentMouseListeners().add(buttonMouseListener);

        panorama.add(westButton);
        westButton.getComponentMouseListeners().add(buttonMouseListener);

        updateScrollButtonVisibility();
    }
View Full Code Here

        updateScrollButtonVisibility();
    }

    @Override
    public void uninstall() {
        Panorama panorama = (Panorama)getComponent();
        panorama.getViewportListeners().remove(this);

        // Remove scroll arrow link buttons
        panorama.remove(northButton);
        panorama.remove(southButton);
        panorama.remove(eastButton);
        panorama.remove(westButton);
    }
View Full Code Here

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

        // The panorama's preferred width is the preferred width of the view
        Panorama panorama = (Panorama)getComponent();
        Component view = panorama.getView();
        if (view != null) {
            preferredWidth = view.getPreferredWidth(height);
        }

        return preferredWidth;
View Full Code Here

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

        // The panorama's preferred height is the preferred height of the view
        Panorama panorama = (Panorama)getComponent();
        Component view = panorama.getView();
        if (view != null) {
            preferredHeight = view.getPreferredHeight(width);
        }

        return preferredHeight;
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        Dimensions preferredSize = null;

        // The panorama's preferred size is the preferred size of the view
        Panorama panorama = (Panorama)getComponent();
        Component view = panorama.getView();
        if (view == null) {
            preferredSize = new Dimensions(0, 0);
        } else {
            preferredSize = view.getPreferredSize();
        }
View Full Code Here

        return preferredSize;
    }

    public void layout() {
        Panorama panorama = (Panorama)getComponent();
        int width = getWidth();
        int height = getHeight();

        Component view = panorama.getView();
        if (view != null) {
            view.setSize(view.getPreferredSize());
            int viewWidth = view.getWidth();
            int viewHeight = view.getHeight();

            int scrollTop = panorama.getScrollTop();
            int maxScrollTop = getMaxScrollTop();
            if (scrollTop > maxScrollTop) {
                panorama.setScrollTop(maxScrollTop);
                scrollTop = maxScrollTop;
            }

            int scrollLeft = panorama.getScrollLeft();
            int maxScrollLeft = getMaxScrollLeft();
            if (scrollLeft > maxScrollLeft) {
                panorama.setScrollLeft(maxScrollLeft);
                scrollLeft = maxScrollLeft;
            }

            if (width < viewWidth) {
                // Show east/west buttons
View Full Code Here

    @Override
    public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount,
        int wheelRotation, int x, int y) {
        boolean consumed = false;

        Panorama panorama = (Panorama)getComponent();
        Component view = panorama.getView();

        if (view != null) {
            // The scroll orientation is tied to whether the shift key was
            // presssed while the mouse wheel was scrolled
            if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
                // Treat the mouse wheel as a horizontal scroll event
                int previousScrollLeft = panorama.getScrollLeft();
                int newScrollLeft = previousScrollLeft + (scrollAmount * wheelRotation *
                    (int)INITIAL_SCROLL_DISTANCE);

                if (wheelRotation > 0) {
                    int maxScrollLeft = getMaxScrollLeft();
                    newScrollLeft = Math.min(newScrollLeft, maxScrollLeft);

                    if (previousScrollLeft < maxScrollLeft) {
                        consumed = true;
                    }
                } else {
                    newScrollLeft = Math.max(newScrollLeft, 0);

                    if (previousScrollLeft > 0) {
                        consumed = true;
                    }
                }

                panorama.setScrollLeft(newScrollLeft);
            } else {
                // Treat the mouse wheel as a vertical scroll event
                int previousScrollTop = panorama.getScrollTop();
                int newScrollTop = previousScrollTop + (scrollAmount * wheelRotation *
                    (int)INITIAL_SCROLL_DISTANCE);

                if (wheelRotation > 0) {
                    int maxScrollTop = getMaxScrollTop();
                    newScrollTop = Math.min(newScrollTop, maxScrollTop);

                    if (previousScrollTop < maxScrollTop) {
                        consumed = true;
                    }
                } else {
                    newScrollTop = Math.max(newScrollTop, 0);

                    if (previousScrollTop > 0) {
                        consumed = true;
                    }
                }

                panorama.setScrollTop(newScrollTop);
            }
        }

        return consumed;
    }
View Full Code Here

    }

    protected int getMaxScrollTop() {
        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

    }

    protected int getMaxScrollLeft() {
        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

TOP

Related Classes of pivot.wtk.Panorama

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.