void positionPopup() {

        if (m_popup.isShowing()) {
            int width = m_popup.getOffsetWidth();

            int openerHeight = CmsDomUtil.getCurrentStyleInt(m_opener.getElement(), CmsDomUtil.Style.height);
            int popupHeight = getPopupHeight();
            int dx = 0;
            if (width > (m_opener.getOffsetWidth())) {
                int spaceOnTheRight = (Window.getClientWidth() + Window.getScrollLeft())
                    - m_opener.getAbsoluteLeft()
                    - width;
                dx = spaceOnTheRight < 0 ? spaceOnTheRight : 0;
            }
            // Calculate top position for the popup
            int top = m_opener.getAbsoluteTop();

            // Make sure scrolling is taken into account, since
            // box.getAbsoluteTop() takes scrolling into account.
            int windowTop = Window.getScrollTop();
            int windowBottom = Window.getScrollTop() + Window.getClientHeight();

            // Distance from the top edge of the window to the top edge of the
            // text box
            int distanceFromWindowTop = top - windowTop;

            // Distance from the bottom edge of the window to the bottom edge of
            // the text box
            int distanceToWindowBottom = windowBottom - (top + m_opener.getOffsetHeight());

            boolean displayAbove = displayingAbove();

            // in case there is not enough space, add a scroll panel to the selector popup
            if ((displayAbove && (distanceFromWindowTop < popupHeight))
                || (!displayAbove && (distanceToWindowBottom < popupHeight))) {
                setScrollingSelector((displayAbove ? distanceFromWindowTop : distanceToWindowBottom) - 10);
                popupHeight = m_popup.getOffsetHeight();
            }

            if (displayAbove) {
                // Position above the text box
                CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, -(popupHeight - 2));
                m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom());
                m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop());
            } else {
                CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, openerHeight - 1);
                m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop());
                m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom());
            }
        }
    }
void positionPopup ( ) { if ( m_popup . isShowing ( ) ) { int width = m_popup . getOffsetWidth ( ) ; int openerHeight = CmsDomUtil . getCurrentStyleInt ( m_opener . getElement ( ) , CmsDomUtil . Style . height ) ; int popupHeight = getPopupHeight ( ) ; int dx = 0 ; if ( width > ( m_opener . getOffsetWidth ( ) ) ) { int spaceOnTheRight = ( Window . getClientWidth ( ) + Window . getScrollLeft ( ) ) - m_opener . getAbsoluteLeft ( ) - width ; dx = spaceOnTheRight < 0 ? spaceOnTheRight : 0 ; } int top = m_opener . getAbsoluteTop ( ) ; int windowTop = Window . getScrollTop ( ) ; int windowBottom = Window . getScrollTop ( ) + Window . getClientHeight ( ) ; int distanceFromWindowTop = top - windowTop ; int distanceToWindowBottom = windowBottom - ( top + m_opener . getOffsetHeight ( ) ) ; boolean displayAbove = displayingAbove ( ) ; if ( ( displayAbove && ( distanceFromWindowTop < popupHeight ) ) || ( ! displayAbove && ( distanceToWindowBottom < popupHeight ) ) ) { setScrollingSelector ( ( displayAbove ? distanceFromWindowTop : distanceToWindowBottom ) - 10 ) ; popupHeight = m_popup . getOffsetHeight ( ) ; } if ( displayAbove ) { CmsDomUtil . positionElement ( m_popup . getElement ( ) , m_panel . getElement ( ) , dx , - ( popupHeight - 2 ) ) ; m_selectBoxState . setValue ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . cornerBottom ( ) ) ; m_selectorState . setValue ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . cornerTop ( ) ) ; } else { CmsDomUtil . positionElement ( m_popup . getElement ( ) , m_panel . getElement ( ) , dx , openerHeight - 1 ) ; m_selectBoxState . setValue ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . cornerTop ( ) ) ; m_selectorState . setValue ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . cornerBottom ( ) ) ; } } }
Positions the select popup.<p>