Package org.hippoecm.frontend.i18n.types
Class 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:
CollectionmyTypeList = ... SortedTypeChoiceRenderer renderer = new SortedTypeChoiceRenderer(myComponent, myTypeList); DropDownChoice dropDown = new DropDownChoice("wicketId", typeModel, renderer, renderer);
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionSortedTypeChoiceRenderer
(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
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 org.apache.wicket.markup.html.form.IChoiceRenderer
detach
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
SortedTypeChoiceRenderer
-
SortedTypeChoiceRenderer
-
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 Details
-
get
-
size
public int size()- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceList<String>
- Specified by:
size
in classAbstractCollection<String>
-
getIdValue
- 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>
-
getDisplayValue
- Specified by:
getDisplayValue
in interfaceorg.apache.wicket.markup.html.form.IChoiceRenderer<String>
-