sky.engine.field
Class BaseField

java.lang.Object
  extended bysky.engine.field.BaseField
All Implemented Interfaces:
Field
Direct Known Subclasses:
CharField, EmailField, IntField, RangeField, SessionField, UrlField

public abstract class BaseField
extends java.lang.Object
implements Field


Field Summary
protected  java.util.ArrayList _aliases
          Aliases (or database columns) that this field maps to.
protected  java.lang.String _default
          Default value of the field.
protected  boolean _defaulted
          Flag indicating whether this field has defaulted to using the default value instead of a user-specified value.
protected  int _maxlen
          Maximum length of the data value that this field can have.
protected  int _minlen
          Minimum length of a data value that this field can have.
protected  java.lang.String _name
          Field name
protected  boolean _required
          If true then the user must specify a value for this field.
protected  java.util.ArrayList _values
          Values of this field.
protected  int _vislen
          Visible length of this field (used to generate the HTML code for input field).
static FormattedResourceBundle STRINGS
          String resources.
 
Constructor Summary
BaseField()
           
 
Method Summary
 void addAlias(java.lang.String alias)
          Add an alias for this field.
 void clear()
          Remove all alaises of this field.
 void destory()
          Destory this field object.
 java.util.ArrayList getAliases()
          Get all the aliases associated with this field.
 java.util.ArrayList getData()
          Get all the values of this field.
 int getDataSize()
          Number of values in this field.
 java.lang.String getHTMLData(int nPos)
          Get a specific field value formatted according to HTML syntax.
 java.lang.String getName()
          Get name of this field.
 boolean getRequired()
          Is a value for this field required or not.
 java.lang.String getSQLData(int nPos)
          Get a specific field value formatted according to sql syntax.
 java.lang.String getStringData(int nPos)
          Get a specific field value formatted as a simple string.
 boolean hasAliases()
          Find out if field has any aliases.
protected  boolean hasValue(java.lang.String value)
          Does the given string represent a value for this field.
 void removeAliases()
          Remove all the aliases that the field has.
 void removeValues()
          Remove all values from this field.
 java.lang.String toHTML()
          Generate HTML code fragment that generates the HTML input field associated with this field.
 java.lang.String toString()
          Covert this field into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sky.engine.field.Field
addValue, checkValue
 

Field Detail

_name

protected java.lang.String _name
Field name


_aliases

protected java.util.ArrayList _aliases
Aliases (or database columns) that this field maps to.


_values

protected java.util.ArrayList _values
Values of this field.


_required

protected boolean _required
If true then the user must specify a value for this field.


_vislen

protected int _vislen
Visible length of this field (used to generate the HTML code for input field).


_minlen

protected int _minlen
Minimum length of a data value that this field can have.


_maxlen

protected int _maxlen
Maximum length of the data value that this field can have.


_default

protected java.lang.String _default
Default value of the field.


_defaulted

protected boolean _defaulted
Flag indicating whether this field has defaulted to using the default value instead of a user-specified value.


STRINGS

public static final FormattedResourceBundle STRINGS
String resources.

Constructor Detail

BaseField

public BaseField()
Method Detail

getName

public java.lang.String getName()
Get name of this field.

Specified by:
getName in interface Field
Returns:
field name.

getRequired

public boolean getRequired()
Is a value for this field required or not.

Specified by:
getRequired in interface Field
Returns:
true if field value is required; otherwise, false.

addAlias

public void addAlias(java.lang.String alias)
Add an alias for this field.

Specified by:
addAlias in interface Field

getAliases

public java.util.ArrayList getAliases()
Get all the aliases associated with this field.

Specified by:
getAliases in interface Field
Returns:
list of aliases.

removeAliases

public void removeAliases()
Remove all the aliases that the field has.

Specified by:
removeAliases in interface Field

hasAliases

public boolean hasAliases()
Find out if field has any aliases.

Specified by:
hasAliases in interface Field
Returns:
true if mapping exists; otherwise, false.

getData

public java.util.ArrayList getData()
Get all the values of this field.

Returns:
field values.

getSQLData

public java.lang.String getSQLData(int nPos)
Get a specific field value formatted according to sql syntax.

Specified by:
getSQLData in interface Field
Parameters:
nPos - position of the value
Returns:
sql representation of the field value.

getHTMLData

public java.lang.String getHTMLData(int nPos)
Get a specific field value formatted according to HTML syntax.

Specified by:
getHTMLData in interface Field
Parameters:
nPos - position of the value.
Returns:
HTML representation of the field value.

getStringData

public java.lang.String getStringData(int nPos)
Get a specific field value formatted as a simple string.

Specified by:
getStringData in interface Field
Parameters:
nPos - position of the value.
Returns:
string representation of the field value.

getDataSize

public int getDataSize()
Number of values in this field.

Specified by:
getDataSize in interface Field
Returns:
value count

removeValues

public void removeValues()
Remove all values from this field.

Specified by:
removeValues in interface Field

toString

public java.lang.String toString()
Covert this field into a string.

Specified by:
toString in interface Field
Returns:
string representation of this field.

toHTML

public java.lang.String toHTML()
Generate HTML code fragment that generates the HTML input field associated with this field.

Specified by:
toHTML in interface Field
Returns:
HTML code fragment for generating HTML input field.

clear

public void clear()
Remove all alaises of this field.

Specified by:
clear in interface Field

hasValue

protected boolean hasValue(java.lang.String value)
Does the given string represent a value for this field.

Returns:
true, if given string represents a value; otherwise, false.

destory

public void destory()
Destory this field object.

Specified by:
destory in interface Field