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

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

public class DefaultPreferenceStore
extends DefaultDataSource
implements PreferenceStore

Default implementation of a PreferenceStore. This default implementation is currently a DefaultDataSource and works with SData.


Field Summary
 
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
DefaultPreferenceStore(TypeInfo typeInfo, java.lang.String application, java.lang.String dataURL, SwtRequestDispatcher requestDispatcher, SwtErrorStack errorStack)
          Constructs a default PreferenceStore with the specified type information, application, initial query, and request dispatcher.
 
Method Summary
 boolean containsProperty(java.lang.String propertyName)
           Tests if the specified property name is a property (key) in this preference store.
 boolean containsProperty(java.lang.String parentWidgetKey, java.lang.String propertyName)
           Tests if the specified property name is a property (key) in this preference store.
 java.lang.Object getPropertyValue(java.lang.String propertyName)
           Gets the value of the specified property in the current entity of this bindable data provider.
 java.lang.Object getPropertyValue(java.lang.String parentWidgetKey, java.lang.String propertyName)
           Gets the value of the specified property in the current entity of this preference store.
 void insert(DataRequestCallback callback)
           Inserts a new entity.
 void moveToDefault(java.lang.String applicationId, DataRequestCallback callback)
           Moves the cursor to the given key in the current result set, where the objectId segment of that key uses the default value (of "default").
 void moveToDefault(java.lang.String applicationId, java.lang.String objectId, DataRequestCallback callback)
           Moves the cursor to the given key in the current result set
 void removePreference(java.lang.String preferenceName)
           Removes preference/properties in the current entity of this preference store
 void setPrimaryKeyValue(java.lang.String applicationId)
          Sets the values of the Primary key fields, using the default objectId value (of "default") for the objectId part of that key.
 void setPrimaryKeyValue(java.lang.String applicationId, java.lang.String objectId)
          Sets the values of the Primary key fields
 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 setPropertyValue(java.lang.String parentWidgetKey, java.lang.String propertyName, java.lang.Object value)
           Sets the value of a preference in the current entity of this bindable 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 com.sage.swt.client.sdata.datasource.DefaultDataSource
addBindableDataChangedHandler, addBindableDataChangingAsyncHandler, addBindableDataChangingHandler, addDataSourceCursorMovedHandler, addDataSourceCursorMovingHandler, addDataSourceDataChangedHandler, addDataSourceDataChangingHandler, checkDirty, clearCache, delete, equals, fireEvent, getChildDataSource, getCopy, getCurrentEntity, getDataSource, getEntities, getEntities, getEntities, getMetaData, getSort, getTypeInfo, hashCode, isDeleted, isInserting, moveFirst, moveLast, moveNext, movePrevious, moveTo, moveTo, moveToByPropertyName, moveToCurrent, moveToInsert, parseSDataPayload, setFilter, setSelected, setSort, shutdown
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sage.swt.client.sdata.DataSource
addDataSourceCursorMovedHandler, addDataSourceDataChangedHandler, checkDirty, delete, getChildDataSource, getCopy, getCurrentEntity, getDataSource, getEntities, getEntities, getEntities, getSort, isDeleted, isInserting, moveFirst, moveLast, moveNext, movePrevious, moveTo, moveTo, moveToByPropertyName, moveToCurrent, moveToInsert, setFilter, setSort
 
Methods inherited from interface com.sage.swt.client.sdata.BindableDataProvider
getMetaData, getTypeInfo, shutdown
 
Methods inherited from interface com.sage.swt.client.sdata.HasBindableDataChangedHandlers
addBindableDataChangedHandler
 
Methods inherited from interface com.sage.swt.client.sdata.HasBindableDataChangingHandlers
addBindableDataChangingHandler
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.sage.swt.client.sdata.HasBindableDataChangingAsyncHandlers
addBindableDataChangingAsyncHandler
 
Methods inherited from interface com.sage.swt.client.sdata.HasDataSourceCursorMovingHandlers
addDataSourceCursorMovingHandler
 
Methods inherited from interface com.sage.swt.client.sdata.HasDataSourceDataChangingHandlers
addDataSourceDataChangingHandler
 

Constructor Detail

DefaultPreferenceStore

public DefaultPreferenceStore(TypeInfo typeInfo,
                              java.lang.String application,
                              java.lang.String dataURL,
                              SwtRequestDispatcher requestDispatcher,
                              SwtErrorStack errorStack)
