Arthur N
unread,Aug 29, 2012, 12:53:37 PM8/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vldo...@googlegroups.com
I have a CompoundDockable ("Plots") that is auto-hidable. Inside are several Dockables ("Plot 1", "Plot 2", ... ).
In my application, if I execute File->New, I want to close all the existing plots, and create new ones.
So, I call DockingDesktop.close(Dockable dockable) on each plot.
If "Plots" is visible (ie, pinned), everything works as expected. But if "Plots" is not visible. DockingDesktop.close( ) doesn't close the plot dockables.
Abbreviated debug/trace info follows:
-------------------------------------
public void close(Dockable dockable) {
DockableState currentState = getDockableState(dockable); /* DockableState [DockKey[Mag], state=DOCKED, position=RelativePosition .... */
if (currentState == null || currentState.isClosed()){
return;
}
DockableState.Location currentLocation = getLocation(currentState); /* DOCKED */
/* position=, newState=, dswe=, dae= all omitted for brevity */
if (dockingPanel.isAncestorOf(dockable.getComponent())) { /* Returns false */
/* ... */
} else if (currentState.isHidden()) { /* Returns false */
/* ... */
} else if (currentState.isFloating()){ /* Returns false */
/* ... */
} else if (currentState.isMaximized()){ /* Returns false */
/* ... */
}
}
-------------------------------------
DockingDesktop.close(Dockable dockable_in_unpinned_autohide_compound_dockable) is a no-op.
dockable.getComponent() is correctly returning my plot:
Plot[[0.0 .. 1.0][-1.05 .. 1.05]]@1544851525
but "boolean java.awt.Container.isAncestorOf(Component c)" returns false,
because the auto-hide container is removing the children from the hierarchy.
As a workaround, I follow
desktop.close( dockable );
desktop.unregisterDockable(dockable);
with
desktop.remove( dockable );
/* This method shouldn't be used by user applications (only by the framework). */
but I'm looking for a proper solution.
Thanks.