Class ViewHelper
- java.lang.Object
-
- org.ametys.plugins.repository.model.ViewHelper
-
public final class ViewHelper extends Object
Helper for manipulating views in the context of the repository plugin (aware of repeaters, composites, ...).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,List<I18nizableText>>
validateValues(ViewItemAccessor viewItemAccessor, Optional<Map<String,Object>> values)
Validates the given values according to the view item accessorstatic void
visitView(ViewItemAccessor viewItemAccessor, BiConsumer<ViewElement,ElementDefinition> elementConsumer, BiConsumer<ModelViewItemGroup,CompositeDefinition> compositeConsumer, BiConsumer<ModelViewItemGroup,RepeaterDefinition> repeaterConsumer, Consumer<ViewItemGroup> groupConsumer)
Visit a view, allowing to perform specific actions for view elements.
-
-
-
Method Detail
-
visitView
public static void visitView(ViewItemAccessor viewItemAccessor, BiConsumer<ViewElement,ElementDefinition> elementConsumer, BiConsumer<ModelViewItemGroup,CompositeDefinition> compositeConsumer, BiConsumer<ModelViewItemGroup,RepeaterDefinition> repeaterConsumer, Consumer<ViewItemGroup> groupConsumer)
Visit a view, allowing to perform specific actions for view elements.- Parameters:
viewItemAccessor
- theViewItemAccessor
to visit.elementConsumer
- the consumer called on eachViewElement
.compositeConsumer
- the consumer called on each item refering to aCompositeDefinition
.repeaterConsumer
- the consumer called on each item refering to aRepeaterDefinition
.groupConsumer
- the consumer called on each otherViewItemGroup
.
-
validateValues
public static Map<String,List<I18nizableText>> validateValues(ViewItemAccessor viewItemAccessor, Optional<Map<String,Object>> values)
Validates the given values according to the view item accessor- Parameters:
values
- the values to validateviewItemAccessor
- the view item accessor to visit- Returns:
- the errors information if the validation fails.
-
-