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
,ModelItemAccessor
,ModelItemContainer
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
ContentRestrictedRepeaterDefinition
Definition of a repeater.
-
Field Summary
Fields inherited from class org.ametys.runtime.model.ModelItemGroup
DEFAULT_TYPE_ID
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__serviceManager
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorDescriptionDefault constructor.RepeaterDefinition
(String name, ModelItemType type, ModelItem... children) Constructor used to create simple models and items -
Method Summary
Modifier and TypeMethodDescription_toJSON
(DefinitionContext context, boolean includeChildren) Converts the model item group in a JSON mapRetrieves the add label.Retrieves the delete label.Get the header label.int
Retrieves the initial size.int
Retrieves the maximum size.int
Retrieves the minimum size.static RepeaterDefinition
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.void
toSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model itemMethods inherited from class org.ametys.runtime.model.ModelItemGroup
_toJSON, addChild, addChild, getChildren, getChildren, getModelItems, getSwitcher, getType, of, setModel, setType, toJSON
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_shouldJSONBeEmpty, _widgetParameterToSAX, _widgetToSAX, addItemChecker, compareTo, equals, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, getWidget, getWidgetParameters, hashCode, setDescription, setDisableConditions, setLabel, setName, setParent, setPluginName, setServiceManager, setWidget, setWidgetParameters, toJSON, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItem
-
Constructor Details
-
RepeaterDefinition
public RepeaterDefinition()Default constructor. -
RepeaterDefinition
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 Details
-
getInitialSize
Retrieves the initial size.- Returns:
- the initial size.
-
setInitialSize
Set the initial size.- Parameters:
size
- the initial size.
-
getMinSize
Retrieves the minimum size.- Returns:
- the minimum size.
-
setMinSize
Set the minimum size.- Parameters:
size
- the minimum size.
-
getMaxSize
Retrieves the maximum size.- Returns:
- the maximum size or
-1
if unbounded.
-
setMaxSize
Set the maximum size.- Parameters:
size
- the maximum size or-1
if unbounded.
-
getAddLabel
Retrieves the add label.- Returns:
- the add label or
null
if none.
-
setAddLabel
Set the add label.- Parameters:
label
- the add label ornull
if none.
-
getDeleteLabel
Retrieves the delete label.- Returns:
- the delete label or
null
if none.
-
setDeleteLabel
Set the delete label.- Parameters:
label
- the delete label ornull
if none.
-
getHeaderLabel
Get the header label.- Returns:
- the header label or
null
if none.
-
setHeaderLabel
Set the header label.- Parameters:
label
- the header label ornull
if none.
-
_toJSON
protected Map<String,Object> _toJSON(DefinitionContext context, boolean includeChildren) throws ProcessingException Description copied from class:ModelItemGroup
Converts the model item group in a JSON map- Overrides:
_toJSON
in classModelItemGroup
- Parameters:
context
- the context of the definitionincludeChildren
- 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
-
toSAX
Description copied from class:ModelItemGroup
Generates SAX events for the model item Do not generate SAX events for children. This method has been created to generate SAX events for views, the children are taken into account via view items children- Specified by:
toSAX
in interfaceModelItem
- Overrides:
toSAX
in classModelItemGroup
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definition- Throws:
SAXException
- if an error occurs during the SAX events generation
-
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
-