conversion.getSituation().add( new CommonMultipleDockableFactory( item.getKey(), item.getValue(), control, perspective ) );
}
XElement xstations = root.getElement( "stations" );
if( xstations == null ){
throw new XException( "missing element 'stations'" );
}
Map<String, DockLayoutComposition> stations = conversion.getSituation().readCompositionsXML( xstations );
factory.setStations( stations );
for( DockLayoutComposition composition : stations.values() ){
PerspectiveElement station = conversion.convert( composition );
if( station instanceof CommonElementPerspective ){
CStationPerspective stationPerspective = ((CommonElementPerspective)station).getElement().asStation();
if( stationPerspective != null ){
perspective.addStation( stationPerspective );
}
}
}
perspective.storeLocations();
// read the last known location of all elements
XElement xinvisible = root.getElement( "invisible" );
if( xinvisible != null ){
PropertyTransformer transformer = frontend.getPropertyTransformer();
for( XElement xdockable : xinvisible.getElements( "dockable" )){
String key = xdockable.getString( "key" );
CDockablePerspective dockable = perspective.getDockable( key );
if( dockable == null ){
XElement xcontent = xdockable.getElement( "content" );
if( xcontent != null ){
PerspectiveElement element = conversion.convert( conversion.getSituation().readCompositionXML( xcontent ) );
if( element instanceof CommonElementPerspective ){
dockable = ((CommonElementPerspective)element).getElement().asDockable();
if( dockable != null ){
perspective.putDockable( dockable );
}
}
}
}
if( dockable != null ){
XElement xlocation = xdockable.getElement( "location" );
String locationRoot = xlocation.getString( "root" );
DockableProperty location = transformer.readXML( xlocation );
Path mode = new Path( xlocation.getString( "mode" ));
ExtendedMode extendedMode = perspective.getLocationManager().getMode( mode );
if( extendedMode != null ){
dockable.getLocationHistory().add( extendedMode, new Location( mode, locationRoot, location ) );
}
}
}
}
XElement xmodes = root.getElement( "modes" );
if( xmodes == null ){
throw new XException( "missing element 'modes'" );
}
ModeSettingsConverter<Location, Location> converter = new LocationSettingConverter( control.getOwner().getController() );
ModeSettings<Location, Location> modes = control.getOwner().getLocationManager().createModeSettings( converter );
modes.readXML( xmodes );