public CommonDockable layout( CommonSingleDockableLayout layout, PlaceholderStrategy placeholders ) {
SingleCDockableFactory backup = getFactory( layout.getId() );
if( backup == null )
return null;
SingleCDockable dockable = backup.createBackup( layout.getId() );
if( dockable == null )
return null;
String factoryId = dockable.intern().getFactoryID();
if( !factoryId.equals( getID() )){
throw new IllegalArgumentException( "Wrong type of dockable for unique id '" + layout.getId() + "': The backup factory created a dockable which expects a factory with type-id '" + factoryId +
"', but the call was done from a factory with type-id '" + getID() + "'" );
}
control.addDockable( dockable );
if( layout.isAreaSet()){
if( layout.getArea() != null ){
CStation<?> station = control.getStation( layout.getArea() );
if( station == null ){
DelayedWorkingAreaSetter setter = new DelayedWorkingAreaSetter( layout.getArea(), dockable, control );
setter.install();
}
else {
dockable.setWorkingArea( station );
}
}
else{
dockable.setWorkingArea( null );
}
}
return dockable.intern();
}