Class ListMultipleChoice<T>

    • Method Detail

      • setMaxRows

        public final ListMultipleChoice<T> setMaxRows​(int maxRows)
        Sets the number of visible rows in the listbox.
        Parameters:
        maxRows - the number of visible rows
        Returns:
        this
      • isSelected

        protected final boolean isSelected​(T choice,
                                           int index,
                                           java.lang.String selected)
        Description copied from class: AbstractChoice
        Gets whether the given value represents the current selection.
        Specified by:
        isSelected in class AbstractChoice<java.util.Collection<T>,​T>
        Parameters:
        choice - The object to check
        index - The index in the choices collection this object is in.
        selected - The currently selected string value
        Returns:
        Whether the given value represents the current selection
        See Also:
        AbstractChoice.isSelected(Object,int, String)
      • convertValue

        protected java.util.Collection<T> convertValue​(java.lang.String[] ids)
                                                throws org.apache.wicket.util.convert.ConversionException
        Description copied from class: FormComponent
        Subclasses should overwrite this if the conversion is not done through the type field and the IConverter. WARNING: this method may be removed in future versions. If conversion fails then a ConversionException should be thrown
        Overrides:
        convertValue in class FormComponent<java.util.Collection<T>>
        Parameters:
        ids - The value can be the getInput() or through a cookie
        Returns:
        The converted value. default returns just the given value
        Throws:
        org.apache.wicket.util.convert.ConversionException - If input can't be converted
        See Also:
        FormComponent.convertValue(String[])
      • convertChoiceIdsToChoices

        protected java.util.List<T> convertChoiceIdsToChoices​(java.lang.String[] ids)
        Converts submitted choice ids to choice objects.
        Parameters:
        ids - choice ids. this array is nonnull and always contains at least one id.
        Returns:
        list of choices.
      • isRetainDisabledSelected

        public boolean isRetainDisabledSelected()
        If true, choices that were selected in the model but disabled in rendering will be retained in the model after a form submit. Example: Choices are [1, 2, 3, 4]. Model collection is [2, 4]. In rendering, choices 2 and 3 are disabled (AbstractChoice.isDisabled(Object, int, String)). That means that four checkboxes are rendered, checkboxes 2 and 4 are checked, but 2 and 3 are not clickable. User checks 1 and unchecks 4. If this flag is off, the model will be updated to [1]. This is because the browser does not re-submit a disabled checked checkbox: it only submits [1]. Therefore Wicket will only see the [1] and update the model accordingly. If you set this flag to true, Wicket will check the model before updating to find choices that were selected but disabled. These choices will then be retained, leading to a new model value of [1, 2] as (probably) expected by the user. Note that this will lead to additional calls to AbstractChoice.isDisabled(Object, int, String).
        Returns:
        flag