private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchFullTextTab = new Tab();
    searchFullTextTab.setTitle("Full Text Search");
    final DynamicForm searchFullTextForm = new DynamicForm();
    searchFullTextForm.setID("searchFullTextForm");
    searchFullTextForm.setNumCols(3);
    searchFullTxt.setName("searchFullTxt");
    searchFullTxt.setTitle("Full Text Search");
    searchFullTxt.setWidth(250);
    searchFullTxt.setRequired(true);
    //		RegExpValidator regExpValidator = new RegExpValidator();
    //		regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$");
    //		searchFullTxt.setValidateOnChange(true);
    //		searchFullTxt.setValidators(regExpValidator);
    SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem");
    searchFullTextSubmitItem.setTitle("Search");
    searchFullTextSubmitItem.setWidth(100);
    class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchFullTextForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.fullTextSearch(
              searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchFullTextForm.addSubmitValuesHandler(
        new SearchFullTextSubmitValuesHandler(jackrabbitExplorer));
    searchFullTextForm.setSaveOnEnter(true);
    searchFullTxt.setStartRow(true);
    searchFullTxt.setEndRow(false);
    searchFullTextSubmitItem.setStartRow(false);
    searchFullTextSubmitItem.setEndRow(true);
    searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem);
    searchFullTextTab.setPane(searchFullTextForm);
    return searchFullTextTab;
  }
  private Tab xpathSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchXpathTab = new Tab();
    searchXpathTab.setTitle("Xpath Search");
    final DynamicForm searchXpathForm = new DynamicForm();
    searchXpathForm.setID("searchXpathForm");
    searchXpathForm.setNumCols(3);
    searchXpathTxt.setName("searchXpathTxt");
    searchXpathTxt.setTitle("Xpath Search");
    searchXpathTxt.setWidth(250);
    searchXpathTxt.setRequired(true);
    SubmitItem searchXpathSubmitItem = new SubmitItem("searchXpathSubmitItem");
    searchXpathSubmitItem.setTitle("Search");
    searchXpathSubmitItem.setWidth(100);
    class SearchXpathSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchXpathSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchXpathForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.xpathSearch(
              searchXpathTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchXpathForm.addSubmitValuesHandler(new SearchXpathSubmitValuesHandler(jackrabbitExplorer));
    searchXpathForm.setSaveOnEnter(true);
    searchXpathTxt.setStartRow(true);
    searchXpathTxt.setEndRow(false);
    searchXpathSubmitItem.setStartRow(false);
    searchXpathSubmitItem.setEndRow(true);
    searchXpathForm.setItems(searchXpathTxt, searchXpathSubmitItem);
    searchXpathTab.setPane(searchXpathForm);
    return searchXpathTab;
  }
Ejemplo n.º 3
0
  // Submit button on Completion Variables pop-up
  protected void submit(Map<String, String> map, boolean assign) {
    String varString = "", outcomeString = "";
    if (map.get("Choose") != null) {
      outcomeString = "?outcome=" + map.get("Choose");
    } else if (map.get("mustChoose") != null) {
      SC.say("Please choose one of the available options before submitting.");
      return;
    }
    for (int i = 0; i < 5; i++) {
      String key = map.get("key" + i), value = map.get("value" + i);
      if (key != null && !key.equals("Note Name")) {
        // key = BpmServiceMain.xmlEncode(key);
        if (value == null || value == "Note or URL") {
          SC.say("The name for note #" + (i + 1) + " is filled in, but there is no value");
          return;
        }
        // value = BpmServiceMain.xmlEncode(value);
        varString += "&var=" + BpmServiceMain.urlEncode(key + ":" + value);
      } else if ((key == null || key.equals("Note Name"))
          && (value != null && !value.equals("Note or URL"))) {
        SC.say("The value for note #" + (i + 1) + " is filled in, but there is no name");
        return;
      }
    }
    if (outcomeString.equals("")) varString = varString.replaceFirst("&", "?");
    final String tempString = map.get("taskID") + outcomeString + varString;
    if (assign) {
      submitItem.disable();
      BpmServiceMain.sendPostNoLocation(
          "/tasks/active/" + map.get("taskID") + "?assignee=" + BpmServiceMain.getUser(),
          new AsyncCallback<Void>() {
            public void onFailure(Throwable arg0) {
              SC.say(
                  "Error. Please ensure that you are connected to the Internet, that the server is currently online, and that the task was not already assigned.");
              submitItem.enable();
            }

            public void onSuccess(Void arg0) {
              BpmServiceMain.sendDelete(
                  "/tasks/active/" + tempString,
                  true,
                  new AsyncCallback<Void>() {
                    public void onFailure(Throwable arg0) {
                      SC.say(
                          "Error. Please ensure that you are connected to the Internet, that the server is currently online, and that the task was not already completed.");
                      confirm.destroy();
                      updateTasks();
                    }

                    public void onSuccess(Void arg0) {
                      confirm.destroy();
                      updateTasks();
                    }
                  });
            }
          });
    } else {
      BpmServiceMain.sendDelete(
          "/tasks/active/" + tempString,
          true,
          new AsyncCallback<Void>() {
            public void onFailure(Throwable arg0) {
              SC.say(
                  "Error. Please ensure that you are connected to the Internet, that the server is currently online, and that the task was not already completed.");
            }

            public void onSuccess(Void arg0) {
              confirm.destroy();
              updateTasks();
            }
          });
    }
  }