if (drag != null && (
drag instanceof FBMenuItem //when you add a component from the menu
|| drag instanceof MovablePanel)) { //when you move an already dropped element
HasWidgets panel = layoutView.getUnderlyingLayout(x, y);
if (panel instanceof FBCompositeItem) {
FBCompositeItem container = (FBCompositeItem) panel;
phantoms.add(new PhantomPanel(container, x, y));
} else if (((Widget) panel).getParent() instanceof FBCompositeItem) {
FBCompositeItem container = (FBCompositeItem) ((Widget) panel).getParent();
phantoms.add(new PhantomPanel(container, x, y));
}
}
}