com.silverpeas.form.record
Class GenericFieldTemplate

java.lang.Object
  extended by com.silverpeas.form.record.GenericFieldTemplate
All Implemented Interfaces:
FieldTemplate, Serializable, Cloneable

public class GenericFieldTemplate
extends Object
implements FieldTemplate, Serializable, Cloneable

A generic FieldTemplate implementation.

See Also:
Serialized Form

Constructor Summary
GenericFieldTemplate()
          Builds a GenericFieldTemplate
GenericFieldTemplate(String fieldName, Class 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
 void addLabel(String label, String language)
          Adds a local label.
 void addParameter(String name, String value)
          Adds a local parameter.
 GenericFieldTemplate clone()
           
 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 castor xml mapping.
 String[] getLanguages()
          Returns the locals
 int 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 castor 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 flag
 void 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 flag
 void setLabel(String label)
          Set the default label.
 void setLabelsObj(List<Label> labelsObj)
          Used by the castor xml mapping.
 void setMandatory(boolean isMandatory)
          Set or unset the isMandatory flag
 void setMandatory(Boolean isMandatory)
          Set or unset the isMandatory flag
 void setMaximumNumberOfOccurrences(int nb)
           
 void setParametersObj(List<Parameter> parametersObj)
          Used by the castor xml mapping.
 void setReadOnly(boolean isReadOnly)
          Set or unset the isReadOnly flag
 void setSearchable(boolean searchable)
           
 void setTemplateName(String templateName)
           
 void setTypeName(String typeName)
          set the type name of the described field.
 void setUsedAsFacet(boolean usedAsFacet)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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 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 interface FieldTemplate

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 interface FieldTemplate

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 interface FieldTemplate

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 interface FieldTemplate

getLabel

public String getLabel(String language)
Returns the local label of the described field.

Specified by:
getLabel in interface FieldTemplate

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.


addLabel

public void addLabel(String label,
                     String language)
Adds a local label.


addParameter

public void addParameter(String name,
                         String value)
Adds a local parameter.


isMandatory

public boolean isMandatory()
Returns true when the described field must have a value.

Specified by:
isMandatory in interface FieldTemplate

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 interface FieldTemplate

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 interface FieldTemplate

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 interface FieldTemplate

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 interface FieldTemplate

getKeyValuePairs

public Map<String,String> getKeyValuePairs(String language)

getLabels

public Map<String,String> getLabels()

getEmptyField

public Field getEmptyField()
                    throws FormException
Returns an empty Field built on this template.

Specified by:
getEmptyField in interface FieldTemplate
Throws:
FormException

getEmptyField

public Field getEmptyField(int occurrence)
                    throws FormException
Specified by:
getEmptyField in interface FieldTemplate
Throws:
FormException

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getLanguages

public String[] getLanguages()
Description copied from interface: FieldTemplate
Returns the locals

Specified by:
getLanguages in interface FieldTemplate

getLabelsObj

public List<Label> getLabelsObj()
Used by the castor xml mapping.


setLabelsObj

public void setLabelsObj(List<Label> labelsObj)
Used by the castor xml mapping.


getParametersObj

public List<Parameter> getParametersObj()
Used by the castor xml mapping.

Specified by:
getParametersObj in interface FieldTemplate

setParametersObj

public void setParametersObj(List<Parameter> parametersObj)
Used by the castor xml mapping.


isSearchable

public boolean isSearchable()
Specified by:
isSearchable in interface FieldTemplate

setSearchable

public void setSearchable(boolean searchable)

getTemplateName

public String getTemplateName()
Specified by:
getTemplateName in interface FieldTemplate

setTemplateName

public void setTemplateName(String templateName)

isUsedAsFacet

public boolean isUsedAsFacet()
Specified by:
isUsedAsFacet in interface FieldTemplate

setUsedAsFacet

public void setUsedAsFacet(boolean usedAsFacet)

clone

public GenericFieldTemplate clone()
Overrides:
clone in class Object

getMaximumNumberOfOccurrences

public int getMaximumNumberOfOccurrences()
Specified by:
getMaximumNumberOfOccurrences in interface FieldTemplate

setMaximumNumberOfOccurrences

public void setMaximumNumberOfOccurrences(int nb)

isRepeatable

public boolean isRepeatable()
Specified by:
isRepeatable in interface FieldTemplate


Copyright © 2016 Silverpeas. All Rights Reserved.