@WorkbenchMenu
 public Menus getMenus() {
   return MenuFactory.newTopLevelMenu(constants.MenuOrganizationalUnits())
       .withPermission(OrganizationalUnit.RESOURCE_TYPE, OrganizationalUnitAction.READ)
       .menus()
       .menu(constants.MenuManageOrganizationalUnits())
       .respondsWith(
           () ->
               placeManager.goTo(
                   "org.kie.workbench.common.screens.organizationalunit.manager.OrganizationalUnitManager"))
       .endMenu()
       .endMenus()
       .endMenu()
       .newTopLevelMenu(constants.repositories())
       .menus()
       .menu(constants.listRepositories())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.READ)
       .respondsWith(() -> placeManager.goTo("RepositoriesEditor"))
       .endMenu()
       .menu(constants.cloneRepository())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.READ)
       .respondsWith(cloneRepoCommand)
       .endMenu()
       .menu(constants.newRepository())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.CREATE)
       .respondsWith(newRepoCommand)
       .endMenu()
       .endMenus()
       .endMenu()
       .build();
 }
  @WorkbenchMenu
  public Menus getMenus() {
    return MenuFactory.newTopLevelMenu(Constants.INSTANCE.New_Process_Instance())
        .respondsWith(
            new Command() {
              @Override
              public void execute() {
                newProcessInstancePopup.show();
              }
            })
        .endMenu()
        .newTopLevelCustomMenu(
            new MenuFactory.CustomMenuBuilder() {
              @Override
              public void push(MenuFactory.CustomMenuBuilder element) {}

              @Override
              public MenuItem build() {
                return new BaseMenuCustom<IsWidget>() {
                  @Override
                  public IsWidget build() {
                    menuRefreshButton.addClickHandler(
                        new ClickHandler() {
                          @Override
                          public void onClick(ClickEvent clickEvent) {
                            refreshGrid();
                          }
                        });
                    return menuRefreshButton;
                  }

                  @Override
                  public boolean isEnabled() {
                    return true;
                  }

                  @Override
                  public void setEnabled(boolean enabled) {}

                  @Override
                  public String getSignatureId() {
                    return "org.jbpm.console.ng.pr.client.editors.instance.list.ProcessInstanceListPresenter#menuRefreshButton";
                  }
                };
              }
            })
        .endMenu()
        .newTopLevelCustomMenu(refreshSelectorMenuBuilder)
        .endMenu()
        .newTopLevelCustomMenu(resetFiltersMenuBuilder)
        .endMenu()
        .build();
  }
 @WorkbenchMenu
 public Menus getMenus() {
   return MenuFactory.newTopLevelMenu("Open")
       .withItems(ShowcaseEntryPoint.getScreens())
       .endMenu()
       .newTopLevelMenu("Command")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Command!");
             }
           })
       .endMenu()
       .newTopLevelMenu("Create New")
       .menus()
       .menu("Command 1")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Command 1!");
             }
           })
       .endMenu()
       .menu("Command 2")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Command 2!");
             }
           })
       .endMenu()
       .endMenus()
       .endMenu()
       .newTopLevelMenu("Find")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Find!");
             }
           })
       .position(MenuPosition.RIGHT)
       .endMenu()
       .build();
 }
  @Override
  protected void setupMenu() {

    final AbstractWorkbenchPerspectiveActivity defaultPerspective =
        menusHelper.getDefaultPerspectiveActivity();
    final Menus menus =
        MenuFactory.newTopLevelMenu(constants.Home())
            .place(new DefaultPlaceRequest(defaultPerspective.getIdentifier()))
            .endMenu()
            .newTopLevelMenu(constants.Authoring())
            .withItems(getAuthoringViews())
            .endMenu()
            .newTopLevelMenu(constants.Deploy())
            .withItems(getDeploymentViews())
            .endMenu()
            .newTopLevelMenu(constants.Case_Management())
            .withItems(getCaseManagementViews())
            .endMenu()
            .newTopLevelMenu(constants.Process_Management())
            .withItems(getProcessManagementViews())
            .endMenu()
            .newTopLevelMenu(constants.Work())
            .withItems(getWorkViews())
            .endMenu()
            .newTopLevelMenu(constants.Dashboards())
            .withItems(getDashboardsViews())
            .endMenu()
            .newTopLevelMenu(constants.Extensions())
            .withItems(menusHelper.getExtensionsViews())
            .endMenu()
            .newTopLevelMenu(constants.Experimental())
            .withItems(getExperimentalViews())
            .endMenu()
            .newTopLevelCustomMenu(iocManager.lookupBean(SearchMenuBuilder.class).getInstance())
            .endMenu()
            .build();

    menuBar.addMenus(menus);

    menusHelper.addRolesMenuItems();
    menusHelper.addGroupsMenuItems();
    menusHelper.addWorkbenchConfigurationMenuItem();
    menusHelper.addUtilitiesMenuItems();
  }
  @Override
  protected void makeMenuBar() {
    super.makeMenuBar();

    menuBuilder.addNewTopLevelMenu(
        MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Tags())
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    AddTag addTag = new AddTag(PerspectiveEditorPresenter.this);
                    addTag.show();
                  }
                })
            .endMenu()
            .build()
            .getItems()
            .get(0));
  }
