RobertBColton/DockFX

Not firing event to DockPane

lovky opened this issue · 1 comments

lovky commented

Hello,
I found (maybe) bug with deleting Node with DockPane. For example if you got Tab with DockPane and you close it in next tabs there will be NullPointException in DockTitleBar -> pickEventTarget() -> DockPane.dockpanes. Its because dockpane is no more in scene.
I tried to delete dockPane from DockPane.dockpanes, exception disapere but there is no more event in existing dockpanes.
And also I would ask you where do you fire event to dockPane ?

EDIT:
Magicly when I dock null to dockPane, events start firing.

EDIT 2:
Problem was in TabPane listener and not in DockPane listener. If something similiar happends to you just remove TabPane listener, add tabs with DockPane and then add listener to TabPane.

This is partly a regression caused by 8d44134

The custom dock events are fired here:

private void pickEventTarget(Point2D location, EventTask eventTask, Event explicit) {

This is a bit of a tricky problem that I still haven't managed to figure out a good way around. In order to show the indicators and know when you are docking, the dock title bar has to forward my custom dock events to nodes that are behind it. Basically, I have to do my own scene graph traversal because JavaFX does not provide any that is considered public API. They deprecated StageHelper in Java 9, which I was using to get a list of all stages. That prompted me to maintain a static list of all DockPanes that have been created.

As you can see, that list is what is now causing your problem, you remove the DockPane and it's not removed from that list. There are multiple ways I could continue to hack around this, but at this point, I'd like to come up with a more permanent solution. I could have originally gone with using the clipboard preview, but I wanted dragging of a full blown window in DockFX like Visual Studio and Qt Framework. I'm open to ideas.