protected void onActionGrantRightsForGroups(WidgetEvent event) throws Exception {
    SearchHelp searchHelp =
        SearchHelpProcessor.createSearch("com.mg.merp.security.support.ui.SecGroupSearchHelp");
    searchHelp.addSearchHelpListener(
        new SearchHelpListener() {
          public void searchPerformed(SearchHelpEvent event) {
            final Groups[] groups = new Groups[event.getItems().length];
            for (int i = 0; i < groups.length; i++) groups[i] = (Groups) event.getItems()[i];
            final DocFlowStageRightsDialog rightDialog =
                (DocFlowStageRightsDialog)
                    UIProducer.produceForm(
                        "com/mg/merp/docflow/resources/DocFlowStageRightsDialog.mfd.xml");
            rightDialog.addOkActionListener(
                new FormActionListener() {
                  public void actionPerformed(FormEvent event) {
                    DocFlowStageServiceLocal service =
                        (DocFlowStageServiceLocal)
                            ApplicationDictionaryLocator.locate()
                                .getBusinessService(DOCFLOW_STAGE_SERVICE_NAME);
                    service.grantRightsForGroups(
                        ((DocProcessStage) getEntity()), groups, rightDialog.getGrants());
                    refreshRights();
                  }
                });
            rightDialog.run(true);
          }

          public void searchCanceled(SearchHelpEvent event) {
            // do nothing
          }
        });
    searchHelp.search();
  }
  @Override
  protected void doAdd() {
    OrgUnitSearchHelp searchHelp =
        (OrgUnitSearchHelp)
            SearchHelpProcessor.createSearch(
                "com.mg.merp.reference.support.ui.OrgUnitSearchHelp"); //$NON-NLS-1$
    searchHelp.addSearchHelpListener(
        new SearchHelpListener() {

          private int id;

          public void searchCanceled(SearchHelpEvent event) {}

          public void searchPerformed(SearchHelpEvent event) {
            Warehouse warehouse = whServ.addWarehouse((OrgUnit) event.getItems()[0]);
            id = warehouse.getId();
            MaintenanceHelper.edit(
                whServ,
                (PersistentObject) warehouse,
                null,
                new MaintenanceFormActionListener() {
                  public void performed(MaintenanceFormEvent event) {
                    refresh();
                  }

                  public void canceled(MaintenanceFormEvent event) {
                    whServ.eraseWarehouse(id);
                  }
                });
          }
        });
    searchHelp.search();
  }
  protected void onActionChooseDocumentModel(WidgetEvent event) throws Exception {
    SearchHelp searchHelp =
        SearchHelpProcessor.createSearch(
            "com.mg.merp.document.support.ui.UniversalDocModelSearchHelp");
    searchHelp.addSearchHelpListener(
        new SearchHelpListener() {
          public void searchPerformed(SearchHelpEvent event) {
            PersistentObject entity = event.getItems()[0];
            ((DocProcessStage) getEntity()).setLinkDocModel((Integer) entity.getPrimaryKey());
            linkDocModelName = (String) entity.getAttribute("ModelName");
            view.flushModel();
          }

          public void searchCanceled(SearchHelpEvent event) {
            // do nothing
          }
        });
    Map<String, Object> context = new HashMap<String, Object>();
    context.put("DocSection", ((DocProcessStage) getEntity()).getLinkDocSection());
    context.put("DocModelFolder", ((DocProcessStage) getEntity()).getLinkDocModelFolder());
    searchHelp.setImportContext(context);
    searchHelp.search();
  }