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
,ViewItemContainer
,ViewItemGroup
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, _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()
ModelItemGroup
getDefinition()
Retrieves the referenced model item definitionString
getName()
Retrieves the name of the view itemstatic ModelViewItemGroup
of(ModelItemGroup modelItem)
Creates aModelViewItemGroup
with the items of the givenModelItemGroup
static ModelViewItemGroup
of(ModelItemGroup modelItem, String... itemPaths)
Creates aModelViewItemGroup
with the given itemsvoid
setDefinition(ModelItemGroup definition)
Sets the referenced model item definitionMap<String,Object>
toJSON()
Converts the view item in a JSON map-
Methods inherited from class org.ametys.runtime.model.AbstractViewItemGroup
addViewItem, getRole, getViewItems, insertViewItem, setRole
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ViewItemContainer
getModelViewItem, hasModelViewItem
-
-
-
-
Field Detail
-
_definition
private ModelItemGroup _definition
-
-
Constructor Detail
-
ModelViewItemGroup
public ModelViewItemGroup()
-
-
Method Detail
-
of
public static ModelViewItemGroup of(ModelItemGroup modelItem) throws IllegalArgumentException
Creates aModelViewItemGroup
with 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 aModelViewItemGroup
with 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 isnull
or 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:ModelViewItem
Retrieves the referenced model item definition- Specified by:
getDefinition
in interfaceModelViewItem<ModelItemGroup>
- Returns:
- the referenced definition
-
setDefinition
public void setDefinition(ModelItemGroup definition)
Description copied from interface:ModelViewItem
Sets the referenced model item definition- Specified by:
setDefinition
in interfaceModelViewItem<ModelItemGroup>
- Parameters:
definition
- the referenced definition
-
getName
public String getName()
Description copied from interface:ViewItem
Retrieves the name of the view item
-
toJSON
public Map<String,Object> toJSON() throws ProcessingException
Description copied from interface:ViewItem
Converts the view item in a JSON map- Specified by:
toJSON
in interfaceViewItem
- Returns:
- The view item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the view item
-
_getChildrenForJSON
private List<ViewItem> _getChildrenForJSON()
-
-