* when the view is maximized.
*/
protected void configureButtons(DockViewTitleBar tb){
layoutTitleBar();
DockKey key = tb.getDockable().getDockKey();
DockableState.Location location = key.getLocation();
JButton closeButton = titleBar.getCloseButton();
JButton maxBtn = titleBar.getMaximizeOrRestoreButton();
JButton hideBtn = titleBar.getHideOrDockButton();
JButton floatBtn = titleBar.getFloatButton();
switch (location){
case DOCKED:
if (key.isCloseEnabled() && isCloseButtonDisplayed){
closeButton.setVisible(true);
configureCloseButton(closeButton);
} else {
closeButton.setVisible(false);
}
if (key.isMaximizeEnabled() && isMaximizeButtonDisplayed){
maxBtn.setVisible(true);
configureMaximizeButton(maxBtn);
} else {
maxBtn.setVisible(false);
}
boolean isChildOfMaximizedContainer = false;
DockingDesktop desk = titleBar.getDesktop();
if (desk != null){
Dockable max = desk.getMaximizedDockable();
if (max != null && max.getComponent().getParent().isAncestorOf(titleBar)){
isChildOfMaximizedContainer = true;
}
}
if (key.isAutoHideEnabled() && isHideButtonDisplayed && ! isChildOfMaximizedContainer){
hideBtn.setVisible(true);
configureHideButton(hideBtn);
} else {
hideBtn.setVisible(false);
}
if (key.isFloatEnabled() && isFloatButtonDisplayed && !isChildOfMaximizedContainer){
floatBtn.setVisible(true);
configureFloatButton(floatBtn);
} else {
floatBtn.setVisible(false);
}
titleBar.revalidate();
break;
case HIDDEN:
if (key.isCloseEnabled() && isCloseButtonDisplayed){
closeButton.setVisible(true);
configureCloseButton(closeButton);
} else {
closeButton.setVisible(false);
}
// maximize not allowed when in autohide mode
maxBtn.setVisible(false);
boolean isChildOfCompound = DockingUtilities.isChildOfCompoundDockable(tb.getDockable());
// idem for float
if (key.isFloatEnabled() && isFloatButtonDisplayed && !isChildOfCompound){
floatBtn.setVisible(true);
configureFloatButton(floatBtn);
} else {
floatBtn.setVisible(false);
}
// hide becomes dock
if (isChildOfCompound){
//tb.getParent().getParent() instanceof AutoHideExpandPanel
// V2.1 : only when not nested
hideBtn.setVisible(false);
} else {
if (isDockButtonDisplayed
&& key.isAutoHideEnabled()){ // 2007/01/08
hideBtn.setVisible(true);
configureDockButton(hideBtn);
} else {
hideBtn.setVisible(false);
}