Class RepeaterDefinition
- java.lang.Object
-
- org.ametys.runtime.model.AbstractModelItem
-
- org.ametys.runtime.model.ModelItemGroup
-
- org.ametys.plugins.repository.model.RepeaterDefinition
-
- All Implemented Interfaces:
Comparable<ModelItem>
,ModelItem
,ModelItemContainer
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
ContentRestrictedRepeaterDefinition
public class RepeaterDefinition extends ModelItemGroup
Definition of a repeater.
-
-
Field Summary
Fields Modifier and Type Field Description private I18nizableText
_addLabel
private I18nizableText
_delLabel
private String
_headerLabel
private int
_initializeSize
private int
_maxSize
private int
_minSize
-
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__serviceManager
-
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description RepeaterDefinition()
Default constructor.RepeaterDefinition(String name, ModelItemType type, ModelItem... children)
Constructor used to create simple models and items
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description I18nizableText
getAddLabel()
Retrieves the add label.I18nizableText
getDeleteLabel()
Retrieves the delete label.String
getHeaderLabel()
Get the header label.int
getInitialSize()
Retrieves the initial size.int
getMaxSize()
Retrieves the maximum size.int
getMinSize()
Retrieves the minimum size.static RepeaterDefinition
of(String name, String availableTypesExtensionPoint, ModelItem... children)
Creates aRepeaterDefinition
void
setAddLabel(I18nizableText label)
Set the add label.void
setDeleteLabel(I18nizableText label)
Set the delete label.void
setHeaderLabel(String label)
Set the header label.void
setInitialSize(int size)
Set the initial size.void
setMaxSize(int size)
Set the maximum size.void
setMinSize(int size)
Set the minimum size.Map<String,Object>
toJSON(boolean includeChildren)
Converts the model item group in a JSON map-
Methods inherited from class org.ametys.runtime.model.ModelItemGroup
addChild, addChild, getChildren, getChildren, getModelItems, getSwitcher, getType, of, setModel, setType, toJSON
-
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
addItemChecker, compareTo, equals, getDescription, getItemCheckers, getLabel, getModel, getName, getParent, getPath, hashCode, setDescription, setLabel, setName, setParent, setServiceManager, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ModelItemContainer
getChild, getModelItem, hasModelItem
-
-
-
-
Field Detail
-
_initializeSize
private int _initializeSize
-
_minSize
private int _minSize
-
_maxSize
private int _maxSize
-
_addLabel
private I18nizableText _addLabel
-
_delLabel
private I18nizableText _delLabel
-
_headerLabel
private String _headerLabel
-
-
Constructor Detail
-
RepeaterDefinition
public RepeaterDefinition()
Default constructor.
-
RepeaterDefinition
public RepeaterDefinition(String name, ModelItemType type, ModelItem... children)
Constructor used to create simple models and items- Parameters:
name
- the name of the definitiontype
- the type of the repeaterchildren
- the repeater's children
-
-
Method Detail
-
getInitialSize
public int getInitialSize()
Retrieves the initial size.- Returns:
- the initial size.
-
setInitialSize
public void setInitialSize(int size)
Set the initial size.- Parameters:
size
- the initial size.
-
getMinSize
public int getMinSize()
Retrieves the minimum size.- Returns:
- the minimum size.
-
setMinSize
public void setMinSize(int size)
Set the minimum size.- Parameters:
size
- the minimum size.
-
getMaxSize
public int getMaxSize()
Retrieves the maximum size.- Returns:
- the maximum size or
-1
if unbounded.
-
setMaxSize
public void setMaxSize(int size)
Set the maximum size.- Parameters:
size
- the maximum size or-1
if unbounded.
-
getAddLabel
public I18nizableText getAddLabel()
Retrieves the add label.- Returns:
- the add label or
null
if none.
-
setAddLabel
public void setAddLabel(I18nizableText label)
Set the add label.- Parameters:
label
- the add label ornull
if none.
-
getDeleteLabel
public I18nizableText getDeleteLabel()
Retrieves the delete label.- Returns:
- the delete label or
null
if none.
-
setDeleteLabel
public void setDeleteLabel(I18nizableText label)
Set the delete label.- Parameters:
label
- the delete label ornull
if none.
-
getHeaderLabel
public String getHeaderLabel()
Get the header label.- Returns:
- the header label or
null
if none.
-
setHeaderLabel
public void setHeaderLabel(String label)
Set the header label.- Parameters:
label
- the header label ornull
if none.
-
toJSON
public Map<String,Object> toJSON(boolean includeChildren) throws ProcessingException
Description copied from class:ModelItemGroup
Converts the model item group in a JSON map- Overrides:
toJSON
in classModelItemGroup
- Parameters:
includeChildren
- true to iterate and add children as elements in the returned JSON map, false otherwise- Returns:
- The model item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the model item group
-
of
public static RepeaterDefinition of(String name, String availableTypesExtensionPoint, ModelItem... children) throws UnknownTypeException, ServiceException
Creates aRepeaterDefinition
- Parameters:
name
- the repeater's nameavailableTypesExtensionPoint
- the role of the extension point containing all available types for thisModelItem
children
- the repeater's children- Returns:
- the created
RepeaterDefinition
- Throws:
UnknownTypeException
- if the repeater type is not available in the extension pointServiceException
- if an error occurs while getting the extension point of available types
-
-