Package pivot.wtk

Examples of pivot.wtk.ScrollPane


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

        ScrollPane scrollPane = (ScrollPane)getComponent();
        Component view = scrollPane.getView();

        if (view != null) {
            int preferredRowHeaderWidth = 0;
            Component rowHeader = scrollPane.getRowHeader();
            if (rowHeader != null) {
                preferredRowHeaderWidth = rowHeader.getPreferredWidth(-1);
            }

            int preferredColumnHeaderHeight = 0;
            Component columnHeader = scrollPane.getColumnHeader();
            if (columnHeader != null) {
                preferredColumnHeaderHeight = columnHeader.getPreferredHeight(-1);
            }

            ScrollBarPolicy verticalPolicy = scrollPane.getVerticalScrollBarPolicy();

            if (verticalPolicy != ScrollBarPolicy.FILL) {
                // Get the unconstrained preferred size of the view
                Dimensions preferredViewSize = view.getPreferredSize();
View Full Code Here


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

        ScrollPane scrollPane = (ScrollPane)getComponent();
        Component view = scrollPane.getView();

        if (view != null) {
            int preferredRowHeaderWidth = 0;
            Component rowHeader = scrollPane.getRowHeader();
            if (rowHeader != null) {
                preferredRowHeaderWidth = rowHeader.getPreferredWidth(-1);
            }

            int preferredColumnHeaderHeight = 0;
            Component columnHeader = scrollPane.getColumnHeader();
            if (columnHeader != null) {
                preferredColumnHeaderHeight = columnHeader.getPreferredHeight(-1);
            }

            ScrollBarPolicy horizontalPolicy = scrollPane.getHorizontalScrollBarPolicy();

            if (horizontalPolicy != ScrollBarPolicy.FILL) {
                // Get the unconstrained preferred size of the view
                Dimensions preferredViewSize = view.getPreferredSize();
View Full Code Here

        return preferredHeight;
    }

    @Override
    public Dimensions getPreferredSize() {
        ScrollPane scrollPane = (ScrollPane)getComponent();

        int preferredWidth = 0;
        int preferredHeight = 0;

        Component view = scrollPane.getView();
        if (view != null) {
            Dimensions preferredViewSize = view.getPreferredSize();

            preferredWidth += preferredViewSize.width;
            preferredHeight += preferredViewSize.height;

            Component rowHeader = scrollPane.getRowHeader();
            if (rowHeader != null) {
                preferredWidth += rowHeader.getPreferredWidth(-1);
            }

            Component columnHeader = scrollPane.getColumnHeader();
            if (columnHeader != null) {
                preferredHeight += columnHeader.getPreferredHeight(-1);
            }

            if (scrollPane.getHorizontalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) {
                preferredHeight += horizontalScrollBar.getPreferredHeight(-1);
            }

            if (scrollPane.getVerticalScrollBarPolicy() == ScrollBarPolicy.ALWAYS) {
                preferredWidth += verticalScrollBar.getPreferredWidth(-1);
            }
        }

        return new Dimensions(preferredWidth, preferredHeight);
View Full Code Here

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

        ScrollPane scrollPane = (ScrollPane)getComponent();
        Component view = scrollPane.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 = scrollPane.getScrollLeft();
                int newScrollLeft = previousScrollLeft + (scrollAmount * wheelRotation *
                    horizontalScrollBar.getUnitIncrement());

                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;
                    }
                }

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

                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;
                    }
                }

                scrollPane.setScrollTop(newScrollTop);
            }
        }

        return consumed;
    }
View Full Code Here

    @Override
    public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
        boolean consumed = super.keyPressed(component, keyCode, keyLocation);

        if (!consumed) {
            ScrollPane scrollPane = (ScrollPane)getComponent();

            int scrollTop = scrollPane.getScrollTop();
            int scrollLeft = scrollPane.getScrollLeft();

            if (keyCode == Keyboard.KeyCode.UP) {
                int newScrollTop = Math.max(scrollTop -
                    verticalScrollBar.getUnitIncrement(), 0);

                scrollPane.setScrollTop(newScrollTop);

                consumed = (newScrollTop != scrollTop);
            } else if (keyCode == Keyboard.KeyCode.DOWN) {
                int newScrollTop = Math.min(scrollTop +
                    verticalScrollBar.getUnitIncrement(), getMaxScrollTop());

                scrollPane.setScrollTop(newScrollTop);

                consumed = (newScrollTop != scrollTop);
            } else if (keyCode == Keyboard.KeyCode.LEFT) {
                int newScrollLeft = Math.max(scrollLeft -
                    horizontalScrollBar.getUnitIncrement(), 0);

                scrollPane.setScrollLeft(newScrollLeft);

                consumed = (newScrollLeft != scrollLeft);
            } else if (keyCode == Keyboard.KeyCode.RIGHT) {
                int newScrollLeft = Math.min(scrollLeft +
                    horizontalScrollBar.getUnitIncrement(), getMaxScrollLeft());

                scrollPane.setScrollLeft(newScrollLeft);

                consumed = (newScrollLeft != scrollLeft);
            } else if (keyCode == Keyboard.KeyCode.PAGE_UP) {
                int increment = verticalScrollBar.getBlockIncrement();
                int newScrollTop = Math.max(scrollTop - increment, 0);

                scrollPane.setScrollTop(newScrollTop);

                consumed = (newScrollTop != scrollTop);
            } else if (keyCode == Keyboard.KeyCode.PAGE_DOWN) {
                int increment = verticalScrollBar.getBlockIncrement();
                int newScrollTop = Math.min(scrollTop + increment, getMaxScrollTop());

                scrollPane.setScrollTop(newScrollTop);

                consumed = (newScrollTop != scrollTop);
            }
        }
