}
@SuppressWarnings({ "deprecation", "rawtypes" })
private void linkPopupToDropDownPosition(final DropDownControl<T> dropDownControl) {
Element panel = getElement().findElementByName("#panel");
panel.setConstraintX(new SizeValue(dropDownControl.getElement().getX() + "px"));
panel.setConstraintWidth(new SizeValue(dropDownControl.getWidth() + "px"));
getElement().layoutElements();
ListBoxControl listBox = getElement().findNiftyControl("#listBox", ListBoxControl.class);
listBox.ensureWidthConstraints();
panel.setConstraintHeight(new SizeValue(listBox.getHeight() + "px"));
if ((dropDownControl.getElement().getY() + listBox.getHeight()) > nifty.getRenderEngine().getHeight()) {
panel.setConstraintY(new SizeValue(dropDownControl.getElement().getY() - listBox.getHeight() + "px"));
updateMoveEffect(listBox, 1);
} else {
panel.setConstraintY(new SizeValue(dropDownControl.getElement().getY() + dropDownControl.getHeight() + "px"));
updateMoveEffect(listBox, -1);
}
getElement().layoutElements();
}