-
Notifications
You must be signed in to change notification settings - Fork 266
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
#801 Add support to remove row from the GridPane #802
Conversation
As well as remove all rows.
Also added the unit tests to verify the behavior.
src/main/java/tornadofx/Layouts.kt
Outdated
*/ | ||
fun GridPane.removeRow(node: Node): Int { | ||
if (properties.containsKey(GridPaneRowIdKey)) { | ||
properties[GridPaneRowIdKey] = properties[GridPaneRowIdKey] as Int - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the alternative implementation could be if the property value is 0, just to remove the property all together instead of subtract.
Although currently it doesn't matter, as in the current case it will result in -1
, and when adding the new row the index will become 0
, same as if the property were absent.
…ngle row Thinking more it feels like the better approach to remove the property rather than going to -1 value.
Thank you for your hard work. Let me know when you are ready to merge :) |
Hi, @edvin. Thank you! I am not planning to push any more changes. So if it looks good to you, feel free to proceed with the merge. |
Great! I will look at it in more detail ASAP and perform the merge! Thanks again :) |
Merged :) |
As my pull request has been already merged to the TornadoFX edvin/tornadofx#802.
As well as remove all rows.
Currently I extend the
GridPane
manually in my own project https://github.com/zshamrock/dynoman/blob/master/src/main/kotlin/com/akazlou/dynoman/ext/Ext.kt, but would be nice to have these features as part of the TornadoFX package.Please, let me know whether the provided PR looks good or make any necessary adjustments you feel like good doing.