Package org.ametys.runtime.model
Class AbstractModelItem
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
- All Implemented Interfaces:
Comparable<ModelItem>
,ModelItem
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
DefaultElementDefinition
,ModelItemGroup
Abstract class for model items
-
Field Summary
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorDescriptionDefault constructor.AbstractModelItem
(String name) Constructor used to create simple models and itemsAbstractModelItem
(ModelItem modelItemToCopy) Constructor by copying an existingAbstractModelItem
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_shouldJSONBeEmpty
(DefinitionContext context) Checks if the current definition JSON conversion should return an empty map_toJSON
(DefinitionContext context) Converts the model item in a JSON mapprotected void
_widgetParameterToSAX
(ContentHandler contentHandler, String parameterName, I18nizableText parameterValue, DefinitionContext context) Generates SAX events for the given widget parameterprotected void
_widgetToSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model item's widgetvoid
addItemChecker
(ItemCheckerDescriptor itemChecker) Add an item checker to the groupint
boolean
Retrieves the description.Retrieves the disable condition.Returns theItemCheckerDescriptor
s associated with this group.getLabel()
Retrieves the label.getModel()
Retrieves the model of the itemgetName()
Get the name.Retrieves the parent of the itemgetPath()
Retrieves the path of the model itemRetrieves the name of the plugin declaring this element.Retrieves the widget to use for rendering.Get the widget's parametersint
hashCode()
void
setDescription
(I18nizableText description) Set the description.void
setDisableConditions
(DisableConditions disableConditions) Sets the disable condition.void
setLabel
(I18nizableText label) Set the label.void
Sets the model of the elementvoid
Set the name.void
setParent
(ModelItemGroup parent) Sets the parent of the itemvoid
setPluginName
(String pluginName) Set the name of the plugin declaring this element.static void
setServiceManager
(ServiceManager manager) Set the service manager TheServiceManager
is used in the model items creation methods to get the model item type.void
Set the widget.void
setWidgetParameters
(Map<String, I18nizableText> params) Set the widget's parameterstoJSON
(DefinitionContext context) Converts the model item in a JSON mapvoid
toSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model itemtoString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.runtime.model.ModelItem
getCriterionWidget, getCriterionWidgetParameters, getType, setType
-
Field Details
-
__serviceManager
The service manager
-
-
Constructor Details
-
AbstractModelItem
public AbstractModelItem()Default constructor. -
AbstractModelItem
Constructor used to create simple models and items- Parameters:
name
- the name of the item
-
AbstractModelItem
Constructor by copying an existingAbstractModelItem
.- Parameters:
modelItemToCopy
- TheAbstractModelItem
to copy
-
-
Method Details
-
getName
Description copied from interface:Labelable
Get the name. -
setName
Description copied from interface:ModifiableLabelable
Set the name.- Specified by:
setName
in interfaceModifiableLabelable
- Parameters:
name
- the name.
-
getPluginName
Description copied from interface:ModelItem
Retrieves the name of the plugin declaring this element.- Specified by:
getPluginName
in interfaceModelItem
- Returns:
- the plugin name.
-
setPluginName
Description copied from interface:ModelItem
Set the name of the plugin declaring this element.- Specified by:
setPluginName
in interfaceModelItem
- Parameters:
pluginName
- the plugin name.
-
getLabel
Description copied from interface:Labelable
Retrieves the label. -
setLabel
Description copied from interface:ModifiableLabelable
Set the label.- Specified by:
setLabel
in interfaceModifiableLabelable
- Parameters:
label
- the label.
-
getDescription
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Returns:
- the description.
-
setDescription
Description copied from interface:ModifiableLabelable
Set the description.- Specified by:
setDescription
in interfaceModifiableLabelable
- Parameters:
description
- the description.
-
addItemChecker
Description copied from interface:ModelItem
Add an item checker to the group- Specified by:
addItemChecker
in interfaceModelItem
- Parameters:
itemChecker
- the item checker to add
-
getItemCheckers
Description copied from interface:ModelItem
Returns theItemCheckerDescriptor
s associated with this group.- Specified by:
getItemCheckers
in interfaceModelItem
- Returns:
- the
ItemCheckerDescriptor
s associated with this group.
-
getWidget
Description copied from interface:ModelItem
Retrieves the widget to use for rendering. -
setWidget
Description copied from interface:ModelItem
Set the widget. -
getWidgetParameters
Description copied from interface:ModelItem
Get the widget's parameters- Specified by:
getWidgetParameters
in interfaceModelItem
- Returns:
- the widget's parameters
-
setWidgetParameters
Description copied from interface:ModelItem
Set the widget's parameters- Specified by:
setWidgetParameters
in interfaceModelItem
- Parameters:
params
- the parameters to set
-
getDisableConditions
Description copied from interface:ModelItem
Retrieves the disable condition.- Specified by:
getDisableConditions
in interfaceModelItem
- Returns:
- the disable condition or
null
if none is defined.
-
setDisableConditions
Description copied from interface:ModelItem
Sets the disable condition.- Specified by:
setDisableConditions
in interfaceModelItem
- Parameters:
disableConditions
- the disable condition.
-
getPath
Description copied from interface:ModelItem
Retrieves the path of the model item -
getModel
Description copied from interface:ModelItem
Retrieves the model of the item -
setModel
Description copied from interface:ModelItem
Sets the model of the element -
getParent
Description copied from interface:ModelItem
Retrieves the parent of the item -
setParent
Description copied from interface:ModelItem
Sets the parent of the item -
toJSON
Description copied from interface:ModelItem
Converts the model item in a JSON map- Specified by:
toJSON
in interfaceModelItem
- Parameters:
context
- the context of the definition- Returns:
- The model item as a JSON map, or an empty map
- Throws:
ProcessingException
- If an error occurs when converting the model item
-
_toJSON
Converts the model item in a JSON map- Parameters:
context
- the context of the definition- Returns:
- The model item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the model item
-
_shouldJSONBeEmpty
Checks if the current definition JSON conversion should return an empty map- Parameters:
context
- the context of the definition- Returns:
true
if the JSON conversion should return an empty map,false
otherwise
-
toSAX
Description copied from interface:ModelItem
Generates SAX events for the model item- Specified by:
toSAX
in interfaceModelItem
- 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
-
_widgetToSAX
protected void _widgetToSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException Generates SAX events for the model item's widget- 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
-
_widgetParameterToSAX
protected void _widgetParameterToSAX(ContentHandler contentHandler, String parameterName, I18nizableText parameterValue, DefinitionContext context) throws SAXException Generates SAX events for the given widget parameter- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventsparameterName
- the name of the parameterparameterValue
- the value of the parametercontext
- the context of the definition- Throws:
SAXException
- if an error occurs during the SAX events generation
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ModelItem>
-
equals
-
hashCode
-
toString
-
setServiceManager
Set the service manager TheServiceManager
is used in the model items creation methods to get the model item type.ModelItem
is not aComponent
and can't have aServiceManager
itself. AnotherComponent
has to set it- Parameters:
manager
- the service manager to set
-