View Full Code Here

     * associated with one table view at a time.
     */
    public TableViewRowEditor() {
        // Create the editor components
        popup = new Window(true);
        editorScrollPane = new ScrollPane(ScrollPane.ScrollBarPolicy.NEVER, ScrollPane.ScrollBarPolicy.FILL);
        editorCardPane = new CardPane();
        editorTablePane = new TablePane();
        editorTablePane.getStyles().put("horizontalSpacing", 1);

        // Set up the editor component hierarchy
View Full Code Here

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

        ScrollPane scrollPane = (ScrollPane)component;
        scrollPane.getViewportListeners().add(this);
        scrollPane.getScrollPaneListeners().add(this);

        scrollPane.add(horizontalScrollBar);
        scrollPane.add(verticalScrollBar);

        scrollPane.add(topLeftCorner);
        scrollPane.add(bottomLeftCorner);
        scrollPane.add(bottomRightCorner);
        scrollPane.add(topRightCorner);

        horizontalScrollBar.getScrollBarValueListeners().add(this);
        verticalScrollBar.getScrollBarValueListeners().add(this);
    }
View Full Code Here

        verticalScrollBar.getScrollBarValueListeners().add(this);
    }

    @Override
    public void uninstall() {
        ScrollPane scrollPane = (ScrollPane)getComponent();
        scrollPane.getViewportListeners().remove(this);
        scrollPane.getScrollPaneListeners().remove(this);

        scrollPane.remove(horizontalScrollBar);
        scrollPane.remove(verticalScrollBar);

        scrollPane.remove(topLeftCorner);
        scrollPane.remove(bottomLeftCorner);
        scrollPane.remove(bottomRightCorner);
        scrollPane.remove(topRightCorner);

        horizontalScrollBar.getScrollBarValueListeners().remove(this);
        verticalScrollBar.getScrollBarValueListeners().remove(this);

        super.uninstall();
View Full Code Here

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

        ScrollPane scrollPane = (ScrollPane)getComponent();
        Component view = scrollPane.getView();

        if (view != null) {
            int preferredRowHeaderWidth = 0;
            Component rowHeader = scrollPane.getRowHeader();
            if (rowHeader != null) {
                preferredRowHeaderWidth = rowHeader.getPreferredWidth(-1);
            }

            int preferredColumnHeaderHeight = 0;
            Component columnHeader = scrollPane.getColumnHeader();
            if (columnHeader != null) {
                preferredColumnHeaderHeight = columnHeader.getPreferredHeight(-1);
            }

            ScrollBarPolicy verticalPolicy = scrollPane.getVerticalScrollBarPolicy();

            if (verticalPolicy != ScrollBarPolicy.FILL) {
                // Get the unconstrained preferred size of the view
                Dimensions preferredViewSize = view.getPreferredSize();
View Full Code Here

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

        ScrollPane scrollPane = (ScrollPane)getComponent();
        Component view = scrollPane.getView();

        if (view != null) {
            int preferredRowHeaderWidth = 0;
            Component rowHeader = scrollPane.getRowHeader();
            if (rowHeader != null) {
                preferredRowHeaderWidth = rowHeader.getPreferredWidth(-1);
            }

            int preferredColumnHeaderHeight = 0;
            Component columnHeader = scrollPane.getColumnHeader();
            if (columnHeader != null) {
                preferredColumnHeaderHeight = columnHeader.getPreferredHeight(-1);
            }

            ScrollBarPolicy horizontalPolicy = scrollPane.getHorizontalScrollBarPolicy();

            if (horizontalPolicy != ScrollBarPolicy.FILL) {
                // Get the unconstrained preferred size of the view
                Dimensions preferredViewSize = view.getPreferredSize();
View Full Code Here

TOP

Related Classes of pivot.wtk.ScrollPane

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.