|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Operations
SmartGWT Operations are dynamic, transparent communications made from the client-side
SmartGWT system running in the browser, to the server-side SmartGWT system running in
a servlet engine, or to other non-SmartGWT servers available via HTTP. Operations are
used to load new data or new behavior into a running SmartGWT application. Operations are
also used to save data entered by users, and in general, to get the result of any process
which must be run on the server for security reasons.
RPC Operations
RPC Operations are low-level communications that send and retrieve arbitrary data. RPC
Operations are supported by the RPCManager
class, which when used with the
SmartGWT server, provides Java to JavaScript data
of
basic data structures. The RPCManager also provides a mechanism for client-side code to be
invoked when an operation completes (called a "callback"). RPC Operations are intended for
unstructured data; data that is ultimately destined for display in SmartGWT components
will generally come from DataSource operations.
DataSource Operations and DataBound Components
A 'DataSource Operation'
is an operation that acts on a
DataSource, performing one of the basic actions that makes sense on a set of similar
records: "fetch", "add", "update" or "remove". Unlike RPC operations, DataSource operations
have specific request data and response data, for example, in the "fetch" DataSource
operation, the request data is expected to be search criteria, and the response data is
expected to be a list of matching DataSource records. Although DataSource operations can be
invoked manually from the client, they are generally automatically invoked by DataBound
components.
DataBound Components are components that understand DataSources. Databound components
configured with a DataSource are able to offer complete user interactions without further
configuration (extensive customization is also supported).
For example, given a DataSource, the ListGrid component supports a sophisticated inline
editing interaction, complete with automatically chosen editors like date pickers for dates,
type-aware validation, saving, and error reporting.
A DataBound component supporting an interaction such as inline editing will automatically
submit DataSource operations to the server at appropriate times.
DataSource Operation Integration
Integrating DataSource operations with an existing system is best approached by implementing
the the 4 basic DataSource operations in terms of your existing object model or data store.
With these 4 operations implemented, the entire range of user interactions supported by
SmartGWT DataBoundComponent
becomes applicable to
your server. At that point authentication, authorization and other business rules can be
layered on top.
Built-in SQL Connectivity
The SmartGWT server comes with built-in SQL connectivity, so that SQL-based DataSources
can be created and used without any server-side code needing to be written. In contrast,
any operation which uses custom server-side code is called a "Custom Operation".
Generally it makes sense to prototype an application using Built-in DataSource Operations,
then on the backend, create Custom DataSource Operations to retrieve data from the data
store you will use in production. As you switch from using Built-in DataSources to Custom
Operations, no client-side code changes will be required, because the client cares only
about the DataSource definition, not the data store which the data is ultimately retrieved
from.
Data Managers: ResultSet and ResultTree
Data Managers manage datasets retrieved from DataSources. Data Managers are automatically
created by DataBound components, but can be created directly when more control is needed.
Data Managers provide load-on-demand for datasets too large to be loaded on the client,
automatically invoking DataSource operations as necessary to retrieve data as it is
requested, and optionally fetching ahead to anticipate further requests. Data Managers
will automatically perform actions locally when it is possible, for example, a sort
action can be performed locally with a complete cache. Data Managers also automatically
manage the consistency of the client-side cache, observing update operations performed
against DataSources and integrating updated rows automatically.
DataSource.fetchData()
,
DataSource.filterData(com.smartgwt.client.data.Criteria)
,
com.smartgwt.client.data.DataSource#exportData
,
DataSource.addData(com.smartgwt.client.data.Record)
,
DataSource.updateData(com.smartgwt.client.data.Record)
,
DataSource.removeData(com.smartgwt.client.data.Record)
,
com.smartgwt.client.rpc.RPCManager#handleError
,
com.smartgwt.client.data.DSRequest#getOperationId
,
DataBoundComponent.getFetchOperation()
,
DataBoundComponent.getUpdateOperation()
,
DataBoundComponent.getAddOperation()
,
DataBoundComponent.getRemoveOperation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |