Main Page | Packages | Class Tree | Index | Help

xp.data

class Binding

Object
  |
  +--xp.data.Binding


class Binding
extends Object

The Binding class is intended to be used to make connections between a source object and a target object

Calling execute invokes the source and target paths

Binding can handle complex paths on both the source and target
"a.b.c['dog'].methodX().y[1].methodZ()"
format value to string / parse string to value

target - the object that will be invoked with the property
property - the (possibly qualified) name of a writable property or method on the target(alias-property)
source - the object that will be invoked with the path
path - the (possibly qualified) name of a readable property or method of the incoming event(alias-path)
sourceEvent - the type of the event in the listener interface that should trigger the targetPropertyPath
sourceEventName - the eventName of the event in the listener interface that should trigger the targetPropertyPath
targetEvent - the type of the event in the listener interface that should trigger the sourcePropertyPath
targetEventName - the eventName of the event in the listener interface that should trigger the sourcePropertyPath
inverse - if set to true the execute will invoke the source and targets in reverse


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public
bindType: String
The binding type - one of the BindType constants

public
dataItem: Object
the current data item

public
defaultValue: Object
def value to use if no src value is available

public static
Explicit: String
Constant - when to update source - only when manually called

public
formatter: Object
Format objects

public static
Immediate: String
Constant - when to update source - as soon as the target changes the value

public
inverse: Boolean
Is the eventHandler triggered in forward(src>tgt) or reverse mode(src

public
isDataBound: Boolean
whether this instance of a binding is bound to a datasource

public
isExecuting: Boolean
Are we currently running - to stop recursive trigger

public static
logEnabled: Boolean
Is logging enabled

public static
OneTime: String
Constant - BindType - only updates the target when the binding is established.

public static
OneWay: String
Constant - BindType - only updates the target when the source changes.

public static
OnLostFocus: String
Constant - when to update source - when the target loses focus

public
path: String
The (possibly qualified) name of a readable property or method of the incoming event(alias-path)

public
property: String
The (possibly qualified) name of a writable property or method on the target(alias-property)

public
source: Object
The object that will be invoked with the path

public
sourceEvent: String
Event emitted by source that will trigger the eventHandler

public
sourceEventName: String
An eventEventName that filters the firing of trigger

public
status: Number
0-exists,1-attached to target,2-attached to source

public
target: Object
The object that will be invoked with the property

public
targetEvent: String
Event emitted by target that will trigger the eventHandler

public
targetEventName: String
An eventEventName that filters the firing of execute

public static
TwoWay: String
Constant - BindType - updates the target or the source whenever either changes.

public
validator: Object
Validate objects

Constructor

public
Binding ( bind: Object)
Construct a new Binding optionally from a Bind definition

Method Summary

public static
addBinding ( target: Object, bind: Object ): Binding
This is called from an component or an object when its addXXXBinding method is called it is not called by Flash during buidling a Collection

public static
addStaticBinding ( bind: Object ): Binding
Creates a binding that simply binds to itself and is fired manually the source will be set dynamically before trigger is called

public static
attachBinding ( binding: Binding ): Boolean
Attaches a binding to its source

public static
cloneBinding ( bind: Object ): Object
Creates a new copy of the the bind

public static
cloneBindings ( bind: Object ): Object
Creates a new copy of the the set of bindings

public static
detachBinding ( binding: Binding ): Boolean
Detaches a binding from its source

public
execute ( dir: Boolean ): Void
Triggers or executes the binding

public static
getBinding ( target: Object, property: String ): Binding
Gets the binding attached to the target property

public static
getBindingIndex ( target: Object, property: String ): Number
Get the index of a binding in the bindings array

public
handleEvent ( e: Event ): Void
Internal event handler that may be called by either the source or target objects

public static
initBinding ( target: Object, binding: Object ): Object
Create a standard field data binding-bind def specs everything but the target -- this is called from UIControl DONT CHANGE!!! assumes we are binding to the modelChanged event of the target and that we will access the event target.data

public static
initBindings ( target: Object ): Void
Initializes binding on the target

public static
refreshFromSources ( target: Object, property: String ): Boolean
Force the target to update from its sources Used when the source doesnt emit events

public static
refreshTargets ( source: Object )
Forces all targets to get refreshed from this source

public static
removeAllBindings ( target: Object ): Void
Removes all bindings from the target

public static
removeBinding ( target: Object, binding: Binding ): Void
Removes a binding from a target

public
toString ( ): String
Summary info



Field Documentation

bindType

public var bindType: String
The binding type - one of the BindType constants

dataItem

public var dataItem: Object
the current data item

defaultValue

public var defaultValue: Object
def value to use if no src value is available

Explicit

public static var Explicit: String
Constant - when to update source - only when manually called

formatter

public var formatter: Object
Format objects

Immediate

public static var Immediate: String
Constant - when to update source - as soon as the target changes the value

inverse

public var inverse: Boolean
Is the eventHandler triggered in forward(src>tgt) or reverse mode(src

isDataBound

public var isDataBound: Boolean
whether this instance of a binding is bound to a datasource

isExecuting

public var isExecuting: Boolean
Are we currently running - to stop recursive trigger

logEnabled

public static var logEnabled: Boolean
Is logging enabled

OneTime

public static var OneTime: String
Constant - BindType - only updates the target when the binding is established.

OneWay

public static var OneWay: String
Constant - BindType - only updates the target when the source changes.

OnLostFocus

public static var OnLostFocus: String
Constant - when to update source - when the target loses focus

path

public var path: String
The (possibly qualified) name of a readable property or method of the incoming event(alias-path)

property

public var property: String
The (possibly qualified) name of a writable property or method on the target(alias-property)

source

public var source: Object
The object that will be invoked with the path

sourceEvent

public var sourceEvent: String
Event emitted by source that will trigger the eventHandler

sourceEventName

public var sourceEventName: String
An eventEventName that filters the firing of trigger

status

public var status: Number
0-exists,1-attached to target,2-attached to source

target

public var target: Object
The object that will be invoked with the property

targetEvent

public var targetEvent: String
Event emitted by target that will trigger the eventHandler

targetEventName

public var targetEventName: String
An eventEventName that filters the firing of execute

TwoWay

public static var TwoWay: String
Constant - BindType - updates the target or the source whenever either changes.

validator

public var validator: Object
Validate objects


Constructor Documentation

Binding

public function Binding(bind: Object)
Construct a new Binding optionally from a Bind definition


Method Documentation

addBinding

public static function addBinding(target: Object,
 bind: Object): Binding
This is called from an component or an object when its addXXXBinding method is called it is not called by Flash during buidling a Collection

Parameters:
target
The target component
bind
The binding descriptor
Returns:
The binding object

addStaticBinding

public static function addStaticBinding(bind: Object): Binding
Creates a binding that simply binds to itself and is fired manually the source will be set dynamically before trigger is called

Parameters:
bind
The binding descriptor

attachBinding

public static function attachBinding(binding: Binding): Boolean
Attaches a binding to its source

Parameters:
binding
The binding to be detached

cloneBinding

public static function cloneBinding(bind: Object): Object
Creates a new copy of the the bind

Parameters:
bind
A single binding definition

cloneBindings

public static function cloneBindings(bind: Object): Object
Creates a new copy of the the set of bindings

Parameters:
bind
A set of binding definition

detachBinding

public static function detachBinding(binding: Binding): Boolean
Detaches a binding from its source

Parameters:
binding
The binding to be detached

execute

public function execute(dir: Boolean): Void
Triggers or executes the binding

The binding may be executed forward (source to target) or reverse (target to source)

Parameters:
dir
The direction to execute the binding

getBinding

public static function getBinding(target: Object,
 property: String): Binding
Gets the binding attached to the target property

Returns:
The binding object

getBindingIndex

public static function getBindingIndex(target: Object,
 property: String): Number
Get the index of a binding in the bindings array

Parameters:
target
The target component
property
The bound property
Returns:
The index of the bound property

handleEvent

public function handleEvent(e: Event): Void
Internal event handler that may be called by either the source or target objects

Parameters:
e
The event object

initBinding

public static function initBinding(target: Object,
 binding: Object): Object
Create a standard field data binding-bind def specs everything but the target -- this is called from UIControl DONT CHANGE!!! assumes we are binding to the modelChanged event of the target and that we will access the event target.data

Parameters:
target
The target component
binding
The binding object
Returns:
The initialized binding

initBindings

public static function initBindings(target: Object): Void
Initializes binding on the target

Parameters:
target
The target component

refreshFromSources

public static function refreshFromSources(target: Object,
 property: String): Boolean
Force the target to update from its sources Used when the source doesnt emit events

refreshTargets

public static function refreshTargets(source: Object)
Forces all targets to get refreshed from this source

removeAllBindings

public static function removeAllBindings(target: Object): Void
Removes all bindings from the target

Parameters:
target
The target component

removeBinding

public static function removeBinding(target: Object,
 binding: Binding): Void
Removes a binding from a target

Parameters:
target
The target component
binding
The binding to remove

toString

public function toString(): String
Summary info


The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc