Class AbstractStaticFormQuestionType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.question.types.AbstractStaticFormQuestionType
- All Implemented Interfaces:
FormQuestionType
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
AbstractFormQuestionType
,ComputedQuestionType
,RichTextQuestionType
public abstract class AbstractStaticFormQuestionType
extends AbstractLogEnabled
implements FormQuestionType, Configurable, PluginAware, Serviceable
Static class for creating
FormQuestionType
from xml config-
Field Summary
Modifier and TypeFieldDescriptionprotected I18nizableText
The type category in button menuprotected I18nizableText
Description of question typeprotected Model
The form question modelprotected I18nUtils
I18n Utilsprotected String
Icon glyph of question typeprotected String
Id of question typeprotected I18nizableText
Label of question typeprotected String
Formsprotected Integer
The type priority in button menuprotected List<ClientSideElement.ScriptFile>
Scripts associated with question typeprotected String
Xslt associated of question type -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleViewItemGroup
Helper to create an empty tab to use as the advanced tabprotected SimpleViewItemGroup
Helper to create an empty tab to use as the main tabprotected ModelItem
_getEntryModelItem
(FormQuestion question) Define the entry model itemsGet the list of ModelItemsprotected SimpleViewItemGroup
Get the view's common rules tabprotected abstract List<ViewItemGroup>
Get the list of tabs that will be added in the question view.void
configure
(Configuration configuration) void
doAdditionalOperations
(FormQuestion question, Map<String, Object> values) Do additional operations to create or edit the questionGet the category of question typeGet description of question typeGet display order of the question typeGet the display XSLT filegetEntryModel
(FormQuestion question) Get the form entry model for the question typegetFieldToDisableIfFormPublished
(FormQuestion question) Get field to disable if form is publishedGet icon of question type buttongetId()
Get id of the question typegetLabel()
Get label of question typegetModel()
Get the form question modelGet the scripts to importGet the form question viewboolean
isQuestionConfigured
(FormQuestion question) Say if question needs more configuration to be usedvoid
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) void
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.void
validateEntryValues
(FormQuestion question, Map<String, Object> values, Multimap<String, I18nizableText> errors, Optional<Long> currentStepId) Validate values to create a form entryvoid
validateQuestionValues
(Map<String, Object> values, Map<String, I18nizableText> errors) Validate values to create or edit the questionMethods 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.FormQuestionType
canBeAnsweredByUser, getDefaultTitle, getJSConverter, getJSRenderer, getStorageType, isCacheable, onlyForDisplay, valueToJSONForClient
-
Field Details
-
_i18nUtils
I18n Utils -
_id
Id of question type -
_label
Label of question type -
_description
Description of question type -
_iconGlyph
Icon glyph of question type -
_pluginName
Forms -
_scripts
Scripts associated with question type -
_xslt
Xslt associated of question type -
_formQuestionModel
The form question model -
_category
The type category in button menu -
_priority
The type priority in button menu
-
-
Constructor Details
-
AbstractStaticFormQuestionType
public AbstractStaticFormQuestionType()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getId
Description copied from interface:FormQuestionType
Get id of the question type- Specified by:
getId
in interfaceFormQuestionType
- Returns:
- the id
-
getLabel
Description copied from interface:FormQuestionType
Get label of question type- Specified by:
getLabel
in interfaceFormQuestionType
- Returns:
- the label
-
getDescription
Description copied from interface:FormQuestionType
Get description of question type- Specified by:
getDescription
in interfaceFormQuestionType
- Returns:
- the description
-
getDisplayOrder
Description copied from interface:FormQuestionType
Get display order of the question type- Specified by:
getDisplayOrder
in interfaceFormQuestionType
- Returns:
- the display order
-
getIconGlyph
Description copied from interface:FormQuestionType
Get icon of question type button- Specified by:
getIconGlyph
in interfaceFormQuestionType
- Returns:
- the icon-glyph name
-
getScripts
Description copied from interface:FormQuestionType
Get the scripts to import- Specified by:
getScripts
in interfaceFormQuestionType
- Returns:
- the list of scripts
-
getDisplayXSLT
Description copied from interface:FormQuestionType
Get the display XSLT file- Specified by:
getDisplayXSLT
in interfaceFormQuestionType
- Returns:
- the display XSLT file
-
getCategory
Description copied from interface:FormQuestionType
Get the category of question type- Specified by:
getCategory
in interfaceFormQuestionType
- Returns:
- the name of the category in questionTypeButtonMenu
-
getModel
Description copied from interface:FormQuestionType
Get the form question model- Specified by:
getModel
in interfaceFormQuestionType
- Returns:
- the form question model
-
getEntryModel
Description copied from interface:FormQuestionType
Get the form entry model for the question type- Specified by:
getEntryModel
in interfaceFormQuestionType
- Parameters:
question
- the question- Returns:
- the form entry model
-
_getModelItems
Get the list of ModelItems- Returns:
- a list of ModelItems
-
getView
Description copied from interface:FormQuestionType
Get the form question view- Specified by:
getView
in interfaceFormQuestionType
- Parameters:
form
- the form- Returns:
- a view of question model
-
_getTabs
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- Parameters:
form
- the form- Returns:
- the tabs
-
_createMainTab
Helper to create an empty tab to use as the main tab- Returns:
- an empty tab
-
_createAdvancedTab
Helper to create an empty tab to use as the advanced tab- Returns:
- an empty advanced tab
-
_getRulesTab
Get the view's common rules tab- Returns:
- the rules tab as SimpleViewItemGroup
-
_getEntryModelItem
Define the entry model items- Parameters:
question
- the question- Returns:
- the entry model item
-
isQuestionConfigured
Description copied from interface:FormQuestionType
Say if question needs more configuration to be used- Specified by:
isQuestionConfigured
in interfaceFormQuestionType
- Parameters:
question
- the current question- Returns:
- false if question needs more configuration, true by default
-
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
- Parameters:
contentHandler
- the content handlerquestion
- the question- Throws:
SAXException
- if a saxing error occurred
-
doAdditionalOperations
Description copied from interface:FormQuestionType
Do additional operations to create or edit the question- Specified by:
doAdditionalOperations
in interfaceFormQuestionType
- Parameters:
question
- the questionvalues
- the values
-
validateQuestionValues
Description copied from interface:FormQuestionType
Validate values to create or edit the question- Specified by:
validateQuestionValues
in interfaceFormQuestionType
- Parameters:
values
- the valueserrors
- the errors
-
validateEntryValues
public void validateEntryValues(FormQuestion question, Map<String, Object> values, Multimap<String, I18nizableText> errors, Optional<Long> currentStepId) Description copied from interface:FormQuestionType
Validate values to create a form entry- Specified by:
validateEntryValues
in interfaceFormQuestionType
- Parameters:
question
- the questionvalues
- the valueserrors
- the errorscurrentStepId
- the current step id of the entry. Can be empty if the form has no workflow
-
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
- 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
- Parameters:
question
- the form question- Returns:
- the list of field name
-