Package org.ametys.runtime.model
Class ModelViewItemGroup
- java.lang.Object
-
- org.ametys.runtime.model.AbstractViewItemGroup
-
- org.ametys.runtime.model.ModelViewItemGroup
-
- All Implemented Interfaces:
ModelViewItem<ModelItemGroup>,ViewItem,ViewItemAccessor,ViewItemContainer,ViewItemGroup,Labelable,ModifiableLabelable
public class ModelViewItemGroup extends AbstractViewItemGroup implements ModelViewItem<ModelItemGroup>
View reference to a group of model items
-
-
Field Summary
Fields Modifier and Type Field Description private ModelItemGroup_definition-
Fields inherited from class org.ametys.runtime.model.AbstractViewItemGroup
_children, _description, _label, _role
-
Fields inherited from interface org.ametys.runtime.model.ViewItemGroup
FIELDSET_ROLE, TAB_ROLE
-
-
Constructor Summary
Constructors Constructor Description ModelViewItemGroup()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<ViewItem>_getChildrenForJSON()voidcopyTo(ViewItem item)Copy the current view item in the given one.ModelViewItemGroupcreateInstance()Create an instance ofViewItembooleanequals(Object obj)ModelItemGroupgetDefinition()Retrieves the referenced model item definitionI18nizableTextgetDescription()Retrieves the description.I18nizableTextgetLabel()Retrieves the label.StringgetName()Get the name.inthashCode()static ModelViewItemGroupof(ModelItemGroup modelItem)Creates aModelViewItemGroupwith the items of the givenModelItemGroupstatic ModelViewItemGroupof(ModelItemGroup modelItem, String... itemPaths)Creates aModelViewItemGroupwith the given itemsvoidsetDefinition(ModelItemGroup definition)Sets the referenced model item definitionMap<String,Object>toJSON(DefinitionContext context)Converts the view item in a JSON map-
Methods inherited from class org.ametys.runtime.model.AbstractViewItemGroup
addViewItem, clear, equals, getRole, getViewItems, insertViewItem, removeViewItem, setDescription, setLabel, setRole
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ModelViewItem
setName
-
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel
-
Methods inherited from interface org.ametys.runtime.model.ViewItemAccessor
addViewItems, getModelViewItem, hasModelViewItem, hasModelViewItem
-
Methods inherited from interface org.ametys.runtime.model.ViewItemGroup
copyTo
-
-
-
-
Field Detail
-
_definition
private ModelItemGroup _definition
-
-
Constructor Detail
-
ModelViewItemGroup
public ModelViewItemGroup()
-
-
Method Detail
-
of
public static ModelViewItemGroup of(ModelItemGroup modelItem) throws IllegalArgumentException
Creates aModelViewItemGroupwith the items of the givenModelItemGroup- Parameters:
modelItem- the model item group- Returns:
- the created
ModelViewItemGroup - Throws:
IllegalArgumentException- if the model item isnull
-
of
public static ModelViewItemGroup of(ModelItemGroup modelItem, String... itemPaths) throws IllegalArgumentException, BadItemTypeException
Creates aModelViewItemGroupwith the given items- Parameters:
modelItem- the model item containing items definitionsitemPaths- the paths of the items to put in the view item- Returns:
- the created
ModelViewItemGroup - Throws:
IllegalArgumentException- if the model item isnullor if an item path isnull, empty, or is not defined in the given model itemsBadItemTypeException- if a segment in a path (but not the last) does not represent a group item
-
getDefinition
public ModelItemGroup getDefinition()
Description copied from interface:ModelViewItemRetrieves the referenced model item definition- Specified by:
getDefinitionin interfaceModelViewItem<ModelItemGroup>- Returns:
- the referenced definition
-
setDefinition
public void setDefinition(ModelItemGroup definition)
Description copied from interface:ModelViewItemSets the referenced model item definition- Specified by:
setDefinitionin interfaceModelViewItem<ModelItemGroup>- Parameters:
definition- the referenced definition
-
getLabel
public I18nizableText getLabel()
Description copied from interface:LabelableRetrieves the label.- Specified by:
getLabelin interfaceLabelable- Overrides:
getLabelin classAbstractViewItemGroup- Returns:
- the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Overrides:
getDescriptionin classAbstractViewItemGroup- Returns:
- the description.
-
toJSON
public Map<String,Object> toJSON(DefinitionContext context) throws ProcessingException
Description copied from interface:ViewItemConverts the view item in a JSON map- Specified by:
toJSONin interfaceViewItem- Parameters:
context- the context of the definitions referenced in this view item and/or its children- Returns:
- The view item as a JSON map
- Throws:
ProcessingException- If an error occurs when converting the view item
-
_getChildrenForJSON
private List<ViewItem> _getChildrenForJSON()
-
copyTo
public void copyTo(ViewItem item)
Description copied from interface:ViewItemCopy the current view item in the given one. If the view item is an accessor, its view items are not copied- Specified by:
copyToin interfaceViewItem- Overrides:
copyToin classAbstractViewItemGroup- Parameters:
item- the copy
-
createInstance
public ModelViewItemGroup createInstance()
Description copied from interface:ViewItemCreate an instance ofViewItem- Specified by:
createInstancein interfaceViewItem- Returns:
- the created instance
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractViewItemGroup
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractViewItemGroup
-
-