Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added DataBindings.getDataProvider(propertyName) to retrieve a data p…

…rovider from a property name

F DataBindings.addProperty() will now remove the property first if it already exists
  • Loading branch information...
commit ff5012ceb80a6ea6846bdacd0c550ca7b9e24ada 1 parent 1d9d1aa
@promethe42 promethe42 authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/aerys/minko/type/data/DataBindings.as
View
15 src/aerys/minko/type/data/DataBindings.as
@@ -14,6 +14,7 @@ package aerys.minko.type.data
private var _bindings : Dictionary = new Dictionary(true);
private var _values : Object = new Object();
private var _properties : Vector.<String> = new <String>[];
+ private var _propertyToProvider : Object = {};
private var _propertyChanged : Object = new Object();
@@ -70,6 +71,16 @@ package aerys.minko.type.data
return this;
}
+ public function getDataProvider(propertyName : String) : IDataProvider
+ {
+ var provider : IDataProvider = _propertyToProvider[propertyName] as IDataProvider;
+
+ if (!provider)
+ throw new Error('The property \'' + propertyName + '\' has no data provider.');
+
+ return provider;
+ }
+
public function getProperty(propertyName : String) : Object
{
return _values[propertyName];
@@ -108,6 +119,9 @@ package aerys.minko.type.data
source : IDataProvider,
key : Object = null) : DataBindings
{
+ if (_propertyToProvider[propertyName])
+ removeProperty(propertyName);
+
var bindingTable : Object = _bindings[source] as Object;
if (!bindingTable)
@@ -212,6 +226,7 @@ package aerys.minko.type.data
_properties.length = numProperties;
delete _values[propertyName];
+ delete _propertyToProvider[propertyName];
// delete _propertyChanged[propertyName];
signalChange(propertyName, null);
Please sign in to comment.
Something went wrong with that request. Please try again.