info.informatica.ui.html.tag
Class FormData

java.lang.Object
  extended by info.informatica.doc.DocumentFragment
      extended by info.informatica.html.tag.HTMLTag
          extended by info.informatica.ui.html.tag.FormData
All Implemented Interfaces:
info.informatica.doc.DocumentElement, info.informatica.html.tag.AttributeListener, DataControl, DataValue, Comparable<info.informatica.doc.DocumentFragment>
Direct Known Subclasses:
FormField, MetaField

public abstract class FormData
extends info.informatica.html.tag.HTMLTag
implements DataControl

Base class for all form data fields.

Author:
amengual at informatica dot info

Nested Class Summary
 
Nested classes/interfaces inherited from class info.informatica.doc.DocumentFragment
info.informatica.doc.DocumentFragment.FragmentComp, info.informatica.doc.DocumentFragment.NotFragmentComp
 
Method Summary
static info.informatica.html.tag.HTMLTag createField(info.informatica.html.tag.HTMLTag t)
          Creates a FormData instance of a form HTMLTag.
static FormData createField(String clase, String id, ControlName nameattr, info.informatica.doc.FragmentPosition pos)
           
 info.informatica.html.tag.Attributes getAttributes()
          Returns the tag attributes.
 ControlName getControlName()
          Gets the Control name (the name attribute of this tag).
 FieldName getFieldname()
          Returns the name of the database field associated to this entity.
 Integer getFieldSize()
           
 Object getFormat()
          Gets the format that applies to this UI element.
 String[] getStringValues()
          Devuelve lo introducido por el usuario.
 Object getValue()
          Gets the Object value of the field.
 DataField guessDataField()
          Try to guess the DataType from the default value, and return a temptative DataField representing this field.
 void init(DataField de)
          Inicializa el valor del campo
 void mapDataToUI(DataField de, Dataset ds, Map<String,Object> m)
           
static String mapInputField(String fieldtype)
          Maps input field types to FormField classes.
 void setFieldname(FieldName name)
          Sets the name of the data field associated to this UI field.
 void setFormat(Object fmt)
          Sets the formatting object for this UI element.
 void setValue(Object o)
          Sets the value of the field.
 void setValue(String s)
           
 void setValue(String[] sa)
           
 String toString(info.informatica.html.CharData cdata)
           
 String toString(String innerstring)
           
 
Methods inherited from class info.informatica.html.tag.HTMLTag
align, endTag, getAlignment, getBlockPosition, getId, getName, getParent, getStyle, getStyleClass, getTagData, isSelfClosing, length, onAttributeRemoved, onAttributes, onAttributeStringSet, onDummyAttributes, setAttributes, setId, setParent, setSelfClosing, setSelfClosing, setTagData, setTagData, startTag, toString, toString, toXml, vAlign
 
Methods inherited from class info.informatica.doc.DocumentFragment
adjustWidth, compareTo, getCurrentPosition, getPosition, setPosition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getFieldname

public FieldName getFieldname()
Description copied from interface: DataControl
Returns the name of the database field associated to this entity.

Specified by:
getFieldname in interface DataControl

setFieldname

public void setFieldname(FieldName name)
Description copied from interface: DataControl
Sets the name of the data field associated to this UI field.

Specified by:
setFieldname in interface DataControl

getAttributes

public info.informatica.html.tag.Attributes getAttributes()
Returns the tag attributes.

Overrides:
getAttributes in class info.informatica.html.tag.HTMLTag
Returns:
the attributes

getValue

public Object getValue()
Description copied from interface: DataValue
Gets the Object value of the field.

Specified by:
getValue in interface DataValue
Returns:
the Object value of the field.

getStringValues

public String[] getStringValues()
Devuelve lo introducido por el usuario.

Returns:
array of objects entered by user

setValue

public void setValue(String s)
              throws DataFieldException
Throws:
DataFieldException

setValue

public void setValue(String[] sa)
              throws DataFieldException
Throws:
DataFieldException

setValue

public void setValue(Object o)
              throws DataFieldException
Description copied from interface: DataValue
Sets the value of the field.

Must NOT perform any data validation (only UI-level validation).

Specified by:
setValue in interface DataValue
Parameters:
o - the value to be given to field.
Throws:
DataFieldException

init

public void init(DataField de)
          throws DataFieldException
Inicializa el valor del campo

Specified by:
init in interface DataControl
Throws:
DataFieldException

mapDataToUI

public void mapDataToUI(DataField de,
                        Dataset ds,
                        Map<String,Object> m)
                 throws DatasetException
Specified by:
mapDataToUI in interface DataControl
Throws:
DatasetException

toString

public String toString(info.informatica.html.CharData cdata)

toString

public String toString(String innerstring)
Overrides:
toString in class info.informatica.html.tag.HTMLTag

getControlName

public ControlName getControlName()
Gets the Control name (the name attribute of this tag).

Specified by:
getControlName in interface DataControl
Returns:
tag name attribute, or the ID if could not find it, otherwise returns null.

setFormat

public void setFormat(Object fmt)
Description copied from interface: DataControl
Sets the formatting object for this UI element.

It is allowed to thow an UnsupportedOperationException if the UI Control does not support formatting.

Specified by:
setFormat in interface DataControl
Parameters:
fmt - the Formatting object

getFormat

public Object getFormat()
Description copied from interface: DataControl
Gets the format that applies to this UI element.

Specified by:
getFormat in interface DataControl
Returns:
a formatting object for this element, or null if it has no format, or this object does not support formatting.

guessDataField

public DataField guessDataField()
Try to guess the DataType from the default value, and return a temptative DataField representing this field.

Returns:
a guessed DataField for this form field.

getFieldSize

public Integer getFieldSize()

createField

public static final info.informatica.html.tag.HTMLTag createField(info.informatica.html.tag.HTMLTag t)
                                                           throws DataViewException
Creates a FormData instance of a form HTMLTag.

Parameters:
t - the tag that may be of a form field type.
Returns:
an instance of FormData representing the tag, or null if the tag was not recognized as a form data tag.
Throws:
DataViewException

createField

public static final FormData createField(String clase,
                                         String id,
                                         ControlName nameattr,
                                         info.informatica.doc.FragmentPosition pos)
                                  throws DataViewException
Throws:
DataViewException

mapInputField

public static String mapInputField(String fieldtype)
Maps input field types to FormField classes.

Parameters:
fieldtype - type of field.
Returns:
a String with the name of the UI class associated to fieldtype, or null if no correspondence was found.