public class SimpleType extends BaseClass
SimpleTypes can be created at any time, and subsequently referred to as a
field type
in DataSources
and
DataBoundComponents
. This allows you to define
validation
, formatting
and editing
behaviors for a type to be reused across all
DataBoundComponents
.
The SimpleType class also allows data to be stored in some opaque format but treated as
simple atomic values as far as Smart GWT components are concerned by implementing
getAtomicValue()
and updateAtomicValue()
methods.
For example, if some record has a field value set to a javascript object with the
following properties:
{ stringValue:"A String", length: 9 }this value could be treated as a simple string by defining a SimpleType with
inheritsFrom
set to "text"
and a custom
getAtomicValue()
method that simply extracted the "stringValue"
attribute from the data object. DataBoundComponents would then display
the string value, and use it for sorting and other standard databinding features.
Note that the term "simpleType" is used in the same sense as in
XML Schema, and
XMLTools.loadXMLSchema()
will create new SimpleType definitions.
When using the Smart GWT Server, SimpleTypes can be defined server-side, and should be defined server-side if validators are going to be declared so that the server will enforce validation. To define server-side SimpleTypes using Component XML you should create file {typeName}.type.xml in the following format:
<SimpleType name="{typeName}" inheritsFrom="{otherSimpleType}" editorType="{FormItemClassName}"> <validators> <!-- validator definition just like DataSourceField --> </validators> </SimpleType>.. and place this file alongside your DataSource files (.ds.xml) files - in any of folders listed in
project.datasources
property in server.properties
.
SimpleTypes can be loaded via DataSourceLoader or loadDS JSP tags
and
should be loaded before the definitions of any DataSources that use them (so
generally put all SimpleType definitions first).
Define validators in the server-side type definition, for example:
<SimpleType name="countryCodeType" inheritsFrom="text"> <validators> <validator type="lengthRange" min="2" max="2" errorMessage="Length of country code should be equal to 2." /> <validator type="regexp" expression="[A-Z][A-Z]" errorMessage="CountryCode should have only uppercase letters." /> </validators> </SimpleType>
For client-side formatters, add these to the type definition after loading it from the server, for example:
SimpleType.getType("independenceDateType").setShortDisplayFormatter(new SimpleTypeFormatter() { public String format(Object value, DataClass field, DataBoundComponent component, Record record) { if (value == null) return null; return "<i>" + (((java.util.Date) value).getYear() + 1900) + "</i>"; } });Note that formatters must be added to the SimpleType definition before any DataBoundComponent binds to a DataSource that uses the SimpleType.
An example is here.
Modifier and Type | Class and Description |
---|---|
static interface |
SimpleType.SimpleTypeValueComparator |
static class |
SimpleType.SimpleTypeValueExtractor |
static class |
SimpleType.SimpleTypeValueUpdater |
config, configOnly, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
SimpleType()
Create a new simple type.
|
SimpleType(com.google.gwt.core.client.JavaScriptObject jsObj) |
SimpleType(java.lang.String name,
FieldType inheritsFrom)
Create a new simple type.
|
SimpleType(java.lang.String name,
SimpleType inheritsFrom)
Create a new simple type.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
applySummaryFunction(Record[] records,
ListGridField field,
java.lang.String functionName)
Apply a registered summary function to a set of records and a field.
|
static java.lang.Object |
applySummaryFunction(Record[] records,
ListGridField field,
SummaryFunctionType summaryFunction)
Apply a standard
SummaryFunctionType to a set of records and a field. |
com.google.gwt.core.client.JavaScriptObject |
create() |
java.lang.Boolean |
getCanEdit()
Default value for
DataSourceField.canEdit for fields of this
type. |
java.lang.Boolean |
getCanFilter()
Default value for
DataSourceField.canFilter for fields of
this type. |
java.lang.String |
getDefaultGroupingMode()
In components that support grouping, the default mode from the available
groupingModes to use when grouping values of this type. |
OperatorId |
getDefaultOperator()
The default
search-operator for this data-type. |
java.lang.String |
getExportFormat()
FormatString used during exports for numeric or date formatting. |
DataSourceField |
getFieldProperties()
These are properties that are essentially copied onto any DataSourceField where the property is applied.
|
java.lang.String |
getFormat()
FormatString for numeric or date formatting. |
java.util.Map |
getGroupingModes()
A set of key-value pairs that represent the names and titles of the grouping modes available to values of this type,
for use in components that support grouping.
|
java.lang.String |
getGroupTitle(java.lang.Object value,
Record record,
java.util.Map field,
java.lang.String fieldName,
Canvas component)
Returns a string value appropriate for the title of the group containing the passed value.
|
java.lang.Object |
getGroupValue(java.lang.Object value,
Record record,
java.util.Map field,
java.lang.String fieldName,
Canvas component)
Returns a group value appropriate for the passed record, field and value, in the passed component.
|
java.lang.String |
getInheritsFrom()
Name of another SimpleType from which this type should inherit.
|
com.google.gwt.core.client.JavaScriptObject |
getJsObj() |
java.lang.String |
getName()
Name of the type, used to refer to the type from
field.type . |
static SimpleType |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
ReadOnlyDisplayAppearance |
getReadOnlyDisplay()
Default
readOnlyDisplay for fields of this
type. |
static java.lang.Boolean |
getSkipConvertOpaqueValues()
Tells the atomic values subsystem whether to convert the incoming opaque value to a Java object when calling user
getAtomicValue() and updateAtomicValue() methods.
|
static SimpleType |
getType(java.lang.String typeName)
Retrieve a simpleType definition by type name
|
boolean |
isCreated() |
void |
register()
Explicitly register this SimpleType with the system so that it can be used / referenced by remote DataSources.
|
static void |
registerSummaryFunction(java.lang.String functionName,
SummaryFunction summaryFunction)
Registers a new SummaryFunction by name.
|
SimpleType |
setCanEdit(java.lang.Boolean canEdit)
Default value for
DataSourceField.canEdit for fields of this
type. |
SimpleType |
setCanFilter(java.lang.Boolean canFilter)
Default value for
DataSourceField.canFilter for fields of
this type. |
SimpleType |
setDefaultGroupingMode(java.lang.String defaultGroupingMode)
In components that support grouping, the default mode from the available
groupingModes to use when grouping values of this type. |
SimpleType |
setDefaultOperator(OperatorId defaultOperator)
The default
search-operator for this data-type. |
static void |
setDefaultSummaryFunction(java.lang.String typeName,
java.lang.String functionName)
Set a default summary function for some field type.
|
static void |
setDefaultSummaryFunction(java.lang.String typeName,
SummaryFunctionType summaryFunction)
Set a default summary function for some field type.
|
void |
setEditFormatter(SimpleTypeFormatter formatter)
Formatter for values of this type when displayed in a freeform text editor such as a
TextItem |
void |
setEditorProperties(FormItem editorProperties)
Default
FormItem configuration for editing values of this type. |
void |
setEditorType(java.lang.Class<? extends FormItem> editorType)
Set the default
FormItem class to be used whenever a value of this type is edited
(whether in a grid, form, or other component). |
void |
setEditorType(FormItem editorType)
Deprecated.
Renamed to
setEditorProperties(FormItem) . You can also consider using
setEditorType(Class) or setEditorType(String) instead. |
void |
setEditorType(java.lang.String editorType)
Set the default
FormItem class to be used whenever a value of this type is edited
(whether in a grid, form, or other component). |
void |
setEditParser(SimpleTypeParser parser)
Specify a parser to convert some user-edited value to an underlying data value of this type.
|
SimpleType |
setExportFormat(java.lang.String exportFormat)
FormatString used during exports for numeric or date formatting. |
SimpleType |
setFieldProperties(DataSourceField fieldProperties)
These are properties that are essentially copied onto any DataSourceField where the property is applied.
|
void |
setFilterEditorProperties(FormItem filterEditorProperties)
Default
FormItem configuration for editing values of this type in a
ListGrid filter row or
SearchForm . |
void |
setFilterEditorType(java.lang.Class<? extends FormItem> filterEditorType)
Set the default
FormItem class to be used whenever a value of this type appears
in a ListGrid filter row or
SearchForm . |
void |
setFilterEditorType(java.lang.String filterEditorType)
Set the default
FormItem class to be used whenever a value of this type appears
in a ListGrid filter row or
SearchForm . |
SimpleType |
setFormat(java.lang.String format)
FormatString for numeric or date formatting. |
SimpleType |
setGroupingModes(java.util.Map groupingModes)
A set of key-value pairs that represent the names and titles of the grouping modes available to values of this type,
for use in components that support grouping.
|
void |
setGroupTitleFunction(GroupTitleFunction titleFunction)
Sets customizer whose
getTitle()
method overrides the default behavior of
getGroupTitle() . |
void |
setGroupValueFunction(GroupValueFunction valueFunction)
Sets customizer whose
getValue()
method overrides the default behavior of
getGroupValue() . |
void |
setInheritsFrom(FieldType inheritsFrom)
Name of another SimpleType from which this type should inherit.
|
SimpleType |
setInheritsFrom(java.lang.String inheritsFrom)
Name of another SimpleType from which this type should inherit.
|
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
SimpleType |
setName(java.lang.String name)
Name of the type, used to refer to the type from
field.type . |
void |
setNormalDisplayFormatter(SimpleTypeFormatter formatter)
Normal formatter for values of this type used in a
StaticTextItem or DetailViewer . |
SimpleType |
setReadOnlyDisplay(ReadOnlyDisplayAppearance readOnlyDisplay)
Default
readOnlyDisplay for fields of this
type. |
void |
setReadOnlyEditorProperties(FormItem editorProperties)
FormItem properties to be applied when editing values of this type in a read-only
context.
|
void |
setReadOnlyEditorType(java.lang.Class<? extends FormItem> editorType)
Set the default
FormItem class to be used whenever a value of this type is edited
in a read-only context (whether in a grid, form, or other component). |
void |
setReadOnlyEditorType(FormItem editorType)
Deprecated.
Renamed to
setReadOnlyEditorProperties(FormItem) . You can also consider using
setReadOnlyEditorType(Class) or setReadOnlyEditorType(String) instead. |
void |
setReadOnlyEditorType(java.lang.String editorType)
Set the default
FormItem class to be used whenever a value of this type is edited
in a read-only context (whether in a grid, form, or other component). |
void |
setShortDisplayFormatter(SimpleTypeFormatter formatter)
|
void |
setSimpleTypeValueComparator(SimpleType.SimpleTypeValueComparator comparator)
Specify a custom comparator to use for this type.
|
void |
setSimpleTypeValueExtractor(SimpleType.SimpleTypeValueExtractor extractor)
Specify an extractor to extract an atomic value (such as a string or number) from some arbitrary live data value.
|
void |
setSimpleTypeValueUpdater(SimpleType.SimpleTypeValueUpdater updater)
Specify an updater to update a live data value with an edited atomic value (such as a string or number).
|
static void |
setSkipConvertOpaqueValues(java.lang.Boolean convert)
Tells the atomic values subsystem whether to skip conversion of the incoming opaque value to a Java object when
calling user getAtomicValue() and updateAtomicValue() methods.
|
SimpleType |
setValidators(Validator... validators)
Validators to apply to value of this type.
|
SimpleType |
setValidOperators(OperatorId... validOperators)
Set of
search-operators valid for this SimpleType . |
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 . |
addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, asSGWTComponent, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getOrCreateJsObj, getRef, getRuleScope, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setRuleScope, setScClassName
public SimpleType(com.google.gwt.core.client.JavaScriptObject jsObj)
public SimpleType()
name
- the name of the simple typeinheritsFrom
- the type it inherits frompublic SimpleType(java.lang.String name, FieldType inheritsFrom)
name
- the name of the simple typeinheritsFrom
- the type it inherits frompublic SimpleType(java.lang.String name, SimpleType inheritsFrom)
name
- the name of the simple typeinheritsFrom
- the type it inherits frompublic static SimpleType getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
setJavaScriptObject
in class BaseClass
public com.google.gwt.core.client.JavaScriptObject create()
public SimpleType setCanEdit(java.lang.Boolean canEdit) throws java.lang.IllegalStateException
DataSourceField.canEdit
for fields of this
type. This impacts client-side behavior only and is a way to simply disallow editing of this field type by default
within editors
.
This property is set to false for the "sequence" SimpleType by default.
canEdit
- New canEdit value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getCanEdit()
DataSourceField.canEdit
for fields of this
type. This impacts client-side behavior only and is a way to simply disallow editing of this field type by default
within editors
.
This property is set to false for the "sequence" SimpleType by default.
public SimpleType setCanFilter(java.lang.Boolean canFilter) throws java.lang.IllegalStateException
DataSourceField.canFilter
for fields of
this type. This impacts client-side behavior only and may be used to explicitly enable editing in filter interfaces,
even if editing is disabled
.
This property is set to true for the "sequence" SimpleType by default.
canFilter
- New canFilter value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getCanFilter()
DataSourceField.canFilter
for fields of
this type. This impacts client-side behavior only and may be used to explicitly enable editing in filter interfaces,
even if editing is disabled
.
This property is set to true for the "sequence" SimpleType by default.
public SimpleType setDefaultGroupingMode(java.lang.String defaultGroupingMode)
groupingModes
to use when grouping values of this type.defaultGroupingMode
- New defaultGroupingMode value. Default value is nullSimpleType
instance, for chaining setter callspublic java.lang.String getDefaultGroupingMode()
groupingModes
to use when grouping values of this type.public SimpleType setDefaultOperator(OperatorId defaultOperator) throws java.lang.IllegalStateException
search-operator
for this data-type.defaultOperator
- New defaultOperator value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdAdvanced Filtering
public OperatorId getDefaultOperator()
search-operator
for this data-type.Advanced Filtering
public SimpleType setExportFormat(java.lang.String exportFormat) throws java.lang.IllegalStateException
FormatString
used during exports for numeric or date formatting. See DataSourceField.exportFormat
.exportFormat
- New exportFormat value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdFormatString
,
Exports & Formatting
public java.lang.String getExportFormat()
FormatString
used during exports for numeric or date formatting. See DataSourceField.exportFormat
.FormatString
,
Exports & Formatting
public SimpleType setFieldProperties(DataSourceField fieldProperties) throws java.lang.IllegalStateException
fieldProperties
- New fieldProperties value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic DataSourceField getFieldProperties()
public SimpleType setFormat(java.lang.String format) throws java.lang.IllegalStateException
FormatString
for numeric or date formatting. See DataSourceField.format
.format
- New format value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdFormatString
,
Exports & Formatting
public java.lang.String getFormat()
FormatString
for numeric or date formatting. See DataSourceField.format
.FormatString
,
Exports & Formatting
public SimpleType setGroupingModes(java.util.Map groupingModes)
Some types provide a set of builtin groupingModes, as covered here
.
Use setGroupValueFunction()
and setGroupTitleFunction()
to implement custom grouping logic
for each of the grouping modes you provide.
groupingModes
- New groupingModes value. Default value is nullSimpleType
instance, for chaining setter callspublic java.util.Map getGroupingModes()
Some types provide a set of builtin groupingModes, as covered here
.
Use setGroupValueFunction()
and setGroupTitleFunction()
to implement custom grouping logic
for each of the grouping modes you provide.
grouping modes
available for values of
this type in components that support grouping. Default value is nullpublic SimpleType setInheritsFrom(java.lang.String inheritsFrom) throws java.lang.IllegalStateException
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
inheritsFrom
- New inheritsFrom value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdIdentifier
,
DataType Reuse Examplepublic java.lang.String getInheritsFrom()
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
Identifier
,
DataType Reuse Examplepublic SimpleType setName(java.lang.String name) throws java.lang.IllegalStateException
field.type
.name
- New name value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdIdentifier
public java.lang.String getName()
field.type
.Identifier
public SimpleType setReadOnlyDisplay(ReadOnlyDisplayAppearance readOnlyDisplay) throws java.lang.IllegalStateException
readOnlyDisplay
for fields of this
type. For more sophisticated management of read-only behavior, see readOnlyEditorType
.
readOnlyDisplay
- New readOnlyDisplay value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic ReadOnlyDisplayAppearance getReadOnlyDisplay()
readOnlyDisplay
for fields of this
type. For more sophisticated management of read-only behavior, see readOnlyEditorType
.
public SimpleType setValidators(Validator... validators) throws java.lang.IllegalStateException
validators
- New validators value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdValidation overview and related methods
public SimpleType setValidOperators(OperatorId... validOperators) throws java.lang.IllegalStateException
search-operators
valid for this SimpleType
. If
not specified, the inherited
type's operators will be used,
finally defaulting to the default operators for the basic types (eg, integer).
validOperators
- New validOperators value. Default value is nullSimpleType
instance, for chaining setter callsjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdAdvanced Filtering
public java.lang.String getGroupTitle(java.lang.Object value, Record record, java.util.Map field, java.lang.String fieldName, Canvas component)
value
- the record value to return a group title forrecord
- the record containing the passed group valuefield
- the field relating to the value to be processedfieldName
- the name of the field relating to the value to be processedcomponent
- the component, usually a ListGrid
, containing the
passed recordpublic java.lang.Object getGroupValue(java.lang.Object value, Record record, java.util.Map field, java.lang.String fieldName, Canvas component)
value
- the record value to return a group value forrecord
- the record containing the passed valuefield
- the field relating to the value to be processedfieldName
- the name of the field relating to the value to be processedcomponent
- the component, usually a ListGrid
, containing the
passed recordpublic static SimpleType getType(java.lang.String typeName)
typeName
- the name
of the simpleType to returnpublic void register()
public void setValueMap(java.lang.String... valueMap) throws java.lang.IllegalStateException
valueMap
.valueMap
- valueMap Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setValueMap(java.util.Map valueMap) throws java.lang.IllegalStateException
valueMap
.valueMap
- valueMap Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setEditorProperties(FormItem editorProperties) throws java.lang.IllegalStateException
FormItem
configuration for editing values of this type.
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).
Note: The FormItem passed to setEditorProperties()
is used as a
"template" to create a FormItem.
For an overview of the template rules, reflection requirements when trying to assign
an edit Formitem by type, and an understanding of how the various
setEditorProperties()
calls on different classes relate to each other in
determining what configuration ultimately gets applied to the edit FormItem, see
DataSourceField.setEditorProperties(FormItem)
.
editorProperties
- FormItem with default properties to use when editingjava.lang.IllegalStateException
- this property cannot be changed after the underlying
component has been createdsetEditorType(String)
,
setEditorType(Class)
public void setEditorType(FormItem editorType) throws java.lang.IllegalStateException
setEditorProperties(FormItem)
. You can also consider using
setEditorType(Class)
or setEditorType(String)
instead.setEditorProperties(FormItem)
.editorType
- FormItem with default properties to be applied when editingjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setEditorType(java.lang.String editorType)
FormItem
class to be used whenever a value of this type is edited
(whether in a grid, form, or other component).
If unset, a FormItem will be automatically chosen.
Note: The editorType must be registered for use with the
reflection mechanism
.
By doing so, you avoid the limitations of setEditorProperties(FormItem)
.
If the editorType cannot be resolved via reflection, this method will still work if
editorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
editorType
- the fully-qualified class name of a FormItem
subclass, which must have been registered with the
reflection mechanism
(except for built-in
framework classes).java.lang.IllegalArgumentException
- if the editorType class has not been registered for use with the
reflection mechanism
, and
it is not a built-in framework class, or if it does not inherit from
FormItem
.public void setEditorType(java.lang.Class<? extends FormItem> editorType)
FormItem
class to be used whenever a value of this type is edited
(whether in a grid, form, or other component).
If unset, a FormItem will be automatically chosen.
Note: The editorType must be registered for use with the
reflection mechanism
.
By doing so, you avoid the limitations of setEditorProperties(FormItem)
.
If the editorType cannot be resolved via reflection, this method will still work if
editorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
editorType
- a FormItem
subclass, which must have been registered with the
reflection mechanism
(except for built-in
framework classes).java.lang.IllegalArgumentException
- if the editorType class has not been registered for use with the
reflection mechanism
, and
it is not a built-in framework class, or if it does not inherit from
FormItem
.public void setReadOnlyEditorProperties(FormItem editorProperties) throws java.lang.IllegalStateException
Note: The FormItem passed to setReadOnlyEditorProperties() is used as a
"template" to create a FormItem whenever a
DataBoundComponent
needs to show an interface for
editing this field (and the field is marked read-only).
For an overview of the template rules, reflection requirements when trying to assign
an edit Formitem by type, and an understanding of how the various
setReadOnlyEditorProperties()
calls on different classes relate to each
other in determining what configuration ultimately gets applied to the edit FormItem,
see DataSourceField.setEditorProperties(FormItem)
.
editorProperties
- FormItem with properties to be applied when editing values of
this type in a read-only context.java.lang.IllegalStateException
- this property cannot be changed after the underlying
component has been createdsetReadOnlyEditorType(String)
,
setReadOnlyEditorType(Class)
public void setReadOnlyEditorType(FormItem editorType)
setReadOnlyEditorProperties(FormItem)
. You can also consider using
setReadOnlyEditorType(Class)
or setReadOnlyEditorType(String)
instead.setReadOnlyEditorProperties(FormItem)
.editorType
- FormItem with default properties to be applied when editingpublic void setReadOnlyEditorType(java.lang.String editorType)
FormItem
class to be used whenever a value of this type is edited
in a read-only context (whether in a grid, form, or other component).
If unset, a FormItem will be automatically chosen.
By using the reflection mechanism
,
this method avoids the limitations described in setReadOnlyEditorProperties(FormItem)
.
If the editorType cannot be resolved via reflection, this method will still work if
editorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
editorType
- the fully-qualified class name of a FormItem
subclass, which must have been registered with the
reflection mechanism
(except for built-in
framework classes).java.lang.IllegalArgumentException
- if the editorType class has not been registered for use with the
reflection mechanism
, and
it is not a built-in framework class, or if it does not inherit from
FormItem
.public void setReadOnlyEditorType(java.lang.Class<? extends FormItem> editorType)
FormItem
class to be used whenever a value of this type is edited
in a read-only context (whether in a grid, form, or other component).
If unset, a FormItem will be automatically chosen.
By using the reflection mechanism
,
this method avoids the limitations described in setReadOnlyEditorProperties(FormItem)
.
If the editorType cannot be resolved via reflection, this method will still work if
editorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
editorType
- a FormItem
subclass, which must have been registered with the
reflection mechanism
(except for built-in
framework classes).java.lang.IllegalArgumentException
- if the editorType class has not been registered for use with the
reflection mechanism
, and
it is not a built-in framework class, or if it does not inherit from
FormItem
.public void setFilterEditorProperties(FormItem filterEditorProperties) throws java.lang.IllegalStateException
FormItem
configuration for editing values of this type in a
ListGrid
filter row or
SearchForm
.
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).
Note: The FormItem passed to setFilterEditorProperties() is used as a "template" to create a FormItem whenever filter rows or search forms need to show an interface for editing a field of this type.
For an overview of the template rules, reflection requirements when trying to assign
an edit Formitem by type, and an understanding of how the various
setFilterEditorProperties()
calls on different classes relate to each other
in determining what configuration ultimately gets applied to the edit FormItem, see
DataSourceField.setEditorProperties(FormItem)
.
filterEditorProperties
- FormItem with default properties to use when editingjava.lang.IllegalStateException
- this property cannot be changed after the underlying
component has been createdsetFilterEditorType(String)
,
setFilterEditorType(Class)
public void setFilterEditorType(java.lang.String filterEditorType)
FormItem
class to be used whenever a value of this type appears
in a ListGrid
filter row or
SearchForm
.
If unset, a FormItem will be automatically chosen.
Note: The filterEditorType must be registered for use with the
reflection mechanism
.
By doing so, you avoid the limitations of setFilterEditorProperties(FormItem)
.
If the filterEditorType cannot be resolved via reflection, this method will still work
if filterEditorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
filterEditorType
- the fully-qualified class name of a
FormItem
subclass, which must have
been registered with the reflection mechanism
(except for built-in framework classes).java.lang.IllegalArgumentException
- if the filterEditorType class has not been registered for use with
the reflection mechanism
,
and it is not a built-in framework class, or if it does not inherit
from FormItem
.public void setFilterEditorType(java.lang.Class<? extends FormItem> filterEditorType)
FormItem
class to be used whenever a value of this type appears
in a ListGrid
filter row or
SearchForm
.
If unset, a FormItem will be automatically chosen.
Note: The filterEditorType must be registered for use with the
reflection mechanism
.
By doing so, you avoid the limitations of setFilterEditorProperties(FormItem)
.
If the filterEditorType cannot be resolved via reflection, this method will still work
if filterEditorType refers to a built-in SmartGWT framework class, such as
SetFilterItem
.
filterEditorType
- a FormItem
subclass, which must have been registered with the
reflection mechanism
(except for built-in framework classes).java.lang.IllegalArgumentException
- if the filterEditorType class has not been registered for use with
the reflection mechanism
,
and it is not a built-in framework class, or if it does not inherit
from FormItem
.public void setInheritsFrom(FieldType inheritsFrom) throws java.lang.IllegalStateException
Validators, if any, will be combined. All other SimpleType properties default to the inherited type's value.
inheritsFrom
- inheritsFrom Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setNormalDisplayFormatter(SimpleTypeFormatter formatter)
StaticTextItem
or DetailViewer
.
A formatter can make itself configurable on a per-component or per-field basis by checking properties on the component or field. For example, a formatter for account IDs may want to omit a prefix in views where it is redundant, and could check a flag detailViewer.omitAccountIdPrefix for this purpose.
formatter
- the formatterpublic void setShortDisplayFormatter(SimpleTypeFormatter formatter)
ListGrid
or
TreeGrid
.
A formatter can make itself configurable on a per-component or per-field basis by checking properties on the component or field. For example, a formatter for account IDs may want to omit a prefix in views where it is redundant, and could check a flag listGridField.omitAccountIdPrefix for this purpose.
formatter
- the formatterpublic void setEditFormatter(SimpleTypeFormatter formatter)
TextItem
See also #parseInput
for parsing an edited text value back to a data value.
formatter
- the formatterpublic void setEditParser(SimpleTypeParser parser)
TextItem
.
Typically this will convert from the format produced by #editFormatter
back to a data value.parser
- the parserpublic static void setSkipConvertOpaqueValues(java.lang.Boolean convert)
convert
- Whether the atomic values subsystem should skip conversion of opaque values to native Java typespublic static java.lang.Boolean getSkipConvertOpaqueValues()
public void setSimpleTypeValueExtractor(SimpleType.SimpleTypeValueExtractor extractor)
extractor
- the extractorpublic void setSimpleTypeValueUpdater(SimpleType.SimpleTypeValueUpdater updater)
extractor
- the updaterpublic void setSimpleTypeValueComparator(SimpleType.SimpleTypeValueComparator comparator)
If defined, this comparator's compareValues() method will be called when the framework needs to compares values of this type for equality.
comparator
- the comparatorpublic com.google.gwt.core.client.JavaScriptObject getJsObj()
public static void registerSummaryFunction(java.lang.String functionName, SummaryFunction summaryFunction)
functionName
- name for the SummaryFunctionsummaryFunction
- new SummaryFunction implementationpublic static java.lang.Object applySummaryFunction(Record[] records, ListGridField field, SummaryFunctionType summaryFunction)
SummaryFunctionType
to a set of records and a field.records
- records to obtain the summary value forfield
- field on which the summary function is being runsummaryFunction
- standard summary function identifierpublic static java.lang.Object applySummaryFunction(Record[] records, ListGridField field, java.lang.String functionName)
records
- records to obtain the summary value forfield
- field on which the summary function is being runfunctionName
- name under which the summary function is registered. See registerSummaryFunction(String, SummaryFunction)
public static void setDefaultSummaryFunction(java.lang.String typeName, SummaryFunctionType summaryFunction)
typeName
- name of the field type. If this is the name of a custom SimpleType, the developer may need
to ensure the type is registered
.summaryFunction
- standard summary function type for this data typepublic static void setDefaultSummaryFunction(java.lang.String typeName, java.lang.String functionName)
typeName
- name of the field type. If this is the name of a custom SimpleType, the developer may need
to ensure the type is registered
.summaryFunction
- name under which the summary function is registered. See registerSummaryFunction(String, SummaryFunction)
public void setGroupTitleFunction(GroupTitleFunction titleFunction)
getTitle()
method overrides the default behavior of
getGroupTitle()
.
Pass null to clear the override.public void setGroupValueFunction(GroupValueFunction valueFunction)
getValue()
method overrides the default behavior of
getGroupValue()
.
Pass null to clear the override.