com.smartgwt.client.data
Class SimpleType

java.lang.Object
  extended by com.smartgwt.client.core.BaseClass
      extended by com.smartgwt.client.data.SimpleType

public class SimpleType
extends BaseClass

An atomic type such as a string or number, that is generally stored, displayed and manipulated as a single value.

SimpleTypes can be created at any time, and subsequently referred to as a type in DataSource and DataBoundComponent. This allows you to define validators, com.smartgwt.client.data.SimpleType#normalDisplayFormatter and editorType behaviors for a type to be reused across all DataBoundComponent.

Note that the term "simpleType" is used in the same sense as in http://www.w3.org/TR/xmlschema-0/, and XMLTools.loadXMLSchema(java.lang.String, com.smartgwt.client.data.XSDLoadCallback) will create new SimpleType definitions.

An ${isc.DocUtils.linkForExampleId('customSimpleType', 'example')} is here.


Field Summary
 
Fields inherited from class com.smartgwt.client.core.BaseClass
config, id
 
Constructor Summary
SimpleType()
           
SimpleType(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 com.google.gwt.core.client.JavaScriptObject create()
           
 java.lang.String getInheritsFrom()
          Name of another SimpleType from which this type should inherit.
 java.lang.String getName()
          Name of the type, used to refer to the type from name.
static SimpleType getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
           
static SimpleType getType(java.lang.String typeName)
          Retrieve a simpleType definition by type name
 void setEditorType(FormItem editorType)
          Classname of the FormItem that should be the default for editing values of this type (eg "SelectItem").
 void setInheritsFrom(java.lang.String inheritsFrom)
          Name of another SimpleType from which this type should inherit.
 void setName(java.lang.String name)
          Name of the type, used to refer to the type from name.
 void setValidators(Validator... validators)
          Validators to apply to value of this type.
 void setValidOperators(OperatorId... operators)
          Set of search operators valid for this type.
 void setValueMap(java.util.Map valueMap)
          List of legal values for this type, like valueMap.
 void setValueMap(java.lang.String... valueMap)
          List of legal values for this type, like valueMap.
 
Methods inherited from class com.smartgwt.client.core.BaseClass
destroy, doAddHandler, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsString, getConfig, getHandlerCount, getID, getJsObj, getOrCreateJsObj, getRef, isCreated, onInit, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setID, setProperty, setProperty, setProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleType

public SimpleType()

SimpleType

public SimpleType(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static SimpleType getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

create

public com.google.gwt.core.client.JavaScriptObject create()
Specified by:
create in class BaseClass

setName

public void setName(java.lang.String name)
             throws java.lang.IllegalStateException
Name of the type, used to refer to the type from name.

Parameters:
name - name Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getName

public java.lang.String getName()
Name of the type, used to refer to the type from name.

Returns:
String

setInheritsFrom

public void setInheritsFrom(java.lang.String inheritsFrom)
                     throws java.lang.IllegalStateException
Name of another SimpleType from which this type should inherit.

Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.

Parameters:
inheritsFrom - inheritsFrom Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getInheritsFrom

public java.lang.String getInheritsFrom()
Name of another SimpleType from which this type should inherit.

Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.

Returns:
String

getType

public static SimpleType getType(java.lang.String typeName)
Retrieve a simpleType definition by type name

Parameters:
typeName - the name of the simpleType to return
Returns:
ssimple type object

setValidators

public void setValidators(Validator... validators)
                   throws java.lang.IllegalStateException
Validators to apply to value of this type.

Parameters:
validators - validators Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

setValueMap

public void setValueMap(java.lang.String... valueMap)
                 throws java.lang.IllegalStateException
List of legal values for this type, like valueMap.

Parameters:
valueMap - valueMap Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

setValueMap

public void setValueMap(java.util.Map valueMap)
                 throws java.lang.IllegalStateException
List of legal values for this type, like valueMap.

Parameters:
valueMap - valueMap Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

setEditorType

public void setEditorType(FormItem editorType)
                   throws java.lang.IllegalStateException
Classname of the FormItem that should be the default for editing values of this type (eg "SelectItem").

You can create a simple custom FormItem by adding default icons that launch custom value picking dialogs (an example is in the QuickStart Guide, Chapter 9, Extending SmartGWT). By setting simpleType.editorType to the name of your custom FormItem, forms will automatically use the custom FormItem, as will grids performing canEdit.

Parameters:
editorType - editorType Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

setValidOperators

public void setValidOperators(OperatorId... operators)
                       throws java.lang.IllegalStateException
Set of search operators valid for this type.

If not specified, the inheritsFrom type's operators will be used, finally defaulting to the default operators for the basic types (eg integer).

Parameters:
operators - validOperators Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created