Removing Dockables

Greetings,

Would it be possible to add a removeAllDockables method to the CControl class?

I am using the CControl in conjunction with a CGrid to create a grid of dynamic
SingleCDockables.

Then I use the CControl.readXml and writeXml methods to save/restore user layouts.

The problem is I want the ability to start with a clean slate to manually recreate my grid from scratch.

I have tried using the following:

[LEFT][SIZE=2][SIZE=2]for[/SIZE](SingleCDockable dockable : [SIZE=2]dockables[/SIZE])[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][SIZE=2]control[/SIZE].removeSingleDockable(dockable.getUniqueId());[/SIZE]
[SIZE=2]}[/LEFT]

[LEFT]Unfortunately, the CControl.register.[SIZE=2]getSingleDockables() is always empty. Therefore the delete operation fails.[/SIZE][/LEFT]

I manually maintain a list of SIngleCDockables because the CControl.[SIZE=2]getCDockableCount method always returns zero.

[LEFT]All code was tested against Docking Frames 1.0.8 and Java 1.6.0_21 under Windows XP SP3.[/LEFT]

[LEFT]Any ideas what might be going wrong? I think there might be some wrong with the registration of grids.[/LEFT]

[LEFT]In any case, great library and very thankful for you great work so far.[/LEFT]

[LEFT]Take care,
Rick Kellogg[/LEFT]

[/SIZE][/SIZE]

Still cannot get remove operations to work correctly but did discover one thing.

During the create of the CGrid component, I did not pass in the CControl.

[LEFT][SIZE=2]this[/SIZE].[SIZE=2]control[/SIZE] = [SIZE=2]new[/SIZE] CControl([SIZE=2]this[/SIZE]);
[SIZE=2]this[/SIZE].[SIZE=2]gridArea[/SIZE] = [SIZE=2]control[/SIZE].createGridArea([SIZE=2]“main”[/SIZE]); [/LEFT]

[LEFT][SIZE=2]this[/SIZE].[SIZE=2]grid[/SIZE] = [SIZE=2]new[/SIZE] CGrid([SIZE=2]control[/SIZE]);
// Used to be this.grid = new CGrid();[/LEFT]

[LEFT]Suggest the CGrid component constructor be required to pass in a CControl parameter. Please deprecate the no-args constructor here. Otherwise things work a bit screwy.[/LEFT]

You also have to call “dockable.setVisible( false )”. Removing a Dockable from the CControl just disables any support regarding locations, colors and stuff like that. It does not remove the Dockable from the tree of station/dockables.

As for CGrid: there are cases when one might not want to have Dockables automatically registering themselves. For example if someone builds a set of grids and later applies only one of them. So I am reluctant of making the default constructor deprecated.