Class ComputedQuestionType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.question.types.AbstractStaticFormQuestionType
org.ametys.plugins.forms.question.types.ComputedQuestionType
- All Implemented Interfaces:
FormQuestionType
,ConfidentialAwareQuestionType
,LogEnabled
,PluginAware
,Configurable
,Serviceable
public class ComputedQuestionType
extends AbstractStaticFormQuestionType
implements ConfidentialAwareQuestionType
Class for creating computed question
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant for computing attribute.static final String
Constant for default titleFields inherited from class org.ametys.plugins.forms.question.types.AbstractStaticFormQuestionType
_category, _description, _formQuestionModel, _i18nUtils, _iconGlyph, _id, _label, _pluginName, _priority, _scripts, _xslt
Fields inherited from interface org.ametys.plugins.forms.question.types.ConfidentialAwareQuestionType
ATTRIBUTE_CONFIDENTIALITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleViewItemGroup
Define the content of the advanced tabprotected SimpleViewItemGroup
Define the content of the main tabGet the list of ModelItemsprotected List<ViewItemGroup>
Get the list of tabs that will be added in the question view.boolean
canBeAnsweredByUser
(FormQuestion question) Returntrue
if the type of question can be answered by user.getComputingType
(FormQuestion question) Get the computing typeGet the default title depending on typegetFieldToDisableIfFormPublished
(FormQuestion question) Get field to disable if form is publishedgetJSRenderer
(FormQuestion question) Get the js renderer for the choice listgetStorageType
(FormQuestion question) Get the storage type of the question typeboolean
isCacheable
(FormQuestion question) Returntrue
if the type of question can be cacheable.boolean
isQuestionConfigured
(FormQuestion question) Say if question needs more configuration to be usedboolean
onlyForDisplay
(FormQuestion question) Returntrue
if the type of question is only for display.void
saxAdditionalInfos
(ContentHandler contentHandler, FormQuestion question) Sax additional informations for the question typevoid
saxEntryValue
(ContentHandler contentHandler, FormQuestion question, FormEntry entry) Sax the entry value depending on the question typevoid
service
(ServiceManager manager) valueToJSONForClient
(Object value, FormQuestion question, FormEntry entry, ModelItem modelItem) Convert the entry value into a JSON object to use client sideMethods inherited from class org.ametys.plugins.forms.question.types.AbstractStaticFormQuestionType
_createAdvancedTab, _createMainTab, _getEntryModelItem, _getRulesTab, configure, doAdditionalOperations, getCategory, getDescription, getDisplayOrder, getDisplayXSLT, getEntryModel, getIconGlyph, getId, getLabel, getModel, getScripts, getView, setPluginInfo, validateEntryValues, validateQuestionValues
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.plugins.forms.question.types.ConfidentialAwareQuestionType
getConfidentialityModelItem, getConfidentialityViewElement
Methods inherited from interface org.ametys.plugins.forms.question.FormQuestionType
getJSConverter
-
Field Details
-
ATTRIBUTE_COMPUTING_TYPE
Constant for computing attribute.- See Also:
-
DEFAULT_TITLE
Constant for default title- See Also:
-
-
Constructor Details
-
ComputedQuestionType
public ComputedQuestionType()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractStaticFormQuestionType
- Throws:
ServiceException
-
_getModelItems
Description copied from class:AbstractStaticFormQuestionType
Get the list of ModelItems- Overrides:
_getModelItems
in classAbstractStaticFormQuestionType
- Returns:
- a list of ModelItems
-
_getTabs
Description copied from class:AbstractStaticFormQuestionType
Get the list of tabs that will be added in the question view. The list returned by this method should include the tab provided by _getTabs- Specified by:
_getTabs
in classAbstractStaticFormQuestionType
- Parameters:
form
- the form- Returns:
- the tabs
-
_getMainTab
Define the content of the main tab- Returns:
- the main tab definition
-
_getAdvancedTab
Define the content of the advanced tab- Returns:
- the advanced tab definition
-
getStorageType
Description copied from interface:FormQuestionType
Get the storage type of the question type- Specified by:
getStorageType
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
- the storage type
-
saxAdditionalInfos
public void saxAdditionalInfos(ContentHandler contentHandler, FormQuestion question) throws SAXException Description copied from interface:FormQuestionType
Sax additional informations for the question type- Specified by:
saxAdditionalInfos
in interfaceFormQuestionType
- Overrides:
saxAdditionalInfos
in classAbstractStaticFormQuestionType
- Parameters:
contentHandler
- the content handlerquestion
- the question- Throws:
SAXException
- if a saxing error occurred
-
isQuestionConfigured
Description copied from interface:FormQuestionType
Say if question needs more configuration to be used- Specified by:
isQuestionConfigured
in interfaceFormQuestionType
- Overrides:
isQuestionConfigured
in classAbstractStaticFormQuestionType
- Parameters:
question
- the current question- Returns:
- false if question needs more configuration, true by default
-
getComputingType
Get the computing type- Parameters:
question
- the question- Returns:
- the computing type
-
onlyForDisplay
Description copied from interface:FormQuestionType
Returntrue
if the type of question is only for display.- Specified by:
onlyForDisplay
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
true
if the type of question is only for display.
-
canBeAnsweredByUser
Description copied from interface:FormQuestionType
Returntrue
if the type of question can be answered by user.- Specified by:
canBeAnsweredByUser
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
true
if the type of question can be answered by user.
-
getDefaultTitle
Description copied from interface:FormQuestionType
Get the default title depending on type- Specified by:
getDefaultTitle
in interfaceFormQuestionType
- Returns:
- the default title
-
saxEntryValue
public void saxEntryValue(ContentHandler contentHandler, FormQuestion question, FormEntry entry) throws SAXException Description copied from interface:FormQuestionType
Sax the entry value depending on the question type- Specified by:
saxEntryValue
in interfaceFormQuestionType
- Overrides:
saxEntryValue
in classAbstractStaticFormQuestionType
- Parameters:
contentHandler
- the content handlerquestion
- the question getting saxedentry
- the entry- Throws:
SAXException
- exception while saxing entry
-
getFieldToDisableIfFormPublished
Description copied from interface:FormQuestionType
Get field to disable if form is published- Specified by:
getFieldToDisableIfFormPublished
in interfaceFormQuestionType
- Overrides:
getFieldToDisableIfFormPublished
in classAbstractStaticFormQuestionType
- Parameters:
question
- the form question- Returns:
- the list of field name
-
getJSRenderer
Description copied from interface:FormQuestionType
Get the js renderer for the choice list- Specified by:
getJSRenderer
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
- the js renderer
-
valueToJSONForClient
public Object valueToJSONForClient(Object value, FormQuestion question, FormEntry entry, ModelItem modelItem) throws Exception Description copied from interface:FormQuestionType
Convert the entry value into a JSON object to use client side- Specified by:
valueToJSONForClient
in interfaceFormQuestionType
- Parameters:
value
- the value to convertquestion
- the form questionentry
- the form entrymodelItem
- the model item- Returns:
- The value as JSON
- Throws:
Exception
- if an error occurred
-
isCacheable
Description copied from interface:FormQuestionType
Returntrue
if the type of question can be cacheable.- Specified by:
isCacheable
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
true
if the type of question can be cacheable.
-