com.sage.swt.client.sdata.datasource
Class DataSourceProxy

java.lang.Object
  extended by com.sage.swt.client.sdata.datasource.DataSourceProxy
All Implemented Interfaces:
com.google.gwt.event.shared.HasHandlers, BindableDataProvider, DataSource, HasBindableDataChangedHandlers, HasBindableDataChangingAsyncHandlers, HasBindableDataChangingHandlers, HasDataSourceCursorMovedHandlers, HasDataSourceCursorMovingHandlers, HasDataSourceDataChangedHandlers, HasDataSourceDataChangingHandlers

public class DataSourceProxy
extends java.lang.Object
implements DataSource


Field Summary
protected  java.util.List<BindableDataChangedHandler> bindableDataChangedHandlers
           
protected  java.util.List<BindableDataChangingAsyncHandler> bindableDataChangingAsyncHandlers
           
protected  java.util.List<BindableDataChangingHandler> bindableDataChangingHandlers
           
protected  TypeSchemaCache cache
           
protected  ConnectionInfo connectionInfo
           
protected  DataSource dataSource
           
protected  java.util.List<DataSourceCursorMovedHandler> dataSourceCursorHandlers
           
protected  java.util.List<DataSourceCursorMovingHandler> dataSourceCursorMovingHandlers
           
protected  java.util.List<DataSourceDataChangingHandler> dataSourceDataChangingHandlers
           
protected  java.util.List<DataSourceDataChangedHandler> dataSourceDataHandlers
           
protected  DataSourceInfo dataSourceInfo
           
protected  SwtErrorStack errorStack
           
protected  com.google.gwt.event.shared.SimpleEventBus eventBus
           
protected  com.sage.swt.common.filter.QueryExpression filter
           
protected  SwtRequestDispatcher requestDispatcher
           
protected  java.lang.String sdataURL
           
protected  SortSpecification sortSpecification
           
 
Fields inherited from interface com.sage.swt.client.sdata.DataSource
ACTION_DELETE, ACTION_GETENTITIES, ACTION_GETENTITIES_ALL, ACTION_GETENTITIES_FROMKEY, ACTION_INSERT, ACTION_MOVEFIRST, ACTION_MOVELAST, ACTION_MOVENEXT, ACTION_MOVEPREVIOUS, ACTION_MOVETO, ACTION_MOVETOINSERT, ACTION_MOVETOKEY, ACTION_MOVETOSPECIFIED, ACTION_UPDATE
 
Fields inherited from interface com.sage.swt.client.sdata.BindableDataProvider
PROPERTY_NAME_SEGMENT_ESCAPE_SEPARATOR, PROPERTY_NAME_SEGMENT_SEPARATOR, PROPERTY_NAME_SEGMENT_SPLITTER
 
Constructor Summary
DataSourceProxy(TypeSchemaCache cache, SwtRequestDispatcher requestDispatcher, SwtErrorStack errorStack)
          The DataSourceProxy is used to instantiate datasources only when they are actually used.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addBindableDataChangedHandler(BindableDataChangedHandler handler)
          Adds a BindableDataEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addBindableDataChangingAsyncHandler(BindableDataChangingAsyncHandler handler)
          Adds a BindableDataChangingEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addBindableDataChangingHandler(BindableDataChangingHandler handler)
          Adds a BindableDataChangingEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addDataSourceCursorMovedHandler(DataSourceCursorMovedHandler handler)
          Adds a DataSourceCursorMovedEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addDataSourceCursorMovingHandler(DataSourceCursorMovingHandler handler)
          Adds a DataSourceCursorMovingEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addDataSourceDataChangedHandler(DataSourceDataChangedHandler handler)
          Adds a DataSourceDataChangedEvent event.
 com.google.gwt.event.shared.HandlerRegistration addDataSourceDataChangingHandler(DataSourceDataChangingHandler handler)
          Adds a DataSourceDataChangingEvent event.
 void checkDirty(DataRequestCallback callback)
          Checks whether the current entity is dirty
