Now my problem is, if i have 3 Tabs open, for example: Tab 1, Tab 2, Tab 3. First i close Tab 2 than 3 and 1. Now if i want to open Tab 1, 2 and 3, it cannot be open, because that tabs are still in the Controllers list. So if i say controll.remove(dockable) it don’t gets removed from the controller list. I hope somebody can help me.
I do not understand what exactly your application is doing, but „ccontrol.remove“ works usually. You are certain you have not mixed up different instances of Dockables? Code like … dockableEvent.setVisible(false);
… should not be necessary as the Dockable was just closed (the ccontorl.remove is necessary).
I think to answer your question I need you to write a small sample application that reproduces the behavior. Because your code snippets alone do not tell me where the issue lies.
The next Problem is, sometimes the closed method is called twice. So if i want to add a tab another tab is deleted.
With the same Dockable (the same instance)? That would be really be a bug.
My Code is too big to post it… Thx for your answer, i think there is a bug.
If i start my tool and i add a ControlListener the close method is getting called. Like the example above:
I open:
Tab 1
Tab 2
Tab 3
Now i switch to Tab 2:
Tab 1
Tab 2 → is active
Tab 3
If i now close tab 2 the close method is getting called twice. It looks like that:
Tab 1
Tab 2 → was removed
Tab 3 → was removed
Only Tab 1 is in the List, but Tab 1 and Tab 3 is visible. I hope you have understood me
In your listener, add a line like this: new IllegalStateException("bla").printStackTrace();
What is the stacktrace of the first and the second time the listener is invoked? That should help finding out which code is responsible for “closing” Tab 3.
Observers: 8
Observers: 9
Observers: 10
Closing Tab 2
java.lang.IllegalStateException: bla
at mvc.view.DiagnosticClient.closed(DiagnosticClient.java:655)
at bibliothek.gui.dock.common.CControl$2.dockableUnregistered(CControl.java:498)
at bibliothek.gui.dock.control.DockRegister.fireDockableUnregistered(DockRegister.java:441)
at bibliothek.gui.dock.control.DockRegister.unregister(DockRegister.java:363)
at bibliothek.gui.dock.control.DockRegister$StationListener.removeDockable(DockRegister.java:668)
at bibliothek.gui.dock.control.DockRegister$StationListener.fire(DockRegister.java:545)
at bibliothek.gui.dock.control.DockRegister.setStalled(DockRegister.java:504)
at bibliothek.gui.dock.common.CControl$Access.hide(CControl.java:2755)
at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:292)
at bibliothek.gui.dock.common.action.predefined.CCloseAction.close(CCloseAction.java:85)
at bibliothek.gui.dock.common.action.predefined.CCloseAction$Action.close(CCloseAction.java:109)
at bibliothek.gui.dock.facile.action.CloseAction.action(CloseAction.java:86)
at bibliothek.gui.dock.themes.basic.action.BasicButtonHandler.triggered(BasicButtonHandler.java:48)
at bibliothek.gui.dock.themes.basic.action.BasicButtonModel.trigger(BasicButtonModel.java:631)
at bibliothek.gui.dock.themes.basic.action.BasicButtonModel$Listener.mouseReleased(BasicButtonModel.java:669)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
CLOSING!!!!!!!!!!!!!
----------- Here the closing Method is called the second time
java.lang.IllegalStateException: bla
at mvc.view.DiagnosticClient.closed(DiagnosticClient.java:655)
at bibliothek.gui.dock.common.CControl$2.dockableUnregistered(CControl.java:498)
at bibliothek.gui.dock.control.DockRegister.fireDockableUnregistered(DockRegister.java:441)
at bibliothek.gui.dock.control.DockRegister.unregister(DockRegister.java:363)
at bibliothek.gui.dock.control.DockRegister$StationListener.removeDockable(DockRegister.java:668)
at bibliothek.gui.dock.control.DockRegister$StationListener.fire(DockRegister.java:545)
at bibliothek.gui.dock.control.DockRegister.setStalled(DockRegister.java:504)
at bibliothek.gui.dock.common.CControl$Access.hide(CControl.java:2755)
at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:292)
at mvc.view.DiagnosticClient.addServiceToTab(DiagnosticClient.java:259)
at mvc.controller.DiagnosticController.addServiceToTab(DiagnosticController.java:86)
at mvc.view.DiagnosticTreeView.addServiceTabAndGetSubFunctions(DiagnosticTreeView.java:866)
at mvc.view.DiagnosticTreeView.valueChanged(DiagnosticTreeView.java:922)
at javax.swing.JList.fireSelectionValueChanged(Unknown Source)
at javax.swing.JList$ListSelectionHandler.valueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
at javax.swing.DefaultListSelectionModel.setSelectionInterval(Unknown Source)
at javax.swing.JList.setSelectionInterval(Unknown Source)
at javax.swing.plaf.basic.BasicListUI$Handler.adjustSelection(Unknown Source)
at javax.swing.plaf.basic.BasicListUI$Handler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
CLOSING!!!!!!!!!!!!!
Oh sorry, it was my fault… I deleted it two times… I forgotten to set a boolean to false. That’s why it was deleting an other dockingframe. P.S. your framework rocks