Package org.olat.course.nodes.projectbroker.datamodel

Examples of org.olat.course.nodes.projectbroker.datamodel.CustomField


  private void createFormElements(FormItemContainer formLayout) {
   
    //create form elements
    int i = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext();) {
      CustomField customField = iterator.next();
      createFormElemente(formLayout, i++, customField);
    }   
    formSubmit = uifactory.addFormSubmitButton("save", formLayout);
  }
View Full Code Here


        FormLink link = (FormLink)source;
        if (link.getName().equals(ADD_FIELD_LINK)) {
          if (customFields.size() < MAX_NBR_CUSTOM_FIELDS) {
            // Add new custom-field
            int indexNewCustomField = customFields.size();
            customFields.add(new CustomField("","",false));
            // first remove existing submit button, add it again at the end
            flc.remove(formSubmit);
            createFormElemente( this.flc, indexNewCustomField, customFields.get(indexNewCustomField));           
            formSubmit = uifactory.addFormSubmitButton("save", this.flc);
          } else {
            this.showInfo("info.max.nbr.custom.fields");
          }
        } else {
          int deleteElementNumber = ((Integer)link.getUserObject()).intValue();
          getLogger().debug("remove customfield #=" + deleteElementNumber);
          CustomField customField = customFields.remove(deleteElementNumber);
          initFormElements(flc);
        }
      }
    }
    this.flc.setDirty(true);