protected  void createDataSource()
          Retrieves the type info that has been downloaded from the cache and uses it to create the proper type of datasource.
 void createDelayedDataSource(DataSourceProxyCallback proxyCallback)
          Initializes the creation of a datasource and the download of the related type schema.
 void delete(DataRequestCallback callback)
           Deletes the current entity.
 boolean equals(java.lang.Object obj)
          
 void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
          
 DataSource getChildDataSource(java.lang.String propertyName)
          Gets the datasource that is linked to a property of this datasource.
 DataSource getCopy()
           Creates a copy of this datasource.
 EntityData getCurrentEntity()
          Gets the current entity (in other words, the entity at the cursor) from this datasource.
 DataSource getDataSource(java.lang.String propertyName)
          Gets the datasource that is linked to a property of this datasource.
 void getEntities(DataRequestCallback callback)
           Gets all the entities in the current result set.
 void getEntities(int startIndex, int count, DataRequestCallback callback)
           Gets up to the specified number of entities in the current result set.
 void getEntities(java.lang.Object startKey, int count, DataRequestCallback callback)
           Gets up to the specified number of entities in the current result set.
 DataProviderMetaData getMetaData()
          Gets the metadata for this data provider.
 java.lang.Object getPropertyValue(java.lang.String propertyName)
           Gets the value of the specified property in the current entity of this bindable data provider.
 SortSpecification getSort()
          Get the SortSpecification associated with this datasource.
 TypeInfo getTypeInfo()
          Gets the type information object associated with this bindable data provider.
 int hashCode()
          
 void insert(DataRequestCallback callback)
           Inserts a new entity.
 boolean isDataSourceCreated()
          Returns true if the datasource held by this proxy has been created.
 boolean isDeleted()
          Check whether the current entity is deleted or not.
 boolean isInserting()
           Checks if we are on the insert entity.
 void moveFirst(DataRequestCallback callback)
           Moves the cursor to the first entity in the current result set.
 void moveLast(DataRequestCallback callback)
           Moves the cursor to the last entity in the current result set.
 void moveNext(DataRequestCallback callback)
           Moves the cursor to the next entity in the current result set.
 void movePrevious(DataRequestCallback callback)
           Moves the cursor to the previous entity in the current result set.
 void moveTo(int index, DataRequestCallback callback)
           Moves the cursor to the given index in the current result set.
 void moveTo(java.lang.Object key, DataRequestCallback callback)
           Moves the cursor to the given key in the current result set.
 void moveToByPropertyName(java.util.Map<java.lang.String,java.lang.Object> properties, DataRequestCallback callback)
          Move the cursor to a record whose property values match the values in the property map currently.
 void moveToCurrent(DataRequestCallback callback)
           Moves the cursor to the remembered cursor position, which is usually the current entity.
 void moveToInsert(DataRequestCallback callback)
           Moves the cursor to the "insert" entity.
 void removeBindableDataChangedHandler(BindableDataChangedHandler handler)
          Removes the specified BindableDataChangedHandler
 void removeBindableDataChangingAsyncHandler(BindableDataChangingAsyncHandler handler)
          Removes the specified BindableDataChangingHandler
 void removeBindableDataChangingHandler(BindableDataChangingHandler handler)
          Removes the specified BindableDataChangingHandler
 void removeDataSourceCursorHandler(DataSourceCursorMovedHandler handler)
          Removes the specified DataSourceCursorMovedHandler
 void removeDataSourceCursorMovingHandler(DataSourceCursorMovingHandler handler)
          Removes the specified DataSourceCursorMovingHandler
 void removeDataSourceDataChangingHandler(DataSourceDataChangingHandler handler)
          Removes the specified DataSourceDataChangingHandler
 void removeDataSourceDataHandler(DataSourceDataChangedHandler handler)
          Removes the specified DataSourceDataChangedHandler
