public static < T extends PopupPanel > T show ( T popup , Position pos , Widget target ) { popup . setVisible ( false ) ; popup . show ( ) ; int left , top ; switch ( pos ) { case RIGHT : left = target . getAbsoluteLeft ( ) + target . getOffsetWidth ( ) + NEAR_GAP ; break ; default : left = target . getAbsoluteLeft ( ) ; break ; } if ( left + popup . getOffsetWidth ( ) > Window . getClientWidth ( ) ) { left = Math . max ( 0 , Window . getClientWidth ( ) - popup . getOffsetWidth ( ) ) ; } switch ( pos ) { case ABOVE : top = target . getAbsoluteTop ( ) - popup . getOffsetHeight ( ) - NEAR_GAP ; break ; case OVER : top = target . getAbsoluteTop ( ) ; break ; case RIGHT : top = target . getAbsoluteTop ( ) + ( target . getOffsetHeight ( ) - popup . getOffsetHeight ( ) ) / 2 ; break ; default : case BELOW : top = target . getAbsoluteTop ( ) + target . getOffsetHeight ( ) + NEAR_GAP ; break ; } popup . setPopupPosition ( left , top ) ; popup . setVisible ( true ) ; return popup ; }
Shows the supplied popup in the specified position relative to the specified target widget .