0 Replies Latest reply on Dec 7, 2009 4:14 PM by bolsover

    Dynamically created toolbar menus

    bolsover

      I have a curious problem dynamically creating a tool bar with all the associated menus...

      // this works - the DropDownMenu is added to the ToolBarGroup which is in its turn added to the ToolBar

      ....
      leftToolBarGroup = new HtmlToolBarGroup();
      if (type.equals("dropdown")) {
       HtmlDropDownMenu drop = new HtmlDropDownMenu();
       drop.setValue("menu1");
       leftToolBarGroup.getChildren().add(drop);
       }
      ....
      


      // this does not - no menu is displayed - why? and solution?
      leftToolBarGroup = new HtmlToolBarGroup();
      if (type.equals("dropdown")) {
       addMenuTypeDrop(menu, leftToolBarGroup )
      }
      
       private void addMenuTypeDrop(Menu menu, UIComponentBase parent) {
       UIDropDownMenu drop =
       (UIDropDownMenu) AppUtils.getCurrentApplication().createComponent(UIDropDownMenu.COMPONENT_TYPE);
      
       menu.setValue("menu2");
       parent.getChildren().add(drop);
       }