Wicket
  1. Wicket
  2. WICKET-3718

Introduce select-all components for all types of checkbox

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.18, 1.5-RC5
    • Fix Version/s: 1.5.0
    • Component/s: wicket
    • Labels:
      None

      Description

      So far, Wicket only has CheckGroupSelector as a select-all component. It has two main drawbacks:

      • it only works with CheckGroup components, not with CheckboxMultipleChoice or multiple CheckBox components.
      • it has no "auto update" feature that updates the state of the select-all when any of the associated checkboxes is checked or unchecked.

      This patch introduces two new components:

      • CheckboxMultipleChoiceSelector: This does for CheckboxMultipleChoice what CheckGroupSelector does for CheckGroup.
      • CheckBoxSelector: A select-all component for a collection of CheckBox instances.

      Both are based on a new abstract superclass called AbstractCheckSelector that does the heavy lifting. The subclasses only provide a JS function that finds the associated checkboxes. The superclass manages both the select-all and the auto-update mentioned above. The auto update feature is turned on by default, since it seems to be the most sensible behavior.

      The patch also pretty much rewrites the original CheckGroupSelector to also use the new AbstractCheckSelector. In CheckGroupSelector the auto-update feature is disabled by default to keep the behavior the same as in previous versions. It can be enabled by overriding wantAutomaticUpdate() to return true. This default should probably be changed in Wicket 1.5 or 1.6.

        Activity

        Igor Vaynberg made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 1.5.0 [ 12315432 ]
        Resolution Fixed [ 1 ]
        Hide
        Carl-Eric Menzel added a comment -

        To update my previous opinion: With 1.5 being out for a while now, my project is probably going to upgrade soon-ish. We've lived with our own implementation so far and until we upgrade we can keep doing so.

        Since 1.4 is almost EOL now, I think this issue can be closed even without the patch in 1.4.

        Show
        Carl-Eric Menzel added a comment - To update my previous opinion: With 1.5 being out for a while now, my project is probably going to upgrade soon-ish. We've lived with our own implementation so far and until we upgrade we can keep doing so. Since 1.4 is almost EOL now, I think this issue can be closed even without the patch in 1.4.
        Hide
        Carl-Eric Menzel added a comment -

        As long as it does not break anything, I'd really like to see it in 1.4.x. It's probably going to be a while until we can migrate to 1.5, and having all these available without having to drag our own components around, would be really nice.

        Of course, since I wrote this, I'm biased

        Show
        Carl-Eric Menzel added a comment - As long as it does not break anything, I'd really like to see it in 1.4.x. It's probably going to be a while until we can migrate to 1.5, and having all these available without having to drag our own components around, would be really nice. Of course, since I wrote this, I'm biased
        Hide
        Martin Grigorov added a comment -

        I applied the patch to 1.5 and transformed the quickstart app to example application (wicket-examples).
        Do we want it in 1.4.x ?

        Show
        Martin Grigorov added a comment - I applied the patch to 1.5 and transformed the quickstart app to example application (wicket-examples). Do we want it in 1.4.x ?
        Carl-Eric Menzel made changes -
        Component/s wicket-core [ 12311420 ]
        Carl-Eric Menzel made changes -
        Affects Version/s 1.4.18 [ 12316329 ]
        Affects Version/s 1.5-RC5 [ 12316423 ]
        Carl-Eric Menzel made changes -
        Attachment checkselector-quickstart.tar.gz [ 12479277 ]
        Hide
        Carl-Eric Menzel added a comment -

        A quickstart (uses Wicket 1.4-SNAPSHOT with the above patch included) that demonstrates the new components in action.

        Show
        Carl-Eric Menzel added a comment - A quickstart (uses Wicket 1.4-SNAPSHOT with the above patch included) that demonstrates the new components in action.
        Carl-Eric Menzel made changes -
        Field Original Value New Value
        Attachment 0001-Introduce-a-comprehensive-set-of-select-all-componen.patch [ 12479276 ]
        Hide
        Carl-Eric Menzel added a comment - - edited

        The patch with the new select-all components. This is written against wicket-1.4.x.

        Show
        Carl-Eric Menzel added a comment - - edited The patch with the new select-all components. This is written against wicket-1.4.x.
        Carl-Eric Menzel created issue -

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Carl-Eric Menzel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development