Constructs a default PreferenceStore with the specified type information, application, initial query, and request dispatcher. The PreferenceStore will use the type information object's data transformer as its data transformer and will make stateless SData calls.

Parameters:
typeInfo - The type information object that describes the structure of the data accessed by this PreferenceStore.
application - The SData application that the PreferenceStore connects to.
dataURL - The SData URL for the ResourceKind
requestDispatcher - The server request dispatcher used for making requests to move data back and forth between the client and the server.
errorStack - The UI's stack of SWT errors.
Method Detail

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.

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

getPropertyValue

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

Gets the value of the specified property in the current entity of this preference store.

This method is similar to BindableDataProvider.getPropertyValue(String) method but enables the preference store to bind/link several widgets together. E.G. A SwtQueryPanel is comprised of several different widgets (FilterPanel, QueryFieldListBox, etc). This method enables a widget like SwtQueryPanel which is a composite/aggregate of several widgets to associate values with correct widgets.

Specified by:
getPropertyValue in interface PreferenceStore
Parameters:
parentWidgetKey - The key of the parent widget (e.g. the SwtQueryPanel)
propertyName - The name of the property in question.
Returns:
The value of the property.

setPropertyValue

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

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

This method is similar to BindableDataProvider.setPropertyValue(String, Object) method but enables the preference store to bind/link several widgets together. E.G. A SwtQueryPanel is comprised of several different widgets (FilterPanel, QueryFieldListBox, etc). This method enables a widget like SwtQueryPanel which is a composite/aggregate of several widgets to associate values with correct widgets.

Specified by:
setPropertyValue in interface PreferenceStore
Parameters:
parentWidgetKey - The key of the parent widget (e.g. the SwtQueryPanel)
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)

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

Specified by:
setPropertyValue in interface BindableDataProvider
Overrides:
setPropertyValue in class DefaultDataSource
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
Overrides:
setPropertyValue in class DefaultDataSource
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.

removePreference

public void removePreference(java.lang.String preferenceName)

Removes preference/properties in the current entity of this preference store

Specified by:
removePreference in interface PreferenceStore
Parameters:
preferenceName - The preference/data source property to remove.

moveToDefault

public void moveToDefault(java.lang.String applicationId,
                          DataRequestCallback callback)

Moves the cursor to the given key in the current result set, where the objectId segment of that key uses the default value (of "default").

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:
moveToDefault in interface PreferenceStore
Parameters:
applicationId - The applicationId part of key to move the cursor to in the current result set.
callback - The callback for receiving the notification that this is done

moveToDefault

public void moveToDefault(java.lang.String applicationId,
                          java.lang.String objectId,
                          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:
moveToDefault in interface PreferenceStore
Parameters:
applicationId - The applicationId part of the key to move the cursor to in the current result set.
objectId - The objectId part of the key to move the cursor to in the current result set.
callback - The callback for receiving the notification that this is done

setPrimaryKeyValue

public void setPrimaryKeyValue(java.lang.String applicationId)
Sets the values of the Primary key fields, using the default objectId value (of "default") for the objectId part of that key.

Specified by:
setPrimaryKeyValue in interface PreferenceStore
Parameters:
applicationId - The new value for the applicationId field

setPrimaryKeyValue

public void setPrimaryKeyValue(java.lang.String applicationId,
                               java.lang.String objectId)
Sets the values of the Primary key fields

Specified by:
setPrimaryKeyValue in interface PreferenceStore
Parameters:
applicationId - The new value for the applicationId field
objectId - The new value for the objectId field

containsProperty

public boolean containsProperty(java.lang.String parentWidgetKey,
                                java.lang.String propertyName)

Tests if the specified property name is a property (key) in this preference store.

Specified by:
containsProperty in interface PreferenceStore
Parameters:
parentWidgetKey - The key of the parent widget (e.g. the SwtQueryPanel)
propertyName - The name of the property in question.
Returns:
true if the specified property exists in the preference store

containsProperty

public boolean containsProperty(java.lang.String propertyName)

Tests if the specified property name is a property (key) in this preference store.

Specified by:
containsProperty in interface PreferenceStore
Parameters:
propertyName - The name of the property in question.
Returns:
true if the specified property exists in the preference store

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
Overrides:
update in class DefaultDataSource
Parameters:
callback - The callback for receiving the notification that the update is done.

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
Overrides:
insert in class DefaultDataSource
Parameters:
callback - The callback for receiving the notification that the insertion is done.


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