Exemplo n.º 1
0
 public static void internationalize(Widget b, Map<String, String> strs, String ktext) {
   if (strs == null) return;
   String text = strs.get(ktext);
   String title = strs.get(ktext + ".title");
   if (text != null && text.length() > 0) {
     if (b instanceof HasHTML) ((HasHTML) b).setText(text);
     else if (b instanceof HasText) ((HasText) b).setText(text);
     else if (b instanceof GWTCDatePickerAbstract)
       ((GWTCDatePickerAbstract) b).setCaptionText(text);
     else
       System.out.println(
           "GWTCDatePickerAbstract.internationalize: unknown element "
               + b
               + " "
               + ktext
               + " "
               + text);
   }
   if (title != null && title.length() > 0) b.setTitle(title);
 }
Exemplo n.º 2
0
  /**
   * Prepares the widgets from the items as A DISPLAY FOR THE USER DEPRECATED: Use
   * GetFormItemsWithPrefilledValues instead
   *
   * @param items
   * @deprecated
   */
  public void prepareApplicationForm(final ArrayList<ApplicationFormItem> items) {

    FlexTable ft = new FlexTable();
    FlexCellFormatter fcf = ft.getFlexCellFormatter();
    String locale = "en";

    if (LocaleInfo.getCurrentLocale().getLocaleName().equals("default")) {
      locale = "en";
    } else {
      locale = "cs";
    }

    int i = 0;
    for (final ApplicationFormItem item : items) {

      String value = "";
      if (item.getShortname().equals("affiliation")
          || item.getShortname().equals("mail")
          || item.getShortname().equals("displayName")) {
        value = "from federation";
      }

      RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, value, locale);
      this.applFormGenerators.add(gen);

      if (!gen.isVisible()) {
        continue;
      }

      ItemTexts itemTexts = item.getItemTexts(locale);

      // WITH LABEL (input box ...)
      if (gen.isLabelShown()) {

        // 0 = label
        ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong>");

        // 1 = widget
        Widget w = gen.getWidget();
        w.setTitle(itemTexts.getHelp());
        ft.setWidget(i, 1, w);

        // ELSE HTML COMMENT
      } else {

        ft.setWidget(i, 0, gen.getWidget());

        // colspan = 2
        fcf.setColSpan(i, 0, 2);
      }

      // format
      fcf.setHeight(i, 0, "35px");
      fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_TOP);
      fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_MIDDLE);

      i++;
    }

    contents.setWidget(ft);
  }