/*
 * Copyright (c) 2012-2014 Kaarle Ritvanen
 * See LICENSE file for license details
 */

define(
    ["aconf/statusbar", "aconf/widget/link", "jquery", "underscore"],
    function(statusBar, Base, $, _) {
	return Base.extend({
	    init: function(
		data, name, meta, level, editable, removable
	    ) {
		this.txnMgr = data.txnMgr;
		return Base.init.call(
		    this, data, name, meta, level, editable, removable
		);
	    },

	    staticRender: function(value, meta) { return null; },

	    createEl: function() { return $("<div>"); },

	    requestData: function(value, meta) {
		this.path = value;
		return this._requestData(value, meta);
	    },

	    _requestData: function(value, meta) {
		return Base.requestData.call(this, value, meta);
	    },

	    refreshData: function() {
		var def = $.Deferred();
		this.txnMgr.query(this.path).done(function(data) {
		    def.resolve(data, data.meta);
		});
		return def;
	    }
	});
    }
);
