Package org.olat.core.gui.components.form.flexible.impl

Examples of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer


    String[] langKeys = new String[]{};
    importKeys = uifactory.addCheckboxesVertical("configuration.management.package.import.select", this.flc, langKeys, langKeys, null, 1);
    importKeys.setVisible(false);
    //
    // Add cancel and submit in button group layout
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
    uifactory.addFormSubmitButton("configuration.management.package.import", buttonGroupLayout);
  }
View Full Code Here


    String[] availableLangCssClasses = i18nMgr.createLanguageFlagsCssClasses(availableKeys, "b_with_small_icon_left");
    exportLangSelection = uifactory.addCheckboxesVertical("configuration.exportLangSelection", null, formLayout, availableKeys,
        availableValues, availableLangCssClasses, 2);
    exportLangSelection.addActionListener(this, FormEvent.ONCLICK);
    // Add cancel and submit in button group layout
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
    submitButton = uifactory.addFormSubmitButton("configuration.management.package.export", buttonGroupLayout);
    submitButton.setEnabled(false); // enable as soon as something is checked
  }
View Full Code Here

    String[] availableLangCssClasses = i18nMgr.createLanguageFlagsCssClasses(deletableKeys, "b_with_small_icon_left");
    deleteLangSelection = uifactory.addCheckboxesVertical("configuration.deleteLangSelection", null, formLayout, deletableKeys,
        availableValues, availableLangCssClasses, 2);
    deleteLangSelection.addActionListener(this, FormEvent.ONCLICK);
    // Add cancel and submit in button group layout
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
    submitButton = uifactory.addFormSubmitButton("configuration.management.delete", buttonGroupLayout);
    submitButton.setEnabled(false); // enable as soon as something is checked
  }
View Full Code Here

    // city
    city = uifactory.addTextElement("city", "mf.city", -1, (meta != null ? meta.getCity() : null), formLayout);

    // publish date
    FormLayoutContainer publicationDate = FormLayoutContainer.createHorizontalFormLayout("publicationDateLayout", getTranslator());
    publicationDate.setLabel("mf.publishDate", null);
    formLayout.add(publicationDate);

    String[] pubDate = (meta != null ? meta.getPublicationDate() : new String[] { "", "" });
    publicationMonth = uifactory.addTextElement("publicationMonth", "mf.month", 2, pubDate[1], publicationDate);
    publicationMonth.setMaxLength(2);
    publicationMonth.setDisplaySize(2);

    publicationYear = uifactory.addTextElement("publicationYear", "mf.year", 4, pubDate[0], publicationDate);
    publicationYear.setMaxLength(4);
    publicationYear.setDisplaySize(4);

    // number of pages
    pages = uifactory.addTextElement("pages", "mf.pages", -1, (meta != null ? meta.getPages() : null), formLayout);

    // language
    language = uifactory.addTextElement("language", "mf.language", -1, (meta != null ? meta.getLanguage() : null), formLayout);

    // url/link
    url = uifactory.addTextElement("url", "mf.url", -1, (meta != null ? meta.getUrl() : null), formLayout);

    /* static fields */
    String sizeText, typeText;
    if (item instanceof VFSLeaf) {
      sizeText = StringHelper.formatMemory(((VFSLeaf) item).getSize());
      typeText = FolderHelper.extractFileType(item.getName(), getLocale());
    } else {
      sizeText = "-";
      typeText = translate("mf.type.directory");
    }

    // Targets to hide
    metaFields = new HashSet<FormItem>();
    metaFields.add(creator);
    metaFields.add(publisher);
    metaFields.add(source);
    metaFields.add(city);
    metaFields.add(publicationDate);
    metaFields.add(pages);
    metaFields.add(language);
    metaFields.add(url);

    if (!hasMetadata()) {
      moreMetaDataLink = uifactory.addFormLink("mf.more.meta.link", formLayout, Link.LINK_CUSTOM_CSS);
      moreMetaDataLink.setCustomEnabledLinkCSS("b_link_moreinfo");
      setMetaFieldsVisible(false);
    }

    if (!isSubform) {

      if(!meta.isDirectory()) {
        Long lockedById = meta.getLockedBy();
        //locked
        String lockedTitle = getTranslator().translate("mf.locked");
        String unlockedTitle = getTranslator().translate("mf.unlocked");
        locked = uifactory.addRadiosHorizontal("locked","mf.locked",formLayout, new String[]{"lock","unlock"}, new String[]{lockedTitle, unlockedTitle});
        if(meta.isLocked()) {
          locked.select("lock", true);
        } else {
          locked.select("unlock", true);
        }
        locked.setEnabled(!MetaInfoHelper.isLocked(item, ureq));
       
        //locked by
        String lockedDetails = "";
        if(lockedById != null) {
          Identity lockedIdentity = meta.getLockedByIdentity();
          String user = lockedIdentity.getUser().getProperty(UserConstants.LASTNAME, ureq.getLocale()) + " " +
            lockedIdentity.getUser().getProperty(UserConstants.FIRSTNAME, ureq.getLocale());
          String date = "";
          if (meta.getLockedDate() != null) {
            date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale()).format(meta.getLockedDate());
          }
          lockedDetails = getTranslator().translate("mf.locked.description", new String[]{user, date});
        } else {
          lockedDetails = getTranslator().translate("mf.unlocked.description");
        }
        uifactory.addStaticTextElement("mf.lockedBy", lockedDetails, formLayout);
      }
     
      // username
      uifactory.addStaticTextElement("mf.author", meta.getHTMLFormattedAuthor(), formLayout);

      // filesize
      uifactory.addStaticTextElement("mf.size", sizeText, formLayout);

      // last modified date
      uifactory.addStaticTextElement("mf.lastModified", StringHelper.formatLocaleDate(meta.getLastModified(), getLocale()), formLayout);

      // file type
      uifactory.addStaticTextElement("mf.type", typeText, formLayout);

      uifactory.addStaticTextElement("mf.downloads", String.valueOf(meta.getDownloadCount()), formLayout);
    }

    if (!isSubform && meta.isDirectory()) {
      // Don't show any meta data except title and comment if the item is
      // a directory.
      // Hide the metadata.
      setMetaFieldsVisible(false);
      if (moreMetaDataLink != null) moreMetaDataLink.setVisible(false);
    }

    // save and cancel buttons
    if (!isSubform) {
      final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
      formLayout.add(buttonLayout);
      uifactory.addFormSubmitButton("submit", buttonLayout);
      uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
    }
  }
