Close a CGridArea and his children

Hello,

I create a CGridArea that contains DefaultMultipleCDockable.
When I close the CGridArea (by clicking on close button), children don’t seem to be removed from CControl.
I have a CControlListener and method closed or removed are never called.

Is there a way to close children when closing the parent ?

Thanks
Gilles

Only by going through them manually, sorry.

You can perhaps use DockUtilities.visit to collect all the Dockables. CGridArea.getStation will give you an argument for the visitor, a test “object instanceof CommonDockable” can tell you whether a Dockable represents a CDockable (and this reference may be your DefaultMultipleCDockable).

Thanks for your answer.

I used a CVetoClosingListener to know when a CGridArea is closed then in closing or closed method, I remove CGridArea’s station from CControl.
That seems to work.


    public void closing(CVetoClosingEvent event) {
        for (Iterator<CDockable> iterator = event.iterator(); iterator.hasNext();) {
            CDockable dockable = iterator.next();
            if (dockable instanceof CGridArea) {
                event.getControl().removeStation(((CGridArea) dockable).getStation().getStation());
            }
        }
    }