protected  void reportError(java.lang.String message)
           
 void setFilter(com.sage.swt.common.filter.QueryExpression filter)
           Sets the filter for this datasource.
 void setPropertyValue(java.lang.String propertyName, java.lang.Object value)
           Sets the value of a property in the current entity of this bindable data provider.
 void setPropertyValue(java.lang.String propertyName, java.lang.Object value, DataRequestCallback callback)
           Sets the value of a property in the current entity of this bindable data provider.
 void setProxyDataSourceInfo(DataSourceInfo dataSourceInfo, ConnectionInfo connectionInfo)
          Sets the information needed to create a datasource and download type schemas.
 void setSort(SortSpecification sortSpecification)
           Sets the sorting parameters for this datasource.
 void shutdown()
          Shuts down the data provider.
 void update(DataRequestCallback callback)
          Sends to the server any updated data that was set by BindableDataProvider.setPropertyValue(String, Object) or via a child datasource.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected TypeSchemaCache cache

dataSource

protected DataSource dataSource

requestDispatcher

protected SwtRequestDispatcher requestDispatcher

errorStack

protected SwtErrorStack errorStack

dataSourceInfo

protected DataSourceInfo dataSourceInfo

connectionInfo

protected ConnectionInfo connectionInfo

bindableDataChangingAsyncHandlers

protected java.util.List<BindableDataChangingAsyncHandler> bindableDataChangingAsyncHandlers

bindableDataChangingHandlers

protected java.util.List<BindableDataChangingHandler> bindableDataChangingHandlers

bindableDataChangedHandlers

protected java.util.List<BindableDataChangedHandler> bindableDataChangedHandlers

dataSourceCursorMovingHandlers

protected java.util.List<DataSourceCursorMovingHandler> dataSourceCursorMovingHandlers

dataSourceCursorHandlers

protected java.util.List<DataSourceCursorMovedHandler> dataSourceCursorHandlers

dataSourceDataHandlers

protected java.util.List<DataSourceDataChangedHandler> dataSourceDataHandlers

dataSourceDataChangingHandlers

protected java.util.List<DataSourceDataChangingHandler> dataSourceDataChangingHandlers

filter

protected com.sage.swt.common.filter.QueryExpression filter

sortSpecification

protected SortSpecification sortSpecification

sdataURL

protected java.lang.String sdataURL

eventBus

protected com.google.gwt.event.shared.SimpleEventBus eventBus
Constructor Detail

DataSourceProxy

public DataSourceProxy(TypeSchemaCache cache,
                       SwtRequestDispatcher requestDispatcher,
                       SwtErrorStack errorStack)
The DataSourceProxy is used to instantiate datasources only when they are actually used. This saves time during initialization. The DataSourceProxy pretends to be a real DataSource and creates the real one when a method is called where that is necessary.

Parameters:
cache - A cache of all the downloaded type schemas
requestDispatcher - Dispatches requests to the server
errorStack - Holds all errors that occur during execution
Method Detail

shutdown

public void shutdown()
Shuts down the data provider. No further calls should be made after this has been called.

Specified by:
shutdown in interface BindableDataProvider

addDataSourceCursorMovingHandler

public com.google.gwt.event.shared.HandlerRegistration addDataSourceCursorMovingHandler(DataSourceCursorMovingHandler handler)
Adds a DataSourceCursorMovingEvent handler.

Specified by:
addDataSourceCursorMovingHandler in interface HasDataSourceCursorMovingHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addDataSourceCursorMovedHandler

public com.google.gwt.event.shared.HandlerRegistration addDataSourceCursorMovedHandler(DataSourceCursorMovedHandler handler)
Adds a DataSourceCursorMovedEvent handler.

Specified by:
addDataSourceCursorMovedHandler in interface DataSource
Specified by:
addDataSourceCursorMovedHandler in interface HasDataSourceCursorMovedHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addDataSourceDataChangingHandler

