Formidable.Classes.ListerRow = Base.extend({
	uid: false,
	_parent: false,
	constructor: function(oConfig) { Object.extend(this, oConfig);},
	rdt: function(sRdt) {
		if((sRdtId = this._parent.config.rdtbyrow[this.uid][sRdt])) {
			return this._parent.oForm.o(sRdtId);	
		} else {
			sPath = sRdt.replace(".", "/");
			aPath = sPath.split("/");
			if((oRdt = this.rdt(aPath[0]))) {
				aPath.shift();
				i = 0;
				aPath.each(function(sPathSegment) {
					if((oRdt = oRdt.rdt(sPathSegment))) {
						i++;
					} else {
						throw $break;
					}
				}.bind(this));
				if(i == aPath.size()) {
					return oRdt;
				}	
			}
		}
		
		return false;
	}
});

Formidable.Classes.Lister = Formidable.Classes.RdtBaseClass.extend({
	constructor: function(oConfig) {
		this.base(oConfig);
	},
	getRow: function(iUid) {
		return new Formidable.Classes.ListerRow({
			"uid": iUid,
			"_parent": this
		});
	},
	getRows: function() {
		var aRows = $A();
		
		$H(this.config.rdtbyrow).each(function(oData) {
			aRows.push(this.getRow(oData[0]));
		}.bind(this));

		return aRows;
	},
	getCurrentRow: function() {
		aContext = this.oForm.getContext();
		if(typeof(aContext.currentrow) != "undefined") {
			return this.getRow(aContext.currentrow);
		}
	}
});

