示例#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
  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);
    }
  }