public com.google.gwt.event.shared.HandlerRegistration addDataSourceDataChangingHandler(DataSourceDataChangingHandler handler)
Adds a DataSourceDataChangingEvent event.

Specified by:
addDataSourceDataChangingHandler in interface HasDataSourceDataChangingHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addDataSourceDataChangedHandler

public com.google.gwt.event.shared.HandlerRegistration addDataSourceDataChangedHandler(DataSourceDataChangedHandler handler)
Adds a DataSourceDataChangedEvent event.

Specified by:
addDataSourceDataChangedHandler in interface DataSource
Specified by:
addDataSourceDataChangedHandler in interface HasDataSourceDataChangedHandlers
Parameters:
handler - the handler
Returns:
the handler registration

delete

public void delete(DataRequestCallback callback)

Deletes the current entity.

After deletion, the cursor is placed on the previous entity.

Specified by:
delete in interface DataSource
Parameters:
callback - The callback for receiving the notification that the deletion is done.

getChildDataSource

public DataSource getChildDataSource(java.lang.String propertyName)
Gets the datasource that is linked to a property of this datasource. This method only works for properties that are at least one dimensional (in other words, the property cannot be a primitive type.) The property must also be a child relationship as defined in the SData spec. http://interop.sage .com/daisy/sdata/SDataProtocolDescription/Metadata/193-DSY.html

Specified by:
getChildDataSource in interface DataSource
Parameters:
propertyName - The name of property whose linked datasource we want to get.
Returns:
The datasource that is linked to a property of this datasource, or null if the property is a primitive type.

getCopy

public DataSource getCopy()

Creates a copy of this datasource.

Specified by:
getCopy in interface DataSource
Returns:
copy of the datasource

getCurrentEntity

public EntityData getCurrentEntity()
Gets the current entity (in other words, the entity at the cursor) from this datasource.

Specified by:
getCurrentEntity in interface DataSource
Returns:
The current entity (in other words, the entity at the cursor) from this datasource.

getDataSource

public DataSource getDataSource(java.lang.String propertyName)
Gets the datasource that is linked to a property of this datasource. This method only works for properties that are at least one dimensional (in other words, the property cannot be a primitive type.)

Specified by:
getDataSource in interface DataSource
Parameters:
propertyName - The name of property whose linked datasource we want to get.
Returns:
The datasource that is linked to a property of this datasource, or null if the property is a primitive type.

getEntities

public void getEntities(DataRequestCallback callback)

Gets all the entities in the current result set.

The requested entities are returned via the callback. Warning! Only use this method when the result set is known to be small. Getting all entities in a large result set will have severe performance repercussions.

Specified by:
getEntities in interface DataSource
Parameters:
callback - The callback for receiving the notification that the entities are gotten and for receiving the entities themselves.

getEntities

public void getEntities(int startIndex,
                        int count,
                        DataRequestCallback callback)

Gets up to the specified number of entities in the current result set.

The requested entities are returned via the callback. The number of entities actually delivered may be less that the number requested if there are not enough entities left in the current result set that are at or past the specified starting index.

Specified by:
getEntities in interface DataSource
Parameters:
startIndex - The index of the first entity to get.
count - The maximum number of entities to get.
callback - The callback for receiving the notification that the entities are gotten and for receiving the entities themselves.

getEntities

public void getEntities(java.lang.Object startKey,
                        int count,
                        DataRequestCallback callback)

Gets up to the specified number of entities in the current result set.

The requested entities are returned via the callback. The number of entities actually delivered may be less that the number requested if there are not enough entities left in the current result set that are at or past the specified starting key.

Specified by:
getEntities in interface DataSource
Parameters:
startKey - The key of the first entity to get.
count - The maximum number of entities to get.
callback - The callback for receiving the notification that the entities are gotten and for receiving the entities themselves.

insert

public void insert(DataRequestCallback callback)

Inserts a new entity.

This method can only be called when the cursor is on an "insert" entity.