Пример #6
0
 @WorkbenchMenu
 public Menus getMenu() {
   return MenuFactory.newTopLevelMenu("Save")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Saved!");
             }
           })
       .endMenu()
       .newTopLevelMenu("Delete")
       .respondsWith(
           new Command() {
             @Override
             public void execute() {
               Window.alert("Deleted!");
             }
           })
       .endMenu()
       .build();
 }
 private void makeMenuBar() {
   menus =
       MenuFactory.newTopLevelMenu(constants.Bulk_Actions())
           .withItems(getBulkActions())
           .endMenu()
           .newTopLevelMenu(constants.Refresh())
           .respondsWith(
               new Command() {
                 @Override
                 public void execute() {
                   view.getShowAllLink().setStyleName("active");
                   view.getShowCompletedLink().setStyleName("");
                   view.getShowAbortedLink().setStyleName("");
                   view.getShowRelatedToMeLink().setStyleName("");
                   refreshActiveProcessList();
                   clearSearchEvent.fire(new ClearSearchEvent());
                   view.setCurrentFilter("");
                   view.displayNotification(constants.Process_Instances_Refreshed());
                 }
               })
           .endMenu()
           .build();
 }
  @Override
  public Menus build() {
    final Map<Object, MenuItem> menuItems = new LinkedHashMap<Object, MenuItem>();
    if (saveCommand != null) {
      menuItems.put(
          MenuItems.SAVE,
          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Save())
              .respondsWith(saveCommand)
              .endMenu()
              .build()
              .getItems()
              .get(0));
    } else if (saveMenuItem != null) {
      menuItems.put(MenuItems.SAVE, saveMenuItem);
      menuItemsSyncedWithLockState.add(saveMenuItem);
    }

    if (deleteCommand != null) {
      if (deleteMenuItem == null) {
        deleteMenuItem =
            MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Delete())
                .respondsWith(deleteCommand)
                .endMenu()
                .build()
                .getItems()
                .get(0);
      }
      menuItems.put(MenuItems.DELETE, deleteMenuItem);
      menuItemsSyncedWithLockState.add(deleteMenuItem);
    }

    if (renameCommand != null) {
      if (renameMenuItem == null) {
        renameMenuItem =
            MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Rename())
                .respondsWith(renameCommand)
                .endMenu()
                .build()
                .getItems()
                .get(0);
      }
      menuItems.put(MenuItems.RENAME, renameMenuItem);
      menuItemsSyncedWithLockState.add(renameMenuItem);
    }

    if (copyCommand != null) {
      menuItems.put(
          MenuItems.COPY,
          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Copy())
              .respondsWith(copyCommand)
              .endMenu()
              .build()
              .getItems()
              .get(0));
    }

    if (validateCommand != null) {
      menuItems.put(
          MenuItems.VALIDATE,
          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Validate())
              .respondsWith(validateCommand)
              .endMenu()
              .build()
              .getItems()
              .get(0));
    }

    if (restoreCommand != null) {
      if (restoreMenuItem == null) {
        restoreMenuItem =
            MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Restore())
                .respondsWith(restoreCommand)
                .endMenu()
                .build()
                .getItems()
                .get(0);
      }
      menuItemsSyncedWithLockState.add(restoreMenuItem);
    }

    if (!(otherCommands == null || otherCommands.isEmpty())) {
      final List<MenuItem> otherMenuItems = new ArrayList<MenuItem>();
      for (Pair<String, Command> other : otherCommands) {
        otherMenuItems.add(
            newSimpleItem(other.getK1())
                .respondsWith(other.getK2())
                .endMenu()
                .build()
                .getItems()
                .get(0));
      }
      final MenuItem item =
          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Other())
              .withItems(otherMenuItems)
              .endMenu()
              .build()
              .getItems()
              .get(0);
      menuItems.put(item, item);
    }

    for (MenuItem menuItem : topLevelMenus) {
      menuItems.put(menuItem, menuItem);
    }

    return new Menus() {

      @Override
      public List<MenuItem> getItems() {
        return new ArrayList<MenuItem>() {
          {
            for (final MenuItem menuItem : menuItems.values()) {
              add(menuItem);
            }
          }
        };
      }

      @Override
      public Map<Object, MenuItem> getItemsMap() {
        return menuItems;
      }

      @Override
      public void accept(MenuVisitor visitor) {
        if (visitor.visitEnter(this)) {
          for (final MenuItem item : menuItems.values()) {
            item.accept(visitor);
          }
          visitor.visitLeave(this);
        }
      }
    };
  }
  @WorkbenchMenu
  public Menus getMenus() {
    GWT.log("get menus DatasetTasklist presenter " + autoRefreshSeconds);
    setupButtons();

    return MenuFactory.newTopLevelMenu(Constants.INSTANCE.New_Task())
        .respondsWith(
            new Command() {
              @Override
              public void execute() {
                quickNewTaskPopup.show();
              }
            })
        .endMenu()
        .newTopLevelCustomMenu(
            new MenuFactory.CustomMenuBuilder() {
              @Override
              public void push(MenuFactory.CustomMenuBuilder element) {}

              @Override
              public MenuItem build() {
                return new BaseMenuCustom<IsWidget>() {
                  @Override
                  public IsWidget build() {
                    menuRefreshButton.addClickHandler(
                        new ClickHandler() {
                          @Override
                          public void onClick(ClickEvent clickEvent) {
                            refreshGrid();
                          }
                        });
                    return menuRefreshButton;
                  }

                  @Override
                  public boolean isEnabled() {
                    return true;
                  }

                  @Override
                  public void setEnabled(boolean enabled) {}

                  @Override
                  public String getSignatureId() {
                    return "org.jbpm.console.ng.ht.client.editors.taskslist.grid.dash.DataSetTaskListGridPresenter#menuRefreshButton";
                  }
                };
              }
            })
        .endMenu()
        .newTopLevelCustomMenu(
            new MenuFactory.CustomMenuBuilder() {
              @Override
              public void push(MenuFactory.CustomMenuBuilder element) {}

              @Override
              public MenuItem build() {
                return new BaseMenuCustom<IsWidget>() {
                  @Override
                  public IsWidget build() {
                    return menuActionsButton;
                  }

                  @Override
                  public boolean isEnabled() {
                    return true;
                  }

                  @Override
                  public void setEnabled(boolean enabled) {}

                  @Override
                  public String getSignatureId() {
                    return "org.jbpm.console.ng.ht.client.editors.taskslist.grid.dash.DataSetTaskListGridPresenter#menuActionsButton";
                  }
                };
              }
            })
        .endMenu()
        .newTopLevelCustomMenu(
            new MenuFactory.CustomMenuBuilder() {
              @Override
              public void push(MenuFactory.CustomMenuBuilder element) {}

              @Override
              public MenuItem build() {
                return new BaseMenuCustom<IsWidget>() {
                  @Override
                  public IsWidget build() {
                    menuResetTabsButton.addClickHandler(
                        new ClickHandler() {
                          @Override
                          public void onClick(ClickEvent clickEvent) {
                            view.restoreTabs();
                          }
                        });
                    return menuResetTabsButton;
                  }

                  @Override
                  public boolean isEnabled() {
                    return true;
                  }

                  @Override
                  public void setEnabled(boolean enabled) {}

                  @Override
                  public String getSignatureId() {
                    return "org.jbpm.console.ng.ht.client.editors.taskslist.grid.dash.DataSetTaskListGridPresenter#menuResetTabsButton";
                  }
                };
              }
            })
        .endMenu()
        .build();
  }