View Full Code Here

   
    // customfields
    List<CustomField> customFields = projectBrokerModuleConfiguration.getCustomFields();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext();) {
      CustomField customField = iterator.next();
      getLogger().debug("customField: " + customField.getName() + "=" + customField.getValue());
      StringTokenizer tok = new StringTokenizer(customField.getValue(),ProjectBrokerManager.CUSTOMFIELD_LIST_DELIMITER);
      if (customField.getValue() == null || customField.getValue().equals("") || !tok.hasMoreTokens()) {
        // no value define => Text-input
        // Add StaticTextElement as workaroung for non translated label
        uifactory.addStaticTextElement("customField_label" + customFieldIndex, null, customField.getName(), formLayout);//null > no label
        TextElement textElement = uifactory.addTextElement("customField_" + customFieldIndex, "", 157, project.getCustomFieldValue(customFieldIndex), formLayout);
        textElement.setDisplaySize(157);
        //        textElement.setTranslator(null);
        //        textElement.setLabel(customField.getName(), null);
        textElement.showLabel(false);
        customfieldElementList.add(textElement);
      } else {
        // values define => dropdown selection
        List<String> valueList = new ArrayList<String>();
        while (tok.hasMoreTokens()) {
          String value = tok.nextToken();
          valueList.add(value);
          getLogger().debug("valueList add: " + value);
        }
        String[] theValues = new String[valueList.size() + 1];
        String[] theKeys   = new String[valueList.size() + 1];
        int arrayIndex = 0;
        theValues[arrayIndex]=translate(DROPDOWN_NO_SELECETION);
        theKeys[arrayIndex]=DROPDOWN_NO_SELECETION;
        arrayIndex++;
        for (Iterator<String> iterator2 = valueList.iterator(); iterator2.hasNext();) {
          String value = iterator2.next();
          theValues[arrayIndex]=value;
          theKeys[arrayIndex]=Integer.toString(arrayIndex);
          arrayIndex++;
        }
        // Add StaticTextElement as workaround for non translated label
        uifactory.addStaticTextElement("customField_label" + customFieldIndex, null, customField.getName(), formLayout);//null > no label
        SingleSelection selectionElement = uifactory.addDropdownSingleselect("customField_" + customFieldIndex, null, formLayout, theKeys, theValues, null);
        if (project.getCustomFieldValue(customFieldIndex) != null && !project.getCustomFieldValue(customFieldIndex).equals("")) {
          if (valueList.contains(project.getCustomFieldValue(customFieldIndex))) {     
            String key = Integer.toString(valueList.indexOf(project.getCustomFieldValue(customFieldIndex)) + 1);// '+1' because no-selection at the beginning
            selectionElement.select(key, true);
View Full Code Here

    myContent.contextPut("description", project.getDescription());
    // Custom-fields
    List customFieldList = new ArrayList();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator =  projectBrokerModuleConfiguration.getCustomFields().iterator(); iterator.hasNext();) {
      CustomField customField = iterator.next();
      getLogger().debug("customField=" + customField);
      String name = customField.getName();
      String value = project.getCustomFieldValue(customFieldIndex++);
      getLogger().debug("customField  name=" + name + "  value=" + value);
      customFieldList.add(new CustomField(name,value));
    }
    myContent.contextPut("customFieldList", customFieldList);
   
    // events
    List eventList = new ArrayList();
View Full Code Here

   
    // customfields
    List<CustomField> customFields = projectBrokerModuleConfiguration.getCustomFields();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext();) {
      CustomField customField = iterator.next();
      getLogger().info("customField: " + customField.getName() + "=" + customField.getValue());
      StringTokenizer tok = new StringTokenizer(customField.getValue(),ProjectBrokerManager.CUSTOMFIELD_LIST_DELIMITER);
      if (customField.getValue() == null || customField.getValue().equals("") || !tok.hasMoreTokens()) {
        // no value define => Text-input
        // Add StaticTextElement as workaroung for non translated label
        uifactory.addStaticTextElement("customField_label" + customFieldIndex, customField.getName(), formLayout);
        TextElement textElement = uifactory.addTextElement("customField_" + customFieldIndex, "", 20, project.getCustomFieldValue(customFieldIndex), formLayout);
//        textElement.setLabelComponent(null, null);
        textElement.showLabel(false);
//        textElement.setTranslator(null);
//        textElement.setLabel(customField.getName(), null);
       
        customfieldElementList.add(textElement);
      } else {
        // values define => dropdown selection
        List<String> valueList = new ArrayList<String>();
        while (tok.hasMoreTokens()) {
          valueList.add(tok.nextToken());
        }
        String[] theValues = new String[valueList.size() + 1];
        String[] theKeys   = new String[valueList.size() + 1];
        int arrayIndex = 0;
        theValues[arrayIndex]=translate(DROPDOWN_NO_SELECETION);
        theKeys[arrayIndex]=DROPDOWN_NO_SELECETION;
        arrayIndex++;
        for (Iterator<String> iterator2 = valueList.iterator(); iterator2.hasNext();) {
          String value = iterator2.next();
          theValues[arrayIndex]=value;
          theKeys[arrayIndex]=value;
          arrayIndex++;
        }
        // Add StaticTextElement as workaround for non translated label
        uifactory.addStaticTextElement("customField_label" + customFieldIndex, null, customField.getName(), formLayout);
        SingleSelection selectionElement = uifactory.addDropdownSingleselect("customField_" + customFieldIndex, null, formLayout, theKeys, theValues, null);
        if (project.getCustomFieldValue(customFieldIndex) != null && !project.getCustomFieldValue(customFieldIndex).equals("")) {
          if (valueList.contains(project.getCustomFieldValue(customFieldIndex))) {
            selectionElement.select(project.getCustomFieldValue(customFieldIndex), true);
          } else {
View Full Code Here

      String name = (String)moduleConfiguration.get(CUSTOM_FIELDS_NAME_ + i);
      log.debug("getCustomFields " + CUSTOM_FIELDS_NAME_ + i + "=" + name);
      String value = (String)moduleConfiguration.get(CUSTOM_FIELDS_VALUE_ + i);
      log.debug("getCustomFields " + CUSTOM_FIELDS_VALUE_ + i + "=" + value);
      boolean tableViewEnabled = moduleConfiguration.getBooleanSafe(CUSTOM_FIELDS_TABLE_VIEW_ENABLED_ + i, true);
      customFields.add(new CustomField(name,value,tableViewEnabled));
    }
    return customFields;
  }
View Full Code Here

    projectManagerDescriptor.setIsPopUpWindowAction( true, "height=600, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
    tableController.addColumnDescriptor(projectManagerDescriptor);
    // Custom-Fields
    List<CustomField> customFieldList = moduleConfig.getCustomFields();
    for (Iterator iterator = customFieldList.iterator(); iterator.hasNext();) {
      CustomField customField = (CustomField) iterator.next();
      if (customField.isTableViewEnabled()) {
        numberOfCustomFieldInTable++;
        DefaultColumnDescriptor columnDescriptor = new DefaultColumnDescriptor(customField.getName(), dataColumn++,null, ureq.getLocale());
        columnDescriptor.setTranslateHeaderKey(false);
        tableController.addColumnDescriptor(columnDescriptor);       
      }
    }
    // Project Events
View Full Code Here

    this.enabledCustomFieldNumbers = new int[numberOfCustomFieldInTable];
    // loop over all custom fields
    int index = 0;
    int customFiledIndex = 0;
    for (Iterator<CustomField> iterator = moduleConfig.getCustomFields().iterator(); iterator.hasNext();) {
      CustomField customField = iterator.next();
      if (customField.isTableViewEnabled()) {
        enabledCustomFieldNumbers[index++] = customFiledIndex;     
      }
      customFiledIndex++;
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.course.nodes.projectbroker.datamodel.CustomField

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.