Specified by:
insert in interface DataSource
Parameters:
callback - The callback for receiving the notification that the insertion is done.

isInserting

public boolean isInserting()

Checks if we are on the insert entity.

Specified by:
isInserting in interface DataSource
Returns:
true if we are on the insert entity.

checkDirty

public void checkDirty(DataRequestCallback callback)
Checks whether the current entity is dirty

Specified by:
checkDirty in interface DataSource
Parameters:
callback - The callback for receiving the dirty status.

moveFirst

public void moveFirst(DataRequestCallback callback)

Moves the cursor to the first entity in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Specified by:
moveFirst in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

moveLast

public void moveLast(DataRequestCallback callback)

Moves the cursor to the last entity in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Prior to calling this method the sort specification must be set by calling DataSource.setSort(SortSpecification). Failure to do so will result in an IllegalStateException.

Specified by:
moveLast in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

moveNext

public void moveNext(DataRequestCallback callback)

Moves the cursor to the next entity in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Specified by:
moveNext in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

movePrevious

public void movePrevious(DataRequestCallback callback)

Moves the cursor to the previous entity in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Specified by:
movePrevious in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

moveTo

public void moveTo(int index,
                   DataRequestCallback callback)

Moves the cursor to the given index in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Specified by:
moveTo in interface DataSource
Parameters:
index - The index to move the cursor to in the current result set.
callback - The callback for receiving the notification that the move is done.

moveTo

public void moveTo(java.lang.Object key,
                   DataRequestCallback callback)

Moves the cursor to the given key in the current result set.

Cursor move operations are asynchronous. Between the time a cursor move method is called and the callback is invoked, the position of the cursor is undefined. Therefore, the behaviour of DataSource.getCurrentEntity(), BindableDataProvider.getPropertyValue(String) and BindableDataProvider.setPropertyValue(String, Object) are undefined during that time.

Specified by:
moveTo in interface DataSource
Parameters:
key - The key to move the cursor to in the current result set.
callback - The callback for receiving the notification that the move is done.

moveToByPropertyName

public void moveToByPropertyName(java.util.Map<java.lang.String,java.lang.Object> properties,
                                 DataRequestCallback callback)
Move the cursor to a record whose property values match the values in the property map currently.

Note that there may be more than one record that matches, or no record. If there is no record then the cursor will remain in its current position.

Specified by:
moveToByPropertyName in interface DataSource
Parameters:
properties - the map of properties to use.
callback - The callback for receiving the notification that the operation is done.

moveToCurrent

public void moveToCurrent(DataRequestCallback callback)

Moves the cursor to the remembered cursor position, which is usually the current entity.

This method has no effect if the cursor is not on the "insert" entity.

Specified by:
moveToCurrent in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

moveToInsert

public void moveToInsert(DataRequestCallback callback)

Moves the cursor to the "insert" entity.

The current cursor position is remembered while the cursor is positioned on the "insert" entity. The "insert" entity is a special entity associated with an updatable result set. It is essentially a buffer where a new entity may be constructed by calling BindableDataProvider.setPropertyValue(String, Object) prior to inserting the entity into the result set. Only the BindableDataProvider.setPropertyValue(String, Object), BindableDataProvider.getPropertyValue(String), DataSource.insert(DataRequestCallback) and DataSource.moveToCurrent(DataRequestCallback) methods may be called when the cursor is on the "insert" entity.

Specified by:
moveToInsert in interface DataSource
Parameters:
callback - The callback for receiving the notification that the move is done.

removeDataSourceCursorMovingHandler

public void removeDataSourceCursorMovingHandler(DataSourceCursorMovingHandler handler)
Removes the specified DataSourceCursorMovingHandler

Parameters:
handler - the handler to remove

removeDataSourceCursorHandler

public void removeDataSourceCursorHandler(DataSourceCursorMovedHandler handler)
Removes the specified DataSourceCursorMovedHandler

Parameters:
handler - the handler to remove

removeDataSourceDataHandler

