Palette - LoadableDetachableModel
---------------------------------

                 Key: WICKET-4231
                 URL: https://issues.apache.org/jira/browse/WICKET-4231
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
    Affects Versions: 1.5.3
            Reporter: Wolfgang
            Priority: Minor


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
getRecorderComponent().getSelectedChoices()
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.


Workaround:
Not using a LoadableDetachableModel but a normal ListModel works but Choices 
then get serialized which is not optimal.

Prob. Solution:
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.

org/apache/wicket/extensions/markup/html/form/palette/Palette.java 
Line 498


Please comment your 2 cents on this.
Greetings

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to