Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing issue setting floating property on undock #35

Closed
stevel05 opened this issue Apr 19, 2018 · 10 comments
Closed

Timing issue setting floating property on undock #35

stevel05 opened this issue Apr 19, 2018 · 10 comments

Comments

@stevel05
Copy link

stevel05 commented Apr 19, 2018

If I set a listener on the dockedProperty and undock a dock by dragging it, and in the listener test the floatingProperty it is still set to false.

This causes a problem as I want to know if the undocked dock is actually floating or closed (as in not floating and not docked.).

If I check the floatingProperty in a runLater sub it has correctly changed to true

@stevel05 stevel05 changed the title Timing issue setting floating property Timing issue setting floating property on undock Apr 19, 2018
@RobertBColton
Copy link
Owner

Hrm, this definitely seems undesirable as I was actually going to rely on what you described in order to update DockFX for Java 9. I don't see yet why this is delayed, because as soon as the drag is detected on the title bar the dock node is set to floating:

dockNode.setFloating(true);

Which causes the floating property to be set to true:
this.floatingProperty.set(floating);

@stevel05
Copy link
Author

Possibly because in Docknode you are undocking (setting the dockedProperty) at line 246 and not setting the floatingProperty until line 285. Therefore the dockedProperty changelistener is being fired before the floating property is updated.

@RobertBColton
Copy link
Owner

RobertBColton commented Apr 19, 2018

Alright, I'll see if I can push a patch for it shortly without causing a regression. Thank you for finding that.

@stevel05
Copy link
Author

Thanks very much, and not a problem

@RobertBColton
Copy link
Owner

While I'm going to be addressing this, I want to perhaps look at this another way. I think it may be confusing that I have both dockedProperty and floatingProperty which for the most part have the same meaning. When a node is undocked, it's essentially floating, and when it's floating, it's obviously not docked. There is an inbetween state where it can be neither, but for the purposes of DockFX, it's not useful to define that.

So considering this, would you be alright with me combining the docked and floating properties together into one? I would deprecate one and continue use of the other. I think that would make the API less confusing as well as fix this issue too.

@stevel05
Copy link
Author

The only problem I could see then is that it would not be possible to tell if the dockpane was not visible (Closed).

@RobertBColton
Copy link
Owner

RobertBColton commented Apr 19, 2018

I believe the visible property should take care of that, right?

But now that you mentioned it, I believe I may want to change the behavior of close as well so that it does effect the visible property. As I have it now, I was only binding the close button to the visible property, but close itself should set it false, in case the dock node is closed by something other than the close button:

closeButton.visibleProperty().bind(dockNode.closableProperty());

So I will make these two changes then, I will be deprecating the floating property and changing close to always set visible to false.

@stevel05
Copy link
Author

OK, sounds good to me.

@RobertBColton
Copy link
Owner

Alright, I've patched the issue: e66e091

To avoid breaking any existing users over something trivial, I simply decided to go with the first fix you suggested, to set the floating property before undocking.

I've also generated a new beta release with the fix:
https://github.com/RobertBColton/DockFX/releases/tag/0.3b

@stevel05
Copy link
Author

Yes that got it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants