public AbstractTab getTabByClassName(String javaClassName) {
   for (AbstractTab tab : tabs) {
     if (tab.getClass().getName().equals(javaClassName)) {
       return tab;
     }
   }
   return null;
 }
 protected void onPortletRemoved(String javaClassName) {
   AbstractTab activeTab = getActiveOntologyTab();
   List<EntityPortlet> comps = activeTab.getPortlets();
   for (EntityPortlet entityPortlet2 : comps) {
     EntityPortlet entityPortlet = entityPortlet2;
     if (entityPortlet.getClass().getName().equals(javaClassName)) {
       ((Portlet) entityPortlet).setVisible(false);
       ((Portlet) entityPortlet).destroy();
     }
   }
 }
 protected void onTabRemoved(String javaClassName) {
   AbstractTab tab = getTabByClassName(javaClassName);
   if (tab == null) {
     return;
   }
   getProject().getLayoutManager().removeTab(tab);
   tabs.remove(tab);
   hideTabStripItem(tab);
   remove(tab);
   tab.hide();
   doLayout();
 }
 protected void onPortletAdded(String javaClassName) {
   try {
     EntityPortlet portlet = UIFactory.createPortlet(getProject(), javaClassName);
     if (portlet == null) {
       return;
     }
     AbstractTab activeTab = getActiveOntologyTab();
     activeTab.addPortlet(portlet, activeTab.getColumnCount() - 1);
     doLayout();
   } catch (Exception e) {
     GWT.log("Problem adding portlet", e);
   }
 }
 private void updateTabStyle(AbstractTab tab) {
   String tabHeaderClass = tab.getHeaderClass();
   if (tabHeaderClass != null) {
     Element tabEl = getTabEl(tab);
     tabEl.addClassName(tabHeaderClass);
   }
 }
  private void selectTabWithName(String tabNameToSelect) {
    for (AbstractTab tab : tabs) {
      String tabName = tab.getClass().getName();
      tabName = tabName.substring(tabName.lastIndexOf(".") + 1);
      if (tabName.equals(tabNameToSelect)) {
        activate(tab.getId());
        doLayout();

        String selection = com.google.gwt.user.client.Window.Location.getParameter("id");
        if (selection != null) {
          selection = URL.decodeQueryString(selection);
          tab.setSelection(UIUtil.createCollection(new EntityData(selection)));
          break;
        }
      }
    }
  }
  protected ToolbarMenuButton getAddTabButton() {
    shortToLongTabNameMap = UIFactory.getAvailableTabNameMap();

    List<String> enabledTabs = new ArrayList<String>();
    for (AbstractTab tab : tabs) {
      enabledTabs.add(tab.getClass().getName());
    }

    Menu addTabMenu = new Menu();
    for (String tabName : shortToLongTabNameMap.keySet()) {
      CheckItem item =
          new CheckItem(tabName, enabledTabs.contains(shortToLongTabNameMap.get(tabName)));
      addTabMenu.addItem(item);
      item.addListener(
          new CheckItemListenerAdapter() {
            @Override
            public void onCheckChange(CheckItem item, boolean checked) {
              String javaClassName = shortToLongTabNameMap.get(item.getText());
              if (checked) {
                onTabAdded(javaClassName);
              } else {
                onTabRemoved(javaClassName);
              }
            }
          });
    }

    // Add the "Add user defined tab"
    addTabMenu.addSeparator();
    Item item = new Item("Add your own tab");
    addTabMenu.addItem(item);
    item.addListener(
        new BaseItemListenerAdapter() {
          @Override
          public void onClick(BaseItem item, EventObject e) {
            onUserDefinedTabAdded();
          }
        });

    ToolbarMenuButton addTabButton = new ToolbarMenuButton("Add tab", addTabMenu);
    addTabButton.setIcon("images/tab_add.gif");
    return addTabButton;
  }