|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.data.DataSourceField
public class DataSourceField
Metadata about a DataSourceField, including its type and validators.
Field Summary |
---|
Fields inherited from class com.smartgwt.client.core.JsObject |
---|
jsObj |
Constructor Summary | |
---|---|
DataSourceField()
|
|
DataSourceField(JavaScriptObject jsObj)
|
|
DataSourceField(String name,
FieldType type)
|
|
DataSourceField(String name,
FieldType type,
String title)
|
|
DataSourceField(String name,
FieldType type,
String title,
int length)
|
|
DataSourceField(String name,
FieldType type,
String title,
int length,
boolean required)
|
Method Summary | |
---|---|
static DataSourceField[] |
convertToDataSourceFieldArray(JavaScriptObject nativeArray)
|
void |
exportForceText()
When using DataSource.recordsAsText , what approach (if any)
should be used to force values to be intepreted as text instead of heuristically parsed as dates, times or other
structured types. |
Boolean |
getAutoGenerated()
Indicates this field value is auto-generated by data base or ORM provider. |
Boolean |
getCanEdit()
Controls whether, by default, dataBoundComponents consider this field editable. |
Boolean |
getCanExport()
Dictates whether the data in this field be exported. |
Boolean |
getCanFilter()
Should the user be able to filter data by this field? Effects whether this field will show up in dataBoundComponents with UI for filtering data. |
Boolean |
getCanSave()
Whether values in this field can be updated and saved to the dataSource. |
Boolean |
getCanSortClientOnly()
When true, this field can only be used for sorting if the data is entirely client-side. |
Boolean |
getCanView()
If false, this property indicates that this field is considered "server only". |
Boolean |
getChildrenProperty()
If true, this property indicates that this field will hold an explicit array of child nodes for the current node. |
String |
getChildTagName()
For a field that is multiple:"true" , controls the name of
the XML tag used for each subelement during DataSource.xmlSerialize . |
Boolean |
getCustomSQL()
For a DataSource with serverType "sql" or "hibernate",
indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with
custom queries . |
DateDisplayFormat |
getDateFormatter()
Preferred display format to use for date type values within this field. |
Integer |
getDecimalPad()
Applies only to fields of type "float" and enforces a minimum number of digits shown after the decimal point. |
Integer |
getDecimalPrecision()
Applies only to fields of type "float" and affects how many significant digits are shown. |
Boolean |
getDetail()
Whether this field should be considered a "detail" field by a DataBoundComponent . |
Boolean |
getEscapeHTML()
When data values are displayed in DataBound components, by default strings will be interpreted as HTML by the browser in most cases. |
String |
getExportTitle()
Optional different field-title used for exports. |
String |
getForeignKey()
Declares that this field holds values that can be matched to values from another DataSource field, to create a relationship between records from different DataSources or even records within the same DataSource. |
String |
getGroup()
For use in ComponentSchema , indicates what group to place the property in when editing
in Visual Builder. |
Boolean |
getHidden()
Whether this field should be hidden from users by default within a DataBound component. |
Boolean |
getIgnore()
Whether this field should be completely excluded from this dataSource, as if it had never been defined. |
Integer |
getImageHeight()
Height of the image-content of this field. |
String |
getImageHeightAsString()
Height of the image-content of this field. |
Integer |
getImageSize()
Width and height of the image-content of this field. |
String |
getImageSizeAsString()
Width and height of the image-content of this field. |
Integer |
getImageWidth()
Width of the image-content of this field. |
String |
getImageWidthAsString()
Width of the image-content of this field. |
Boolean |
getInapplicable()
For use in ComponentSchema , a field inherited from another schema can be redeclared with this property
set in order to indicate that the property should not be used. |
Integer |
getLength()
Maximum number of characters allowed. |
Boolean |
getMultiple()
Indicates that this field should always be Array-valued. |
String |
getName()
Name for this field. |
Boolean |
getNillable()
Controls whether an explicit null-valued Record attribute for this field should result in xsi:nil being used to transmit the value when serializing
to XML, like so: |
static DataSourceField |
getOrCreateRef(JavaScriptObject jsObj)
|
String |
getPluralTitle()
Return the plural title. |
Boolean |
getPrimaryKey()
Indicates either that this field holds a value unique across all records in this DataSource, or that it is one of a number of fields marked as primary keys, and the combination of the values held in all of those fields is unique across all records in the DataSource. |
String |
getPrompt()
Causes a tooltip hover to appear on the header generated for this field (effectively sets prompt for the header). |
Boolean |
getPropertiesOnly()
For use in ComponentSchema for fields that contain other components, this flag
suppresses auto-construction for subcomponents that appear under this field. |
Boolean |
getRequired()
Indicates this field must be non-null in order for a record to pass validation. |
Object |
getRootValue()
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. |
String |
getSequenceName()
For a DataSource with serverType:"sql" with a field of
type "sequence", the name of the SQL sequence that should be used when inserting new records into this table. |
Boolean |
getShowFileInline()
For a field of type:"imageFile", indicates whether to stream the image and display it inline or to display the View and Download icons. |
SummaryFunctionType |
getSummaryFunction()
If showGridSummary or showGroupSummary is true, this attribute can be used to
specify an explicit SummaryFunction for calculating the summary value to display. |
String |
getSummaryValueTitle()
Title to show in a Summary of type "title" for this field. |
TimeDisplayFormat |
getTimeFormatter()
Preferred time-format to apply to date type values within this field. |
String |
getTitle()
Default user-visible title for this field. |
FieldType |
getType()
Type of this field. |
DataSource |
getTypeAsDataSource()
Return the type of the assigned DataSource |
String |
getUploadFieldName()
Used by the BatchUploader to map a field in an upload file to this dataSourceField. |
Validator[] |
getValidators()
Validators to be applied to this field. |
OperatorId[] |
getValidOperators()
List of operators valid on this field. |
Map |
getValueMap()
A ValueMap is a set of legal values for a field. |
String |
getValueXPath()
XPath expression used to retrieve the field's value. |
Boolean |
getXmlAttribute()
Indicates that DataSource.xmlSerialize should serialize this
value as an XML attribute. |
void |
setAutoGenerated(Boolean autoGenerated)
Indicates this field value is auto-generated by data base or ORM provider. |
void |
setCanEdit(Boolean canEdit)
Controls whether, by default, dataBoundComponents consider this field editable. |
void |
setCanExport(Boolean canExport)
Dictates whether the data in this field be exported. |
void |
setCanFilter(Boolean canFilter)
Should the user be able to filter data by this field? Effects whether this field will show up in dataBoundComponents with UI for filtering data. |
void |
setCanSave(Boolean canSave)
Whether values in this field can be updated and saved to the dataSource. |
void |
setCanSortClientOnly(Boolean canSortClientOnly)
When true, this field can only be used for sorting if the data is entirely client-side. |
void |
setCanView(Boolean canView)
If false, this property indicates that this field is considered "server only". |
void |
setChildrenProperty(Boolean childrenProperty)
If true, this property indicates that this field will hold an explicit array of child nodes for the current node. |
void |
setChildTagName(String childTagName)
For a field that is multiple:"true" , controls the name of
the XML tag used for each subelement during DataSource.xmlSerialize . |
void |
setCustomSQL(Boolean customSQL)
For a DataSource with serverType "sql" or "hibernate",
indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with
custom queries . |
void |
setDateFormatter(DateDisplayFormat dateFormatter)
Preferred display format to use for date type values within this field. |
void |
setDecimalPad(Integer decimalPad)
Applies only to fields of type "float" and enforces a minimum number of digits shown after the decimal point. |
void |
setDecimalPrecision(Integer decimalPrecision)
Applies only to fields of type "float" and affects how many significant digits are shown. |
void |
setDetail(Boolean detail)
Whether this field should be considered a "detail" field by a DataBoundComponent . |
void |
setEditorType(FormItem editorType)
Sets the default FormItem to be used whenever this field is edited (whether in a grid, form, or other component). |
void |
setEscapeHTML(Boolean escapeHTML)
When data values are displayed in DataBound components, by default strings will be interpreted as HTML by the browser in most cases. |
void |
setExportTitle(String exportTitle)
Optional different field-title used for exports. |
void |
setFieldValueExtractor(FieldValueExtractor extractor)
Function to retrieve the field's value from the XML element or JSON record returned from a web service. |
void |
setForeignKey(String foreignKey)
Declares that this field holds values that can be matched to values from another DataSource field, to create a relationship between records from different DataSources or even records within the same DataSource. |
void |
setGroup(String group)
For use in ComponentSchema , indicates what group to place the property in when editing
in Visual Builder. |
void |
setHidden(Boolean hidden)
Whether this field should be hidden from users by default within a DataBound component. |
void |
setIgnore(Boolean ignore)
Whether this field should be completely excluded from this dataSource, as if it had never been defined. |
void |
setImageHeight(Integer imageHeight)
Height of the image-content of this field. |
void |
setImageHeight(String imageHeight)
Height of the image-content of this field. |
void |
setImageSize(Integer imageSize)
Width and height of the image-content of this field. |
void |
setImageSize(String imageSize)
Width and height of the image-content of this field. |
void |
setImageWidth(Integer imageWidth)
Width of the image-content of this field. |
void |
setImageWidth(String imageWidth)
Width of the image-content of this field. |
void |
setInapplicable(Boolean inapplicable)
For use in ComponentSchema , a field inherited from another schema can be redeclared with this property
set in order to indicate that the property should not be used. |
void |
setJavaScriptObject(JavaScriptObject jsObj)
|
void |
setLength(Integer length)
Maximum number of characters allowed. |
void |
setMultiple(Boolean multiple)
Indicates that this field should always be Array-valued. |
void |
setName(String name)
Name for this field. |
void |
setNillable(Boolean nillable)
Controls whether an explicit null-valued Record attribute for this field should result in xsi:nil being used to transmit the value when serializing
to XML, like so: |
void |
setPluralTitle(String pluralTitle)
Set the plural title. |
void |
setPrimaryKey(Boolean primaryKey)
Indicates either that this field holds a value unique across all records in this DataSource, or that it is one of a number of fields marked as primary keys, and the combination of the values held in all of those fields is unique across all records in the DataSource. |
void |
setPrompt(String prompt)
Causes a tooltip hover to appear on the header generated for this data source field (effectively sets prompt for the header). |
void |
setPropertiesOnly(Boolean propertiesOnly)
For use in ComponentSchema for fields that contain other components, this flag
suppresses auto-construction for subcomponents that appear under this field. |
void |
setReadOnlyEditorType(FormItem editorType)
Sets the default FormItem to be used if this field is marked as #setCanEdit,canEdit false and displayed in an editor component such as a DynamicForm. |
void |
setRequired(Boolean required)
Indicates this field must be non-null in order for a record to pass validation. |
void |
setRootValue(Float rootValue)
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. |
void |
setRootValue(Integer rootValue)
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. |
void |
setRootValue(Object rootValue)
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. |
void |
setRootValue(String rootValue)
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. |
void |
setSequenceName(String sequenceName)
For a DataSource with serverType:"sql" with a field of
type "sequence", the name of the SQL sequence that should be used when inserting new records into this table. |
void |
setShowFileInline(Boolean showFileInline)
For a field of type:"imageFile", indicates whether to stream the image and display it inline or to display the View and Download icons. |
void |
setSummaryFunction(String summaryFunction)
If showGridSummary or showGroupSummary is true, this attribute can be used to
specify an summary function registered via com.smartgwt.client.data.SimpleType#registerSummaryFunction()
for calculating the summary value to display. |
void |
setSummaryFunction(SummaryFunction summaryFunction)
If showGridSummary or showGroupSummary is true, this attribute can be used to
specify an explicit SummaryFunction for calculating the summary value to display. |
void |
setSummaryFunction(SummaryFunctionType summaryFunction)
If showGridSummary or showGroupSummary is true, this attribute can be used to
specify an explicit SummaryFunction for calculating the summary value to display. |
void |
setSummaryValueTitle(String summaryValueTitle)
Title to show in a Summary of type "title" for this field. |
void |
setTimeFormatter(TimeDisplayFormat timeFormatter)
Preferred time-format to apply to date type values within this field. |
void |
setTitle(String title)
Default user-visible title for this field. |
void |
setType(DataSource dataSource)
Deprecated. use #setTypeAsDataSource |
void |
setType(FieldType type)
Type of this field. |
void |
setType(SimpleType type)
Set the type directly to a defined SimpleType. |
void |
setTypeAsDataSource(DataSource dataSource)
The type can also be the another DataSource, which allows you to model nested structures such as XML documents (in fact, XMLTools.loadXMLSchema() models XML schema in this way). |
void |
setUploadFieldName(String uploadFieldName)
Used by the BatchUploader to map a field in an upload file to this dataSourceField. |
void |
setValidators(Validator... validators)
Validators to be applied to this field. |
void |
setValidOperators(OperatorId... validOperators)
List of operators valid on this field. |
void |
setValueMap(Map valueMap)
A ValueMap is a set of legal values for a field. |
void |
setValueMap(String... valueMap)
A ValueMap is a set of legal values for a field. |
void |
setValueXPath(String valueXPath)
XPath expression used to retrieve the field's value. |
void |
setXmlAttribute(Boolean xmlAttribute)
Indicates that DataSource.xmlSerialize should serialize this
value as an XML attribute. |
Methods inherited from class com.smartgwt.client.core.JsObject |
---|
isCreated, setJsObj |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataSourceField()
public DataSourceField(JavaScriptObject jsObj)
public DataSourceField(String name, FieldType type)
public DataSourceField(String name, FieldType type, String title)
public DataSourceField(String name, FieldType type, String title, int length)
public DataSourceField(String name, FieldType type, String title, int length, boolean required)
Method Detail |
---|
public static DataSourceField getOrCreateRef(JavaScriptObject jsObj)
public void setJavaScriptObject(JavaScriptObject jsObj)
public void setAutoGenerated(Boolean autoGenerated)
autoGenerated
- autoGenerated Default value is nullpublic Boolean getAutoGenerated()
public void setCanExport(Boolean canExport)
ListGrid
fields
.
canExport
- canExport Default value is nullpublic Boolean getCanExport()
ListGrid
fields
.
public void setCanFilter(Boolean canFilter)
canFilter
- canFilter Default value is nullSearchForm.setShowFilterFieldsOnly(java.lang.Boolean)
,
SearchForm.setCanEditFieldAttribute(java.lang.String)
public Boolean getCanFilter()
SearchForm.getShowFilterFieldsOnly()
,
SearchForm.getCanEditFieldAttribute()
public void setCanSave(Boolean canSave)
If set to false
, this field
will default to being non-editable in standard editing components (DynamicForm
,
editable ListGrid
), but will be editable when displayed for filtering purposes
only (in a SearchForm
or ListGrid filter editor
. If canEdit
is explicitly specified it will take precedence over this
client-side behavior, but the server will still enforce the no-save policy (described below).
NOTE: If you are using
Smart GWT Server and have specified canSave: false
for a field in a DataSource definition
(.ds.xml
file), this is enforced on the server. This means that we will strip out any attempt to set the
value of such a field before trying to process any update or add request, similar to what happens when a field-level declarative security check
fails.
canSave
- canSave Default value is nullComponentBinding overview and related methods
public Boolean getCanSave()
If set to false
, this field
will default to being non-editable in standard editing components (DynamicForm
,
editable ListGrid
), but will be editable when displayed for filtering purposes
only (in a SearchForm
or ListGrid filter editor
. If canEdit
is explicitly specified it will take precedence over this
client-side behavior, but the server will still enforce the no-save policy (described below).
NOTE: If you are using
Smart GWT Server and have specified canSave: false
for a field in a DataSource definition
(.ds.xml
file), this is enforced on the server. This means that we will strip out any attempt to set the
value of such a field before trying to process any update or add request, similar to what happens when a field-level declarative security check
fails.
ComponentBinding overview and related methods
public void setCanSortClientOnly(Boolean canSortClientOnly)
canSortClientOnly
- canSortClientOnly Default value is falsepublic Boolean getCanSortClientOnly()
public void setCanView(Boolean canView)
dataBoundComponent
, it will be droppedcanEdit
, no updates to the field are allowed
from the client. If you explicitly add a value for the field to, eg, a record you are passing to DataSource.updateData
, the server will strip the value out of the
record before processing the update request. canView:false
is not the same thing as hidden
. Use canView:false
when you want to prevent
the client from ever seeing a field's definition or values; use hidden:true
if it is fine from a security
perspective that a field's definition and values are sent to the browser, but the field should not by default appear in
user interface elements (but could do in some cases, like a special screen for advanced users or administrators, for
example). Note that this property must be set explicitly to false to have an effect; a null or undefined setting is treated the same as true.
This property is used to implement field-level view security: failing a viewRequiresAuthentication
, viewRequiresRole
or viewRequires
test is equivalent to setting
canView:false
on the field (and, indeed, from the client's perspective, the field has had
canView:false
set).
canView
- canView Default value is nullComponentBinding overview and related methods
public Boolean getCanView()
dataBoundComponent
, it will be droppedcanEdit
, no updates to the field are allowed
from the client. If you explicitly add a value for the field to, eg, a record you are passing to DataSource.updateData
, the server will strip the value out of the
record before processing the update request. canView:false
is not the same thing as hidden
. Use canView:false
when you want to prevent
the client from ever seeing a field's definition or values; use hidden:true
if it is fine from a security
perspective that a field's definition and values are sent to the browser, but the field should not by default appear in
user interface elements (but could do in some cases, like a special screen for advanced users or administrators, for
example). Note that this property must be set explicitly to false to have an effect; a null or undefined setting is treated the same as true.
This property is used to implement field-level view security: failing a viewRequiresAuthentication
, viewRequiresRole
or viewRequires
test is equivalent to setting
canView:false
on the field (and, indeed, from the client's perspective, the field has had
canView:false
set).
ComponentBinding overview and related methods
public void setChildrenProperty(Boolean childrenProperty)
childrenField
to this
field's name.
childrenProperty
- childrenProperty Default value is falseDataSource.setChildrenField(java.lang.String)
,
DataSourceRelations overview and related methods
public Boolean getChildrenProperty()
childrenField
to this
field's name.
DataSource.getChildrenField()
,
DataSourceRelations overview and related methods
public void setChildTagName(String childTagName)
multiple:"true"
, controls the name of
the XML tag used for each subelement during DataSource.xmlSerialize
. If unset, the default tag name is "value" for a field of simple type, and for a field of
DataSource type, is the tagName or ID of the DataSource (as though xmlSerialize()
were called on the child
DataSource).
childTagName
- . See String
. Default value is nullComponentSchema overview and related methods
public String getChildTagName()
multiple:"true"
, controls the name of
the XML tag used for each subelement during DataSource.xmlSerialize
. If unset, the default tag name is "value" for a field of simple type, and for a field of
DataSource type, is the tagName or ID of the DataSource (as though xmlSerialize()
were called on the child
DataSource).
String
ComponentSchema overview and related methods
public void setCustomSQL(Boolean customSQL)
serverType
"sql" or "hibernate",
indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with
custom queries
. Having marked a field as customSQL
you
can refer to it via $criteria.fieldName or $values.fieldName in customized queries.
The following are
situations where you would not use customSQL
:
includeFrom
instead sqlStorageStrategy
for
some common cases, or customSelectExpression
, customUpdateExpression
and customInsertExpression
for full customization excludeCriteriaFields
instead Use customSQL in situations like:
operationIds
, and the field is only used in some of them; in
that case, consider using customFields
to
selectively re-introduce SQL generation for the field only in operations where it's used.
customSQL
- customSQL Default value is nullpublic Boolean getCustomSQL()
serverType
"sql" or "hibernate",
indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with
custom queries
. Having marked a field as customSQL
you
can refer to it via $criteria.fieldName or $values.fieldName in customized queries.
The following are
situations where you would not use customSQL
:
includeFrom
instead sqlStorageStrategy
for
some common cases, or customSelectExpression
, customUpdateExpression
and customInsertExpression
for full customization excludeCriteriaFields
instead Use customSQL in situations like:
operationIds
, and the field is only used in some of them; in
that case, consider using customFields
to
selectively re-introduce SQL generation for the field only in operations where it's used.
public void setDateFormatter(DateDisplayFormat dateFormatter)
DynamicForm
or ListGrid
it will be respected (See dateFormatter
and dateFormatter
). Note that this property is also honored when exporting directly to Excel spreadsheets (ie, when using XLS or XLSX/OOXML form, not CSV); "date" and "datetime" fields with this property set will deliver real dates and formatting information to Excel, rather than formatted strings or unformatted dates.
Note : This is an advanced setting
dateFormatter
- dateFormatter Default value is nullAppearance overview and related methods
public DateDisplayFormat getDateFormatter()
DynamicForm
or ListGrid
it will be respected (See dateFormatter
and dateFormatter
). Note that this property is also honored when exporting directly to Excel spreadsheets (ie, when using XLS or XLSX/OOXML form, not CSV); "date" and "datetime" fields with this property set will deliver real dates and formatting information to Excel, rather than formatted strings or unformatted dates.
Appearance overview and related methods
public void setDecimalPad(Integer decimalPad)
For example, a field value of 343.1, 343.104 and 343.09872677 would all be shown as 343.10 if decimalPad is 2.
The original unpadded value is always shown when the value is edited.
decimalPad
- decimalPad Default value is nullAppearance overview and related methods
public Integer getDecimalPad()
For example, a field value of 343.1, 343.104 and 343.09872677 would all be shown as 343.10 if decimalPad is 2.
The original unpadded value is always shown when the value is edited.
Appearance overview and related methods
public void setDecimalPrecision(Integer decimalPrecision)
For example, with decimalPrecision 3, if the field value is 343.672677, 343.673 is shown.
If the value is 125.2, 125.2 is shown -
decimalPrecision will not cause extra zeros to be added. Use decimalPad
for this.
A number if always shown with its original precision when edited.
decimalPrecision
- decimalPrecision Default value is nullAppearance overview and related methods
public Integer getDecimalPrecision()
For example, with decimalPrecision 3, if the field value is 343.672677, 343.673 is shown.
If the value is 125.2, 125.2 is shown -
decimalPrecision will not cause extra zeros to be added. Use decimalPad
for this.
A number if always shown with its original precision when edited.
Appearance overview and related methods
public void setDetail(Boolean detail)
DataBoundComponent
.
Detail fields won't be shown by default in a DataBoundComponent where showDetailFields
is false. This allows for some
DataBound components, like a ListGrid
, to show a summary view of records which
displays only the most commonly viewed fields by default, while other DataBoundComponents, like a DetailViewer
, show all fields by default.
In addition, the formItem.showIf
property is supported in multiple components
for conditional visibility - see for example ListGridField.showIf
and FormItem.showIf
).
detail
- detail Default value is falseComponentBinding overview and related methods
public Boolean getDetail()
DataBoundComponent
.
Detail fields won't be shown by default in a DataBoundComponent where showDetailFields
is false. This allows for some
DataBound components, like a ListGrid
, to show a summary view of records which
displays only the most commonly viewed fields by default, while other DataBoundComponents, like a DetailViewer
, show all fields by default.
In addition, the formItem.showIf
property is supported in multiple components
for conditional visibility - see for example ListGridField.showIf
and FormItem.showIf
).
ComponentBinding overview and related methods
public void setEscapeHTML(Boolean escapeHTML)
If set, this property will be picked up by components bound to this dataSource, notifying them that any HTML characters should be escaped when displaying values for this field.
escapeHTML
- escapeHTML Default value is nullListGridField.setEscapeHTML(java.lang.Boolean)
public Boolean getEscapeHTML()
If set, this property will be picked up by components bound to this dataSource, notifying them that any HTML characters should be escaped when displaying values for this field.
ListGridField.getEscapeHTML()
public void setExportTitle(String exportTitle)
exportTitle
- . See String
. Default value is nullpublic String getExportTitle()
String
public void setForeignKey(String foreignKey)
The format of foreignKey
is
<dataSourceId>.<fieldName>
.
For a foreignKey within the same dataSource, you can omit the dataSourceId
and just specify <fieldName>
.
For example, to create a tree relationship within a DataSource:
DataSource.create({ ID:"supplyItem", fields : [ {name:"itemId", type:"sequence", primaryKey:true}, {name:"parentId", type:"integer", foreignKey:"itemId"}, ... ] });
foreignKey
declarations also allow other automatic behaviors by
DataBoundComponents
, such as ListGrid.fetchRelatedData
.
For SQLDataSources foreign keys can be automatically discovered from SQL tables if
autoDeriveSchema
is set.
foreignKey
- . See String
. Default value is falsecom.smartgwt.client.docs.serverds.DataSourceField#joinType
,
DataSourceRelations overview and related methods
public String getForeignKey()
The format of foreignKey
is
<dataSourceId>.<fieldName>
.
For a foreignKey within the same dataSource, you can omit the dataSourceId
and just specify <fieldName>
.
For example, to create a tree relationship within a DataSource:
DataSource.create({ ID:"supplyItem", fields : [ {name:"itemId", type:"sequence", primaryKey:true}, {name:"parentId", type:"integer", foreignKey:"itemId"}, ... ] });
foreignKey
declarations also allow other automatic behaviors by
DataBoundComponents
, such as ListGrid.fetchRelatedData
.
For SQLDataSources foreign keys can be automatically discovered from SQL tables if
autoDeriveSchema
is set.
String
com.smartgwt.client.docs.serverds.DataSourceField#joinType
,
DataSourceRelations overview and related methods
public void setGroup(String group)
ComponentSchema
, indicates what group to place the property in when editing
in Visual Builder.
group
- . See String
. Default value is nullComponentSchema overview and related methods
public String getGroup()
ComponentSchema
, indicates what group to place the property in when editing
in Visual Builder.
String
ComponentSchema overview and related methods
public void setHidden(Boolean hidden)
See detail
for fields that should be hidden in a summary view such as a ListGrid
,
but still available to the user.
NOTE: This property is not a security setting - data for hidden
fields is still delivered to the client, it just isn't shown to the user. If you wish to make sure that only
appropriate data reaches the client, use outputs
,
canView
:false on the field, or a field-level declarative
security setting like viewRequiresRole
.
hidden
- hidden Default value is falseComponentBinding overview and related methods
public Boolean getHidden()
See detail
for fields that should be hidden in a summary view such as a ListGrid
,
but still available to the user.
NOTE: This property is not a security setting - data for hidden
fields is still delivered to the client, it just isn't shown to the user. If you wish to make sure that only
appropriate data reaches the client, use outputs
,
canView
:false on the field, or a field-level declarative
security setting like viewRequiresRole
.
ComponentBinding overview and related methods
public void setIgnore(Boolean ignore)
ignore
- ignore Default value is falseComponentBinding overview and related methods
public Boolean getIgnore()
ComponentBinding overview and related methods
public void setInapplicable(Boolean inapplicable)
ComponentSchema
, a field inherited
from another schema can be redeclared with this property
set in order to indicate that the property should not be used. This is primarily used to influence VisualBuilder
. For simple type properties, this avoids the property appearing in the
Component Editor.
For fields that hold subcomponents, this prevents inappropriate drag and drop. For example, a
custom class called MyDialog
may automatically create a series of children, and not allow arbitrary other
children to be added. In this case, the inherited property children
should be marked inapplicable in order to prevent arbitrary components being dropped onto a
MyDialog
instance.
inapplicable
- inapplicable Default value is nullComponentSchema overview and related methods
public Boolean getInapplicable()
ComponentSchema
, a field inherited
from another schema can be redeclared with this property
set in order to indicate that the property should not be used. This is primarily used to influence VisualBuilder
. For simple type properties, this avoids the property appearing in the
Component Editor.
For fields that hold subcomponents, this prevents inappropriate drag and drop. For example, a
custom class called MyDialog
may automatically create a series of children, and not allow arbitrary other
children to be added. In this case, the inherited property children
should be marked inapplicable in order to prevent arbitrary components being dropped onto a
MyDialog
instance.
ComponentSchema overview and related methods
public void setLength(Integer length)
NOTE: For DataSources of type
"sql", this property has a bearing on the type of column we use when the underlying table is created by a DataSource
import
in the Admin
Console
. Below a certain length (which is database-specific, see below), we use standard VARCHAR
columns; above that length, we use an alternate strategy (again, database-specific). For these long fields, we
sometimes also generate different SQL for "update" and "add" operations, using JDBC "?" replacement parameters rather
than embedding values directly in the generated SQL; whether or not this is done depends entirely on what the
underlying database product and/or JDBC driver will allow.
Table of field length limits for supported
databases:
Database product | VARCHAR limit * | Type used above limit |
HSQLDB | None | - |
IBM DB2 | 4000 | CLOB |
Firebird | 32767 | BLOB with subtype 1 |
Informix | 255 / 32739 | LVARCHAR / TEXT ** |
Microsoft SQL Server | 8000 | TEXT |
MySQL | 255 / 65535 / 16M | TEXT / MEDIUMTEXT / LONGTEXT *** |
Oracle | 4000 | CLOB |
PostgreSQL | 4000 | TEXT |
** Informix has a limit of just 255 characters for VARCHAR, but has a native LVARCHAR type which supports nearly 32K characters without needing to fall back on long datatypes. Therefore, with that one product, we have two thresholds for a change in storage type.
*** MySQL has a limit of 255 characters for VARCHAR, 65,535 characters for TEXT and 16,777,215 for MEDIUMTEXT; therefore, with that one product, we have three thresholds for a change in storage type.
length
- length Default value is nullpublic Integer getLength()
NOTE: For DataSources of type
"sql", this property has a bearing on the type of column we use when the underlying table is created by a DataSource
import
in the Admin
Console
. Below a certain length (which is database-specific, see below), we use standard VARCHAR
columns; above that length, we use an alternate strategy (again, database-specific). For these long fields, we
sometimes also generate different SQL for "update" and "add" operations, using JDBC "?" replacement parameters rather
than embedding values directly in the generated SQL; whether or not this is done depends entirely on what the
underlying database product and/or JDBC driver will allow.
Table of field length limits for supported
databases:
Database product | VARCHAR limit * | Type used above limit |
HSQLDB | None | - |
IBM DB2 | 4000 | CLOB |
Firebird | 32767 | BLOB with subtype 1 |
Informix | 255 / 32739 | LVARCHAR / TEXT ** |
Microsoft SQL Server | 8000 | TEXT |
MySQL | 255 / 65535 / 16M | TEXT / MEDIUMTEXT / LONGTEXT *** |
Oracle | 4000 | CLOB |
PostgreSQL | 4000 | TEXT |
** Informix has a limit of just 255 characters for VARCHAR, but has a native LVARCHAR type which supports nearly 32K characters without needing to fall back on long datatypes. Therefore, with that one product, we have two thresholds for a change in storage type.
*** MySQL has a limit of 255 characters for VARCHAR, 65,535 characters for TEXT and 16,777,215 for MEDIUMTEXT; therefore, with that one product, we have three thresholds for a change in storage type.
public void setMultiple(Boolean multiple)
XML or JSON data
is singular, it will be wrapped in an Array.
Specifically for XML serialization and deserialization, multiple:true
behaves
similarly to the
SOAP array idiom, that is,
there will be a "wrapper element" named after the field name, whose contents will be several
elements of the specified field.type
.
For example, members
is declared with type:"Canvas",
multiple:true
. The correct XML format is thus:
<VLayout> <members> <Canvas ID="myCanvas" ... /> <ListGrid ID="myGrid" .../> <Toolstrip ID="myToolStrip" ... /> </members> </VLayout>
See childTagName
for customizing the tagName used for
subelements.
multiple
- multiple Default value is nullComponentSchema overview and related methods
public Boolean getMultiple()
XML or JSON data
is singular, it will be wrapped in an Array.
Specifically for XML serialization and deserialization, multiple:true
behaves
similarly to the
SOAP array idiom, that is,
there will be a "wrapper element" named after the field name, whose contents will be several
elements of the specified field.type
.
For example, members
is declared with type:"Canvas",
multiple:true
. The correct XML format is thus:
<VLayout> <members> <Canvas ID="myCanvas" ... /> <ListGrid ID="myGrid" .../> <Toolstrip ID="myToolStrip" ... /> </members> </VLayout>
See childTagName
for customizing the tagName used for
subelements.
ComponentSchema overview and related methods
public void setName(String name)
The field name is also the property in each DataSource record which holds the value for this field.
Must be unique across all fields within the DataSource as well as a valid JavaScript identifier, as specified by ECMA-262 Section 7.6.
NOTE: The StringUtil.isValidID() function can be used to test whether a name is a valid JavaScript identifier.
name
- . See String
. Default value is nullBasics overview and related methods
public String getName()
The field name is also the property in each DataSource record which holds the value for this field.
Must be unique across all fields within the DataSource as well as a valid JavaScript identifier, as specified by ECMA-262 Section 7.6.
NOTE: The StringUtil.isValidID() function can be used to test whether a name is a valid JavaScript identifier.
String
Basics overview and related methods
public void setNillable(Boolean nillable)
xsi:nil
being used to transmit the value when serializing
to XML, like so:
<book> <title>Beowulf</title> <author xsi:nil="true"/> </book>If
nillable
is not set, no XML element will be generated for
the explicit null value.
nillable
- nillable Default value is nullpublic Boolean getNillable()
xsi:nil
being used to transmit the value when serializing
to XML, like so:
<book> <title>Beowulf</title> <author xsi:nil="true"/> </book>If
nillable
is not set, no XML element will be generated for
the explicit null value.
public void setPrimaryKey(Boolean primaryKey)
primaryKey
field per DataSource, and ideally this field should be of type
"sequence". A DataSource that can only perform the "fetch" operation does not require a primaryKey. If a DataSource allows modification of DataSource records through add, update and remove DataSource operations, one or more fields must be marked as the primary key.
Smart GWT requires a primary key value to uniquely identify records when communicating updates or deletions to the server. There is no requirement that the primaryKey field be mapped to an actual "primary key" in your object model, web service, or database (though this is the most obvious and natural thing to do, of course). The only requirement is that the combined values of the primaryKey fields be unique for a given browser instance for the lifetime of the page.
If
using Smart GWT's SQL engine
and generating SQL tables using the Admin Console
, the table column generated from a primaryKey field will have a
unique constraint applied in the database table and, if the field is of type "sequence", the database column will also
be created as an "identity column" in those databases that implement sequence-type handling with identity columns.
primaryKey
- primaryKey Default value is falseDataSourceRelations overview and related methods
public Boolean getPrimaryKey()
primaryKey
field per DataSource, and ideally this field should be of type
"sequence". A DataSource that can only perform the "fetch" operation does not require a primaryKey. If a DataSource allows modification of DataSource records through add, update and remove DataSource operations, one or more fields must be marked as the primary key.
Smart GWT requires a primary key value to uniquely identify records when communicating updates or deletions to the server. There is no requirement that the primaryKey field be mapped to an actual "primary key" in your object model, web service, or database (though this is the most obvious and natural thing to do, of course). The only requirement is that the combined values of the primaryKey fields be unique for a given browser instance for the lifetime of the page.
If
using Smart GWT's SQL engine
and generating SQL tables using the Admin Console
, the table column generated from a primaryKey field will have a
unique constraint applied in the database table and, if the field is of type "sequence", the database column will also
be created as an "identity column" in those databases that implement sequence-type handling with identity columns.
DataSourceRelations overview and related methods
public void setPropertiesOnly(Boolean propertiesOnly)
ComponentSchema
for fields that contain other components, this flag
suppresses auto-construction for subcomponents that appear under this field.
For example, the VLayout
schema sets this for its members
property, so that when a VLayout is constructed via XML as follows:
<VLayout> <members> <ListGrid ID="myGrid" .../> <Toolstrip ID="myToolStrip" ... /> </members> </VLayout>The ListGrid and ToolStrip do not construct themselves automatically. Instead, the VLayout receives the properties of the ListGrid and ToolStrip as ordinary JavaScript Objects, with the special property
_constructor
set to the name of the class that should be
constructed.
propertiesOnly
- propertiesOnly Default value is nullComponentSchema overview and related methods
public Boolean getPropertiesOnly()
ComponentSchema
for fields that contain other components, this flag
suppresses auto-construction for subcomponents that appear under this field.
For example, the VLayout
schema sets this for its members
property, so that when a VLayout is constructed via XML as follows:
<VLayout> <members> <ListGrid ID="myGrid" .../> <Toolstrip ID="myToolStrip" ... /> </members> </VLayout>The ListGrid and ToolStrip do not construct themselves automatically. Instead, the VLayout receives the properties of the ListGrid and ToolStrip as ordinary JavaScript Objects, with the special property
_constructor
set to the name of the class that should be
constructed.
ComponentSchema overview and related methods
public void setRequired(Boolean required)
Note that required
should not be set for a server-generated field, such as a sequence, or validation will fail on the client.
required
- required Default value is nullpublic Boolean getRequired()
Note that required
should not be set for a server-generated field, such as a sequence, or validation will fail on the client.
public void setRootValue(Object rootValue)
Note that the rootValue may be overridden on a specific ResultTree instance by setting rootNode
, or if the ResultTree is auto-generated by a TreeGrid
, by setting treeRootValue
. This allows a component to navigate a subtree of the hierarchical data from this dataSource starting at
a particular node.
rootValue
- rootValue Default value is nullDataSourceRelations overview and related methods
public Object getRootValue()
Note that the rootValue may be overridden on a specific ResultTree instance by setting rootNode
, or if the ResultTree is auto-generated by a TreeGrid
, by setting treeRootValue
. This allows a component to navigate a subtree of the hierarchical data from this dataSource starting at
a particular node.
DataSourceRelations overview and related methods
public void setSequenceName(String sequenceName)
serverType:"sql"
with a field of
type "sequence", the name of the SQL sequence that should be used when inserting new records into this table. Note that this is never required for SQL tables that are generated from Smart GWT DataSources (a default sequence name of tableName + "_" + columnName is chosen), and is never required for databases where inserting null into a sequence column is sufficient (MySQL, SQL Server, DB2 and others).
You would only need to set sequenceName if you are integrating with a pre-existing table stored in a database where the sequence must be named for insertion to work (Oracle, Postgres, Firebird) OR you are trying to use the same sequence across multiple DataSources.
sequenceName
- . See String
. Default value is nullSqlDataSource overview and related methods
public String getSequenceName()
serverType:"sql"
with a field of
type "sequence", the name of the SQL sequence that should be used when inserting new records into this table. Note that this is never required for SQL tables that are generated from Smart GWT DataSources (a default sequence name of tableName + "_" + columnName is chosen), and is never required for databases where inserting null into a sequence column is sufficient (MySQL, SQL Server, DB2 and others).
You would only need to set sequenceName if you are integrating with a pre-existing table stored in a database where the sequence must be named for insertion to work (Oracle, Postgres, Firebird) OR you are trying to use the same sequence across multiple DataSources.
String
SqlDataSource overview and related methods
public void setShowFileInline(Boolean showFileInline)
showFileInline
- showFileInline Default value is nullpublic Boolean getShowFileInline()
public void setSummaryValueTitle(String summaryValueTitle)
title
summaries will show the
title
for the field.
summaryValueTitle
- . See String
. Default value is nullpublic String getSummaryValueTitle()
title
summaries will show the
title
for the field.
String
public void setTimeFormatter(TimeDisplayFormat timeFormatter)
ListGrid
or DynamicForm
, any dates displayed in this field will be formatted as times using the
appropriate format. This is most commonly only applied to fields specified as type "time"
though if no
explicit dateFormatter
is specified it will be
respected for other fields as well.
See timeFormatter
and timeFormatter
for more
information.
Note : This is an advanced setting
timeFormatter
- timeFormatter Default value is nullAppearance overview and related methods
public TimeDisplayFormat getTimeFormatter()
ListGrid
or DynamicForm
, any dates displayed in this field will be formatted as times using the
appropriate format. This is most commonly only applied to fields specified as type "time"
though if no
explicit dateFormatter
is specified it will be
respected for other fields as well.
See timeFormatter
and timeFormatter
for more
information.
Appearance overview and related methods
public void setTitle(String title)
This will be picked up by DataBound components and other views over this DataSource.
Note this property frequently does not need to be set since autoDeriveTitles
(on by default) usually picks an appropriate
user-visible title if you have a reasonable naming convention for your field names.
Note that if this field is being
displayed in a ListGrid
bound to this dataSource, the headerTitle
attribute may be used to specify a different
string for display in the listGrid column header.
title
- . See String
. Default value is nullComponentBinding overview and related methods
public String getTitle()
This will be picked up by DataBound components and other views over this DataSource.
Note this property frequently does not need to be set since autoDeriveTitles
(on by default) usually picks an appropriate
user-visible title if you have a reasonable naming convention for your field names.
Note that if this field is being
displayed in a ListGrid
bound to this dataSource, the headerTitle
attribute may be used to specify a different
string for display in the listGrid column header.
String
ComponentBinding overview and related methods
public void setType(FieldType type)
Field type may imply automatic validators (for example, an integer field cannot accept the value "foo"). Field type also affects the default behaviors of DataBound components, for example, if a field is declared as type "date", components that edit that field will automatically choose a date-editing interface with pop-up date picker.
type
- type Default value is nullBasics overview and related methods
public FieldType getType()
Field type may imply automatic validators (for example, an integer field cannot accept the value "foo"). Field type also affects the default behaviors of DataBound components, for example, if a field is declared as type "date", components that edit that field will automatically choose a date-editing interface with pop-up date picker.
Basics overview and related methods
public void setUploadFieldName(String uploadFieldName)
BatchUploader
to map a field in an upload file to this dataSourceField.
This is only necessary if the dataSourceField's name and title differ from the name of the field in the upload file
(Smart GWT will automatically map upload fields using the dataSourceField's title, if possible, if it does not get a
direct match on field name).
uploadFieldName
- . See String
. Default value is nullpublic String getUploadFieldName()
BatchUploader
to map a field in an upload file to this dataSourceField.
This is only necessary if the dataSourceField's name and title differ from the name of the field in the upload file
(Smart GWT will automatically map upload fields using the dataSourceField's title, if possible, if it does not get a
direct match on field name).
String
public void setValidators(Validator... validators)
Validators are applied whenever there is an attempt to save changes to a field.
For the available set of built-in validators, and how to define a custom validator, see the Validator
class.
validators
- validators Default value is nullValidator
,
Validation overview and related methods
public Validator[] getValidators()
Validators are applied whenever there is an attempt to save changes to a field.
For the available set of built-in validators, and how to define a custom validator, see the Validator
class.
Validator
,
Validation overview and related methods
public void setValidOperators(OperatorId... validOperators)
If not specified, all operators that are valid for the field type are allowed.
validOperators
- validOperators Default value is nullpublic OperatorId[] getValidOperators()
If not specified, all operators that are valid for the field type are allowed.
public void setValueMap(Map valueMap)
The valueMap can be specified as either an Array of legal values, or as an Object where each property maps a stored value to a user-displayable value.
To enforce that a field should be constrained to only the values in the valueMap, either
declare field.type
as "enum", or use a
ValidatorType
of "isOneOf" with explicitly listed values. Otherwise,
although a normal SelectItem
control will only allow values from the
valueMap to be
entered, other controls such as a ComboBox
will allow other
values
to be entered.
In XML, a valueMap that specifies only a list of legal values is specified as follows:
<valueMap> <value>Pens & Pencils</value> <value>Stationery</value> <value>Computer Products</value> <value>Furniture</value> <value>Misc</value> </valueMap>A ValueMap that specifies stored values mapped to user-visible values is specified as follows:
<valueMap> <value ID="1">Pens & Pencils</value> <value ID="2">Stationery</value> <value ID="3">Computer Products</value> <value ID="4">Furniture</value> <value ID="5">Misc</value> </valueMap>
valueMap
- valueMap Default value is nullpublic Map getValueMap()
The valueMap can be specified as either an Array of legal values, or as an Object where each property maps a stored value to a user-displayable value.
To enforce that a field should be constrained to only the values in the valueMap, either
declare field.type
as "enum", or use a
ValidatorType
of "isOneOf" with explicitly listed values. Otherwise,
although a normal SelectItem
control will only allow values from the
valueMap to be
entered, other controls such as a ComboBox
will allow other
values
to be entered.
In XML, a valueMap that specifies only a list of legal values is specified as follows:
<valueMap> <value>Pens & Pencils</value> <value>Stationery</value> <value>Computer Products</value> <value>Furniture</value> <value>Misc</value> </valueMap>A ValueMap that specifies stored values mapped to user-visible values is specified as follows:
<valueMap> <value ID="1">Pens & Pencils</value> <value ID="2">Stationery</value> <value ID="3">Computer Products</value> <value ID="4">Furniture</value> <value ID="5">Misc</value> </valueMap>
public void setValueXPath(String valueXPath)
This XPath expression will be evaluated in the scope of the record objects selected by
the recordXPath
. For XML data
(dataFormat:"xml"
) this means a call to
XMLTools.selectString
passing the selected XML element. For JSON
data
(dataFormat:"json"
), this means a call to
XMLTools.selectObjects
passing the selected JSON object.
In the absence of a valueXPath
, for JSON data the value for the field will
be the value of the same-named property in the record object selected by
recordXPath
.
For XML data, the value will be the attribute or subelement named after the field name. For example, for a field "author" on a record element <book>, the following structures require no valueXPath:
<book author="Mark Jones"/> <book> <author>Mark Jones</author> </book>
If valueXPath
is not required for your field because of the default handling
described above, don't specify it, as it's slightly slower.
To learn about XPath, try the following search: http://www.google.com/search?q=xpath+tutorial
Using valueXPath with the Smart GWT server
If you're using the Smart GWT server to return data via the DSResponse object (or indirectly doing so using DataSource DMI), the valueXPath you specify on the DataSource fields will be applied to the data you return via the JXPath library.
If you are returning Java Beans as your DSResponse data, normally each dataSource field
receives the value of the same-named Java Bean property, that is, a field "zipCode" is
populated by looking for "getZipCode()" on the objects passed as DSResponse data. You can
use valueXPath
to retrieve properties from subobjects, so long as a chain of
getter methods exists that corresponds to the valueXPath. For example, a valueXPath of
"address/zipCode" expects to call "getAddress()" on the bean(s) passed to
DSResponse.setData(), followed by "getZipCode()" on whatever object "getAddress()" returns.
When you are saving data, the inbound DSRequest values, available as a Java Map, will use just dataSource field names as Map keys, not the valueXPath used to derive them. However, to achieve bidirectional valueXPath binding, you can use the server-side method dataSource.setProperties() to use the valueXPath when setting properties on your server object model. When applied as a setter, an XPath like "address/zipCode" attempts "getAddress()" followed by "setZipCode()" on the returned object. JXPath also has some ability to auto-create intervening objects if they are missing, such as auto-creating an "address" subobject when applying "address/zipCode" as a valueXPath.
See the JXPath library documentation for complete details, including other types of server object models supported, such as server-side XML.
valueXPath
- . See XPathExpression
. Default value is nullClientDataIntegration overview and related methods
,
XPath Binding Examplepublic String getValueXPath()
This XPath expression will be evaluated in the scope of the record objects selected by
the recordXPath
. For XML data
(dataFormat:"xml"
) this means a call to
XMLTools.selectString
passing the selected XML element. For JSON
data
(dataFormat:"json"
), this means a call to
XMLTools.selectObjects
passing the selected JSON object.
In the absence of a valueXPath
, for JSON data the value for the field will
be the value of the same-named property in the record object selected by
recordXPath
.
For XML data, the value will be the attribute or subelement named after the field name. For example, for a field "author" on a record element <book>, the following structures require no valueXPath:
<book author="Mark Jones"/> <book> <author>Mark Jones</author> </book>
If valueXPath
is not required for your field because of the default handling
described above, don't specify it, as it's slightly slower.
To learn about XPath, try the following search: http://www.google.com/search?q=xpath+tutorial
Using valueXPath with the Smart GWT server
If you're using the Smart GWT server to return data via the DSResponse object (or indirectly doing so using DataSource DMI), the valueXPath you specify on the DataSource fields will be applied to the data you return via the JXPath library.
If you are returning Java Beans as your DSResponse data, normally each dataSource field
receives the value of the same-named Java Bean property, that is, a field "zipCode" is
populated by looking for "getZipCode()" on the objects passed as DSResponse data. You can
use valueXPath
to retrieve properties from subobjects, so long as a chain of
getter methods exists that corresponds to the valueXPath. For example, a valueXPath of
"address/zipCode" expects to call "getAddress()" on the bean(s) passed to
DSResponse.setData(), followed by "getZipCode()" on whatever object "getAddress()" returns.
When you are saving data, the inbound DSRequest values, available as a Java Map, will use just dataSource field names as Map keys, not the valueXPath used to derive them. However, to achieve bidirectional valueXPath binding, you can use the server-side method dataSource.setProperties() to use the valueXPath when setting properties on your server object model. When applied as a setter, an XPath like "address/zipCode" attempts "getAddress()" followed by "setZipCode()" on the returned object. JXPath also has some ability to auto-create intervening objects if they are missing, such as auto-creating an "address" subobject when applying "address/zipCode" as a valueXPath.
See the JXPath library documentation for complete details, including other types of server object models supported, such as server-side XML.
XPathExpression
ClientDataIntegration overview and related methods
,
XPath Binding Examplepublic void setXmlAttribute(Boolean xmlAttribute)
DataSource.xmlSerialize
should serialize this
value as an XML attribute. Note this does not need to be declared in order for DataSource records to be derived from XML data: a field will be populated with either an attribute or subelement with matching name.
xmlAttribute
- xmlAttribute Default value is nullComponentSchema overview and related methods
public Boolean getXmlAttribute()
DataSource.xmlSerialize
should serialize this
value as an XML attribute. Note this does not need to be declared in order for DataSource records to be derived from XML data: a field will be populated with either an attribute or subelement with matching name.
ComponentSchema overview and related methods
public void exportForceText()
DataSource.recordsAsText
, what approach (if any)
should be used to force values to be intepreted as text instead of heuristically parsed as dates, times or other
structured types.
public void setPluralTitle(String pluralTitle)
pluralTitle
- the plural titlepublic String getPluralTitle()
public void setType(SimpleType type)
type
- the SimpleTypepublic void setValueMap(String... valueMap)
The valueMap can be specified as either an Array of legal values, or as an Object where each property maps a stored value to a user-displayable value.
To
enforce that a field should be constrained to only the values in the valueMap, either
declare field.type
as "enum", or use a
ValidatorType
of "isOneOf" with explicitly listed values. Otherwise,
although a normal
SelectItem
control will only allow values from the valueMap to be
entered, other controls such as a ComboBox
will allow other
values
to be entered.
In XML, a valueMap that specifies only a list of legal values is specified as follows:
<valueMap> <value>Pens & Pencils</value> <value>Stationery</value> <value>Computer Products</value> <value>Furniture</value> <value>Misc</value> </valueMap>A ValueMap that specifies stored values mapped to user-visible values is specified as follows:
<valueMap> <value ID="1">Pens & Pencils</value> <value ID="2">Stationery</value> <value ID="3">Computer Products</value> <value ID="4">Furniture</value> <value ID="5">Misc</value> </valueMap>
valueMap
- valueMap Default value is nullpublic void setEditorType(FormItem editorType)
If unset, a FormItem will be automatically chosen based on the type of the field.
Note: the FormItem passed to setEditorType() is used as a "template" to create a FormItem whenever
a DataBoundComponent needs to show an interface for editing this field. This means you need to
follow special rules:
new MyCustomItem(item.getJsObj());
(complete code sample below).class MyCustomItem extends TextItem { MyCustomItem (JavaScriptObject config) { } MyCustomItem(String name) { setInitHandler(new FormItemInitHandler() { public void onInit(FormItem item) { // correct new MyCustomItem(item.getJsObj()).customMethod(); // incorrect, will throw an error // ((MyCustomItem)item).customMethod(); } } } void customMethod() { ... } } ... myDataSource.setEditorType(new MyCustomItem("field1"));
editorType
- editorType Default value is nullpublic void setReadOnlyEditorType(FormItem editorType)
#setCanEdit,canEdit false
and displayed in an editor component such as a DynamicForm.
This property may also be specified at the type level by specifying
SimpleType.setReadOnlyEditorType()
.
editorType
- editorType Default value is nullpublic void setRootValue(String rootValue)
rootValue
- rootValue Default value is nullpublic void setRootValue(Integer rootValue)
rootValue
- rootValue Default value is nullpublic void setRootValue(Float rootValue)
rootValue
- rootValue Default value is nullpublic void setFieldValueExtractor(FieldValueExtractor extractor)
This is an advanced API for use when a valueXPath
setting is insufficient to derive a field's value, yet an implementation of DataSource.transformResponse(com.smartgwt.client.data.DSResponse, com.smartgwt.client.data.DSRequest, java.lang.Object)
is overkill.
extractor
- the field value extractorpublic void setType(DataSource dataSource)
dataSource
- the data sourcepublic void setTypeAsDataSource(DataSource dataSource)
dataSource
- the data sourcepublic DataSource getTypeAsDataSource()
public static DataSourceField[] convertToDataSourceFieldArray(JavaScriptObject nativeArray)
public void setSummaryFunction(SummaryFunctionType summaryFunction)
showGridSummary
or showGroupSummary
is true, this attribute can be used to
specify an explicit SummaryFunction
for calculating the summary value to display.
summaryFunction
- summaryFunction Default value is nullpublic void setSummaryFunction(String summaryFunction)
showGridSummary
or showGroupSummary
is true, this attribute can be used to
specify an summary function registered via com.smartgwt.client.data.SimpleType#registerSummaryFunction()
for calculating the summary value to display.
summaryFunction
- summaryFunction Default value is nullpublic SummaryFunctionType getSummaryFunction()
showGridSummary
or showGroupSummary
is true, this attribute can be used to
specify an explicit SummaryFunction
for calculating the summary value to display.
public void setSummaryFunction(SummaryFunction summaryFunction)
showGridSummary
or showGroupSummary
is true, this attribute can be used to
specify an explicit SummaryFunction
for calculating the summary value to display.
summaryFunction
- summaryFunction Default value is nullpublic void setImageHeight(Integer imageHeight)
ViewFileItem
as an editor.
imageHeight
- imageHeight Default value is nullpublic Integer getImageHeight()
ViewFileItem
as an editor.
public void setImageHeight(String imageHeight)
ViewFileItem
as an editor.
imageHeight
- imageHeight Default value is nullpublic String getImageHeightAsString()
ViewFileItem
as an editor.
public void setImageSize(Integer imageSize)
ViewFileItem
as an editor.
imageSize
- imageSize Default value is nullpublic Integer getImageSize()
ViewFileItem
as an editor.
public void setImageSize(String imageSize)
ViewFileItem
as an editor.
imageSize
- imageSize Default value is nullpublic String getImageSizeAsString()
ViewFileItem
as an editor.
public void setImageWidth(Integer imageWidth)
ViewFileItem
as an editor.
imageWidth
- imageWidth Default value is nullpublic Integer getImageWidth()
ViewFileItem
as an editor.
public void setImageWidth(String imageWidth)
ViewFileItem
as an editor.
imageWidth
- imageWidth Default value is nullpublic String getImageWidthAsString()
ViewFileItem
as an editor.
public void setPrompt(String prompt)
prompt
for the header).
prompt
- prompt Default value is nullpublic String getPrompt()
prompt
for the header).
public void setCanEdit(Boolean canEdit)
Set to false
to draw
this field read-only.
This attribute may not effect all dataBoundComponents - the canEditFieldAttribute
may be set at the
component level to look for a different attribute on the dataSourceField, and components allow developers to explicitly
override this default (see canEdit
. canEdit
for example).
Note that this setting only
prevents the user from modifying the field's value through the UI; the value can still be modified programmatically,
and it will still be saved in the normal way. If you wish to prevent a field from being saved, use canSave
:false instead (or in addition).
canEdit
- canEdit Default value is nullsetCanFilter(java.lang.Boolean)
,
setCanSave(java.lang.Boolean)
,
ComponentBinding overview and related methods
public Boolean getCanEdit()
Set to false
to draw
this field read-only.
This attribute may not effect all dataBoundComponents - the canEditFieldAttribute
may be set at the
component level to look for a different attribute on the dataSourceField, and components allow developers to explicitly
override this default (see canEdit
. canEdit
for example).
Note that this setting only
prevents the user from modifying the field's value through the UI; the value can still be modified programmatically,
and it will still be saved in the normal way. If you wish to prevent a field from being saved, use canSave
:false instead (or in addition).
getCanFilter()
,
getCanSave()
,
ComponentBinding overview and related methods
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |