Package org.olat.core.gui.formelements

Examples of org.olat.core.gui.formelements.PopupData


    if (f.isDisplayOnly()) {
      sb.append(htmlVal);
    } else if (textElement.isReadOnly()) {
      appendReadOnly(htmlVal, sb);
    } else {
      PopupData popupData = textElement.getPopupData();
      String cId = String.valueOf(textElement.hashCode());
      sb.append("<input type=\"text\" id=\"").append(textElement.getName())
          .append("\" name=\"").append(textElement.getName())
          .append("\" value=\"").append(htmlVal).append("\" size=\"").append(textElement.getSize()).append("\" maxlength=\"")
          .append(textElement.getMaxLength()).append("\" ")
          .append("onkeypress=\"return setFormDirty('").append(JSFORMID).append(f.hashCode()).append("')\" ")
          .append("onclick=\"return setFormDirty('").append(JSFORMID).append(f.hashCode()).append("')\" ").append("id=\"")
          .append(JSELEMENTID).append(cId).append("\" />");
      if (textElement.isUseDateChooser()) {
        // date chooser button
        sb.append("<span class=\"b_form_datechooser\" id=\"trigger_").append(textElement.getName()).append("\" title=\"").append(StringEscapeUtils.escapeHtml(f.getTranslator().translate("calendar.choose"))).append("\">&nbsp;</span>");
        // date chooser javascript
        sb.append("<script type=\"text/javascript\">").append("Calendar.setup({").append("inputField:\"").append(textElement.getName()).append("\",").append("ifFormat:\"");
        if (textElement.getDateChooserDateFormat() == null) {
          // use default format from default locale file
          Formatter formatter = Formatter.getInstance(f.getTranslator().getLocale());
          if (textElement.isDateChooserTimeEnabled()) sb.append(formatter.getSimpleDatePatternForDateAndTime());
          else sb.append(formatter.getSimpleDatePatternForDate());

        } else {
          // use custom date format
          sb.append(textElement.getDateChooserDateFormat());
        }
        sb.append("\",").append("button:\"trigger_").append(textElement.getName()).append("\",").append("align:\"Tl\",").append(
            "singleClick:false,");
        if (textElement.isDateChooserTimeEnabled()) {
          sb.append("showsTime:true,");
          sb.append("timeFormat:\"24\",");
        }
        sb.append("cache:true,").append("firstDay:1,").append("showOthers:true,");
        // Call on change method on input field to trigger dirty button
        sb.append("onUpdate:function(){setFormDirty('").append(JSFORMID).append(f.hashCode()).append("')}");
        // Finish js code       
        sb.append("});").append("</script>");
      }
      if (popupData != null) {
        String text = StringEscapeUtils.escapeHtml(f.getTranslator().translate(popupData.getButtonlabelkey()));
        // javascript:{win=window.open('../media/script/Popup/06_01Strassen.html?olatraw=true','webclass_popup','toolbar=no,location=no,directories=0,status=no,menubar=0,scrollbars=yes,resizable=yes,width=650,height=550');win.focus();}
        sb.append("<a href=\"javascript:{win=window.open('");
        ubu.buildURI(sb, new String[] { Form.ELEM_BUTTON_COMMAND_ID }, new String[] { popupData.getButtonaction() });
        sb.append("','olatpopup','toolbar=no,location=no,directories=0,status=no,menubar=0,scrollbars=yes,resizable=yes,width=")
          .append(popupData.getPopupwidth()).append(",height=").append(popupData.getPopupheight())
          .append("');win.focus();}\" title=\"").append(text).append("\" class=\"b_form_genericchooser\"></a>");
      }
    }
  }
View Full Code Here


   
    // text
    text = new TextElement("guidemo.form.text", 50);
    text.setMandatory(true);
    text.setExample("You may give examples for any form field, whcih is shown below the field.");
    text.setPopupData(new PopupData("textarea", "popup", "guidemo.gorm.popup", 100, 100));
    addFormElement("text", text);
   
    // readonly
    readonly = new TextElement("guidemo.form.readonly", 10);
    readonly.setValue("readonly");
View Full Code Here

    SpacerElement s1 = new SpacerElement(true, false);
    addFormElement("s1", s1);
    //
    group = new TextElement("form.message.group", (String) config.get(COEditController.CONFIG_KEY_EMAILTOGROUPS), false, 3000);
    group.setExample(translate("form.message.example.group"));
    PopupData pd = new PopupData("popupchoosegroups" + this.hashCode(), "popupchoosegroups", "popupchoosegroups", 800, 400);
    group.setPopupData(pd);
    addFormElement(FormRenderer.JSELEMENTID +"popupchoosegroups"+this.hashCode(), group);
    //
    area = new TextElement("form.message.area", (String) config.get(COEditController.CONFIG_KEY_EMAILTOAREAS), false, 3000);
    area.setExample(translate("form.message.example.area"));
    PopupData pda = new PopupData("popupchooseareas" + this.hashCode(), "popupchooseareas", "popupchooseareas", 800, 400);
    area.setPopupData(pda);
    addFormElement(FormRenderer.JSELEMENTID +"popupchooseareas"+this.hashCode(), area);
    //
    SpacerElement s2 = new SpacerElement(true, false);
    addFormElement("s2", s2);
View Full Code Here

TOP

Related Classes of org.olat.core.gui.formelements.PopupData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.