public final class CategorizedElementDefinitionHelper extends Object
CategorizedElementDefinitionProxy
Modifier | Constructor and Description |
---|---|
private |
CategorizedElementDefinitionHelper() |
Modifier and Type | Method and Description |
---|---|
private static ModelViewItemGroup |
_buildCategoryViewItem(ModelItem category,
Comparator<? super ModelItem> groupsComparator) |
private static ModelViewItem |
_buildElementViewItem(ModelItem modelItem) |
private static ModelViewItemGroup |
_buildGroupViewItem(ModelItem modelItem) |
private static Collection<? extends ModelItem> |
_sort(Collection<? extends ModelItem> items,
Comparator<? super ModelItem> comparator)
sort a model item list using comparator
|
static View |
buildViewFromCategories(Collection<? extends ModelItem> categories,
Comparator<? super ModelItem> categoriesComparator,
Comparator<? super ModelItem> groupsComparator)
Generate the wiew for a list of
ModelItem , using comparators to sort the categories and the groups
This works only on the very specific categories/group/fieldset hierarchy and an IllegalArgumentException will be thrown if the hierarchy is incorrect. |
static List<ModelItem> |
categorize(Collection<CategorizedElementDefinitionProxy> elements)
Categorize the ModlItems based on the informations in the
CategorizedElementDefinitionProxy collection
Category and groups are not sorted, only definitions, based on the position. |
protected static Map<I18nizableText,Map<I18nizableText,List<CategorizedElementDefinitionProxy>>> |
categorizeToMap(Collection<CategorizedElementDefinitionProxy> elements)
Organize a collection of skin parameters by categories and groups.
|
static Map<String,ElementDefinition> |
getFlatDefinitions(Collection<CategorizedElementDefinitionProxy> elements)
Get definitions of all elements parsed in this
CategorizedElementDefinitionProxy Collection , as a flat map. |
protected static Collection<CategorizedElementDefinitionProxy> |
orderDefinitions(Collection<CategorizedElementDefinitionProxy> definitions)
Order definitions, based on their position
|
protected static Collection<CategorizedElementDefinitionProxy> |
orderDefinitions(Collection<CategorizedElementDefinitionProxy> definitions,
I18nizableText categoryLabel,
I18nizableText groupLabel)
Order definitions, based on their position
|
static Map<String,List<I18nizableText>> |
validateValuesForWriting(Map<String,DefinitionAndValue> definitionAndValues,
Logger logger)
Validate parameters before writing
|
static Map<String,List<I18nizableText>> |
validateValuesForWriting(Map<String,DefinitionAndValue> definitionAndValues,
Map<String,ElementDefinition> flatDefinitions,
Logger logger)
Deprecated.
TODO NEWATTRIBUTEAPI_CONFIG RUNTIME-2851 remove this method when it is not necessary anymore to have the flat definitions
|
private CategorizedElementDefinitionHelper()
public static Map<String,ElementDefinition> getFlatDefinitions(Collection<CategorizedElementDefinitionProxy> elements)
CategorizedElementDefinitionProxy
Collection
, as a flat map.elements
- a Collection
of CategorizedElementDefinitionProxy
public static List<ModelItem> categorize(Collection<CategorizedElementDefinitionProxy> elements)
CategorizedElementDefinitionProxy
collection
Category and groups are not sorted, only definitions, based on the position.
Sorting of category and groups have to be done when the view is created (each usage can be different)elements
- collection of categorized elementsModelItem
with the correct tree (category/group/definitions)protected static Map<I18nizableText,Map<I18nizableText,List<CategorizedElementDefinitionProxy>>> categorizeToMap(Collection<CategorizedElementDefinitionProxy> elements)
elements
- a collection of elements.protected static Collection<CategorizedElementDefinitionProxy> orderDefinitions(Collection<CategorizedElementDefinitionProxy> definitions)
definitions
- Collection
of CategorizedElementDefinitionProxy
Collection
of CategorizedElementDefinitionProxy
protected static Collection<CategorizedElementDefinitionProxy> orderDefinitions(Collection<CategorizedElementDefinitionProxy> definitions, I18nizableText categoryLabel, I18nizableText groupLabel)
definitions
- Collection
of CategorizedElementDefinitionProxy
categoryLabel
- label of the category to filter (null to avoid filter)groupLabel
- label of the group (null to avoid filter)Collection
of CategorizedElementDefinitionProxy
@Deprecated public static Map<String,List<I18nizableText>> validateValuesForWriting(Map<String,DefinitionAndValue> definitionAndValues, Map<String,ElementDefinition> flatDefinitions, Logger logger)
definitionAndValues
- a map of all parameters and their valuesflatDefinitions
- flat definition of ElementDefinition
from the model filelogger
- a loggerpublic static Map<String,List<I18nizableText>> validateValuesForWriting(Map<String,DefinitionAndValue> definitionAndValues, Logger logger)
definitionAndValues
- a map of all parameters and their valueslogger
- a loggerpublic static View buildViewFromCategories(Collection<? extends ModelItem> categories, Comparator<? super ModelItem> categoriesComparator, Comparator<? super ModelItem> groupsComparator) throws IllegalArgumentException
ModelItem
, using comparators to sort the categories and the groups
This works only on the very specific categories/group/fieldset hierarchy and an IllegalArgumentException
will be thrown if the hierarchy is incorrect.categories
- list of ModelItem
categoriesComparator
- Comparator
used for the categories (can be null to keep order)groupsComparator
- Comparator
for the groups (can be null to keep order)View
ordered from the ModelItem
using the Comparator
IllegalArgumentException
- the hierarchy of the categories/groups/elements is incorrectprivate static Collection<? extends ModelItem> _sort(Collection<? extends ModelItem> items, Comparator<? super ModelItem> comparator)
items
- list of items to sortcomparator
- a comparator, can be null to avoid sortprivate static ModelViewItemGroup _buildCategoryViewItem(ModelItem category, Comparator<? super ModelItem> groupsComparator) throws IllegalArgumentException
IllegalArgumentException
private static ModelViewItemGroup _buildGroupViewItem(ModelItem modelItem) throws IllegalArgumentException
IllegalArgumentException
private static ModelViewItem _buildElementViewItem(ModelItem modelItem) throws IllegalArgumentException
IllegalArgumentException