public void removeDataSourceDataHandler(DataSourceDataChangedHandler handler)
Removes the specified DataSourceDataChangedHandler

Parameters:
handler - the handler to remove

setFilter

public void setFilter(com.sage.swt.common.filter.QueryExpression filter)

Sets the filter for this datasource. Changes the resultset and causes DataSourceDataChangedHandler.dataChanged(DataSourceDataChangedEvent) to fire. The cursor is also reset to before the first entity.

Specified by:
setFilter in interface DataSource
Parameters:
filter - filter for this datasource. The value of the "where" parameter in an SData URL.

setSort

public void setSort(SortSpecification sortSpecification)

Sets the sorting parameters for this datasource. Changes the resultset and causes DataSourceDataChangedHandler.dataChanged(DataSourceDataChangedEvent) to fire. The cursor is also reset to before the first entity.

Specified by:
setSort in interface DataSource
Parameters:
sortSpecification - sorting parameters for this datasource. The value of the "orderBy" parameter in an SData URL.

getSort

public SortSpecification getSort()
Description copied from interface: DataSource
Get the SortSpecification associated with this datasource.

Specified by:
getSort in interface DataSource
Returns:
the SortSpecification for this datasource.

update

public void update(DataRequestCallback callback)
Sends to the server any updated data that was set by BindableDataProvider.setPropertyValue(String, Object) or via a child datasource.

Specified by:
update in interface DataSource
Parameters:
callback - The callback for receiving the notification that the update is done.

addBindableDataChangedHandler

public com.google.gwt.event.shared.HandlerRegistration addBindableDataChangedHandler(BindableDataChangedHandler handler)
Adds a BindableDataEvent handler.

Specified by:
addBindableDataChangedHandler in interface HasBindableDataChangedHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addBindableDataChangingAsyncHandler

public com.google.gwt.event.shared.HandlerRegistration addBindableDataChangingAsyncHandler(BindableDataChangingAsyncHandler handler)
Description copied from interface: HasBindableDataChangingAsyncHandlers
Adds a BindableDataChangingEvent handler.

Specified by:
addBindableDataChangingAsyncHandler in interface HasBindableDataChangingAsyncHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addBindableDataChangingHandler

public com.google.gwt.event.shared.HandlerRegistration addBindableDataChangingHandler(BindableDataChangingHandler handler)
Adds a BindableDataChangingEvent handler.

Specified by:
addBindableDataChangingHandler in interface HasBindableDataChangingHandlers
Parameters:
handler - the handler
Returns:
the handler registration

getMetaData

public DataProviderMetaData getMetaData()
Gets the metadata for this data provider.

Specified by:
getMetaData in interface BindableDataProvider
Returns:
the metadata for this data provider.

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propertyName)

Gets the value of the specified property in the current entity of this bindable data provider.

When a property is an EntityData object, the value of a sub-property can be obtained directly by using "." notation in the property name. For example, if the bindable data provider's current entity has a complex "fromAddress" property that contains a "streetName" sub-property, use "fromAddress.streetName" to get the value of the "streetName" sub-property directly.

Note that the "." notation is meant for cases where the main property (such as the "fromAddress" in the example) does not have a child or a reference relationship to the bindable data provider's current entity, but is instead just a complex property that's part of that current entity.

Also note that for primitive or simple properties that include a "." in their property name, use the "{dot}" escape sequence instead. For example, if the primitive property happens to be called "my.property" in the schema, use "my{dot}property" as the property name.

For datasources: while the cursor is being moved, the behaviour of this method is undefined.

Specified by:
getPropertyValue in interface BindableDataProvider
Parameters:
propertyName - The name of the property in question.
Returns:
The value of the property.

getTypeInfo

public TypeInfo getTypeInfo()
Gets the type information object associated with this bindable data provider.

Specified by:
getTypeInfo in interface BindableDataProvider
Returns:
The type information object associated with this bindable data provider.

removeBindableDataChangedHandler

