There is a better way that works in all directions.
Notes:
- The window may open outside the container so you need to control the opening position.
- The window position is relative to the browser
E.g. if you collapse a west panel and there are windows in a center panel then the windows won't move and can be rendered out of the constraining container
Sven - I think this should be how the window's draggable should be in the code base (rather than just the window's title bar) - your thoughts?
Code:
private class ConstrainedWindow extends Window {
private Container constrainContainer = null;
ConstrainedWindow(Container<Component> constrainContainer)
{
this.constrainContainer = constrainContainer;
}
@Override
protected void afterRender()
{
super.afterRender();
// Disable existing draggable adding one for whole window using existing handle
getDraggable().setEnabled(false);
Draggable d = new Draggable(this, getDraggable().getDragHandle());
d.setContainer(constrainContainer);
}
};
Usage:
Code:
ConstrainedWindow w = new ConstrainedWindow(constrainContainer);