topWindowStateChangeManager_ = new WindowStateChangeManager(session);
bottomWindowStateChangeManager_ = new WindowStateChangeHandler()
{
public void onWindowStateChange(WindowStateChangeEvent event)
{
WindowState topState;
switch (event.getNewState())
{
case NORMAL:
topState = NORMAL;
break;
case MAXIMIZE:
topState = MINIMIZE;
break;
case MINIMIZE:
topState = MAXIMIZE;
break;
case HIDE:
topState = EXCLUSIVE;
break;
case EXCLUSIVE:
topState = HIDE;
break;
default:
throw new IllegalArgumentException(
"Unknown WindowState " + event.getNewState());
}
windowA_.onWindowStateChange(
new WindowStateChangeEvent(topState));
}
};
hookEvents();
new WindowLayoutStateValue(session.getSessionInfo().getClientState(),
clientStateKeyName,
topWindowDefaultState,
defaultSplitterPos);
setWidget(layout_);
if (eventBus != null)
{
layout_.addSplitterBeforeResizeHandler(new SplitterBeforeResizeHandler()
{
public void onSplitterBeforeResize(SplitterBeforeResizeEvent event)
{
// If the splitter ends up causing a minimize operation, then
// we'll need to have saved the normal height for when the
// user decides to restore the panel.
snapMinimizeNormalHeight_ = new NormalHeight(
layout_.getSplitterBottom(),
layout_.getOffsetHeight(),
Window.getClientHeight());
eventBus.fireEvent(new GlassVisibilityEvent(true));
}
});
layout_.addSplitterResizedHandler(new SplitterResizedHandler()
{
public void onSplitterResized(SplitterResizedEvent event)
{
WindowState topState = resizePanes(layout_.getSplitterBottom());
// we're already in normal if the splitter is being invoked
if (topState != WindowState.NORMAL)
{
topWindowStateChangeManager_.onWindowStateChange(