setController( controller );
}
@Override
protected Boolean createGroupKey( Dockable dockable ){
DockStation station = dockable.asDockStation();
if( station == null )
throw new IllegalArgumentException( "Only dockables which are also a DockStation can be used for a ReplaceAction" );
DockStation parent = dockable.getDockParent();
if( parent == null )
return false;
int count = station.getDockableCount();
if( count == 0 )
return parent.canDrag( dockable );
if( count == 1 ){
return parent.canReplace( dockable, station.getDockable( 0 ) ) &&
parent.accept( station.getDockable( 0 )) &&
station.getDockable( 0 ).accept( parent ) &&
station.canDrag( station.getDockable( 0 ));
}
return false;
}