Location of a closed dockable

I like to know the location of a dockable at the moment it is closed by the user (via the close button).
I tried a CDockableStateListener and a CControlListener, but the events are sent after the Dockable is removed.
So, the getBaseLocation() returns NULL

Any other idea?

You could override the method “setVisible” of CDockable. If the user hits the close button it is called with “visible = false”.

            @Override
            public void setVisible( boolean visible ) {
                if( !visible ){
                    // first do something with the location
                    System.out.println( getBaseLocation() );
                }
                
                // then change the visibility
                super.setVisible( visible );
            }
        };```

(Both the information that a Dockable will be closed and the location are in the system, but they are deeply hidden and not easy to access. I have to change that.)

OK that works.
I had already tried to override setLocation(), but that is not called from the inner „deepdown“ system :wink:

BTW, the setVisible() is called twice with the flag == false.
StackTrace:

java.lang.Exception
at nl.frog.docking.impl.ContentDockable.setVisible(ContentDockable.java:103)
at bibliothek.gui.dock.common.action.predefined.CCloseAction.close(CCloseAction.java:82)
at bibliothek.gui.dock.common.action.predefined.CCloseAction$Action.close(CCloseAction.java:106)
at bibliothek.gui.dock.facile.action.CloseAction.action(CloseAction.java:80)
at bibliothek.gui.dock.themes.basic.action.menu.ButtonMenuHandler$1.actionPerformed(ButtonMenuHandler.java:54)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6134)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5899)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

BBBBB getBaseLocation = [working area] [normal WEST 0.07951070336391437] [normal NORTH 0.3960149439601494]

java.lang.Exception
at nl.frog.docking.impl.ContentDockable.setVisible(ContentDockable.java:103)
at bibliothek.gui.dock.common.CControl.remove(CControl.java:1497)
at bibliothek.gui.dock.common.CControl$4.dockableUnregistered(CControl.java:377)
at bibliothek.gui.dock.control.DockRegister.fireDockableUnregistered(DockRegister.java:332)
at bibliothek.gui.dock.control.DockRegister.unregister(DockRegister.java:261)
at bibliothek.gui.dock.control.DockRegister$StationListener.removeDockable(DockRegister.java:533)
at bibliothek.gui.dock.control.DockRegister$StationListener.fire(DockRegister.java:432)
at bibliothek.gui.dock.control.DockRegister.setStalled(DockRegister.java:395)
at bibliothek.gui.dock.common.CControl$Access.hide(CControl.java:1950)
at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:207)
at nl.frog.docking.impl.ContentDockable.setVisible(ContentDockable.java:107)
at bibliothek.gui.dock.common.action.predefined.CCloseAction.close(CCloseAction.java:82)
at bibliothek.gui.dock.common.action.predefined.CCloseAction$Action.close(CCloseAction.java:106)
at bibliothek.gui.dock.facile.action.CloseAction.action(CloseAction.java:80)
at bibliothek.gui.dock.themes.basic.action.menu.ButtonMenuHandler$1.actionPerformed(ButtonMenuHandler.java:54)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6134)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5899)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

BBBBB getBaseLocation = null

That is true, but I don’t consider this as a bug. A “setX”-method changes the property “x” to some value, if that value is already set… well then the method still does its job, even if the job is to do nothing.

That’s right.

I didn’t use the word that consists of the letters ‚B‘, ‚U‘ and ‚G‘ :smiley: