define([ "../lib/object", "./LineWithActionsWidget", "./_ComplexValueWidget", "dijit/_TemplatedMixin", "dijit/_WidgetBase", "dijit/_WidgetsInTemplateMixin", "dojo/_base/declare", "dojo/_base/lang", "dojo/text!./templates/ObjectBox.html" ], function(objectFuns, LineWithActionsWidget, _ComplexValueWidget, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, lang, template) { return declare([_ComplexValueWidget], { baseClass: "rftObjectBox", templateString: template, actions: null, startup: function() { if ( this._started ){ return; } this.inherited(arguments); this.line1 = new LineWithActionsWidget({ actions: { "inspectIcon": { callback: lang.hitch(this, this._showInfoBox), properties: { blockButton: false, icon: "Inspect" } } } }).placeAt(this.line1Node); this.line2 = new LineWithActionsWidget({ }).placeAt(this.line2Node); var line3Actions = this._createLine3Actions(); this.line3 = new LineWithActionsWidget({ actions: line3Actions }).placeAt(this.line3Node); this.line1.startup(); this.line2.startup(); this.line3.startup(); this.inherited(arguments); }, _createLine3Actions: function() { return objectFuns.map(this.actions,function(value,name){ return { callback: lang.hitch(this, function(callback){ if ( this.value ) { callback(this.value); } }, value), properties: { blockButton: true, label: name, icon: name.charAt(0).toUpperCase()+name.slice(1) } }; },this); }, _showInfoBox: function() {}, onChange: function(value) { if ( value ) { this.iconNode.className = "rftIcon typeIcon rftIcon"+(value.type || ''); this.line1.set('title', value.title || ''); this.line2.set('title', value.subTitle || ''); this.line3.set('title', value.lowerTitle || ''); } } }); });