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;
  }
  protected ToolbarMenuButton getAddPortletButton() {
    shortToLongPortletNameMap = UIFactory.getAvailablePortletNameMap();

    Menu addPortletMenu = new Menu();
    for (String portletName : shortToLongPortletNameMap.keySet()) {
      Item item = new Item(portletName);
      addPortletMenu.addItem(item);
      item.addListener(
          new BaseItemListenerAdapter() {
            @Override
            public void onClick(BaseItem item, EventObject e) {
              String javaClassName = shortToLongPortletNameMap.get(((Item) item).getText());
              onPortletAdded(javaClassName);
            }
          });
    }
    ToolbarMenuButton addPortletButton =
        new ToolbarMenuButton("Add content to this tab", addPortletMenu);
    addPortletButton.setIcon("images/portlet_add.gif");
    return addPortletButton;
  }
  public NavegacaoAcesso() {
    menu = new Menu();
    Item mnuMarcar = new Item(OpenSigCore.i18n.txtMarcar());
    mnuMarcar.setIconCls("icon-marcar");
    mnuMarcar.addListener(
        new BaseItemListenerAdapter() {

          public void onClick(BaseItem item, EventObject e) {
            TreeNode node = nodeSelecionado;
            do {
              node.getUI().toggleCheck(true);
              node = (TreeNode) node.getParentNode();
            } while (node != null && node.getDepth() > 0);
            checarNode(nodeSelecionado, true);
          }
        });
    menu.addItem(mnuMarcar);

    Item mnuDesmarcar = new Item(OpenSigCore.i18n.txtDesmarcar());
    mnuDesmarcar.setIconCls("icon-desmarcar");
    mnuDesmarcar.addListener(
        new BaseItemListenerAdapter() {

          public void onClick(BaseItem item, EventObject e) {
            checarNode(nodeSelecionado, false);
          }
        });
    menu.addItem(mnuDesmarcar);

    mnuExec = new Menu();
    final CheckItem chkExecutar = new CheckItem(OpenSigCore.i18n.txtExecutar());
    chkExecutar.addListener(
        new CheckItemListenerAdapter() {
          public void onCheckChange(CheckItem item, boolean checked) {
            nodeSelecionado.setAttribute("executar", checked);
          }
        });
    mnuExec.addItem(chkExecutar);

    treeAcesso = new Arvore();
    treeAcesso.setFiltrar(true);
    treeAcesso.setExpandir(true);
    treeAcesso.setHeight(375);
    treeAcesso.inicializar();
    treeAcesso.addListener(
        new TreePanelListenerAdapter() {

          public void onCheckChange(TreeNode node, boolean checked) {
            node.setAttribute("executar", checked);
            if (checked) {
              do {
                node = (TreeNode) node.getParentNode();
                node.getUI().toggleCheck(true);
              } while (node.getDepth() > 0);
            } else {
              checarNode(node, checked);
            }
          }

          public void onContextMenu(TreeNode node, EventObject e) {
            node.select();
            nodeSelecionado = node;
            if (node.getUserObject() instanceof SisAcao) {
              String executar = nodeSelecionado.getAttribute("executar");
              boolean exec = executar == null ? false : executar.equalsIgnoreCase("true");
              chkExecutar.setChecked(exec);
              mnuExec.showAt(e.getXY());
            } else {
              menu.showAt(e.getXY());
            }
          }
        });
  }