Package pivot.wtk

Examples of pivot.wtk.Component$ComponentListenerList


            fillHeightToCapacity = true;
        }

        layoutHelper(horizontalPolicy, verticalPolicy);

        Component view = scrollPane.getView();
        if (view != null && (fillWidthToCapacity || fillHeightToCapacity)) {
            // We assumed AUTO. Now we check our assumption to see if we
            // need to adjust it to use FILL
            boolean adjustWidth = false, adjustHeight = false;

            if (fillWidthToCapacity) {
                Component rowHeader = scrollPane.getRowHeader();
                int rowHeaderWidth = rowHeader != null ? rowHeader.getWidth() : 0;

                int verticalScrollBarWidth = verticalScrollBar.isVisible() ?
                    verticalScrollBar.getWidth() : 0;
                int minViewWidth = getWidth() - rowHeaderWidth - verticalScrollBarWidth;

                if (view.getWidth() < minViewWidth) {
                    horizontalPolicy = ScrollBarPolicy.FILL;
                    adjustWidth = true;
                }
            }

            if (fillHeightToCapacity) {
                Component columnHeader = scrollPane.getColumnHeader();
                int columnHeaderHeight = columnHeader != null ?
                    columnHeader.getHeight() : 0;

                int horizontalScrollBarHeight = horizontalScrollBar.isVisible() ?
                    horizontalScrollBar.getHeight() : 0;
                int minViewHeight = getHeight() - columnHeaderHeight -
                    horizontalScrollBarHeight;
View Full Code Here


        int height = getHeight();

        boolean constrainWidth = (horizontalPolicy == ScrollBarPolicy.FILL);
        boolean constrainHeight = (verticalPolicy == ScrollBarPolicy.FILL);

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

        int rowHeaderWidth = 0;
        if (rowHeader != null) {
            rowHeaderWidth = rowHeader.getPreferredWidth(-1);
        }

        int columnHeaderHeight = 0;
        if (columnHeader != null) {
            columnHeaderHeight = columnHeader.getPreferredHeight(-1);
        }

        int previousViewWidth, viewWidth = 0;
        int previousViewHeight, viewHeight = 0;
        int previousHorizontalScrollBarHeight, horizontalScrollBarHeight = cachedHorizontalScrollBarHeight;
        int previousVerticalScrollBarWidth, verticalScrollBarWidth = cachedVerticalScrollBarWidth;
        int i = 0;

        do {
            previousViewWidth = viewWidth;
            previousViewHeight = viewHeight;
            previousHorizontalScrollBarHeight = horizontalScrollBarHeight;
            previousVerticalScrollBarWidth = verticalScrollBarWidth;

            if (view != null) {
                if (constrainWidth && constrainHeight) {
                    viewWidth = Math.max
                        (width - rowHeaderWidth - verticalScrollBarWidth, 0);
                    viewHeight = Math.max
                        (height - columnHeaderHeight - horizontalScrollBarHeight, 0);
                } else if (constrainWidth) {
                    viewWidth = Math.max
                        (width - rowHeaderWidth - verticalScrollBarWidth, 0);
                    viewHeight = view.getPreferredHeight(viewWidth);
                } else if (constrainHeight) {
                    viewHeight = Math.max
                        (height - columnHeaderHeight - horizontalScrollBarHeight, 0);
                    viewWidth = view.getPreferredWidth(viewHeight);
                } else {
                    Dimensions viewPreferredSize = view.getPreferredSize();
                    viewWidth = viewPreferredSize.width;
                    viewHeight = viewPreferredSize.height;
                }
            }

            if (horizontalPolicy == ScrollBarPolicy.ALWAYS
                || (horizontalPolicy == ScrollBarPolicy.AUTO
                && viewWidth > width - rowHeaderWidth - verticalScrollBarWidth)) {
                horizontalScrollBarHeight = horizontalScrollBar.getPreferredHeight(-1);
            } else {
                horizontalScrollBarHeight = 0;
            }

            if (verticalPolicy == ScrollBarPolicy.ALWAYS
                || (verticalPolicy == ScrollBarPolicy.AUTO
                && viewHeight > height - columnHeaderHeight - horizontalScrollBarHeight)) {
                verticalScrollBarWidth = verticalScrollBar.getPreferredWidth(-1);
            } else {
                verticalScrollBarWidth = 0;
            }

            if (++i > 4) {
                // Infinite loop protection
                System.err.println("Breaking out of potential infinite loop");
                break;
            }
        } while (viewWidth != previousViewWidth
            || viewHeight != previousViewHeight
            || horizontalScrollBarHeight != previousHorizontalScrollBarHeight
            || verticalScrollBarWidth != previousVerticalScrollBarWidth);

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

        if (view != null) {
            view.setSize(viewWidth, viewHeight);
            view.setLocation(rowHeaderWidth - scrollLeft, columnHeaderHeight - scrollTop);
        }

        if (columnHeader != null) {
            columnHeader.setSize(viewWidth, columnHeaderHeight);
            columnHeader.setLocation(rowHeaderWidth - scrollLeft, 0);
        }

        if (rowHeader != null) {
            rowHeader.setSize(rowHeaderWidth, viewHeight);
            rowHeader.setLocation(0, columnHeaderHeight - scrollTop);
        }

        if (horizontalScrollBarHeight > 0) {
            horizontalScrollBar.setVisible(true);

            int horizontalScrollBarWidth = Math.max
               (width - rowHeaderWidth - verticalScrollBarWidth, 0);
            horizontalScrollBar.setSize(horizontalScrollBarWidth,
                horizontalScrollBarHeight);
            horizontalScrollBar.setLocation(rowHeaderWidth,
                height - horizontalScrollBarHeight);
        } else {
            horizontalScrollBar.setVisible(false);
        }

        if (verticalScrollBarWidth > 0) {
            verticalScrollBar.setVisible(true);

            int verticalScrollBarHeight = Math.max
               (height - columnHeaderHeight - horizontalScrollBarHeight, 0);
            verticalScrollBar.setSize(verticalScrollBarWidth,
                verticalScrollBarHeight);
            verticalScrollBar.setLocation(width - verticalScrollBarWidth,
                columnHeaderHeight);
        } else {
            verticalScrollBar.setVisible(false);
        }

        // Handle corner components

        if (columnHeaderHeight > 0
            && rowHeaderWidth > 0) {
            if (corner != null) {
                corner.setVisible(true);
                corner.setSize(rowHeaderWidth, columnHeaderHeight);
                corner.setLocation(0, 0);

                topLeftCorner.setVisible(false);
            } else {
                topLeftCorner.setVisible(true);
                topLeftCorner.setSize(rowHeaderWidth, columnHeaderHeight);
                topLeftCorner.setLocation(0, 0);
            }
        } else {
            if (corner != null) {
                corner.setVisible(false);
            }

            topLeftCorner.setVisible(false);
        }
View Full Code Here

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

        ScrollPane scrollPane = (ScrollPane)getComponent();

        Component rowHeader = scrollPane.getRowHeader();
        if (rowHeader != null) {
            int rowHeaderWidth = rowHeader.getWidth();

            x += rowHeaderWidth;
            width -= rowHeaderWidth;
        }

        Component columnHeader = scrollPane.getColumnHeader();
        if (columnHeader != null) {
            int columnHeaderHeight = columnHeader.getHeight();

            y += columnHeaderHeight;
            height -= columnHeaderHeight;
        }
View Full Code Here

        // 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 columnHeader = scrollPane.getColumnHeader();
        Component rowHeader = scrollPane.getRowHeader();

        int scrollTop = scrollPane.getScrollTop();
        int columnHeaderHeight = 0;

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

        if (view != null) {
            view.setLocation(view.getX(), columnHeaderHeight - scrollTop);
        }

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

        if (scrollTop >= 0 && scrollTop <= getMaxScrollTop()) {
            verticalScrollBar.setValue(scrollTop);
        }
View Full Code Here

        // 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 columnHeader = scrollPane.getColumnHeader();
        Component rowHeader = scrollPane.getRowHeader();

        int scrollLeft = scrollPane.getScrollLeft();
        int rowHeaderWidth = 0;

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

        if (view != null) {
            view.setLocation(rowHeaderWidth - scrollLeft, view.getY());
        }
View Full Code Here

            this.selectedIndex = selectedIndex;
        }

        @Override
        public void start(TransitionListener transitionListener) {
            Component previousSelectedCard = getPreviousSelectedCard();
            Component selectedCard = getSelectedCard();

            if (matchSelectedCardSize) {
                if (previousSelectedCard != null) {
                    previousSelectedCard.getDecorators().add(fadeOutDecorator);
                }

                if (selectedCard != null) {
                    selectedCard.getDecorators().add(fadeInDecorator);
                }
            }

            super.start(transitionListener);
        }
View Full Code Here

        }

        @Override
        public void stop() {
            if (matchSelectedCardSize) {
                Component previousSelectedCard = getPreviousSelectedCard();
                Component selectedCard = getSelectedCard();

                if (previousSelectedCard != null) {
                    previousSelectedCard.getDecorators().remove(fadeOutDecorator);
                }

                if (selectedCard != null) {
                    selectedCard.getDecorators().remove(fadeInDecorator);
                }
            }

            invalidateComponent();
View Full Code Here

        // Lay out the components
        Accordion.PanelSequence panels = accordion.getPanels();

        int panelY = 0;
        for (int i = 0, n = panels.getLength(); i < n; i++) {
          Component panel = panels.get(i);

          PanelHeader panelHeader = panelHeaders.get(i);
          panelHeader.setLocation(0, panelY);
          panelY += (panelHeader.getHeight() - 1);

          if (selectionChangeTransition == null) {
                Component selectedPanel = accordion.getSelectedPanel();

                if (panel == selectedPanel) {
                    panel.setVisible(true);

                panel.setSize(contentWidth, contentHeight);
                    panel.setLocation(padding.left + 1, panelY + padding.top);

                    panelY += panelHeight;
                } else {
                    panel.setVisible(false);
                }
          } else {
            Component previousSelectedPanel = selectionChangeTransition.previousSelectedPanel;
            Component selectedPanel = selectionChangeTransition.selectedPanel;

            if (selectionChangeTransition.isRunning()) {
                if (panel == previousSelectedPanel) {
                        panel.setLocation(padding.left + 1, panelY + padding.top);

                        int previousSelectedPanelHeight = Math.round((float)panelHeight * (1.0f
                        - selectionChangeTransition.getEasedPercentComplete()));
                  selectionChangeTransition.previousSelectedPanelClipDecorator.setWidth(contentWidth);
                        selectionChangeTransition.previousSelectedPanelClipDecorator.setHeight(previousSelectedPanelHeight);

                        panelY += previousSelectedPanelHeight;
                }

                if (panel == selectedPanel) {
                        panel.setLocation(padding.left + 1, panelY + padding.top);

                  int selectedPanelHeight = Math.round((float)panelHeight
                  * selectionChangeTransition.getEasedPercentComplete());
                  selectionChangeTransition.selectedPanelClipDecorator.setWidth(contentWidth);
                        selectionChangeTransition.selectedPanelClipDecorator.setHeight(selectedPanelHeight);

                  panelY += selectedPanelHeight;
                }
            } else {
              selectedPanel.setSize(previousSelectedPanel.getSize());
              selectedPanel.setVisible(true);
            }
          }
        }
    }
View Full Code Here

      selectionChangeTransition.stop();
      selectionChangeTransition = null;
    }

    // Create a new button for the panel
        Component panel = accordion.getPanels().get(index);
        PanelHeader panelHeader = new PanelHeader(new ButtonData(Accordion.getIcon(panel),
            Accordion.getName(panel)));

        accordion.add(panelHeader);
        panelHeader.setGroup(panelHeaderGroup);
View Full Code Here

      if (selectionChangeTransition == null) {
          int previousSelectedIndex = accordion.getSelectedIndex();

          if (selectedIndex != -1
          && previousSelectedIndex != -1) {
            Component previousSelectedPanel = accordion.getPanels().get(previousSelectedIndex);
            Component selectedPanel = accordion.getPanels().get(selectedIndex);

              selectionChangeTransition = new SelectionChangeTransition(previousSelectedPanel, selectedPanel,
              SELECTION_CHANGE_DURATION, SELECTION_CHANGE_RATE);

              layout();
View Full Code Here

TOP

Related Classes of pivot.wtk.Component$ComponentListenerList

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.