if(!dojo._hasResource["bepixeld.binding.Data"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["bepixeld.binding.Data"] = true;
dojo.provide("bepixeld.binding.Data");
dojo.declare("bepixeld.binding.Data", null, {
	constructor: function(args){
		dojo.mixin(this, args);
		if(!this.item){
			this.item = {};
		}
		if(this.store){
			this.id = this.store.getIdentity(this.item);
		}			
	},
	item: null,	
	store: null,
	id: null,		
	onValueChanged: '',
	properties: {},
	get: function(property){
		return this.getPropertyValue(property);
	},
	getPropertyValue: function(property) {
		return this.item[property];
	},
	set: function(property, value){
		this.setPropertyValue(property, value);
	},
	setPropertyValue: function(property, value) {
		var old = this.item[property];
		this.item[property]=value;
		if(this.onValueChanged){
			this.onValueChanged(property, old, value);
		}
	},
	getStoreItem: function() {
		if (this.store && this.id) {
			return this.store._getItemByIdentity(this.id);
		}
		var item = this.item;
		return (item.__dojo_data_item) ? item.__dojo_data_item: item;
	},		
	getData: function(stripped){
		var item;
		if(this.store){
			item = this.store.itemToObject(this.item);
		} else{
			item = this.item;
		}	
		if(stripped) {
			var c = {};
			for(var key in item) {
				if(item[key] != null) {
					c[key] = item[key];
				}
			}	
			item = c;
		}
		return item;
	},
	copyAttributes: function(sourceItem, targetItem, copyNull) {
		if(this.store) {
			var attr = this.store.getAttributes(targetItem);
			for(var i=0; i < attr.length; i++) {
				var key = attr[i];
				if(typeof sourceItem[key] !== "undefined") {
					if((copyNull) || (sourceItem[key] != null)){
						this.store.setValue(targetItem, key, sourceItem[key]);
					}
				}
			}
		} else {
			for(var key in sourceItem) {
				if((key !== this.store._storeRefPropName) && (key !== this.store._itemNumPropName) && (key !== this.store._rootItemPropName) && (key !== this.store._reverseRefMap)){
					if((copyNull) || (sourceItem[key] != null)){
						targetItem[key] = sourceItem[key];
					}
				}
			}
		}
	},
	clone: function(){
		var c = new bepixeld.binding.Data({store: this.store, id: this.id, onValueChanged: this.onValueChanged});
		c.item = {};
		for(var key in this.item) {
			c.item[key] = this.item[key];
		}		
		return c;
	}			
});

}