View Full Code Here

    newTranslator = uifactory.addTextElement("configuration.management.create.translator", "configuration.management.create.translator", 255,
        "", formLayout);
    newTranslator.setExampleKey("configuration.management.create.translator.example", null);
    // Add warn message
    String warnPage = Util.getPackageVelocityRoot(this.getClass()) + "/i18nConfigurationNewWarnMessage.html";
    FormLayoutContainer logoutWarnMessage = FormLayoutContainer.createCustomFormLayout("logoutWarnMessage", getTranslator(), warnPage);
    formLayout.add(logoutWarnMessage);
    // Add cancel and submit in button group layout
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
    uifactory.addFormSubmitButton("configuration.management.create", buttonGroupLayout);
  }
View Full Code Here

    Arrays.sort(languagePacks);
    deleteLangPackSelection = uifactory.addCheckboxesVertical("configuration.deleteLangPackSelection", null, formLayout, languagePacks,
        languagePacks, null, 1);
    deleteLangPackSelection.addActionListener(this, FormEvent.ONCLICK);
    // Add cancel and submit in button group layout
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
    submitButton = uifactory.addFormSubmitButton("configuration.management.package.delete", buttonGroupLayout);
    submitButton.setEnabled(false); // enable as soon as something is checked
  }
View Full Code Here

  }

  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // sorting form main layout container using default layout
    FormLayoutContainer sortingFormContainer = FormLayoutContainer.createDefaultFormLayout("sortingFormContainer", getTranslator());
    formLayout.add(sortingFormContainer);
   
    setFormTitle("portlet.auto.sorting.form.title");
   
    final int defaultDisplaySize = 2;
    //creates and adds the integer element
    entriesNum = uifactory.addIntegerElement("entriesNumTextField", "portlet.auto.sorting.num_entries", 6, sortingFormContainer);
    //configure the integer element
    entriesNum.setDisplaySize(defaultDisplaySize);
    entriesNum.setMaxValueCheck(99, "portlet.sorting.auto.notgreaterthan");
    entriesNum.setMinValueCheck(1, "portlet.sorting.auto.notsmallerthan");
    entriesNum.setNotEmptyCheck("portlet.sorting.auto.mustbefilled");
    entriesNum.setMandatory(true);
    entriesNum.setEnabled(true);

    // layout container to layout the criterias sorting type and sorting order horizontally
    FormLayoutContainer criteriasContainer = FormLayoutContainer.createHorizontalFormLayout("criteriasContainer", getTranslator());
    criteriasContainer.setLabel("portlet.auto.sorting.term", null);
    sortingFormContainer.add(criteriasContainer);
   
    String[] selectionKeys = null;
    String[] selectionValues = null;   
    if(sortingCriteria.getSortingTermsList().contains(SortingCriteria.TYPE_SORTING)
        && sortingCriteria.getSortingTermsList().contains(SortingCriteria.ALPHABETICAL_SORTING)
        && sortingCriteria.getSortingTermsList().contains(SortingCriteria.DATE_SORTING)) {
      selectionKeys = new String[]{String.valueOf(SortingCriteria.TYPE_SORTING), String.valueOf(SortingCriteria.ALPHABETICAL_SORTING), String.valueOf(SortingCriteria.DATE_SORTING)};
      selectionValues = new String [] {getTranslator().translate("portlet.auto.sorting.type"),getTranslator().translate("portlet.auto.sorting.alphabetical"),getTranslator().translate("portlet.auto.sorting.date")};
    } else if(sortingCriteria.getSortingTermsList().contains(SortingCriteria.ALPHABETICAL_SORTING)
        && sortingCriteria.getSortingTermsList().contains(SortingCriteria.DATE_SORTING)) {
      selectionKeys = new String[]{String.valueOf(SortingCriteria.ALPHABETICAL_SORTING), String.valueOf(SortingCriteria.DATE_SORTING)};
      selectionValues = new String [] {getTranslator().translate("portlet.auto.sorting.alphabetical"),getTranslator().translate("portlet.auto.sorting.date")};
    } else if (sortingCriteria.getSortingTermsList().contains(SortingCriteria.ALPHABETICAL_SORTING))  {
      selectionKeys = new String[]{String.valueOf(SortingCriteria.ALPHABETICAL_SORTING)};
      selectionValues = new String [] {getTranslator().translate("portlet.auto.sorting.alphabetical")};
    }
       
    final String[] keysIn = selectionKeys;   
    final String[] translatedKeys = selectionValues;
    sortingCriteriaSelection = uifactory.addRadiosVertical("criteriaSelection", null, formLayout, keysIn, translatedKeys);   
    sortingCriteriaSelection.select(String.valueOf(SortingCriteria.ALPHABETICAL_SORTING), true);
    criteriasContainer.add(sortingCriteriaSelection);   
   
    //add sortingDirectionSelection
    final String[] sortingDirectionKeys = new String[]{ASCENDING, DESCENDING};
    final String[] sortingDirectionTranslatedKeys = new String [] {getTranslator().translate("portlet.auto.sorting.ascending"),getTranslator().translate("portlet.auto.sorting.descending")};
    sortingDirectionSelection = uifactory.addRadiosVertical("sortingDirectionSelection", null, formLayout, sortingDirectionKeys, sortingDirectionTranslatedKeys);
    //sortingDirectionSelection.setLabel("portlet.auto.sorting.direction", null);
    sortingDirectionSelection.select(ASCENDING, true);
    criteriasContainer.add(sortingDirectionSelection);   
   
    // button layout container horizontally. add this one to form layout to not have the indent
    FormLayoutContainer buttonContainer = FormLayoutContainer.createButtonLayout("buttonContainer", getTranslator());
    formLayout.add(buttonContainer);
    submit = new FormSubmit("submit","submit");
    buttonContainer.add(submit);
    reset = new FormReset("reset","reset");
    buttonContainer.add(reset);
   
  }
