Create a new undocked DockNode
dyrlund opened this issue · 6 comments
Hi
Is there a way to create a new DockNode which is floating? I tried the following:
final DockNode testDock = new DockNode(lineChart,"Example Line Chart 2");
testDock.setFloating(true);
But that returns the following NullPointerException:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at org.dockfx.DockNode.setFloating(DockNode.java:296)
at org.dockfx.DockNode.setFloating(DockNode.java:340)
I also tried to dock the DockNode first and then undock it but in that case it is not visible (= it seems like nothing is happening). Do I have to set some value to make it show?
final DockNode testDock = new DockNode(lineChart,"Example Line Chart 2");
testDock.dock(mainDockPane, DockPos.RIGHT);
testDock.undock();
I can call testDock.setFloatable(true); without any error, but the window still does not float. Any suggestions?
@dyrlund This is a legitimate bug, thank you for reporting this. It was working in the original release, I know what is causing it and will be able to fix it. For now I have the following temporary work around.
From the demo application, wrap your setFloatable call in a Runnable and make sure you dock the node first so that it gets a preferred size:
// can be created and docked before or after the scene is created
// and the stage is shown
final DockNode treeDock = new DockNode(generateRandomTree(), "Tree Dock", new ImageView(dockImage));
treeDock.setPrefSize(100, 100);
treeDock.dock(dockPane, DockPos.LEFT);
Platform.runLater(new Runnable() {
@Override
public void run() {
treeDock.setFloating(true);
}
});
The cause is the use of a local to screen translation in setFloatable returning a null Point2D because the dock node has not yet received a layout pass. It will be very easy to fix.
The intended behavior is exactly as you described, when this is fixed you will not have to dock it first and will be able to simply set it floating.
Is the bug fixed ??
Hi,
First of all thank you for such a great framework. Really docking framework is something I think, should be part of the JavaFx itself. I am following and evaluating your framework for last few weeks. I am seeing the last commited date as aug 2015. I am concerned about this particular bug also. Could anyone please tell me the status of this bug and the dockfx project itself. Is it under active development ? I would really like to use dockfx for a project I am working on.
Thanks & Regards
there's a fair bit of development happening on fork https://github.com/hkmoon/DockFX/tree/hkmoon, this is the fork I'm using at the moment.
Thanks @jasons2000 ..