Search in sources :

Example 6 with FormUIFactory

use of org.olat.core.gui.components.form.flexible.FormUIFactory in project OpenOLAT by OpenOLAT.

the class TranslationToolStartCrumbController method initForm.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm
	 * (org.olat.core.gui.components.form.flexible.FormItemContainer,
	 * org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
	 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FormUIFactory formFactory = FormUIFactory.getInstance();
    List<String> bundleNames = i18nModule.getBundleNamesContainingI18nFiles();
    String[] bundlesKeys = buildBundleArrayKeys(bundleNames, true);
    String[] bundlesValues = buildBundleArrayValues(bundleNames, true);
    // call init methods for each form part
    initLanguageSelectorElements(ureq.getUserSession(), formFactory, formLayout);
    initMissingItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initExistingItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initAllItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initSearchItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    // Initialize progress bar and statistics
    updateStatistics();
    // Override text labels for customizing mode
    if (customizingMode) {
        setCustomizingTextLabels();
    }
    this.flc.contextPut("customizingMode", Boolean.valueOf(customizingMode));
    this.flc.contextPut("customizingPrefix", (customizingMode ? "customize." : ""));
}
Also used : FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory)

Example 7 with FormUIFactory

use of org.olat.core.gui.components.form.flexible.FormUIFactory in project OpenOLAT by OpenOLAT.

the class AbstractLayoutAttribute method getFormItem.

// as per default attaches a dropdown and selects what is given
public FormItem getFormItem(String compName, FormItemContainer formLayout) {
    FormUIFactory uifact = FormUIFactory.getInstance();
    SingleSelection fi = uifact.addDropdownSingleselect(compName, null, formLayout, availKeys, availValues, availCSS);
    if (attributeValue != null && Arrays.asList(availKeys).contains(attributeValue)) {
        fi.select(attributeValue, true);
        fi.showLabel(false);
    }
    return fi;
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory)

Example 8 with FormUIFactory

use of org.olat.core.gui.components.form.flexible.FormUIFactory in project OpenOLAT by OpenOLAT.

the class PreviewLA method getFormItem.

/**
 * @see org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute#getFormItem(java.lang.String, org.olat.core.gui.components.form.flexible.FormItemContainer)
 */
@Override
public FormItem getFormItem(String compName, FormItemContainer formLayout) {
    FormUIFactory uifact = FormUIFactory.getInstance();
    String textEl = new String("<span style=\"" + getAttributeValue() + "\">" + formLayout.getTranslator().translate("preview.sample") + "</span>");
    StaticTextElement fi = uifact.addStaticTextElement(compName, null, textEl, formLayout);
    return fi;
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory)

Example 9 with FormUIFactory

use of org.olat.core.gui.components.form.flexible.FormUIFactory in project openolat by klemens.

the class GlossaryTermAndSynonymController method createOrUpdateSynonymLayout.

private void createOrUpdateSynonymLayout(FormItemContainer formLayout, ArrayList<String> glossItemSynonymsToUse) {
    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);
        synonymTextElementList.add(tmpSynonymTE);
    }
    // add delete-links for existing synonyms
    for (int linkNum = 1; linkNum < glossItemSynonymsToUse.size() + 1; linkNum++) {
        FormLink tmpRemoveButton = formUIf.addFormLink(CMD_DELETE_SYNONYM + linkNum, tmpLayout, Link.BUTTON_XSMALL);
        tmpRemoveButton.setUserObject(glossItemSynonymsToUse.get(linkNum - 1));
        tmpRemoveButton.setI18nKey("synonym.link.delete");
    }
    // add input field for new synonym
    newSynonymField = formUIf.addTextElement("synonym.inputfield", "glossary.term.synonym", 100, "", tmpLayout);
    newSynonymField.setVisible(true);
    newSynonymField.setLabel("synonym.inputfield", null);
    formUIf.addFormSubmitButton("form.submit", tmpLayout);
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 10 with FormUIFactory

use of org.olat.core.gui.components.form.flexible.FormUIFactory in project openolat by klemens.

the class TranslationToolStartCrumbController method initForm.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm
	 * (org.olat.core.gui.components.form.flexible.FormItemContainer,
	 * org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
	 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FormUIFactory formFactory = FormUIFactory.getInstance();
    List<String> bundleNames = i18nModule.getBundleNamesContainingI18nFiles();
    String[] bundlesKeys = buildBundleArrayKeys(bundleNames, true);
    String[] bundlesValues = buildBundleArrayValues(bundleNames, true);
    // call init methods for each form part
    initLanguageSelectorElements(ureq.getUserSession(), formFactory, formLayout);
    initMissingItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initExistingItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initAllItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    initSearchItemsElements(formFactory, formLayout, bundlesKeys, bundlesValues);
    // Initialize progress bar and statistics
    updateStatistics();
    // Override text labels for customizing mode
    if (customizingMode) {
        setCustomizingTextLabels();
    }
    this.flc.contextPut("customizingMode", Boolean.valueOf(customizingMode));
    this.flc.contextPut("customizingPrefix", (customizingMode ? "customize." : ""));
}
Also used : FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory)

Aggregations

FormUIFactory (org.olat.core.gui.components.form.flexible.FormUIFactory)14 FormItem (org.olat.core.gui.components.form.flexible.FormItem)4 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)4 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 SpacerElement (org.olat.core.gui.components.form.flexible.elements.SpacerElement)2 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)2