I have a heavyweight component (World Wind) inside a DefaultSingleCDockable. When I restore a layout from file using CControl.control.readXML(layoutFile) everything loads in the correct position like I expect but it appears that the heavyweight component is removed from it’s parent container and then added back. I say this because there are some OpenGL resources being reloaded and causes flickering. So my question is, when a layout is loaded from XML and one of the dockables is already being displayed, is the already displayed component removed from it’s parent container and then added back? If so, is there a way to prevent this? If not, what class in the docking frames source is responsible?
Loading a layout involves clearing the current layout, so yes, the Dockable is removed from its parent. And it is the parent itself who is responsible for this removing.
You can have a look at how the “setLayout” methods of all the different DockFactories (e.g. SplitDockStationDockFactory) are implemented. But changing them could prove to be a challenge.
Is there no way to reload these OpenGL resources properly? Because the framework has several operations that cause the Dockables to be removed from their parents (drag and drop obviously, but also changing the theme).
What would the parent be? A DefaultSingleCDockable for example? Is it possible to prevent a Dockable from being removed from its parent if is visible before and after the layout change?
Short of rewriting the entire layout changing mechanism? No, there is no option to prevent a Dockable from being removed from its parent.
Speaking in terms of AWT: the parent of the Dockable-Component is a DockableDisplayer-Component, which in return is a child of a DockStation-Component (there are 4 different types of DockStations). There may be additional Containers between the Components to paint decorations or to make layouting easier. The exact amount of Components and the depth of the Component-tree depends also on the current DockTheme…