View Full Code Here

      };
      lockSelection = uifactory.addDropdownSingleselect("lock", formLayout, new String[]{KEY_UNLOCK, KEY_LOCK}, values, null);
      lockSelection.setLabel("meta.locked", null);
    }

    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
    formLayout.add(buttonLayout);
    uifactory.addFormSubmitButton("save", buttonLayout);
  }
View Full Code Here

    textElement = uifactory.addTextElement("fileName", i18nkeyMap.get(TEXT_ELEM_I18N_KEY), MAX_NAME_LENGTH, "", formLayout);
    // set appropriate display length
    textElement.setDisplaySize(20);
    textElement.setMandatory(true);
   
    FormLayoutContainer formButtons = FormLayoutContainer.createHorizontalFormLayout("formButton", getTranslator());
    formLayout.add(formButtons);
    createFile = new FormSubmit("submit",i18nkeyMap.get(SUBMIT_ELEM_I18N_KEY));
    formButtons.add(createFile);
    reset = new FormReset("reset",i18nkeyMap.get(RESET_ELEM_I18N_KEY));
    formButtons.add(reset);     
 
View Full Code Here

    FormUIFactory formUIf = FormUIFactory.getInstance();
    FormItem synLay = formLayout.getFormComponent("synonymLayout");
    if (synLay != null) {
      formLayout.remove("synonymLayout");
    }
    FormLayoutContainer tmpLayout = FormLayoutContainer.createCustomFormLayout("synonymLayout", getTranslator(), velocity_root
        + "/editSynonym.html");
    formLayout.add(tmpLayout);
    tmpLayout.setLabel("glossary.term.synonym", null);
       
    Collections.sort(glossItemSynonymsToUse);
    tmpLayout.contextPut("glossItemSynonyms", glossItemSynonymsToUse);

    // add input fields with existing synonyms
    synonymTextElementList = new ArrayList<TextElement>(glossItemSynonymsToUse.size());
    for (int synNum = 1; synNum < glossItemSynonymsToUse.size() + 1; synNum++) {
      TextElement tmpSynonymTE = formUIf.addTextElement(SYNONYM_TEXT_ELEMENT + synNum, null, 100, glossItemSynonymsToUse.get(synNum - 1), tmpLayout);
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer

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.