s = (String)nextAttributes.get( "icon" );
if ( s != null )
iconName = s;
}
XDockable dockable = findDockable( comp );
if ( dockable == null )
dockable = new XDockable( getDockingApp().getSidebar( sidebar != null ? sidebar : getName()),
title != null ? currentProject.getTranslator().translate( title ) : getName());
dockables.add( dockable );
dockable.content = (Container)comp;
boolean doReplace = true;
dockable.canClose = canClose;
dockable.canMinimize = canMinimize;
dockable.canDock = canDock;
dockable.canDrag = canDrag;
dockable.canZoom = canZoom;
dockable.hasDockingTitle = hasDockingTitle;
if ( nextAttributes != null ) {
String s = (String)nextAttributes.get( "canMinimize" );
if (( s != null ) && ( s.length() > 0 ))
dockable.canMinimize = "true".equals( s );
s = (String)nextAttributes.get( "canClose" );
if (( s != null ) && ( s.length() > 0 ))
dockable.canClose = "true".equals( s );
s = (String)nextAttributes.get( "canDock" );
if (( s != null ) && ( s.length() > 0 ))
dockable.canDock = "true".equals( s );
s = (String)nextAttributes.get( "canDrag" );
if (( s != null ) && ( s.length() > 0 ))
dockable.canDrag = "true".equals( s );
s = (String)nextAttributes.get( "canZoom" );
if (( s != null ) && ( s.length() > 0 ))
dockable.canZoom = "true".equals( s );
s = (String)nextAttributes.get( "hasDockingTitle" );
if (( s != null ) && ( s.length() > 0 ))
dockable.hasDockingTitle = "true".equals( s );
s = (String)nextAttributes.get( "replace" );
if (( s != null ) && ( s.length() > 0 ))
doReplace = "true".equals( s );
s = (String)nextAttributes.get( "state" );
if ( s != null ) {
if ( s.equals( "minimized" )) {
minimized = true;
maximized = false;
}
else if ( s.equals( "maximized" )) {
maximized = true;
minimized = false;
}
}
}
if (( iconName != null ) && ( iconName.length() > 0 ))
dockable.icon = (ImageIcon)currentProject.getIcon( iconName );
// Setup the coloring
Color[] colors = new Color[ 5 ];
colors[ 0 ] = SystemColor.control.brighter(); // headerBkColor
colors[ 1 ] = SystemColor.controlText; // headerTextColor
colors[ 2 ] = Color.orange; // activeColor - the stripe under the active component
colors[ 3 ] = colors[ 2 ];// activeTextColor
colors[ 4 ] = Color.red;// pressedTextColor
XTranslator translator = currentProject.getTranslator();
XStyleManager sm = currentProject.getStyleManager();
if ( sm.hasStyle( "dockingHeader" )) {
XStyle xstyle = sm.getStyle( "dockingHeader" );
colors[ 0 ] = xstyle.getStyleAsColor( XStyle.COLOR_BACK );
colors[ 1 ] = xstyle.getStyleAsColor( XStyle.COLOR_FORE );
XStyle xstyleActive = sm.getStyle( "dockingHeader/active" );
colors[ 2 ] = xstyleActive.getStyleAsColor( XStyle.COLOR_BACK );
colors[ 3 ] = xstyleActive.getStyleAsColor( XStyle.COLOR_FORE );
}
// Setup the tooltips
String[] tooltips = new String[ 3 ];
tooltips[ 0 ] = ( translator != null ? translator.translate( "Minimize" ) : "Minimize" );
tooltips[ 1 ] = ( translator != null ? translator.translate( "Zoom/Restore" ) : "Zoom/Restore" );
tooltips[ 2 ] = ( translator != null ? translator.translate( "Close" ) : "Close" );
super.addDockable( dockable, colors, tooltips );
if ( doReplace ) {
if ( contentPane.getComponentCount() > 0 ) {
XDockable docked = findDockable( contentPane.getComponent( 0 ));
if (( docked != null ) && ( docked != dockable ))
super.removeDockable( docked, false );
else if ( minimized )
dockable.dockedContainer.setVisible( true );
}
}
final XDockable thisDockable = dockable;
SwingUtilities.invokeLater( new Runnable() {
public void run()
{
if ( minimized ) {
thisDockable.dockedContainer.removeDockable( thisDockable, true );