Class SortedTypeChoiceRenderer

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<String>
org.hippoecm.frontend.i18n.types.SortedTypeChoiceRenderer
All Implemented Interfaces:
Serializable, Iterable<String>, Collection<String>, List<String>, org.apache.wicket.markup.html.form.IChoiceRenderer<String>, org.apache.wicket.model.IDetachable, org.apache.wicket.util.io.IClusterable

public class SortedTypeChoiceRenderer extends AbstractList<String> implements org.apache.wicket.markup.html.form.IChoiceRenderer<String>
Type choice renderer that sorts the types alphabetically by the translated value of the type using the default Collator for the current CMS locale. This renderer is also the (sorted) list of types to render. To use it in (for example) a DropDownChoice, use the following code:
   Collection myTypeList = ...
   SortedTypeChoiceRenderer renderer = new SortedTypeChoiceRenderer(myComponent, myTypeList);
   DropDownChoice dropDown = new DropDownChoice("wicketId", typeModel, renderer, renderer);
 
See Also:
  • Constructor Details

    • SortedTypeChoiceRenderer

      public SortedTypeChoiceRenderer(org.apache.wicket.Component component, Collection<String> types)
    • SortedTypeChoiceRenderer

      public SortedTypeChoiceRenderer(Collection<String> types, Locale locale)
    • SortedTypeChoiceRenderer

      public SortedTypeChoiceRenderer(Collection<String> types, Locale locale, org.apache.wicket.Component component)
      Creates a new choice renderer the given types in the given locale. The resource bundle of the given component is used as a backup to lookup the translated type names in case the repository does not contain a translation for it.
      Parameters:
      types - the JCR types to translate
      locale - the locale to translate the types into
      component - the component the component whose resource bundle is used as the backup for looking up translated type names. When null, no backup will be used.
  • Method Details

    • get

      public String get(int index)
      Specified by:
      get in interface List<String>
      Specified by:
      get in class AbstractList<String>
    • size

      public int size()
      Specified by:
      size in interface Collection<String>
      Specified by:
      size in interface List<String>
      Specified by:
      size in class AbstractCollection<String>
    • getIdValue

      public String getIdValue(String type, int index)
      Specified by:
      getIdValue in interface org.apache.wicket.markup.html.form.IChoiceRenderer<String>
    • getObject

      public String getObject(String id, org.apache.wicket.model.IModel<? extends List<? extends String>> choicesModel)
      Specified by:
      getObject in interface org.apache.wicket.markup.html.form.IChoiceRenderer<String>
    • getDisplayValue

      public Object getDisplayValue(String type)
      Specified by:
      getDisplayValue in interface org.apache.wicket.markup.html.form.IChoiceRenderer<String>