Michael,
Here is some code that shows that. This full widget code is the otb Legend widget modified.
define([
'dojo/_base/declare',
'jimu/BaseWidget',
'esri/widgets/Legend',
'jimu/WidgetManager',
'dojo/_base/html'
], function(declare, BaseWidget, Legend, WidgetManager, html) {
var clazz = declare([BaseWidget], {
name: 'Legend',
baseClass: 'jimu-widget-legend',
templateString: "<div><div data-dojo-attach-point='legendDiv'></div></div>",
abc: null,
postCreate: function(){
this.inherited(arguments);
this.legend = new Legend({
container:this.legendDiv,
view:this.sceneView
});
},
destroy: function(){
if(!!this.legend){
this.legend.destroy();
}
this.inherited(arguments);
},
onOpen: function(){
var parentWid = html.getAttr(this.domNode, 'widgetId');
var iconNode = this.getAnchorbarControllerNode(parentWid);
this.parentContainer = iconNode;
html.setAttr(this.parentContainer.tooltipDialog, 'content', "Legend Widget New Title");
var panel = this.getPanel();
html.setAttr(panel.titleLabelNode, 'innerHTML', "Legend Widget New Title");
},
getAnchorbarControllerNode: function(id) {
this.abc = WidgetManager.getInstance().getWidgetsByName("AnchorBarController")[0];
return this.abc._getIconItemById(id);
},
onClose: function(){
html.setAttr(this.parentContainer.tooltipDialog, 'content', "Legend");
html.setAttr(this.getPanel().titleLabelNode, 'innerHTML', "Legend");
}
});
return clazz;
});