@PostConstruct
  private void initComponents() {
    addItem("(Репозиторий не выбран)", null);

    MenuBar.MenuItem miChoose = addItem("", FontAwesome.DATABASE, null);
    MenuBar.MenuItem miEdit =
        addItem("", FontAwesome.EDIT, selectedItem -> editSelectedConnection());

    miChoose.addItem("Стенд 12.178.58.72", selectedItem -> showInfo("Стенд 12.178.58.72"));
    miChoose.addItem("...Подключить репозиторий", selectedItem -> showInfo("...Новый репозиторий"));
  }
  private MenuBar buildMenuBar() {
    mainMenu = new MenuBar();
    mainMenu.setStyleName("mainMenu");
    mainMenu.setImmediate(false);
    mainMenu.setWidth("100%");
    mainMenu.setHeight("-1px");

    Command command1 =
        new Command() {
          public void menuSelected(MenuItem selectedItem) {
            Controller.getInstance().showAllProducts();
            productSearchSplit.setFirstComponent(buildProductTable());
          }
        };

    mainMenu.addItem("ALL", command1);

    for (Section section : Section.values()) {
      List<Category> categories = Controller.getInstance().getCategoriesForSection(section);
      MenuBar.MenuItem menuItem = mainMenu.addItem(section.toString(), null);
      for (final Category category : categories) {
        Command command2 =
            new Command() {
              public void menuSelected(MenuItem selectedItem) {
                Controller.getInstance().searchByCategory(category);
                productSearchSplit.setFirstComponent(buildProductTable());
              }
            };
        menuItem.addItem(category.getName(), command2);
      }
    }

    return mainMenu;
  }
Exemple #3
0
  public SsamMenu(String Logado) throws SQLException {
    Logou = Logado;
    final MenuBar.MenuItem usuario = menubar.addItem("Gerenciamento de Usuário", null);
    usuario.addItem("Cadastrar", menuCommand);
    usuario.addItem("Consultar", menuCommand);
    usuario.addItem("Conta", menuCommand);
    usuario.getChildren().get(2).addItem("Alterar Senha", menuCommand);
    // usuario.addSeparator();

    final MenuBar.MenuItem processo = menubar.addItem("Processo Seletivo", null);
    processo.addItem("Análise", menuCommand);
    processo.addItem("Comparativo", menuCommand);
    processo.addItem("Seleção", menuCommand);
    // processo.addSeparator();
    if (verificaTpUsuario(Logado).equals("V")) {
      menubar.getItems().get(0).getChildren().get(0).setEnabled(false);
      menubar.getItems().get(1).getChildren().get(2).setEnabled(false);
    }

    menubar.setHeight("70%");
    menubar.setWidth("70%");

    addComponent(menubar);
  }