示例#1
0
文件: Term.java 项目: scbd/vocbench
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
示例#2
0
文件: Term.java 项目: scbd/vocbench
    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;
      }
    }
示例#3
0
文件: Term.java 项目: scbd/vocbench
    private Widget getTermTable(
        ArrayList<TermObject> list, HashMap<String, TermRelationshipObject> termRelList) {

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

      Iterator<TermObject> it = list.iterator();
      int i = 1;
      while (it.hasNext()) {
        TermObject tObj = (TermObject) it.next();
        table.setWidget(
            i,
            0,
            new HTML(getTermColorByStatus(tObj.getLabel(), tObj.getStatus(), tObj.isMainLabel())));
        table.setWidget(i, 1, getRelationshipTermTable(termRelList.get(tObj.getUri())));
        i++;
      }
      table.setWidth("100%");
      return GridStyle.setTableConceptDetailStyleTop(
          table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true);
    }
示例#4
0
文件: Term.java 项目: scbd/vocbench
    private Widget getRelationshipTermTable(TermRelationshipObject trObj) {

      HashMap<ClassObject, HashMap<TermObject, Boolean>> resultList = trObj.getResult();
      Iterator<ClassObject> it = resultList.keySet().iterator();
      Grid table = new Grid(resultList.size() + 1, 2);
      table.setWidget(0, 0, new HTML(constants.termRelationship()));
      table.setWidget(0, 1, new HTML(constants.termTerm()));
      int i = 1;
      while (it.hasNext()) {
        ClassObject rObj = (ClassObject) it.next();
        HashMap<TermObject, Boolean> termList = (HashMap<TermObject, Boolean>) resultList.get(rObj);
        // table.setWidget(i, 0, new HTML(Convert.getRelationshipLabel(rObj)));
        // table.setWidget(i, 1, getDestinationTerm(rObj, new
        // ArrayList<TermObject>(termList.keySet())));
        table.setWidget(i, 0, new HTML(rObj.getLabel()));
        table.setWidget(i, 1, getDestinationTerm(new ArrayList<TermObject>(termList.keySet())));
        i++;
      }

      table.setWidth("100%");
      return GridStyle.setTableConceptDetailStyleTop(
          table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true);
    }
示例#5
0
文件: Term.java 项目: scbd/vocbench
  private void initData(ConceptTermObject ctObj) {
    clearPanel();
    attachNewImgButton();
    if (!ctObj.isEmpty()) {
      HashMap<String, ArrayList<TermObject>> termList = ctObj.getTermList();

      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(constants.conceptTerm()));

      table.getColumnFormatter().setWidth(1, "80%");
      int i = 1;
      int count = 0;
      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));
        i++;
        count += list.size();
      }
      if (conceptObject.getBelongsToModule() == ConceptObject.CONCEPTMODULE)
        conceptDetailPanel
            .tabPanel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(
                        (count) > 1 ? constants.conceptTerms() : constants.conceptTerm())
                    + "&nbsp;("
                    + (count)
                    + ")");
      if (conceptObject.getBelongsToModule() == ConceptObject.CLASSIFICATIONMODULE)
        classificationDetailPanel
            .tab2Panel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(
                        (count) > 1 ? constants.conceptTerms() : constants.conceptTerm())
                    + "&nbsp;("
                    + (count)
                    + ")");
      conceptRootPanel.add(
          GridStyle.setTableConceptDetailStyleTop(
              table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true));
    } else {
      Label sayNo = new Label(constants.conceptNoTerm());
      if (conceptObject.getBelongsToModule() == ConceptObject.CONCEPTMODULE)
        conceptDetailPanel
            .tabPanel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(constants.conceptTerm()) + "&nbsp;(0)");
      if (conceptObject.getBelongsToModule() == ConceptObject.CLASSIFICATIONMODULE)
        classificationDetailPanel
            .tab2Panel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(constants.conceptTerm()) + "&nbsp;(0)");
      conceptRootPanel.add(sayNo);
      conceptRootPanel.setCellHorizontalAlignment(sayNo, HasHorizontalAlignment.ALIGN_CENTER);
    }
  }
