Пример #1
0
    public void onSubmit() {

      termMoveObj.setNewConceptURI((String) destConcept.getValue());
      termMoveObj.setOldConceptURI(conceptObject.getUri());
      termMoveObj.setTermObj(tObj);

      AsyncCallback<TermMoveObject> callback =
          new AsyncCallback<TermMoveObject>() {
            public void onSuccess(TermMoveObject results) {
              panel.clear();
              panel.add(getTable(results));
            }

            public void onFailure(Throwable caught) {
              ExceptionManager.showException(caught, constants.conceptDeleteTermFail());
            }
          };

      OwlStatus status = (OwlStatus) initData.getActionStatus().get(ConceptActionKey.termDelete);
      int actionId =
          Integer.parseInt((String) initData.getActionMap().get(ConceptActionKey.termDelete));

      Service.conceptService.moveTerm(
          MainApp.userOntology, actionId, status, MainApp.userId, tObj, termMoveObj, callback);
    }
Пример #2
0
    public Widget getTable(TermMoveObject tmObj) {
      if (!tmObj.isTermListEmpty()) {
        HashMap<String, ArrayList<TermObject>> termList = tmObj.getTermList();
        HashMap<String, TermRelationshipObject> termRelList = tmObj.getTermRelList();

        ArrayList<String> termlanglist = new ArrayList<String>(termList.keySet());
        ArrayList<String> sortedlanglist = new ArrayList<String>();
        for (LanguageCode langCode : MainApp.languageCode) {
          String lang = langCode.getLanguageCode().toLowerCase();

          if (termlanglist.contains(lang)) {
            termlanglist.remove(lang);
            if (MainApp.userPreference.isHideNonselectedlanguages()) {
              if (!MainApp.userSelectedLanguage.contains(lang)) {
                lang = "";
              }
            }
            if (!lang.equals("")) sortedlanglist.add(lang);
          }
        }
        sortedlanglist.addAll(termlanglist);

        FlexTable table = new FlexTable();
        table.setWidget(0, 0, new HTML(constants.conceptLanguage()));
        table.setWidget(0, 1, new HTML("&nbsp;"));

        table.getColumnFormatter().setWidth(1, "80%");
        int i = 1;
        for (String language : sortedlanglist) {
          table.setWidget(
              i, 0, new HTML(getFullnameofLanguage(language) + " (" + language.toString() + ")"));
          ArrayList<TermObject> list = (ArrayList<TermObject>) termList.get(language);
          table.setWidget(i, 1, getTermTable(list, termRelList));
          i++;
        }

        VerticalPanel panel = new VerticalPanel();
        String str =
            "This action will move following terms in different languages and remove all their current relationships with other terms if exists. Please click browse button to select the new concept and click OK button to move or Cancel button to cancel the task?";
        HTML msg = new HTML(str);
        HorizontalPanel msghp = new HorizontalPanel();
        msghp.setStyleName("language-message");
        msghp.add(msg);
        msghp.setSpacing(10);
        panel.add(msg);
        panel.add(getConceptBrowseButton());
        panel.add(
            GridStyle.setTableConceptDetailStyleTop(
                table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true));
        panel.setWidth("100%");
        return panel;

      } else {
        Label sayNo = new Label(constants.conceptNoTerm());
        return sayNo;
      }
    }