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 void
addLabel(String label, String language)
Adds a local label.void
addParameter(String name, String value)
Adds a local parameter.GenericFieldTemplate
copy()
boolean
equals(Object obj)
String
getDisplayerName()
Returns the name of the FieldDisplayer to display the described field.Field
getEmptyField()
Returns an empty Field built on this template.Field
getEmptyField(int occurrence)
String
getFieldName()
Returns the field name of the Field built on this template.Map<String,String>
getKeyValuePairs(String language)
String
getLabel()
Returns the default label of the described field.String
getLabel(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 localsint
getMaximumNumberOfOccurrences()
String
getParameter(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.String
getTemplateName()
String
getTypeName()
Returns the type name of the described field.int
hashCode()
boolean
isDisabled()
Returns true when the described field must be disabled.boolean
isHidden()
Returns true when the described field must be hidden.boolean
isMandatory()
Returns true when the described field must have a value.boolean
isReadOnly()
Returns true when the described field can't be updated.boolean
isRepeatable()
boolean
isSearchable()
boolean
isUsedAsFacet()
void
setDisabled(boolean isDisabled)
Set or unset the isDisabled flagvoid
setDisplayerName(String displayerName)
Set the name of the FieldDisplayer.void
setFieldName(String fieldName)
Set the field name of the Field built on this template.void
setHidden(boolean isHidden)
Set or unset the isHidden flagvoid
setLabel(String label)
Set the default label.void
setLabelsObj(List<Label> labelsObj)
Used by the XML mapping.void
setMandatory(boolean isMandatory)
Set or unset the isMandatory flagvoid
setMandatory(Boolean isMandatory)
Set or unset the isMandatory flagvoid
setMaximumNumberOfOccurrences(int nb)
void
setParametersObj(List<Parameter> parametersObj)
Used by the XML mapping.void
setReadOnly(boolean isReadOnly)
Set or unset the isReadOnly flagvoid
setSearchable(boolean searchable)
void
setTemplateName(String templateName)
void
setTypeName(String typeName)
set the type name of the described field.void
setUsedAsFacet(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:
getFieldName
in 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:
getTypeName
in 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:
getDisplayerName
in 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:
getLabel
in interfaceFieldTemplate
-
getLabel
public String getLabel(String language)
Returns the local label of the described field.- Specified by:
getLabel
in 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:
isMandatory
in 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:
isReadOnly
in 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:
isDisabled
in 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:
isHidden
in 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:FieldTemplate
Returns a Map (String -> String) of named parameters which can be used by the displayer (max-size, length ...).- Specified by:
getParameters
in interfaceFieldTemplate
-
getEmptyField
public Field getEmptyField() throws FormException
Returns an empty Field built on this template.- Specified by:
getEmptyField
in interfaceFieldTemplate
- Throws:
FormException
-
getEmptyField
public Field getEmptyField(int occurrence) throws FormException
- Specified by:
getEmptyField
in interfaceFieldTemplate
- Throws:
FormException
-
getLanguages
public String[] getLanguages()
Description copied from interface:FieldTemplate
Returns the locals- Specified by:
getLanguages
in interfaceFieldTemplate
-
getParametersObj
public List<Parameter> getParametersObj()
Used by the XML mapping.- Specified by:
getParametersObj
in interfaceFieldTemplate
-
setParametersObj
public void setParametersObj(List<Parameter> parametersObj)
Used by the XML mapping.
-
isSearchable
public boolean isSearchable()
- Specified by:
isSearchable
in interfaceFieldTemplate
-
setSearchable
public void setSearchable(boolean searchable)
-
getTemplateName
public String getTemplateName()
- Specified by:
getTemplateName
in interfaceFieldTemplate
-
setTemplateName
public void setTemplateName(String templateName)
-
isUsedAsFacet
public boolean isUsedAsFacet()
- Specified by:
isUsedAsFacet
in interfaceFieldTemplate
-
setUsedAsFacet
public void setUsedAsFacet(boolean usedAsFacet)
-
copy
public GenericFieldTemplate copy()
-
getMaximumNumberOfOccurrences
public int getMaximumNumberOfOccurrences()
- Specified by:
getMaximumNumberOfOccurrences
in interfaceFieldTemplate
-
setMaximumNumberOfOccurrences
public void setMaximumNumberOfOccurrences(int nb)
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatable
in interfaceFieldTemplate
-
-