Class GenericFieldTemplate
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.record.GenericFieldTemplate
-
- All Implemented Interfaces:
Serializable,FieldTemplate
public class GenericFieldTemplate extends Object implements FieldTemplate
A generic FieldTemplate implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericFieldTemplate()Builds a GenericFieldTemplateGenericFieldTemplate(String fieldName, Class<? extends Field> fieldImpl)Builds a GenericFieldTemplate from a field name and a field implementation.GenericFieldTemplate(String fieldName, String typeName)Builds a GenericFieldTemplate from a field name and a field type name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLabel(String label, String language)Adds a local label.voidaddParameter(String name, String value)Adds a local parameter.GenericFieldTemplatecopy()booleanequals(Object obj)StringgetDisplayerName()Returns the name of the FieldDisplayer to display the described field.FieldgetEmptyField()Returns an empty Field built on this template.FieldgetEmptyField(int occurrence)StringgetFieldName()Returns the field name of the Field built on this template.Map<String,String>getKeyValuePairs(String language)StringgetLabel()Returns the default label of the described field.StringgetLabel(String language)Returns the local label of the described field.Map<String,String>getLabels()List<Label>getLabelsObj()Used by the XML mapping.String[]getLanguages()Returns the localsintgetMaximumNumberOfOccurrences()StringgetParameter(String name, String language)Returns a local parameter of the described field.Map<String,String>getParameters(String language)Returns a Map (String -> String) of named parameters which can be used by the displayer (max-size, length ...).List<Parameter>getParametersObj()Used by the XML mapping.StringgetTemplateName()StringgetTypeName()Returns the type name of the described field.inthashCode()booleanisDisabled()Returns true when the described field must be disabled.booleanisHidden()Returns true when the described field must be hidden.booleanisMandatory()Returns true when the described field must have a value.booleanisReadOnly()Returns true when the described field can't be updated.booleanisRepeatable()booleanisSearchable()booleanisUsedAsFacet()voidsetDisabled(boolean isDisabled)Set or unset the isDisabled flagvoidsetDisplayerName(String displayerName)Set the name of the FieldDisplayer.voidsetFieldName(String fieldName)Set the field name of the Field built on this template.voidsetHidden(boolean isHidden)Set or unset the isHidden flagvoidsetLabel(String label)Set the default label.voidsetLabelsObj(List<Label> labelsObj)Used by the XML mapping.voidsetMandatory(boolean isMandatory)Set or unset the isMandatory flagvoidsetMandatory(Boolean isMandatory)Set or unset the isMandatory flagvoidsetMaximumNumberOfOccurrences(int nb)voidsetParametersObj(List<Parameter> parametersObj)Used by the XML mapping.voidsetReadOnly(boolean isReadOnly)Set or unset the isReadOnly flagvoidsetSearchable(boolean searchable)voidsetTemplateName(String templateName)voidsetTypeName(String typeName)set the type name of the described field.voidsetUsedAsFacet(boolean usedAsFacet)
-
-
-
Constructor Detail
-
GenericFieldTemplate
public GenericFieldTemplate()
Builds a GenericFieldTemplate
-
GenericFieldTemplate
public GenericFieldTemplate(String fieldName, String typeName) throws FormException
Builds a GenericFieldTemplate from a field name and a field type name. The type name must be known by the type manager. You must use the set and add methods to change any default value.- Throws:
FormException
-
GenericFieldTemplate
public GenericFieldTemplate(String fieldName, Class<? extends Field> fieldImpl) throws FormException
Builds a GenericFieldTemplate from a field name and a field implementation. You must use the set and add methods to change any default value.- Throws:
FormException
-
-
Method Detail
-
getFieldName
public String getFieldName()
Returns the field name of the Field built on this template.- Specified by:
getFieldNamein interfaceFieldTemplate
-
setFieldName
public void setFieldName(String fieldName)
Set the field name of the Field built on this template.
-
getTypeName
public String getTypeName()
Returns the type name of the described field.- Specified by:
getTypeNamein interfaceFieldTemplate
-
setTypeName
public void setTypeName(String typeName) throws FormException
set the type name of the described field.- Throws:
FormException
-
getDisplayerName
public String getDisplayerName()
Returns the name of the FieldDisplayer to display the described field.- Specified by:
getDisplayerNamein interfaceFieldTemplate
-
setDisplayerName
public void setDisplayerName(String displayerName)
Set the name of the FieldDisplayer.
-
getLabel
public String getLabel()
Returns the default label of the described field.- Specified by:
getLabelin interfaceFieldTemplate
-
getLabel
public String getLabel(String language)
Returns the local label of the described field.- Specified by:
getLabelin interfaceFieldTemplate
-
getParameter
public String getParameter(String name, String language)
Returns a local parameter of the described field.
-
setLabel
public void setLabel(String label)
Set the default label.
-
isMandatory
public boolean isMandatory()
Returns true when the described field must have a value.- Specified by:
isMandatoryin interfaceFieldTemplate
-
setMandatory
public void setMandatory(boolean isMandatory)
Set or unset the isMandatory flag
-
setMandatory
public void setMandatory(Boolean isMandatory)
Set or unset the isMandatory flag
-
isReadOnly
public boolean isReadOnly()
Returns true when the described field can't be updated.- Specified by:
isReadOnlyin interfaceFieldTemplate
-
setReadOnly
public void setReadOnly(boolean isReadOnly)
Set or unset the isReadOnly flag
-
isDisabled
public boolean isDisabled()
Returns true when the described field must be disabled.- Specified by:
isDisabledin interfaceFieldTemplate
-
setDisabled
public void setDisabled(boolean isDisabled)
Set or unset the isDisabled flag
-
isHidden
public boolean isHidden()
Returns true when the described field must be hidden.- Specified by:
isHiddenin interfaceFieldTemplate
-
setHidden
public void setHidden(boolean isHidden)
Set or unset the isHidden flag
-
getParameters
public Map<String,String> getParameters(String language)
Description copied from interface:FieldTemplateReturns a Map (String -> String) of named parameters which can be used by the displayer (max-size, length ...).- Specified by:
getParametersin interfaceFieldTemplate
-
getEmptyField
public Field getEmptyField() throws FormException
Returns an empty Field built on this template.- Specified by:
getEmptyFieldin interfaceFieldTemplate- Throws:
FormException
-
getEmptyField
public Field getEmptyField(int occurrence) throws FormException
- Specified by:
getEmptyFieldin interfaceFieldTemplate- Throws:
FormException
-
getLanguages
public String[] getLanguages()
Description copied from interface:FieldTemplateReturns the locals- Specified by:
getLanguagesin interfaceFieldTemplate
-
getParametersObj
public List<Parameter> getParametersObj()
Used by the XML mapping.- Specified by:
getParametersObjin interfaceFieldTemplate
-
setParametersObj
public void setParametersObj(List<Parameter> parametersObj)
Used by the XML mapping.
-
isSearchable
public boolean isSearchable()
- Specified by:
isSearchablein interfaceFieldTemplate
-
setSearchable
public void setSearchable(boolean searchable)
-
getTemplateName
public String getTemplateName()
- Specified by:
getTemplateNamein interfaceFieldTemplate
-
setTemplateName
public void setTemplateName(String templateName)
-
isUsedAsFacet
public boolean isUsedAsFacet()
- Specified by:
isUsedAsFacetin interfaceFieldTemplate
-
setUsedAsFacet
public void setUsedAsFacet(boolean usedAsFacet)
-
copy
public GenericFieldTemplate copy()
-
getMaximumNumberOfOccurrences
public int getMaximumNumberOfOccurrences()
- Specified by:
getMaximumNumberOfOccurrencesin interfaceFieldTemplate
-
setMaximumNumberOfOccurrences
public void setMaximumNumberOfOccurrences(int nb)
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatablein interfaceFieldTemplate
-
-