When using the Palette you get the List of all available Choices from the choicesModel via Constructor
When this Model is a LoadableDetachableModel<List<String>> (so choices are not serialized)
there is a problem when using as follows:
I have a ListModel<String> as model and a LoadableDetachableModel<List<String>> for choicesModel
So from start the model's List has some values which are not available in the choicesModel's List.
Theirfor I fetch the available List from database and do an addAll of all Items in the modelList
When you show the Palette for the first time everything is correct as all available Values are in the left List - and the presetted Values are in the right List.
When you change nothing and just press the submit button - the updateModel() Method first clears out the model Values (including the presetted values) and then calls
Theirfor the presetted Values are gone and the selected Value list is empty
To clear out things:
ModelList contains 'D'
choicesModelList contains ('A','B','C'),
in the load of the choiceModelList i add the D to the choiceModelList
when just submitting form - the updateModel Method clears out the D
and then fetches available Values again where the D already has gone.
Not using a LoadableDetachableModel but a normal ListModel works but Choices then get serialized which is not optimal.
I tested with just move the line
Iterator<T> it = getRecorderComponent().getSelectedChoices();
at the top of the Method
from 501 to 495
then it works as expected.
Please comment your 2 cents on this.