示例#6
0
  private void initLayout() {

    table = new FlexTable();
    table.setWidth("100%");

    HTML conceptLab = new HTML(constants.exportConcept());
    HTML exportLab = new HTML(constants.exportFormat());
    HTML schemeLab = new HTML(constants.exportScheme());
    HTML dateLab = new HTML(constants.exportDate());
    HTML termCodeLab = new HTML(constants.exportTermCode());

    conceptLab.setWordWrap(false);
    exportLab.setWordWrap(false);
    schemeLab.setWordWrap(false);
    dateLab.setWordWrap(false);
    termCodeLab.setWordWrap(false);

    table.setWidget(0, 0, schemeLab);
    table.setWidget(0, 1, getScheme());
    table.setWidget(1, 0, conceptLab);
    table.setWidget(1, 1, getConcept());
    table.setWidget(2, 0, exportLab);
    table.setWidget(2, 1, getExportFormat());
    // table.setWidget(3, 0, termCodeLab);
    // table.setWidget(3, 1, getTermCode());
    // table.setWidget(4, 0, dateLab);
    // table.setWidget(4, 1, getDatePanel());

    table.getColumnFormatter().setWidth(0, "15%");
    table.getColumnFormatter().setWidth(1, "75%");

    final VerticalPanel exportOption = new VerticalPanel();
    exportOption.setSize("100%", "100%");
    exportOption.add(GridStyle.setTableRowStyle(table, "#F4F4F4", "#E8E8E8", 3));

    final Button export = new Button(constants.exportButton());
    final CheckBox chkZip = new CheckBox(constants.exportUseZip());

    HorizontalPanel bottombar = new HorizontalPanel();
    bottombar.setSpacing(5);
    bottombar.add(chkZip);
    bottombar.add(export);
    bottombar.setSize("100%", "100%");
    bottombar.setStyleName("bottombar");
    bottombar.setCellHorizontalAlignment(chkZip, HasHorizontalAlignment.ALIGN_LEFT);
    bottombar.setCellHorizontalAlignment(export, HasHorizontalAlignment.ALIGN_RIGHT);
    bottombar.setCellVerticalAlignment(export, HasVerticalAlignment.ALIGN_MIDDLE);

    // ButtonbarWidget bottomBarPanel = new ButtonbarWidget(null, bottombar);

    /*ld.setSize("100%", "100%");
    spacer.setSize("100%", "100%");
    spacer.setCellHorizontalAlignment(ld, HasHorizontalAlignment.ALIGN_CENTER);
    spacer.setCellVerticalAlignment(ld, HasVerticalAlignment.ALIGN_MIDDLE);

     Window.addResizeHandler(new ResizeHandler()
        {
        	public void onResize(ResizeEvent event) {
        		spacer.setSize("100%", "100%");
    		}
    	});*/

    VerticalPanel optionPanel = new VerticalPanel();
    optionPanel.setSize("100%", "100%");
    optionPanel.setStyleName("borderbar");
    optionPanel.add(exportOption);
    // optionPanel.add(spacer);
    optionPanel.add(bottombar);
    // optionPanel.setCellHeight(spacer, "100%");
    optionPanel.setCellVerticalAlignment(exportOption, HasVerticalAlignment.ALIGN_TOP);
    optionPanel.setCellVerticalAlignment(bottombar, HasVerticalAlignment.ALIGN_BOTTOM);

    HorizontalPanel langPanel = new HorizontalPanel();
    /*Image img = new Image("images/map-grey.gif");
    final Label lang = new Label(constants.exportSelectLang());
    lang.setSize("150", "100%");
    lang.setStyleName("displayexportLang");
    lang.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lang.addClickHandler(new ClickHandler() {
    	public void onClick(ClickEvent event) {
    		if(selectLanguage == null || !selectLanguage.isLoaded)
    			selectLanguage = new SelectLanguage();
    		selectLanguage.show();
    	}
    });

    langPanel.setSize("10%", "100%");
    langPanel.add(img);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(lang);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(new HTML("&nbsp;"));
    langPanel.setCellWidth(lang, "100%");
    langPanel.setCellHeight(lang, "100%");
    langPanel.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellVerticalAlignment(lang, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellHorizontalAlignment(lang, HasHorizontalAlignment.ALIGN_RIGHT);
    langPanel.setSpacing(1);*/

    VerticalPanel tempmainPanel = new VerticalPanel();
    tempmainPanel.setSpacing(10);
    tempmainPanel.add(optionPanel);

    BodyPanel mainPanel = new BodyPanel(constants.exportTitle(), tempmainPanel, langPanel);

    mainBodypanel.setSize("100%", "100%");
    mainBodypanel.add(mainPanel);
    mainBodypanel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainBodypanel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    mainBodypanel.setCellWidth(mainPanel, "100%");
    mainBodypanel.setCellHeight(mainPanel, "100%");

    panel.clear();
    panel.setSize("100%", "100%");
    panel.add(mainBodypanel);
    panel.add(loadingDialog);
    panel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    showLoading(false);

    // =================

    export.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!format.getValue((format.getSelectedIndex())).equals("")
                && !format.getValue(format.getSelectedIndex()).equals("--None--")) {
              exp.setFormat(format.getValue(format.getSelectedIndex()));
            } else {
              exp.setFormat(null);
            }
            String expformat = exp.getFormat();
            if (expformat == null || expformat.equals("")) {
              Window.alert(constants.exportSelectFormat());
            } else if (exp.getStartDate() != null || exp.getEndDate() != null) {
              if (exp.getStartDate() == null || exp.getEndDate() == null) {
                Window.alert(constants.exportSelectDateRange());
              }
            } else {
              showLoading(true);
              exp.setExpLanguage(userSelectedLanguage);
              exp.setTermCode(termCodeBox.getValue().equals("") ? null : termCodeBox.getValue());

              AsyncCallback<String> callback =
                  new AsyncCallback<String>() {
                    public void onSuccess(String key) {
                      String formattype = format.getValue(format.getSelectedIndex());

                      String filename =
                          "export_"
                              + formattype.toLowerCase()
                              + "_"
                              + DateTimeFormat.getFormat("ddMMyyyyhhmmss").format(new Date());

                      if (formattype.equals(ExportFormat.SKOS)
                          || formattype.equals(ExportFormat.SKOSXL)) filename += ".rdf";
                      else if (formattype.equals(ExportFormat.TBX)) filename += ".tbx";
                      else if (formattype.equals(ExportFormat.OWL_SIMPLE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.OWL_COMPLETE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.RDBMS_SQL_FORMAT)) filename += ".sql";

                      Window.open(
                          GWT.getHostPageBaseURL()
                              + "downloadExportData?filename="
                              + filename
                              + "&key="
                              + key
                              + "&size="
                              + ConfigConstants.ZIPSIZE
                              + "&forcezip="
                              + chkZip.getValue(),
                          "_download",
                          "");
                      showLoading(false);
                    }

                    public void onFailure(Throwable caught) {
                      showLoading(false);
                      ExceptionManager.showException(caught, constants.exportDataFail());
                    }
                  };
              Service.exportService.export(exp, MainApp.userId, 74, MainApp.userOntology, callback);
            }
          }
        });
  }