Many thanks ! It’s working well
Posting a solution for Question #1 for google…
// ...
public class MyCFlapLayoutManager extends CFlapLayoutManager {
@Override
public int getSize( FlapDockStation station, Dockable dockable )
{
/*
* A hack to allow each Dockable to have its own default size. All we
* do is set the stations default window size to our size if it is
* available, return getSize, and restore the default window size. The
* getSize method will take care of the normal logic for us (such as
* only setting the size to the default when the flap is first opened).
*/
int oldDefault = 0, rt;
boolean instance = dockable instanceof MyDockable.MyDefaultCommonDockable;
if ( instance )
{
oldDefault = station.getDefaultWindowSize();
station.setDefaultWindowSize( ( (MyDockable.MyDefaultCommonDockable) dockable ).getDefaultFlapWindowSize() );
}
rt = super.getSize( station, dockable );
if ( instance ) {
station.setDefaultWindowSize( oldDefault );
}
return rt;
}
}
public static class MyDockable extends DefaultSingleCDockable {
public static class MyDefaultCommonDockable extends DefaultCommonDockable {
private int defaultFlapWindowSize = 400;
public MyDefaultCommonDockable( CDockable dockable,
DockActionSource... sources )
{
super( dockable, sources );
}
public void setDefaultFlapWindowSize( int size ) {
defaultFlapWindowSize = size;
}
public int getDefaultFlapWindowSize() {
return defaultFlapWindowSize;
}
}
public MyDockable( String id, Component comp, CAction... actions )
{
super( id, comp, actions );
}
public MyDockable( String id, CAction... actions )
{
super( id, actions );
}
// ...
public void setDefaultFlapWindowSize( int size ) {
DefaultCommonDockable intern = intern();
if (intern instanceof MyDefaultCommonDockable) {
((MyDefaultCommonDockable)intern()).setDefaultFlapWindowSize( size );
}
}
public int getDefaultFlapWindowSize() {
DefaultCommonDockable intern = intern();
if (intern instanceof MyDefaultCommonDockable) {
return ((MyDefaultCommonDockable)intern()).getDefaultFlapWindowSize();
} else {
return 0;
}
}
// Insert our own "middleman" so we can store default sizes
@Override
protected DefaultCommonDockable createCommonDockable(){
return new MyDefaultCommonDockable( this, getClose() );
}
}
Then for the CControl
// Control will use our custom layout managers when internally creating FlapDockStations
control.putProperty( FlapDockStation.LAYOUT_MANAGER, new MyCFlapLayoutManager() );
myDockable.setDefaultFlapWindowSize( 200 );