I have the following code that successfully shows a widget panel. When using the Launchpad theme, the colour from the widget's button icon in the AnchorBarController doesn't get applied to the panel header. It should look like this:
but instead looks like this:
Also, when minimised the panel looks like this:
when it should take on the colour of the button icon in the AnchorBarController like this:
The code:
var myWidget = null;
arrayUtils.some(this.wManager.appConfig.widgetPool.widgets, function (aWidget) {
if (aWidget.name === widgetName) {
myWidget = aWidget;
}
});
if (myWidget) {
// check for presence of the AnchorBarController
var controller = this.wManager.getWidgetsByName("AnchorBarController");
if (controller.length > 0) {
this.pManager.showPanel(myWidget).then(lang.hitch(this, function (panel) {
panel.setPosition({ top: 120, left: 10, width: 350, height: 480, margin: 10, index: 0 });
}));
}
else {
this.pManager.showPanel(myWidget);
}
}
Does anyone know of a way to get the icon colours to apply to the panel?
Andrew,
Here is the fix for that:
_showWidget: function (widgetName) {
this.wManager = WidgetManager.getInstance();
this.pManager = PanelManager.getInstance();
var myWidget = null, panelConfig = null, dockableItem = null;
arrayUtils.some(this.wManager.appConfig.widgetPool.widgets, function (aWidget) {
if (aWidget.name === widgetName) {
myWidget = aWidget;
}
});
if (myWidget) {
// check for presence of the AnchorBarController
var controller = this.wManager.getWidgetsByName("AnchorBarController");
if (controller.length > 0) {
var abc = controller[0]
arrayUtils.some(abc.iconList, lang.hitch(this, function (wpanel) {
var pc = wpanel.getConfigForPanel();
if (pc.name === widgetName) {
wpanel.setOpened(true);
wpanel.setPanelIndex(abc._calPanelIndex());
panelConfig = wpanel.getConfigForPanel();
dockableItem = wpanel;
return true;
}
}));
this.pManager.showPanel(panelConfig).then(lang.hitch(this, function (panel) {
panel.setPosition(panelConfig.panel.position);
}));
abc._addToOpenedIds(dockableItem.config.id);
} else {
this.pManager.showPanel(myWidget);
}
}
},
Thanks, Robert.