Launchpad theme and panelmanager problem

3907
2
Jump to solution
11-22-2015 07:28 PM
AndrewTerwiel
Occasional Contributor II

I've been trying to open a widget from another widget. The code I have works fine for Foldable theme but not for Launchpad theme.

_showWidget: function (widgetName) {
  var wm = WidgetManager.getInstance();
  var pm = PanelManager.getInstance();
  var myWidget = null;
  arrayUtils.some(wm.appConfig.widgetPool.widgets, function (aWidget) {
   if (aWidget.name === widgetName) {
     myWidget = aWidget;
   }
  });

  if (myWidget) {
   var controller = wm.getWidgetsByName("AnchorBarController");
   if (controller.length > 0) {
     var deferred = pm.showPanel(myWidget);
     deferred.then(function (panel) {
       //pm.minimizePanel(panel);
       pm.normalizePanel(panel);
       //pm.maximizePanel(panel);
     });
   }
   else {
     pm.showPanel(myWidget);
   }
  }
},

line 17 and 19 both work i.e. they perform as expected, but line 18 does nothing. My panel is still hidden.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Andrew,

  When dealing with a widget in the LaunchPads AnchorBar you have to set the panels position:

_showWidget: function (widgetName) {  
      var wm = WidgetManager.getInstance();  
      var pm = PanelManager.getInstance();  
      var myWidget = null;  
      arrayUtils.some(wm.appConfig.widgetPool.widgets, function (aWidget) {  
       if (aWidget.name === widgetName) {  
         myWidget = aWidget;  
       }  
      });  
      
      if (myWidget) {
         var controller = wm.getWidgetsByName("AnchorBarController");
         if (controller.length > 0) {
           pm.showPanel(myWidget).then(lang.hitch(this, function(panel){
             panel.setPosition({ top: 120, left: 10, width: 350, height: 480, margin: 10, index: 0 });
             pm.normalizePanel(panel);
           }));
         } else {
           pm.showPanel(myWidget);
         }
        }  
    },

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Andrew,

  When dealing with a widget in the LaunchPads AnchorBar you have to set the panels position:

_showWidget: function (widgetName) {  
      var wm = WidgetManager.getInstance();  
      var pm = PanelManager.getInstance();  
      var myWidget = null;  
      arrayUtils.some(wm.appConfig.widgetPool.widgets, function (aWidget) {  
       if (aWidget.name === widgetName) {  
         myWidget = aWidget;  
       }  
      });  
      
      if (myWidget) {
         var controller = wm.getWidgetsByName("AnchorBarController");
         if (controller.length > 0) {
           pm.showPanel(myWidget).then(lang.hitch(this, function(panel){
             panel.setPosition({ top: 120, left: 10, width: 350, height: 480, margin: 10, index: 0 });
             pm.normalizePanel(panel);
           }));
         } else {
           pm.showPanel(myWidget);
         }
        }  
    },
0 Kudos
AndrewTerwiel
Occasional Contributor II

Thanks very much, Robert. Works perfectly now.

0 Kudos