docs: public void position() {
  
          // get the window client width
          int windowWidth = Window.getClientWidth();
          // get the min left position
          int minLeft = MIN_MARGIN;
  
          // get the max right position
          int maxRight = windowWidth - MIN_MARGIN;
          // get the middle button position
          CmsPositionBean buttonPosition = CmsPositionBean.generatePositionInfo(m_button.getElement());
          int buttonMiddle = (buttonPosition.getLeft() - Window.getScrollLeft()) + (buttonPosition.getWidth() / 2);
          // get the content width
          int contentWidth = getOffsetWidth();
  
          // the optimum left position is in the middle of the button minus the half content width
          // assume that the optimum fits into the space
          int contentLeft = buttonMiddle - (contentWidth / 2);
  
          if (minLeft > contentLeft) {
              // if the optimum left position of the popup is outside the min left position:
              // move the popup to the right (take the min left position as left)
              contentLeft = minLeft;
          } else if ((contentLeft + contentWidth) > maxRight) {
              // if the left position plus the content width is outside the max right position:
              // move the popup to the left (take the max right position minus the content width)
              contentLeft = maxRight - contentWidth;
          }
  
          // limit the right position if the popup is right outside the window
          if ((contentLeft + contentWidth + MIN_MARGIN) > windowWidth) {
              contentLeft = windowWidth - contentWidth - MIN_MARGIN;
          }
  
          // limit the left position if the popup is left outside the window
          if (contentLeft < MIN_MARGIN) {
              contentLeft = MIN_MARGIN;
          }
  
          int arrowSpace = 10;
          int arrowWidth = 40;
          int arrowHeight = 12;
  
          // the optimum position for the arrow is in the middle of the button
          int arrowLeft = buttonMiddle - contentLeft - (arrowWidth / 2);
          if ((arrowLeft + arrowWidth + arrowSpace) > contentWidth) {
              // limit the arrow position if the maximum is reached (content width 'minus x')
              arrowLeft = contentWidth - arrowWidth - arrowSpace;
          } else if ((arrowLeft - arrowSpace) < 0) {
              // limit the arrow position if the minimum is reached ('plus x')
              arrowLeft = arrowWidth + arrowSpace;
          }
  
          int arrowTop = -(arrowHeight - 2);
          String arrowClass = I_CmsLayoutBundle.INSTANCE.dialogCss().menuArrowTop();
  
          int contentTop = (((buttonPosition.getTop() + buttonPosition.getHeight()) - Window.getScrollTop())
              + arrowHeight) - 2;
          if (!m_isToolbarMode) {
              contentTop = (buttonPosition.getTop() + buttonPosition.getHeight() + arrowHeight) - 2;
              int contentHeight = getOffsetHeight();
              int windowHeight = Window.getClientHeight();
  
              if (((contentHeight + MIN_MARGIN) < windowHeight)
                  && ((buttonPosition.getTop() - Window.getScrollTop()) > contentHeight)
                  && (((contentHeight + MIN_MARGIN + contentTop) - Window.getScrollTop()) > windowHeight)) {
                  // content fits into the window height,
                  // there is enough space above the button
                  // and there is to little space below the button
                  // so show above
                  contentTop = ((buttonPosition.getTop() - arrowHeight) + 2) - contentHeight;
                  arrowTop = contentHeight - 1;
                  arrowClass = I_CmsLayoutBundle.INSTANCE.dialogCss().menuArrowBottom();
              }
          } else {
              contentLeft = contentLeft - Window.getScrollLeft();
              setPositionFixed();
          }
  
          m_arrow.setClassName(arrowClass);
          m_arrow.getStyle().setLeft(arrowLeft, Unit.PX);
          m_arrow.getStyle().setTop(arrowTop, Unit.PX);
  
          showArrow(m_arrow);
          setPopupPosition(contentLeft + Window.getScrollLeft(), contentTop);
      }