Replacing row content in GridPanes
I have a GridPane where I want to be able to seamlessly add rows, delete rows, and change row indices.
For example, I want to be able to "push" a new item in at the top of the GridPane, subsequently pushing all other rows down by one index.
The GridPane class does not have any replace() method or interface to my knowledge. I can reference the individual nodes in the Pane, so I suspect one possible solution would be to use getRowIndex(Node), and then update all the nodes on that row directly (all I need is a Label.setText). However, due to the size of the Pane, it would not really be desirable to run all this code on the application thread. For a MxN pane, I would have to loop through N lists of M nodes, looking for the right row, then updating, and repeat this for all nodes, for a total of MxN updates.
Another solution might be to just redraw the entire GridPane with updated information, dump the current scene, and redraw with a new scene containing the updated GridPane.
So it can be done, but I think both suggested approaches seem a bit kludgy, and was wondering if anybody could suggest a more elegant solution.