Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.ScrollPane$Corner


    @Override
    public void scrollTopChanged(Viewport viewport, int previousScrollTop) {
        // NOTE we don't invalidate the component here because we need only
        // reposition the view and row header. Invalidating would yield
        // the correct positioning, but it would do much more work than needed.
        ScrollPane scrollPane = (ScrollPane)viewport;

        Component view = scrollPane.getView();
        Component rowHeader = scrollPane.getRowHeader();
        Component columnHeader = scrollPane.getColumnHeader();

        int columnHeaderHeight = 0;
        if (columnHeader != null) {
            columnHeaderHeight = columnHeader.getHeight();
        }

        int scrollTop = scrollPane.getScrollTop();

        if (view != null
            && view.isShowing()
            && isOptimizeScrolling()) {
            Bounds blitArea = view.getVisibleArea();

            int blitX = blitArea.x + view.getX();
            int blitY = blitArea.y + view.getY();
            int blitWidth = blitArea.width;
            int blitHeight = blitArea.height;

            if (rowHeader != null) {
                // Blit the row header as well
                int rowHeaderWidth = rowHeader.getWidth();
                blitX -= rowHeaderWidth;
                blitWidth += rowHeaderWidth;
            }

            int deltaScrollTop = scrollTop - previousScrollTop;
            blitY += Math.max(deltaScrollTop, 0);
            blitHeight -= Math.abs(deltaScrollTop);

            Graphics2D graphics = scrollPane.getGraphics();
            graphics.copyArea(blitX, blitY, blitWidth, blitHeight, 0, -deltaScrollTop);

            scrollPane.setConsumeRepaint(true);
            try {
                view.setLocation(view.getX(), columnHeaderHeight - scrollTop);

                if (rowHeader != null) {
                    rowHeader.setLocation(0, columnHeaderHeight - scrollTop);
                }
            } finally {
                scrollPane.setConsumeRepaint(false);
            }

            scrollPane.repaint(blitX, columnHeaderHeight + (deltaScrollTop > 0 ? blitHeight : 0),
                blitWidth, Math.abs(deltaScrollTop), true);
        } else {
            if (view != null) {
                view.setLocation(view.getX(), columnHeaderHeight - scrollTop);
            }
View Full Code Here


    @Override
    public void scrollLeftChanged(Viewport viewport, int previousScrollLeft) {
        // NOTE we don't invalidate the component here because we need only
        // reposition the view and column header. Invalidating would yield
        // the correct positioning, but it would do much more work than needed.
        ScrollPane scrollPane = (ScrollPane)viewport;

        Component view = scrollPane.getView();
        Component rowHeader = scrollPane.getRowHeader();
        Component columnHeader = scrollPane.getColumnHeader();

        int rowHeaderWidth = 0;
        if (rowHeader != null) {
            rowHeaderWidth = rowHeader.getWidth();
        }

        int scrollLeft = scrollPane.getScrollLeft();

        if (view != null
            && view.isShowing()
            && isOptimizeScrolling()) {
            Bounds blitArea = view.getVisibleArea();

            int blitX = blitArea.x + view.getX();
            int blitY = blitArea.y + view.getY();
            int blitWidth = blitArea.width;
            int blitHeight = blitArea.height;

            if (columnHeader != null) {
                // Blit the column header as well
                int columnHeaderHeight = columnHeader.getHeight();
                blitY -= columnHeaderHeight;
                blitHeight += columnHeaderHeight;
            }

            int deltaScrollLeft = scrollLeft - previousScrollLeft;
            blitX += Math.max(deltaScrollLeft, 0);
            blitWidth -= Math.abs(deltaScrollLeft);

            Graphics2D graphics = scrollPane.getGraphics();
            graphics.copyArea(blitX, blitY, blitWidth, blitHeight, -deltaScrollLeft, 0);

            scrollPane.setConsumeRepaint(true);
            try {
                view.setLocation(rowHeaderWidth - scrollLeft, view.getY());

                if (columnHeader != null) {
                    columnHeader.setLocation(rowHeaderWidth - scrollLeft, 0);
                }
            } finally {
                scrollPane.setConsumeRepaint(false);
            }

            scrollPane.repaint(rowHeaderWidth + (deltaScrollLeft > 0 ? blitWidth : 0), blitY,
                Math.abs(deltaScrollLeft), blitHeight, true);
        } else {
            if (view != null) {
                view.setLocation(rowHeaderWidth - scrollLeft, view.getY());
            }
View Full Code Here

    // ScrollBarValueListener methods

    @Override
    public void valueChanged(ScrollBar scrollBar, int previousValue) {
        ScrollPane scrollPane = (ScrollPane)getComponent();

        int value = scrollBar.getValue();

        if (scrollBar == horizontalScrollBar) {
            scrollPane.setScrollLeft(value);
        } else {
            scrollPane.setScrollTop(value);
        }
    }
View Full Code Here

                beanAdapter = new BeanAdapter(tableRow);
                rowData = beanAdapter;
            }

            // Set up the editor component hierarchy
            scrollPane = new ScrollPane(ScrollPane.ScrollBarPolicy.NEVER,
                ScrollPane.ScrollBarPolicy.FILL);
            setContent(scrollPane);

            cardPane = new CardPane();
            scrollPane.setView(cardPane);
View Full Code Here

    // ScrollBarValueListener methods

    @Override
    public void valueChanged(ScrollBar scrollBar, int previousValue) {
        ScrollPane scrollPane = (ScrollPane)getComponent();

        int value = scrollBar.getValue();

        if (scrollBar == horizontalScrollBar) {
            scrollPane.setScrollLeft(value);
        } else {
            scrollPane.setScrollTop(value);
        }
    }
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

        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

TOP

Related Classes of org.apache.pivot.wtk.ScrollPane$Corner

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.