public class ModelItemGroup extends AbstractModelItem implements ModelItemContainer
Modifier and Type | Field and Description |
---|---|
private static String |
__DEFAULT_TYPE_ID
Id for model item group types
|
private List<ModelItem> |
_children |
private ElementDefinition<Boolean> |
_switcher |
private AbstractModelItemType |
_type |
ITEM_PATH_SEPARATOR
Constructor and Description |
---|
ModelItemGroup() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(ModelItem child)
Add a child in the group
|
void |
addChild(ModelItem child,
boolean isGroupSwitch)
Add a child in the group
|
List<ModelItem> |
getChildren()
Retrieves the list of children model items
|
List<ModelItem> |
getChildren(boolean withSwitch)
Retrieves the list of children model items, with or without the switcher
|
Collection<ModelItem> |
getModelItems()
Retrieves all the model items of this container
|
ElementDefinition<Boolean> |
getSwitcher()
Retrieves the switcher element definition
|
AbstractModelItemType |
getType()
Retrieves the type.
|
void |
setType(ModelItemType type)
Set the type.
|
Map<String,Object> |
toJSON()
Converts the model item in a JSON map
|
Map<String,Object> |
toJSON(boolean includeChildren)
Converts the model item group in a JSON map
|
addItemChecker, compareTo, equals, getDescription, getItemCheckers, getLabel, getModel, getName, getParent, getPath, hashCode, setDescription, setLabel, setModel, setName, setParent, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChild, getModelItem, hasModelItem
private static final String __DEFAULT_TYPE_ID
private ElementDefinition<Boolean> _switcher
private AbstractModelItemType _type
public ModelItemGroup()
public Collection<ModelItem> getModelItems()
ModelItemContainer
getModelItems
in interface ModelItemContainer
public List<ModelItem> getChildren()
public List<ModelItem> getChildren(boolean withSwitch)
withSwitch
- true to retrieve the switcher with the other childrenpublic void addChild(ModelItem child)
child
- the item to addpublic void addChild(ModelItem child, boolean isGroupSwitch)
child
- the child to addisGroupSwitch
- true if the child to add is the group switch, false otherwisepublic ElementDefinition<Boolean> getSwitcher()
public AbstractModelItemType getType()
ModelItem
public void setType(ModelItemType type)
ModelItem
public Map<String,Object> toJSON() throws ProcessingException
ModelItem
toJSON
in interface ModelItem
toJSON
in class AbstractModelItem
ProcessingException
- If an error occurs when converting the model itempublic Map<String,Object> toJSON(boolean includeChildren) throws ProcessingException
includeChildren
- true to iterate and add children as elements in the returned JSON map, false otherwiseProcessingException
- If an error occurs when converting the model item group