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

Some Selection Extension Properties should be nullable #35

Closed
thomasnield opened this issue Mar 4, 2016 · 12 comments
Closed

Some Selection Extension Properties should be nullable #35

thomasnield opened this issue Mar 4, 2016 · 12 comments
Assignees

Comments

@thomasnield
Copy link
Collaborator

Documenting another item that I will fix this weekend. Some of the selection extension properties should be nullable. For example, Nodes.kt has some controls with a selectedItem or selectedValue property that could be null.

val <T> TableView<T>.selectedItem: T
    get() = this.selectionModel.selectedItem

val <T> TreeView<T>.selectedValue: T
    get() = this.selectionModel.selectedItem.value

...

val <T> ListView<T>.selectedItem: T
    get() = selectionModel.selectedItem

val <T> ComboBox<T>.selectedItem: T
    get() = selectionModel.selectedItem

To avoid nullability issues, they should be this. I'll do a sweep later to ensure nullable extension properties are indeed nullable.

val <T> TableView<T?>.selectedItem: T?
    get() = this.selectionModel.selectedItem

val <T> TreeView<T?>.selectedValue: T?
    get() = this.selectionModel.selectedItem.value

...

val <T> ListView<T?>.selectedItem: T?
    get() = selectionModel.selectedItem

val <T> ComboBox<T/>.selectedItem: T?
    get() = selectionModel.selectedItem
@thomasnield thomasnield self-assigned this Mar 4, 2016
@edvin
Copy link
Owner

edvin commented Mar 4, 2016

Ah, thanks a lot! I knew about this, but actually used a workaround in my apps instead of fixing it for some strange reason :)

@thomasnield
Copy link
Collaborator Author

Haha I do that too. I tend to cope with small uninteresting problems and procrastinate on fixing them...

@edvin
Copy link
Owner

edvin commented Mar 6, 2016

Yeah, good thing we don't procrastinate on the same things :) haha

Did you add this change or should I do it?

@thomasnield
Copy link
Collaborator Author

Ah forgot about this one. I'll do it today.

@thomasnield
Copy link
Collaborator Author

Doing this right now. What is the status of the release?

@thomasnield
Copy link
Collaborator Author

Okay done. I'll go ahead and merge.

@edvin
Copy link
Owner

edvin commented Mar 7, 2016

Nice! I'll get in some changes to the logging support and documentat that, other than that I think I'm done. What about you?

@edvin
Copy link
Owner

edvin commented Mar 7, 2016

Oh, and thanks for all the hard work lately, you've put in a lot of time and effort. Really appreciate it!

@edvin
Copy link
Owner

edvin commented Mar 7, 2016

By the way, I reverted the T? type in the onUserSelect functions, as we do null check before calling :) The onUserSelect action will never be called unless there is a value for the selectedItem.

@thomasnield
Copy link
Collaborator Author

Got it. That makes sense.

@thomasnield
Copy link
Collaborator Author

No problem! Glad to help and I think that's it. I may go through documentation later and add more stuff. I already added example for menus to builders section.

@edvin
Copy link
Owner

edvin commented Mar 7, 2016

Perfect! I'll release tonight :)

@edvin edvin closed this as completed Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants