Package com.smartgwt.client.types

# Enum FieldType

java.lang.Object
java.lang.Enum<FieldType>
com.smartgwt.client.types.FieldType

All Implemented Interfaces:
  `ValueEnum`, `Serializable`, `Comparable<FieldType>`, `Constable`

public enum FieldType extends Enum<FieldType> implements ValueEnum
The types listed below are built-in types that `databound\n components` understand and treat specially (using type-specific form controls, validators, formatters, sorting logic, etc).

You can declare custom types via `SimpleType.create()`, with settings that will influence DataBound components. You can also create your own subclasses of databound components to add further custom, reusable behaviors based on field.type.

`field.type` can also be the ID of another `DataSource`, which allows you to model nested structures such as XML documents (in fact, `XMLTools.loadXMLSchema()` models XML schema in this way). Nested DataSource declarations affect how XML and JSON data is deserialized into JavaScript objects in the `client-side integration` pipeline, so that you can load complex XML documents and have them deserialized into a correctly typed nested data structure.

Note: to declare related but separate objects, as in an "Account" object that can be related to both a "Contact" object and "Order" objects, use `DataSourceField.foreignKey`, not a nested structure declaration.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ANY`
  Fields of this type can contain any data value and have no default formatting or validation behavior.
  `BINARY`
  Arbitrary binary data.
  `BOOLEAN`
  A boolean value, e.g.
  `CREATOR`
  Fields of this type are automatically populated by the Smart GWT Server with the current authenticated userId as part of "add" operations.
  `CREATORTIMESTAMP`
  Fields of this type are automatically populated by the Smart GWT Server with the current date and time as part of an "add" operation (when the record is first created).
  `CUSTOM`
  Synonymous with "any".
  `DATE`
  A logical date, with no time value (such as a holiday or birthday).
  `DATETIME`
  A date and time, accurate to the `second`.
  `ENUM`
  A text value constrained to a set of legal values specified by the field's `valueMap`, as though a `ValidatorType` of "isOneOf" had been declared.
  `FLOAT`
  A floating point (decimal) number, e.g.
  `IMAGE`
  A string representing a well-formed URL that points to an image.
  `IMAGEFILE`
  Binary data comprising an image.
  `INTEGER`
  A whole number, e.g.
  `INTENUM`
  An enum whose values are numeric.
  `LINK`
  A string representing a well-formed URL.
  `LOCALECURRENCY`
  A float number with locale-based formatting and using currency symbol, e.g.
  `LOCALEFLOAT`
  A float number with locale-based formatting, e.g.
  `LOCALEINT`
  An integer number with locale-based formatting, e.g.
  `MODIFIER`
  Fields of this type are automatically populated by the Smart GWT Server with the current authenticated userId as part of "add" and "update" operations.
  `MODIFIERTIMESTAMP`
  Fields of this type are automatically populated by the Smart GWT Server with the current date and time as part of "add" and "update" operations.
  `NTEXT`
  A special field type specifically for use with Unicode data in conjunction with the Microsoft SQL Server database.
  `PASSWORD`
  Same as "text", but causes `PasswordItem` to be used by default for editing (hides typed-in value), and defaults `storeWithhash` to "bcrypt" (affecting server operations).
  `PHONENUMBER`
  A telephone number.
  `SEQUENCE`
  If you are using the Smart GWT SQL datasource connector, a `sequence` is a unique, increasing whole number, incremented whenever a new record is added.
  `TEXT`
  Generic text, e.g.
  `TIME`
  A time of day, with no date.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue()`
  `static FieldType`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static FieldType[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### TEXT

    public static final FieldType TEXT
    Generic text, e.g. `"John Doe"`. This is the default field type. Use `field.length` to set length.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "text".

  - ### BOOLEAN

    public static final FieldType BOOLEAN
    A boolean value, e.g. `true`

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "boolean".

  - ### INTEGER

    public static final FieldType INTEGER
    A whole number, e.g. `123`

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "integer".

  - ### FLOAT

    public static final FieldType FLOAT
    A floating point (decimal) number, e.g. `1.23`

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "float".

  - ### DATE

    public static final FieldType DATE
    A logical date, with no time value (such as a holiday or birthday). Represented on the client as a JavaScript `Date` object where time values are ignored. See `DateFormatAndStorage` for more information on date display and serialization formats.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "date".

  - ### TIME

    public static final FieldType TIME
    A time of day, with no date. Represented on the client as a JavaScript `Date` object in UTC/GMT by default (see also `DateFormatAndStorage` and the String class).

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "time".

  - ### DATETIME

    public static final FieldType DATETIME
    A date and time, accurate to the `second`. Represented on the client as a JavaScript `Date` object. See also `DateFormatAndStorage`.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "datetime".

  - ### ENUM

    public static final FieldType ENUM
    A text value constrained to a set of legal values specified by the field's `valueMap`, as though a `ValidatorType` of "isOneOf" had been declared.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "enum".

  - ### INTENUM

    public static final FieldType INTENUM
    An enum whose values are numeric.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "intEnum".

  - ### SEQUENCE

    public static final FieldType SEQUENCE
    If you are using the Smart GWT SQL datasource connector, a `sequence` is a unique, increasing whole number, incremented whenever a new record is added. Otherwise, `sequence` behaves identically to `integer`. This type is typically used with `field.primaryKey` to auto-generate unique primary keys. See also `DataSourceField.sequenceName` and `DataSource.sequenceMode`

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "sequence".

  - ### LINK

    public static final FieldType LINK
    A string representing a well-formed URL. Some components will render this as an HTML link (using an anchor tag for example).

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "link".

  - ### IMAGE

    public static final FieldType IMAGE
    A string representing a well-formed URL that points to an image. Some components will render an IMG tag with the value of this field as the 'src' attribute to render the image.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "image".

  - ### BINARY

    public static final FieldType BINARY
    Arbitrary binary data. When this field type is present, three additional fields are automatically generated. They are: <fieldName>_filename, <fieldName>_filesize, and <fieldName>_date_created where <fieldName> is the value of the `name` attribute of this field. These fields are marked as `DataSourceField.hidden``:true` to suppress their rendering by default. You can show one or more of these fields by specifying the field with a `hidden:false` override in the fields array of the databound component. Stream / view file support for custom DataSources: a custom DataSource or DMI must implement the "viewFile" and "downloadFile" operationTypes and return a single Record with a byte[] as the field value for the binary field. For more detail see the overview of `Binary Fields`.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "binary".

  - ### IMAGEFILE

    public static final FieldType IMAGEFILE
    Binary data comprising an image. Causes `ViewFileItem` to be used when the field is displayed in a form, allowing the image to optionally be displayed inline.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "imageFile".

  - ### ANY

    public static final FieldType ANY
    Fields of this type can contain any data value and have no default formatting or validation behavior. This is useful as the `parent type` for SimpleTypes where you do not want any of the standard validation or formatting logic to be inherited from the standard built-in types.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "any".

  - ### CUSTOM

    public static final FieldType CUSTOM
    Synonymous with "any".

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "custom".

  - ### MODIFIER

    public static final FieldType MODIFIER
    Fields of this type are automatically populated by the Smart GWT Server with the current authenticated userId as part of "add" and "update" operations. By default, fields of this type are hidden and not editable; the server ignores any value that the client sends in a field of this type (but see also `writeToGeneratedFields`). Note that the "authenticated user" can be set explicitly on the server-side `RPCManager` using the `setUserId()` method, or it can come from the servlet API if you are using its built-in authentication scheme. See the server-side Javadocs for `RPCManager`.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "modifier".

  - ### MODIFIERTIMESTAMP

    public static final FieldType MODIFIERTIMESTAMP
    Fields of this type are automatically populated by the Smart GWT Server with the current date and time as part of "add" and "update" operations. By default, fields of this type are hidden and not editable; the server ignores any value that the client sends in a field of this type (but see also `writeToGeneratedFields`).

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "modifierTimestamp".

  - ### CREATOR

    public static final FieldType CREATOR
    Fields of this type are automatically populated by the Smart GWT Server with the current authenticated userId as part of "add" operations. By default, fields of this type are hidden and not editable; the server ignores any value that the client sends in a field of this type. (but see also `writeToGeneratedFields`). The notes about type "modifier" also apply to fields of this type.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "creator".

  - ### CREATORTIMESTAMP

    public static final FieldType CREATORTIMESTAMP
    Fields of this type are automatically populated by the Smart GWT Server with the current date and time as part of an "add" operation (when the record is first created). By default, fields of this type are hidden and not editable; the server ignores any value that the client sends in a field of this type (but see also `writeToGeneratedFields`).

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "creatorTimestamp".

  - ### PASSWORD

    public static final FieldType PASSWORD
    Same as "text", but causes `PasswordItem` to be used by default for editing (hides typed-in value), and defaults `storeWithhash` to "bcrypt" (affecting server operations).

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "password".

  - ### NTEXT

    public static final FieldType NTEXT
    A special field type specifically for use with Unicode data in conjunction with the Microsoft SQL Server database. Field type "ntext" implies the use of `sqlStorageStrategy` "ntext"; other than that, this type is identical to "text"

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "ntext".

  - ### LOCALEINT

    public static final FieldType LOCALEINT
    An integer number with locale-based formatting, e.g. `12,345,678`. See `Localized Number Formatting` for more info.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "localeInt".

  - ### LOCALEFLOAT

    public static final FieldType LOCALEFLOAT
    A float number with locale-based formatting, e.g. `12,345.67`. See `Localized Number Formatting` for more info.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "localeFloat".

  - ### LOCALECURRENCY

    public static final FieldType LOCALECURRENCY
    A float number with locale-based formatting and using currency symbol, e.g. `$12,345.67`. See `Localized Number Formatting` for more info.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "localeCurrency".

  - ### PHONENUMBER

    public static final FieldType PHONENUMBER
    A telephone number. Uses `FormItem.browserInputType` "tel" to hint to the device to restrict input. On most mobile devices that have software keyboards, this cause a specialized keyboard to appear which only allows entry of normal phone numbers. When displayed read-only, a "phoneNumber" renders as an HTML link with the "tel:" URL scheme, which will invoke the native phone dialing interface on most mobile devices. In addition, the CSS style "sc_phoneNumber" is applied.

    By default, "phoneNumber" fields do not include validators, however the following validator definition would limit to digits, dashes and the "+" character: xml:

    <validator type="regexp" expression="^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$" errorMessage="Phone number should be in the correct format e.g. +#(###)###-##-##" />

    or directly in Java:

          RegExpValidator v = new RegExpValidator();
          v.setType(ValidatorType.REGEXP);
          v.setErrorMessage("Phone number should be in the correct format e.g. +#(###)###-##-##");
          v.setExpression("^(\\(?\\+?[0-9]*\\)?)?[0-9_\\- \\(\\)]*$");

    and adding "#" and "*" to the regular expressions above would allow for users to enter special keys sometimes used for extension numbers or pauses

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "phoneNumber".

- ## Method Details

  - ### values

    public static FieldType[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static FieldType valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### getValue

    public String getValue()
    Specified by:
      `getValue` in interface `ValueEnum`