TSUI.Data
Extends: None
Implements: IDataBinding
Exported: Yes

Associated source files:

Description

Defines the structure for a data binding. Data bindings bind a particular Control's property to a data source and handle pull / pushing data to/from that source.
I: Specifies the type of data sent/received to/from the server.
O: Specifies the type of data out of the data adapter.

Constructors

constructor(control: TSUI.UI.IControl, propertyName: string, dataProperty: TSUI.Collections.IList<string>, accessor: Data.IDataAccessor<string>)
Creates a new data binding.
  • control: TSUI.UI.IControl - The control to bind.
  • propertyName: string - The name of the control property (i.e. method) to bind to.
  • dataProperty: TSUI.Collections.IList<string> - The name (or sub names) of the data property to use for the value. Use array of length 0 to use the raw data.
  • accessor: Data.IDataAccessor<string> - The data accessor to use for this binding.
constructor(control: TSUI.UI.IControl, propertyName: string, dataProperty: TSUI.Collections.IList<string>, accessor: Data.IDataAccessor<string>, bindingDirection: Data.BindingDirections)
Creates a new data binding.
  • control: TSUI.UI.IControl - The control to bind.
  • propertyName: string - The name of the control property (i.e. method) to bind to.
  • dataProperty: TSUI.Collections.IList<string> - The name (or sub names) of the data property to use for the value. Use array of length 0 to use the raw data.
  • accessor: Data.IDataAccessor<string> - The data accessor to use for this binding.
  • bindingDirection: Data.BindingDirections - The binding direction to use for this binding. Default: BOTH_S2UDefault
constructor(control: TSUI.UI.IControl, propertyName: string, dataProperty: TSUI.Collections.IList<string>, accessor: Data.IDataAccessor<string>, bindingDirection: Data.BindingDirections, adapter: Data.IDataAdapter<string, O>)
Creates a new data binding.
  • control: TSUI.UI.IControl - The control to bind.
  • propertyName: string - The name of the control property (i.e. method) to bind to.
  • dataProperty: TSUI.Collections.IList<string> - The name (or sub names) of the data property to use for the value. Use array of length 0 to use the raw data.
  • accessor: Data.IDataAccessor<string> - The data accessor to use for this binding.
  • bindingDirection: Data.BindingDirections - The binding direction to use for this binding. Default: BOTH_S2UDefault
  • adapter: Data.IDataAdapter<string, O> - The data adapter to use for this binding. Default: JSONDataAdapter
constructor(control: TSUI.UI.IControl, propertyName: string, dataProperty: TSUI.Collections.IList<string>, accessor: Data.IDataAccessor<string>, bindingDirection?: Data.BindingDirections, adapter?: Data.IDataAdapter<string, O>)
  • control: TSUI.UI.IControl -
  • propertyName: string -
  • dataProperty: TSUI.Collections.IList<string> -
  • accessor: Data.IDataAccessor<string> -
  • OPTIONAL bindingDirection: Data.BindingDirections -
  • OPTIONAL adapter: Data.IDataAdapter<string, O> -


Private Properties

Accessor_OnDataPulledHandler;
The pull event handler attached to the data accessor.
Accessor_OnDataPushedHandler;
The push event handler attached to the data accessor.
_Accessor;
The underlying accessor.
_Control;
The underlying control.
_PropertyName;
The underlying property name.
oldValue;
The old value of the property this binding is for.
updateTimeout;
The update timeout reference number.


Public Properties

Adapter: Data.IDataAdapter<string, O>;
The data adapter to use for this binding.
BindingDirection: Data.BindingDirections;
The binding direction to use for this binding.
DataProperty: TSUI.Collections.IList<string>;
A list of property names (in increasing depth order) that specify what property of the data from the adapter to bind to.
DelayMode: Data.DelayModes;
The Update Delay Mode to use for this binding.
OnUpdateFromSource: TSUI.Events.UpdateFromSourceEvent<string, O>;
Fired when the binding updates from the source.
OnUpdateFromUser: TSUI.Events.UpdateFromUserEvent<string, O>;
Fired when the binding updates from the user.
UpdateDelayTime: number;
Time to delay between sending access requests to the server to reduce network usage and JS overload. Useful for data bindings such as those bound to text boxes.


Private Static Properties

DefaultJSONAdapter;


Private Methods

Accessor_OnDataPulled(args)
Called when the accessor receives data from the source after a pull request (i.e. when data is pulled from the source)
  • args: TSUI.Events.DataPulledEventArgs<string> - The event args for the event call.
Accessor_OnDataPushed(args)
Called when the accessor receives data from the source after a push request (i.e. when data is pushed to the source)
  • args: TSUI.Events.DataPushedEventArgs<string> - The event args for the event call.
UpdateUsingData(data)
Updates the control from the supplied data.
  • data: O - The data to update from.


Public Methods

Accessor(value?: Data.IDataAccessor<string>): Data.IDataAccessor<string>
The data accessor to use for this binding.
  • OPTIONAL value: Data.IDataAccessor<string> -
  • Returns: TSUI.Data.IDataAccessor<string> -
Bind(): boolean
Wraps the property (method) in a special controlled method, maintaining a copy of the original.
  • Returns: boolean -
Control(value?: TSUI.UI.IControl): TSUI.UI.IControl
The control to bind.
  • OPTIONAL value: TSUI.UI.IControl -
  • Returns: TSUI.UI.IControl -
PropertyName(value?: string): string
The name of the method to call to set the control property.
  • OPTIONAL value: string -
  • Returns: string -
Unbind(): boolean
Unwraps the property (method).
  • Returns: boolean -
Update(trigger?: Data.UpdateTriggers): boolean
Causes the data binding to update using the direction specified in BindingDirection.
  • OPTIONAL trigger: Data.UpdateTriggers - The trigger that caused the update request. Leave this parameter at default if calling programatically.
  • Returns: boolean - A boolean indicating whether the update was successful or not.
UpdateFromSource(): boolean
Causes the data binding to update from the source.
  • Returns: boolean - A boolean indicating whether the update has successfully started or not.
UpdateFromUser(): boolean
Causes the data binding to update from the user.
  • Returns: boolean - A boolean indicating whether the update has successfully started or not.


Last edited Aug 29, 2013 at 9:12 PM by EdwardNutting, version 1

Comments

No comments yet.