Package org.hippoecm.frontend.i18n.types
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 defaultCollator
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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SortedTypeChoiceRenderer(Collection<String> types, Locale locale)
SortedTypeChoiceRenderer(Collection<String> types, Locale locale, org.apache.wicket.Component component)
Creates a new choice renderer the given types in the given locale.SortedTypeChoiceRenderer(org.apache.wicket.Component component, Collection<String> types)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
get(int index)
Object
getDisplayValue(String type)
String
getIdValue(String type, int index)
String
getObject(String id, org.apache.wicket.model.IModel<? extends List<? extends String>> choicesModel)
int
size()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Constructor Detail
-
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 translatelocale
- the locale to translate the types intocomponent
- the component the component whose resource bundle is used as the backup for looking up translated type names. Whennull
, no backup will be used.
-
-
Method Detail
-
get
public String get(int index)
-
size
public int size()
- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceList<String>
- Specified by:
size
in classAbstractCollection<String>
-
getIdValue
public String getIdValue(String type, int index)
- Specified by:
getIdValue
in interfaceorg.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 interfaceorg.apache.wicket.markup.html.form.IChoiceRenderer<String>
-
-