Class StringTextChoiceProvider

java.lang.Object
org.wicketstuff.select2.ChoiceProvider<String>
org.wicketstuff.select2.StringTextChoiceProvider
All Implemented Interfaces:
Serializable, IDetachable, IClusterable

public abstract class StringTextChoiceProvider extends ChoiceProvider<String>
A simple StringTextChoiceProvider for Strings.
Author:
Tom Götz (tom@decoded.de)
See Also:
  • Constructor Details

    • StringTextChoiceProvider

      public StringTextChoiceProvider()
  • Method Details

    • getDisplayValue

      public String getDisplayValue(String choice)
      Description copied from class: ChoiceProvider
      Get the value for displaying to an end user.
      Specified by:
      getDisplayValue in class ChoiceProvider<String>
      Parameters:
      choice - the actual object
      Returns:
      the value meant for displaying to an end user
    • getIdValue

      public String getIdValue(String choice)
      Description copied from class: ChoiceProvider
      This method is called to get the id value of an object (used as the value attribute of a choice element) The id can be extracted from the object like a primary key, or if the list is stable you could just return a toString of the index.

      Note that the given index can be -1 if the object in question is not contained in the available choices.

      Specified by:
      getIdValue in class ChoiceProvider<String>
      Parameters:
      choice - The object for which the id should be generated
      Returns:
      String
    • toChoices

      public Collection<String> toChoices(Collection<String> ids)
      Description copied from class: ChoiceProvider
      Converts a list of choice ids back into application's choice objects. When the choice provider is attached to a single-select component the ids collection will contain exactly one id, and a collection containing exactly one choice should be returned.
      Specified by:
      toChoices in class ChoiceProvider<String>
      Parameters:
      ids - collection containing choice ids
      Returns:
      collection containing application choice objects