stackDockable separate tab and splitDockable to change the size of a specific Panel

Hi Byte,

When I detach a tab from stackDockable, in rare cases I meet a null point exception, which is successful in most cases.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at bibliothek.gui.dock.station.split.SplitNode.getSize(SplitNode.java:807)
at bibliothek.gui.dock.station.split.DefaultSplitLayoutManager.calculateDivider(DefaultSplitLayoutManager.java:195)
at bibliothek.gui.dock.facile.station.split.DelegatingSplitLayoutManager.calculateDivider(DelegatingSplitLayoutManager.java:53)
at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:1925)
at bibliothek.gui.dock.SplitDockStation.access$2300(SplitDockStation.java:189)
at bibliothek.gui.dock.SplitDockStation$Access.drop(SplitDockStation.java:3537)
at bibliothek.gui.dock.station.split.SplitDropOperation.execute(SplitDropOperation.java:103)
at bibliothek.gui.dock.control.relocator.DropOperation.execute(DropOperation.java:106)
at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.executeOperation(DefaultDockRelocator.java:216)
at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.dragMouseReleased(DefaultDockRelocator.java:878)
at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.dragMouseReleased(DefaultDockRelocator.java:778)
at bibliothek.gui.dock.control.relocator.DefaultDockRelocator$MouseRepresentativeListener.mouseReleased(DefaultDockRelocator.java:1168)
at bibliothek.gui.dock.control.relocator.DefaultDockRelocator$GlobalMouseReleaseListener.mouseReleased(DefaultDockRelocator.java:1205)
at bibliothek.gui.dock.control.DefaultGlobalMouseDispatcher.dispatch(DefaultGlobalMouseDispatcher.java:116)
at bibliothek.gui.dock.control.DefaultGlobalMouseDispatcher$3.eventDispatched(DefaultGlobalMouseDispatcher.java:235)
at java.desktop/java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2194)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2086)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2085)
at java.desktop/java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2042)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4914)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Is this a problem with my use or a bug?

best regards,
Scott.

When stackDockable and splitDockable exist in a Frame at the same time, when I set one of the tabs in stackDockable to a minimumSize, no matter how small I drag this stackDockable, the minimum size will not take effect. But when I drag the tab with the minimum size out of the stackDockable so that it is a separate panel in the Frame, then the minimum size of this setting will take effect (this Panel can only be dragged to its minimum size). I did this test in a clean environment. Can I set it up?

best regards,
Scott.

About the minimum size: there is a method StackDockStation.setSmallMinimumSize that you want to call and set to false. Use CControl.getController().getRegister().addDockRegisterListener to install a listener that gets called whenever a DockStation was added (and StackDockStation is a DockStation). Set the property in the listener.

About the exception: I’ll have to check out the code, will answer later (maybe during the weekend).

Your method is to change the minimum value of the stackStation. Can I set whether the minimum value of a Dockable in spliltpanel is valid?

So you want that the user can make the Dockables as small as he wants?

The Dockables just forward the minimumn size of their child Components to the SplitDockStation. You may want to call Component.setMinimumSize(<something small>) on the children you add.

About the exception.

Looking at the code it says “the place you are trying to drop your element at, no longer exists”.

I guess something is modifying the underlying SplitDockStation just before the Dockable is dropped (probably just after the mouse is released).

Since I was not able to reproduce the exception with my default applications, I have to ask: is there anything in your application that might modify the layout just when a Dockable is dropped? For example are you automatically removing (aka closing, aka making invisible) another Dockable?

Thanks for your reply to my minimal window setting question.

The example you listed is the problem. I made this setting for each Dockable dockable.setCloseable(false); when this exception occurs, the dragged dockable disappears.
I did not set the layout to change automatically.

Best regards,
Scott.

It disappears because of the exception (has already been removed from somewhere, but not yet added at the new position).

Since I cannot reproduce the exception, you have to find more hints. Is there anything connecting these exceptions, e.g.

  • is it always the same Dockable(s)?
  • is the layout somehow always the same?
  • Did you press the same buttons / do the same actions before the exception?
  • … ?

Maybe just make a video while working with the application, and next time the exception happens there is a history to watch.

We have not reproduce this problem after refine the GUI refresh/reload.

regards,
Scott.