public Button addButtonOnNavigatorContainer(String id, String caption, Resource icon) {
   final ButtonTabImpl button = new ButtonTabImpl(id, 0, caption, "");
   navigatorContainer.addComponent(button);
   navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
   button.setStyleName(TAB_STYLENAME);
   button.setWidth("90%");
   button.setIcon(icon);
   return button;
 }
  public void addTab(
      Component component, String id, int level, String caption, String link, Resource resource) {
    if (!hasTab(id)) {
      final ButtonTabImpl button = new ButtonTabImpl(id, level, caption, link);

      button.addClickListener(
          new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
              if (!event.isCtrlKey() && !event.isMetaKey()) {
                if (selectedButton != button) {
                  clearTabSelection(true);
                  selectedButton = button;
                  selectedButton.addStyleName(TAB_SELECTED_STYLENAME);
                  selectedComp = compMap.get(button.getTabId());
                }
                fireTabChangeEvent(new SelectedTabChangeEvent(VerticalTabsheet.this));
              } else {
                Page.getCurrent().open(button.link, "_blank", false);
              }
            }
          });

      if (resource == null) {
        setDefaulButtonIcon(button, false);
      } else {
        button.setIcon(resource);
      }
      button.setStyleName(TAB_STYLENAME);
      button.setWidth("90%");

      if (button.getLevel() > 0) {
        int insertIndex = 0;
        for (int i = 0; i < navigatorContainer.getComponentCount(); i++) {
          ButtonTabImpl buttonTmp = (ButtonTabImpl) navigatorContainer.getComponent(i);
          if (buttonTmp.getLevel() > level) {
            break;
          } else {
            insertIndex++;
          }
        }
        navigatorContainer.addComponent(button, insertIndex);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      } else {
        navigatorContainer.addComponent(button);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      }

      TabImpl tabImpl = new TabImpl(id, caption, component);
      compMap.put(id, tabImpl);
    }
  }