{
Widget current = getWidgetForMode(mode_);
Widget target = getWidgetForMode(mode);
boolean focus = DomUtils.hasFocus(getActiveHistory().getFocusTarget());
HasHistory focusCurrent = getHistoryForMode(mode_);
HasHistory focusTarget = getHistoryForMode(mode);
boolean rightToLeft = mode_.getValue() < mode.getValue();
if (mode != Mode.Recent && mode_ != Mode.Recent)
animate(current,
target,
rightToLeft,
focusCurrent,
focusTarget,
focus);
else
{
setVisible(current, focusCurrent.getFocusTarget(), false);
setVisible(target, focusTarget.getFocusTarget(), true);
if (focus)
{
DomUtils.setActive(focusTarget.getFocusTarget());
}
}
mode_ = mode;
// enable/disable commands