Пример #10
0
  private void setupMenu() {
    final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

    final Menus menus =
        MenuFactory.newTopLevelMenu(AppConstants.INSTANCE.Home())
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    if (defaultPerspective != null) {
                      placeManager.goTo(
                          new DefaultPlaceRequest(defaultPerspective.getIdentifier()));
                    } else {
                      Window.alert("Default perspective not found.");
                    }
                  }
                })
            .endMenu()
            .newTopLevelMenu(AppConstants.INSTANCE.MenuOrganizationalUnits())
            .menus()
            .menu(AppConstants.INSTANCE.MenuManageOrganizationalUnits())
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(
                        "org.kie.workbench.common.screens.organizationalunit.manager.OrganizationalUnitManager");
                  }
                })
            .endMenu()
            .endMenus()
            .endMenu()
            .newTopLevelMenu("Repositories")
            .menus()
            .menu("Repositories List")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo("RepositoriesEditor");
                  }
                })
            .endMenu()
            .menu("Clone repository")
            .respondsWith(cloneRepoCommand)
            .endMenu()
            .menu("New repository")
            .respondsWith(newRepoCommand)
            .endMenu()
            .endMenus()
            .endMenu()
            .newTopLevelMenu("Authoring")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    if (defaultPerspective != null) {
                      placeManager.goTo(new DefaultPlaceRequest("AuthoringPerspective"));
                    } else {
                      Window.alert(" perspective not found.");
                    }
                  }
                })
            .endMenu()
            .newTopLevelMenu("Artifacts")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(
                        new DefaultPlaceRequest(
                            "org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective"));
                  }
                })
            .endMenu()
            .newTopLevelMenu("Wires")
            .menus()
            .menu("Scratch Pad")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("WiresScratchPadPerspective"));
                  }
                })
            .endMenu()
            .menu("Trees")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("WiresTreesPerspective"));
                  }
                })
            .endMenu()
            .menu("Bayesian networks")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("WiresBayesianPerspective"));
                  }
                })
            .endMenu()
            .endMenus()
            .endMenu()
            .newTopLevelMenu("Workbench")
            .menus()
            .menu("Apps")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("AppsPerspective"));
                  }
                })
            .endMenu()
            .menu("Plugins")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("PlugInAuthoringPerspective"));
                  }
                })
            .endMenu()
            .endMenus()
            .endMenu()
            .newTopLevelMenu("Messages")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("MessagesPerspective"));
                  }
                })
            .endMenu()
            .newTopLevelMenu("Inbox")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("InboxPerspective"));
                  }
                })
            .endMenu()
            .newTopLevelMenu("Assets")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("AssetsPerspective"));
                  }
                })
            .endMenu()
            .newTopLevelMenu("Projects")
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    placeManager.goTo(new DefaultPlaceRequest("ProjectsPerspective"));
                  }
                })
            .endMenu()
            .newTopLevelMenu(AppConstants.INSTANCE.Logout())
            .respondsWith(new LogoutCommand())
            .position(MenuPosition.RIGHT)
            .endMenu()
            .build();

    menubar.addMenus(menus);
  }