public void windowAdded(final DockingWindow addedToWindow, final DockingWindow addedWindow) {
if(addedWindow instanceof TabWindow) {
final DockingWindowProperties windowProperties = addedWindow.getWindowProperties();
windowProperties.setDockEnabled(false);
windowProperties.setUndockEnabled(false);
final TabAreaProperties tabAreaProperties = ((TabWindow)addedWindow).getTabWindowProperties().getTabbedPanelProperties().getTabAreaProperties();
if (addedToWindow == rootWindow)
tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.MORE_THAN_ONE_TAB);
else
tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS);
}
setTabPolicies(addedWindow);
}
private void setTabPolicies(final DockingWindow window) {
if(window instanceof TabWindow){
TabbedPanelProperties tabbedPanelProperties = ((TabWindow)window).getTabWindowProperties().getTabbedPanelProperties();
if(! tabbedPanelProperties.getTabLayoutPolicy().equals(TabLayoutPolicy.COMPRESSION))
tabbedPanelProperties.setTabLayoutPolicy(TabLayoutPolicy.COMPRESSION);
if(! tabbedPanelProperties.getTabDropDownListVisiblePolicy().equals(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB))
tabbedPanelProperties.setTabDropDownListVisiblePolicy(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB);
}
for(int i = 0; i < window.getChildWindowCount(); i++){
setTabPolicies(window.getChildWindow(i));
}
}
@Override
public void windowRemoved(DockingWindow removedFromWindow, DockingWindow removedWindow) {
if(removedWindow instanceof TabWindow) {
if (removedFromWindow == rootWindow) {
final TabAreaProperties tabAreaProperties = ((TabWindow)removedWindow).getTabWindowProperties().getTabbedPanelProperties().getTabAreaProperties();
tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS);
}
}
}
});