Class AbstractMatrixElementType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.model.type.AbstractModelItemType
org.ametys.core.model.type.AbstractElementType<Matrix>
org.ametys.plugins.forms.repository.type.AbstractMatrixElementType
- All Implemented Interfaces:
ElementType<Matrix>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
- Direct Known Subclasses:
MatrixRepositoryElementType
Abstract class for matrix element types
-
Field Summary
FieldsFields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_singleValueToSAX
(ContentHandler contentHandler, String tagName, Matrix value, Optional<ViewItem> viewItem, DataContext context, AttributesImpl attributes) Generates SAX events for the given single valueprotected Matrix
_string2Matrix
(String value) Map json to matrixconvertValue
(Object value) Try to convert the given value, that is not of the managed typefromJSONForClient
(Object json, DataContext context) Convert the given client side JSON object to the types valueboolean
isCompatible
(Object value) Checks if the value is compatible with the element typeboolean
isSimple()
Determines if this type is simple or not.Cast a typed value to a StringMethods inherited from class org.ametys.core.model.type.AbstractElementType
_compareMultipleValues, _compareSingleValues, _getValueAttributes, _isMultiple, _isSingle, _isValueFromXMLMultiple, _singleValueFromXML, _singleValueToJSON, _singleValueToJSONForEdition, _useJSONForEdition, _valueToJSON, _valueToSAX, _valueToSAX, _valueToSAXForEdition, castValue, compareValues, getManagedClass, getManagedClassArray, parseConfiguration, service, valueFromXML, valueToJSONForClient, valueToJSONForEdition, valueToSAX, valueToSAXForEdition
Methods inherited from class org.ametys.core.model.type.AbstractModelItemType
getId, setPluginInfo
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
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.type.ModelItemType
getId, valueToJSONForClient, valueToSAX
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
-
Field Details
-
MATRIX_REPOSITORY_DATA_TYPE
Constant for type matrix- See Also:
-
-
Constructor Details
-
AbstractMatrixElementType
public AbstractMatrixElementType()
-
-
Method Details
-
convertValue
Description copied from class:AbstractElementType
Try to convert the given value, that is not of the managed type- Overrides:
convertValue
in classAbstractElementType<Matrix>
- Parameters:
value
- the value to convert- Returns:
- the converted value or null if it's not possible.
-
toString
Description copied from interface:ElementType
Cast a typed value to a String- Specified by:
toString
in interfaceElementType<Matrix>
- Overrides:
toString
in classAbstractElementType<Matrix>
- Parameters:
value
- the value to cast- Returns:
- the String representation of the value
-
fromJSONForClient
Description copied from interface:ElementType
Convert the given client side JSON object to the types value- Parameters:
json
- the JSON object to convertcontext
- the context of the data to retrieve- Returns:
- the typed value corresponding to the JSON object
-
isSimple
Description copied from interface:ElementType
Determines if this type is simple or not. A simple element type is a type of elements that can be edited in a grid- Returns:
true
if the type is simple,false
otherwise
-
isCompatible
Description copied from interface:ElementType
Checks if the value is compatible with the element type- Specified by:
isCompatible
in interfaceElementType<Matrix>
- Overrides:
isCompatible
in classAbstractElementType<Matrix>
- Parameters:
value
- the value to check- Returns:
true
if the value matches the current type,false
otherwise
-
_string2Matrix
Map json to matrix- Parameters:
value
- the json value- Returns:
- the matrix
-
_singleValueToSAX
protected void _singleValueToSAX(ContentHandler contentHandler, String tagName, Matrix value, Optional<ViewItem> viewItem, DataContext context, AttributesImpl attributes) throws SAXException Description copied from class:AbstractElementType
Generates SAX events for the given single value- Overrides:
_singleValueToSAX
in classAbstractElementType<Matrix>
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventstagName
- the tag name of the SAX event to generate.value
- the single value to SAXviewItem
- The optional view item corresponding item that is currently saxed. This view item gives context for the SAX event that will be generated here.context
- The context of the data to SAXattributes
- the attributes for the SAX event to generate- Throws:
SAXException
- if an error occurs during the SAX events generation
-