Force versioned reference update


#1

Is there a better way to force an versionedRef update than this?
Sloppy code for example use only.

                Integer selection = getListBox.getSelectionModel().getSelection();
                getListBox.getSelectionModel().setSelection(-1);
                getListBox.getSelectionModel().setSelection(selection);

The use is to make versionRef update so it is caught by the update loop and will update a separate listBox.

The listBox needing the update to fire may only have one selection in it so cant fire it by clicking it.

The second listbox is not used for anything other than displaying results.

Edit: basic performance is similar to forcing doClick() in swing.


#2

What is the code that is updating doing? Sounds like maybe you need a separate versioned object to keep track of state but I’m still not clear on what you are doing or why this is an issue.


#3

listBoxA is populated from user settings when they create a certain object. I override the valueToString on a new DefaultCellRenderer to show that data they input while that object is in the listBoxA.

That object in listBoxA will be updated at a later time to have more settings data from a different gui. It is required that the item in listBoxA be selected so the gui knows what object it is updating. That data is specific to that object in listBoxA they created and is displayed in the second listBoxB.

If there is only one object in listBoxA, they cant update manualy without a click listener if there is only one item in listboxA. They also cant update it from the other gui without forcing an update of the versioned Reference so it will automagically populate listBoxB for them.

Adding a click listener makes no sense because that object can be deleted at any time by the user and it needs to be updated anytime they update the listBoxA object from the other gui.

Everything works perfectly if I just update the versioned Reference like I show above whenever they update the object from the other gui. Since the object in listBoxA is already selected, the update loop always catches the update. Otherwise the user would have to select a different item in listBoxA, assuming there were two or more, and then re-click the original object to get the listBoxB to populate the new data.

As said before though, if only one item is in listBoxA, no way to update it without adding click listeners, which is overkill really.


#4

Can I see a picture? It might help me understand because I feel like there is still something that I’m missing.