public void removeBindableDataChangedHandler(BindableDataChangedHandler handler)
Removes the specified BindableDataChangedHandler

Parameters:
handler - the handler to remove

removeBindableDataChangingAsyncHandler

public void removeBindableDataChangingAsyncHandler(BindableDataChangingAsyncHandler handler)
Removes the specified BindableDataChangingHandler

Parameters:
handler - the handler to remove

removeBindableDataChangingHandler

public void removeBindableDataChangingHandler(BindableDataChangingHandler handler)
Removes the specified BindableDataChangingHandler

Parameters:
handler - the handler to remove

removeDataSourceDataChangingHandler

public void removeDataSourceDataChangingHandler(DataSourceDataChangingHandler handler)
Removes the specified DataSourceDataChangingHandler

Parameters:
handler - the handler to remove

setPropertyValue

public void setPropertyValue(java.lang.String propertyName,
                             java.lang.Object value)

Sets the value of a property in the current entity of this bindable data provider.

When a property is an EntityData object, the value of a sub-property can be set directly by using "." notation in the property name. For example, if the bindable data provider's current entity has a complex "fromAddress" property that contains a "streetName" sub-property, use "fromAddress.streetName" to set the value of the "streetName" sub-property directly. (If "fromAddress" or any of its sub-properties have not been set yet, an EntityData object is created for "fromAddress", and then its "streetName" property is set.)

Note that the "." notation is meant for cases where the main property (such as the "fromAddress" in the example) does not have a child or a reference relationship to the bindable data provider's current entity, but is instead just a complex property that's part of that current entity.

Also note that for primitive or simple properties that include a "." in their property name, use the "{dot}" escape sequence instead. For example, if the primitive property happens to be called "my.property" in the schema, use "my{dot}property" as the property name.

For datasources: While the cursor is being moved, the behaviour of this method is undefined. Properties set via this method are not sent to the server until the update method is called.

Specified by:
setPropertyValue in interface BindableDataProvider
Parameters:
propertyName - The name of the property in question.
value - The new value of the property.

setPropertyValue

public void setPropertyValue(java.lang.String propertyName,
                             java.lang.Object value,
                             DataRequestCallback callback)

Sets the value of a property in the current entity of this bindable data provider.

Specified by:
setPropertyValue in interface BindableDataProvider
Parameters:
propertyName - The name of the property in question.
value - The new value of the property.
callback - The callback for success and failure notification of the property set.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

setProxyDataSourceInfo

public void setProxyDataSourceInfo(DataSourceInfo dataSourceInfo,
                                   ConnectionInfo connectionInfo)
Sets the information needed to create a datasource and download type schemas.

Parameters:
dataSourceInfo - Holds relationship types, children, and other datasource related information.
connectionInfo - Holds the information necessary to create a connection to a datasource.

createDelayedDataSource

public void createDelayedDataSource(DataSourceProxyCallback proxyCallback)
Initializes the creation of a datasource and the download of the related type schema. If the datasource has already been created, then the proxyCallback's onDone will be called immediately.

Parameters:
proxyCallback - This callback will be notified when the datasource has been created.

reportError

protected void reportError(java.lang.String message)
Parameters:
message -

isDataSourceCreated

public boolean isDataSourceCreated()
Returns true if the datasource held by this proxy has been created.

Returns:
True if the datasource held by this proxy has been created.

createDataSource

protected void createDataSource()
Retrieves the type info that has been downloaded from the cache and uses it to create the proper type of datasource. The handlers and other settings that the proxy has been holding are set in the newly created datasource.


fireEvent

public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)

Specified by:
fireEvent in interface com.google.gwt.event.shared.HasHandlers

isDeleted

public boolean isDeleted()
Check whether the current entity is deleted or not.

Specified by:
isDeleted in interface DataSource
Returns:
true if the current entity is deleted. Otherwise false


Copyright © 2011 Sage Software, Inc. All rights reserved.