Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4231

allow palette's choicesModel to take current selection into account

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.3, 6.0.0-beta1
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket-extensions
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              svenmeier Sven Meier
              Reporter:
              wolfman22 Wolfgang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified