… and I just figured out my problem - it must have been a friday thing. It was my test code was misleading me - I did not add in all the child dockables into the PredefinedDockSituation. My fault. Below is what I am actually doing, does it look right ?
lets save I have the following components
a,b,c,d,e are all stations
1,2,3,4,5,6 are all dockables
Give the following layout where the “.” represents the Dock parent child relationship. (So in case of “a.b.1” then “1” is a child dockable of station “b” which is a child of station “a”)
a.b.c.1
a.b.c.2
a.b.3
a.d.e.4
a.d.e.5
a.d.6
I want to be able to switch between that layout and this layout
a.b.3
Hiding the c, d, e stations and all dockables that are on those stations.
PredefinedDockSituation p1 = new PredefinedDockSituation();
PredefinedDockSituation p2 = new PredefinedDockSituation();
HashMap map = new HashMap();
// Put all dockables in p1 pseudo code
p1.put a,b,c,d,e,1,2,3,4,5,6
// Put subset in p2 pseudo code
p2.put a,b,3
XElement e1 = new XElement("layout");
map.put("root",a);
p1.writeXML(map,e1)
// Remove two stations, redo the layout
c.getDockParent().drag(c)
d.getDockParent().drag(d)
XElement e2 = new XElement("layout");
p1.writeXML(map,e2)
Now to switch between the two views
p1.readXML(e1);
p2.readXML(e2);
nz