Examples of TextElement


Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

        } else {
          // user did not actively select one, maybe because the first one was already the one he wanted. Use this one
          condValue = valuessi.getKey(0);
        }
      } else {
        TextElement valuetei = (TextElement) flc.getFormComponent(PRE_VALUE_TEXT + row);
        condValue = valuetei.getValue();
      }
      le.add(new ExtendedCondition(condName, condOperator, condValue));
    }
    return le;
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

    columnOperator.add(rowPos, operator.getName());

    // 2c) Attribute value - can be either a text input field or a selection
    // drop down box - create both and hide the selection box
    //
    TextElement valuetxt = uifactory.addTextElement(PRE_VALUE_TEXT + rowCreationCounter, null, -1, null, flc);
    valuetxt.setDisplaySize(25);
    valuetxt.setNotEmptyCheck("form.easy.error.attribute");
    valuetxt.setUserObject(Integer.valueOf(rowPos));
    columnValueText.add(rowPos, valuetxt.getName());
    // now the selection box
    FormItem iselect = uifactory.addDropdownSingleselect(PRE_VALUE_SELECTION + rowCreationCounter, null, flc, new String[0], new String[0], null);
    iselect.setUserObject(Integer.valueOf(rowPos));
    iselect.setVisible(false);
    columnValueSelection.add(rowPos, iselect.getName());
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

          null;
    // Get the value text input and selection drop down form elements for this
    // row. Don't use the element name since there we have the global row
    // counter in the name and _not_ the current row id!
    SingleSelection iselect = (SingleSelection) flc.getFormComponent(columnValueSelection.get(row));
    TextElement tei = (TextElement) flc.getFormComponent(columnValueText.get(row));

    if (selectableKeys != null) {
      // to set value on selection drop down we first need to remove it and create it as new one with new keys
      // create an object array with key - value pairs in it
      String[] guiTranslatedKeys = new String[selectableKeys.length];
      for (int i = 0; i < selectableKeys.length; i++) {
        String key = selectableKeys[i];
        String translated = getTranslator().translate(attribute + "." + key);
        if (translated.indexOf(PackageTranslator.NO_TRANSLATION_ERROR_PREFIX) == 0) {
          // could not translate this key, use key for non-translated values
          guiTranslatedKeys[i] = key;
        } else {
          guiTranslatedKeys[i] = translated;
        }
      }     
      // sort the key-value-pairs by value
      ArrayHelper.sort(selectableKeys, guiTranslatedKeys, false, true, true);
     
      // update keys and values now
      iselect.setKeysAndValues(selectableKeys, guiTranslatedKeys, null);
      // set user value
      if (value != null) {
        // check if stored value exists, otherwise don't select anything
        if (Arrays.asList(selectableKeys).contains(value)) {
          iselect.select(value, true);
        } else {
          // ups, maybe this value has been removed from the list? maybe a programming error?
          logWarn("could not select value::" + value + " for shibboleth attribute::" + attribute
              + " in course easy mode, not found in selectable list", null);
        }
      }
      iselect.setVisible(true);
      // set alternative text input field as non visible
      tei.setVisible(false);
    } else {
      // update text element visibility and the value
      tei.setValue(value);
      tei.setVisible(true);
      // and hide selection box
      iselect.setVisible(false);
    }
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

   * @return true: has an error; false: is valid
   */
  public boolean hasError() {
    for (Iterator<String> iterator = columnValueText.iterator(); iterator.hasNext();) {
      String name = iterator.next();
      TextElement tei = (TextElement) flc.getFormComponent(name);
      if (tei.isVisible() && tei.getValue().trim().length() == 0) { return true; }
    }
    return false;
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

       
    for (int i=0; i<NUMATTR; i++) {
      FormLayoutContainer attrgrp = FormLayoutContainer.createHorizontalFormLayout("attrgrp"+i, getTranslator());
      attrlayout.add(attrgrp);

      TextElement name = uifactory.addTextElement("attrname"+i, null, 255, "", attrgrp);
      name.setDisplaySize(12);
      TextElement value = uifactory.addTextElement("attrvalue"+i, "form.equals", 255, "", attrgrp);
      value.setDisplaySize(12);
      attrNames.add(name);
      attrValues.add(value);   
    }
   
    uifactory.addFormSubmitButton("submit", "command.preview", formLayout);
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

      Settings.setAjaxGloballyEnabled(false);
    }
    String newUserAgent = newuseragent.getValue();
    if(newUserAgent != null && !newUserAgent.equals("")){
      String fieldName = "useragent"+row;
      TextElement te = new TextElementImpl(fieldName, newUserAgent){
        {
          setLabel("form.useragent", null);
          displaySize = 32;
        }
      };
      // remove and attach later again
      agentSubContainer.remove(newuseragent);
      agentSubContainer.remove(subm);
      // add new text field
      userAgentsTextFields.add(te);
      userAgentFieldNames.add(fieldName);
      agentSubContainer.add(te);
      // add previously saved input field and submit button
      agentSubContainer.add(newuseragent);
      agentSubContainer.add(subm);

//      this.flc.add(te);
      row++;
      newuseragent.setValue("");
    }
    List<String> newagents = new ArrayList<String>();
    int newrow=0;
    List<TextElement> toIterate = new ArrayList<TextElement>(userAgentsTextFields);
    for (Iterator iter = toIterate.iterator(); iter.hasNext();) {
      TextElement uagEl = (TextElement) iter.next();
      String newUag = uagEl.getValue();
      if(newUag != null && !newUag.trim().equals("")){
        newagents.add(uagEl.getValue());
      }else{
        userAgentsTextFields.remove(uagEl);
        agentSubContainer.remove(uagEl);
        String fieldName = "useragent"+newrow;
        userAgentFieldNames.remove(fieldName);
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

    userAgentsTextFields = new ArrayList<TextElement>();
    row = 0;
    for (Iterator iter = userAgents.iterator(); iter.hasNext();) {
      String userAgent = (String) iter.next();
      String fieldName = "useragent"+row;
      TextElement te = uifactory.addTextElement(fieldName, "form.useragent", -1, userAgent, agentSubContainer);
      te.setDisplaySize(32);
      //internal management
      userAgentsTextFields.add(te);
      userAgentFieldNames.add(fieldName);
      row++;
    }
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

   * @param formItemsFactory
   * @param form
   */
  private void addTextFields(FormItemContainer form) {
    // Mandatory text field
    final TextElement textField = uifactory.addTextElement("textField", "guidemo.form.text", 256, "", form);
    textField.setMandatory(true);
    textField.setNotEmptyCheck("guidemo.form.error.notempty");
    textField.setExampleKey("advanced_form.text_field.example", null);

    // Read-only text field
    final TextElement readOnly = uifactory.addTextElement("readOnly", "guidemo.form.readonly", 256, "forever", form);
    readOnly.setEnabled(false);
  }
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

    fireEvent(ureq, Event.CHANGED_EVENT);
  }
 
  private void addNewFormCheckpoint(int index, Checkpoint checkpoint) {
    // add checkpoint title
    TextElement title = uifactory.addTextElement("title" + counter, null, -1, checkpoint.getTitle(), titleContainer);
    title.showError(false);//TODO:SK:2009-11-20:PB:should be default -> check layout in velocity.
    title.setDisplaySize(20);
    title.setMandatory(true);
    title.setNotEmptyCheck("cl.table.title.error");//TODO:Stefan Köber: please verify that the default not empty check does the same as you ItemValidatorProvider
    title.setUserObject(checkpoint);
    titleInputList.add(index, title);
   
    // add checkpoint description
    TextElement description = uifactory.addTextElement("description" + counter, null, -1, checkpoint.getDescription(), titleContainer);
    description.setDisplaySize(35);
    description.setMandatory(false);
    description.setUserObject(checkpoint);
    descriptionInputList.add(index, description);
   
    // add link comment
    String[] keys = CheckpointMode.getModes();
    String[] values = new String[keys.length];
View Full Code Here

Examples of org.olat.core.gui.components.form.flexible.elements.TextElement

   *
   * @param link the link model object
   */
  private void addNewFormLink(int index, final LLModel link) {
    // add link target
    TextElement lTarget = uifactory.addTextElement("target" + counter, null, -1, link.getTarget(), titleContainer);
    lTarget.clearError();
    lTarget.setDisplaySize(40);
    lTarget.setMandatory(true);
    lTarget.setNotEmptyCheck("ll.table.target.error");
    lTarget.setItemValidatorProvider(new ItemValidatorProvider() {
      public boolean isValidValue(String value, ValidationError validationError, @SuppressWarnings("unused") Locale locale) {
        try {
          if (!value.contains("://")) {
            value = "http://".concat(value);
          }
          new URL(value);
        } catch (MalformedURLException e) {
          validationError.setErrorKey("ll.table.target.error.format");
          return false;
        }
        return true;
      }
    });
    lTarget.addActionListener(this, FormEvent.ONCHANGE);
    lTarget.setUserObject(link);
    lTargetInputList.add(index, lTarget);
    //add html target
    MultipleSelectionElement htmlTargetSelection = uifactory.addCheckboxesHorizontal("html_target" + counter, titleContainer, new String[]{BLANK_KEY}, new String[]{""}, null);
    htmlTargetSelection.setUserObject(link);
    htmlTargetSelection.select(BLANK_KEY, "_blank".equals(link.getHtmlTarget()));
    lHtmlTargetInputList.add(index, htmlTargetSelection);
   
    // add link description
    TextElement lDescription = uifactory.addTextElement("description" + counter, null, -1, link.getDescription(), titleContainer);
    lDescription.clearError();
    lDescription.setDisplaySize(20);
    lDescription.setNotEmptyCheck("ll.table.description.error");
    lDescription.setMandatory(true);
    lDescription.setUserObject(link);
    lDescriptionInputList.add(index, lDescription);
   
    // add link comment
    TextElement lComment =uifactory.addTextElement("comment" + counter, null, -1, link.getComment(), titleContainer);
    lComment.setDisplaySize(20);
    lComment.setUserObject(link);
    lCommentInputList.add(index, lComment);
   
    // add link add action button
    FormLink addButton = new FormLinkImpl("add" + counter, "add" + counter, "ll.table.add", Link.BUTTON_SMALL);
    addButton.setUserObject(link);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.