|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.smartgwt.client.core.BaseClass
com.smartgwt.client.data.SimpleType
public class SimpleType
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 'field type'
in DataSource
and DataBoundComponent
. This allows you to define 'validation'
, com.smartgwt.client.data.SimpleType#normalDisplayFormatter
and 'editing'
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, scClassName |
Constructor Summary | |
---|---|
SimpleType(JavaScriptObject jsObj)
|
|
SimpleType(String name,
FieldType inheritsFrom)
Create a new simple type. |
|
SimpleType(String name,
SimpleType inheritsFrom)
Create a new simple type. |
Method Summary | |
---|---|
JavaScriptObject |
create()
|
String |
getInheritsFrom()
Name of another SimpleType from which this type should inherit. |
String |
getName()
Name of the type, used to refer to the type from 'field.name' . |
static SimpleType |
getOrCreateRef(JavaScriptObject jsObj)
|
static SimpleType |
getType(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(FieldType inheritsFrom)
Name of another SimpleType from which this type should inherit. |
void |
setInheritsFrom(String inheritsFrom)
Name of another SimpleType from which this type should inherit. |
void |
setName(String name)
Name of the type, used to refer to the type from 'field.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(Map valueMap)
List of legal values for this type, like valueMap . |
void |
setValueMap(String... valueMap)
List of legal values for this type, like valueMap . |
Methods inherited from class com.smartgwt.client.core.BaseClass |
---|
destroy, doAddHandler, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, 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 |
---|
public SimpleType(JavaScriptObject jsObj)
public SimpleType(String name, FieldType inheritsFrom)
name
- the name of the simple typeinheritsFrom
- the type it inherits frompublic SimpleType(String name, SimpleType inheritsFrom)
name
- the name of the simple typeinheritsFrom
- the type it inherits fromMethod Detail |
---|
public static SimpleType getOrCreateRef(JavaScriptObject jsObj)
public JavaScriptObject create()
create
in class BaseClass
public void setName(String name) throws IllegalStateException
'field.name'
.
name
- name Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic String getName()
'field.name'
.
public void setInheritsFrom(String inheritsFrom) throws IllegalStateException
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
inheritsFrom
- inheritsFrom Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic String getInheritsFrom()
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
public static SimpleType getType(String typeName)
typeName
- the name
of the simpleType to return
public void setValidators(Validator... validators) throws IllegalStateException
validators
- validators Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setValueMap(String... valueMap) throws IllegalStateException
valueMap
.
valueMap
- valueMap Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setValueMap(Map valueMap) throws IllegalStateException
valueMap
.
valueMap
- valueMap Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setEditorType(FormItem editorType) throws IllegalStateException
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 Smart GWT). By setting simpleType.editorType to the name of your custom FormItem, forms will
automatically use the custom FormItem, as will grids performing canEdit
.
editorType
- editorType Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setValidOperators(OperatorId... operators) throws IllegalStateException
If not specified, the inheritsFrom
type's operators will be used, finally
defaulting to the default operators for the basic types (eg integer).
operators
- validOperators Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setInheritsFrom(FieldType inheritsFrom) throws IllegalStateException
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
inheritsFrom
- inheritsFrom Default value is null
IllegalStateException
- this property cannot be changed after the underlying component has been created
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |