public void setPosition(int offsetWidth, int offsetHeight)
{
InputEditorPosition position =
docDisplay_.createInputEditorPosition(
completionPosition_.getPosition());
Rectangle bounds = docDisplay_.getPositionBounds(position);
int windowBottom = Window.getScrollTop() +
Window.getClientHeight() ;
int cursorBottom = bounds.getBottom() ;
// figure out whether we should show below (do this
// only once so that we maintain the menu orientation
// while filtering)
if (showBelow_ == null)
showBelow_ = windowBottom - cursorBottom >= offsetHeight;
final int PAD = 3;
if (showBelow_)
setPopupPosition(bounds.getLeft(), cursorBottom + PAD) ;
else
setPopupPosition(bounds.getLeft(),
bounds.getTop() - offsetHeight) ;
}
});
}