define(["cilantro/lib/base"],function(){var a=Base.extend({constructor:function(a,b){this.state="INIT",this.ds={},this.viewset=a,this.concept_pk=b,this.dom=$(),this.render(),this.dom.delegate("input,select,textarea","change keyup",$.proxy(this.elementChanged,this)),this.dom.bind("UpdateElementEvent",$.proxy(this.updateElement,this)),this.dom.bind("UpdateDSEvent",$.proxy(this.updateDS,this)),this.dom.bind("GainedFocusEvent",$.proxy(this.gainedFocus,this)),this.dom.bind("LostFocusEvent",$.proxy(this.lostFocus,this)),this.dom.bind("RegisterElementsEvent",$.proxy(this.registerElements,this)),this.dom.bind("HideDependentsEvent",$.proxy(this.hideDependents,this)),this.dom.bind("ShowDependentsEvent",$.proxy(this.showDependents,this))},render:function(){throw{name:"FunctionNotImplementedException",message:'This function needs to set the "dom" attribute of this object.'}},elementChanged:function(a){throw{name:"FunctionNotImplementedException",message:"This function needs to trigger an ElementChangedEvent with the new value of the evt.target."}},updateElement:function(a,b){throw{name:"FunctionNotImplementedException",message:"This function needs to find the element whose name = element.name, and set its value to element.value."}},updateDS:function(a,b){for(var c in b)this.updateElement("UpdateElementEvent",{name:c,value:b[c]});this.ds=b,this.dom.data("datasource",b)},registerElements:function(a){$("input,select",this.dom).change()},gainedFocus:function(){this.state="ONSCREEN"},lostFocus:function(){this.state="OFFSCREEN"},hideDependents:function(a){this.dom[0]!==(a.originalEvent?a.originalEvent.target:a.target)&&this.dom.has(a.target).length===0&&$("input,select,label",this.dom).attr("disabled","true").change()},showDependents:function(a){this.dom[0]!==(a.originalEvent?a.originalEvent.target:a.target)&&this.dom.has(a.target).length===0&&$("input,select,label",this.dom).filter(":disabled").removeAttr("disabled").change()}});return a})