Different PredefinedDockSituation

Hi

I have a need for several different PredefinedDockSituation. Some do not display all the Dockables that others do. Whats the best way to accomplish this ? and switch between them ?

I have tried building the dockables and adding only the ones I want in a situation to that situation. That did not work

I also tried to build the complete tree of dockables, store this situation then using the “remove” method and the removeDockable method. But removing a station this way causes all its child children to slide up to a visible StationDockable which isnt what I want to do either.

I am probably missing the obvious , help ?

Thanks
nz

Maybe a “DockSituationIgnore”, which has to be set using the method “setIgnore” of “DockSituation” can help. The “DockSituationIgnore” is only used when writing the layout, not when reading it.

But then I’m not quite sure what you want to accomplish…

… 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

Yeah, looks right. You don’t even have to build two different PredefinedDockSituations, the only thing that matters when writing a layout is how the tree (a,b,c,1,2,3…) looks like. If there is a Dockable in PredefinedDockSituation that is not in the tree, then this Dockable is just ignored.

very cool, thx …