{
hidePopup ( false );
}
}
} );
button.addAncestorListener ( new AncestorAdapter ()
{
@Override
public void ancestorRemoved ( final AncestorEvent event )
{
// Hiding popup properly when button is removed from visible container somehow
hidePopup ( false );
}
@Override
public void ancestorMoved ( final AncestorEvent event )
{
// Placing popup properly when button has moved
updateBounds ();
}
} );
button.addComponentListener ( new ComponentAdapter ()
{
@Override
public void componentHidden ( final ComponentEvent e )
{
// Hiding popup properly when button is hidden
hidePopup ( false );
}
@Override
public void componentResized ( final ComponentEvent e )
{
updateBounds ();
}
@Override
public void componentMoved ( final ComponentEvent e )
{
updateBounds ();
}
} );
// Popup content panel
container = new WebPanel ();
container.setOpaque ( false );
container.setFocusCycleRoot ( true );
// Initial components composition
updateContent ();
// Bounds update listeners
addAncestorListener ( new AncestorAdapter ()
{
@Override
public void ancestorAdded ( final AncestorEvent event )
{
updateBounds ();