public class DataContext extends DataClass
DataSource
IDs to specific Records
.
To understand how dataContext
is used to automatically populate
DataBoundComponents
, see Canvas.autoPopulateData
.
For example, in SmartGWT:
Record customerRecord = new Record(); customerRecord.setAttribute("customerNumber", "15"); customerRecord.setAttribute("name", "Trish Joiner"); Record employeeRecord = new Record(); employeeRecord.setAttribute("employeeID", "4231"); employeeRecord.setAttribute("name", "Fred Smith"); DataContext dataContext = new DataContext(); dataContext.addMapping("Customer", customerRecord); dataContext.addMapping("Employee", employeeRecord);
factoryCreated, factoryProperties
Constructor and Description |
---|
DataContext() |
DataContext(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
DataContext |
addMapping(DataSource dataSource,
Record record)
Maps the record to the supplied DataSource.
|
DataContext |
addMapping(java.lang.String dataSourceID,
Record record)
Maps the record to the supplied DataSource ID.
|
java.util.Set<java.lang.String> |
getMappedDataSources()
Returns set of all DataSource IDs currently mapped for this DataContext.
|
Record[] |
getMapping(DataSource dataSource)
Returns record(s) mapped to the supplied DataSource.
|
Record[] |
getMapping(java.lang.String dataSourceID)
Returns record mapped to the supplied DataSource ID.
|
java.util.Map<java.lang.String,Record[]> |
getMappings()
Returns all current mappings of DataSource IDs to records for this DataContext.
|
Record |
getMappingSingle(DataSource dataSource)
Returns record mapped to the supplied DataSource.
|
Record |
getMappingSingle(java.lang.String dataSourceID)
Returns record mapped to the supplied DataSource ID.
|
static DataContext |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
Record[] |
removeMapping(DataSource dataSource)
Unmaps the supplied DataSource so it doesn't correspond to any record.
|
Record[] |
removeMapping(java.lang.String dataSourceID)
Unmaps the supplied DataSource ID so it doesn't correspond to any record.
|
DataContext |
setMapping(DataSource dataSource,
Record... record)
Sets the DataSource to map to the supplied record(s).
|
DataContext |
setMapping(java.lang.String dataSourceID,
Record... record)
Sets the DataSource ID to map to the supplied record(s).
|
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
public DataContext()
public DataContext(com.google.gwt.core.client.JavaScriptObject jsObj)
public static DataContext getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public DataContext addMapping(DataSource dataSource, Record record)
dataSource
- record
- DataContext
instance, for
chaining setter callspublic DataContext addMapping(java.lang.String dataSourceID, Record record)
dataSourceID
- record
- DataContext
instance, for
chaining setter callspublic DataContext setMapping(DataSource dataSource, Record... record)
dataSource
- record
- DataContext
instance, for
chaining setter callspublic DataContext setMapping(java.lang.String dataSourceID, Record... record)
dataSource
- record
- DataContext
instance, for
chaining setter callspublic Record[] getMapping(DataSource dataSource)
dataSource
- public Record[] getMapping(java.lang.String dataSourceID)
dataSourceID
- public Record getMappingSingle(DataSource dataSource)
dataSource
- public Record getMappingSingle(java.lang.String dataSourceID)
dataSourceID
- public Record[] removeMapping(DataSource dataSource)
dataSource
- public Record[] removeMapping(java.lang.String dataSourceID)
dataSourceID
- public java.util.Map<java.lang.String,Record[]> getMappings()
public java.util.Set<java.lang.String> getMappedDataSources()