/**
   * Create a ribbon bar widget using a back-end spring bean identifier and a map.
   *
   * @param mapWidget The map widget onto which many actions in this ribbon apply.
   * @param application The name of the application wherein to search for the ribbon configuration.
   * @param beanId A unique spring bean identifier for a bean of class {@link RibbonInfo}. This
   *     configuration is then fetched and applied.
   * @param ribbonBarMembersMargin Sets the margin between the different {@link
   *     org.geomajas.widget.utility.common.client.ribbon.RibbonGroup}s. If null, the {@link
   *     GuwLayout#ribbonBarInternalMargin} is used.
   */
  public RibbonTabLayout(
      final MapWidget mapWidget,
      String application,
      String beanId,
      final Integer ribbonBarMembersMargin) {
    tabs = new TabSet();
    tabs.setPaneMargin(0);
    addMember(tabs);

    setOverflow(GuwLayout.ribbonBarOverflow);

    ClientConfigurationService.getApplicationWidgetInfo(
        application,
        beanId,
        new WidgetConfigurationCallback<RibbonInfo>() {

          public void execute(RibbonInfo ribbonInfo) {
            for (RibbonBarInfo tabInfo : ribbonInfo.getTabs()) {
              RibbonBarLayout ribbon = new RibbonBarLayout(tabInfo, mapWidget);
              if (null != ribbonBarMembersMargin) {
                ribbon.setMembersMargin(ribbonBarMembersMargin);
              } else {
                ribbon.setMembersMargin(GuwLayout.ribbonBarInternalMargin);
              }
              // if no custom style is set, replace smartgwt's default 'normal' with our default
              // 'ribbon'.
              String styleName = !"normal".equals(getStyleName()) ? getStyleName() : "ribbon";
              ribbon.setStyleName(styleName);
              ribbon.setBorder("0px");
              Tab tab = new Tab(tabInfo.getTitle());
              tab.setTitleStyle(styleName + "TabTitle");
              tab.setPane(ribbon);
              tabs.addTab(tab);
              tabs.setStyleName(getStyleName() + "TabSet");
            }
          }
        });
  }