Search in sources :

Example 1 with FormLinkImpl

use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.

the class FormUIFactory method addFormLink.

/**
 * Add a form link with a special css class
 *
 * @param name The name of the form element (identifyer), also used as i18n key
 * @param formLayout
 * @param css class
 * @return
 */
public FormLink addFormLink(String name, FormItemContainer formLayout, String customEnabledLinkCSS) {
    FormLinkImpl fte = new FormLinkImpl(name);
    fte.setCustomEnabledLinkCSS(customEnabledLinkCSS);
    if (formLayout != null) {
        formLayout.add(fte);
    }
    return fte;
}
Also used : FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)

Example 2 with FormLinkImpl

use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.

the class FormUIFactory method addFormLink.

/**
 * @param name to be used to render in velocity <code>$r.render("name")</code>
 * @param i18nLink i18n key for the link text
 * @param i18nLabel i18n key for the link elements label, maybe <code>null</code>
 * @param formLayout FormLink is added as element here
 * @param presentation See Link.BUTTON etc.
 * @return
 */
public FormLink addFormLink(String name, String i18nLink, String i18nLabel, FormItemContainer formLayout, int presentation) {
    FormLinkImpl fte = new FormLinkImpl(name, name, i18nLink, presentation);
    fte.setI18nKey(i18nLink);
    setLabelIfNotNull(i18nLabel, fte);
    if (formLayout != null) {
        formLayout.add(fte);
    }
    return fte;
}
Also used : FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)

Example 3 with FormLinkImpl

use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.

the class FlexiTableElementImpl method setSearchEnabled.

@Override
public void setSearchEnabled(boolean enable) {
    this.searchEnabled = enable;
    if (searchEnabled) {
        String dispatchId = component.getDispatchID();
        searchFieldEl = new TextElementImpl(dispatchId + "_searchField", "search", "");
        searchFieldEl.showLabel(false);
        components.put("rSearch", searchFieldEl);
        searchButton = new FormLinkImpl(dispatchId + "_searchButton", "rSearchButton", "search", Link.BUTTON);
        searchButton.setTranslator(translator);
        searchButton.setIconLeftCSS("o_icon o_icon_search");
        components.put("rSearchB", searchButton);
        rootFormAvailable(searchFieldEl);
        rootFormAvailable(searchButton);
    } else {
        components.remove("rSearch");
        components.remove("rSearchB");
        searchFieldEl = null;
        searchButton = null;
    }
}
Also used : TextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl) FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)

Example 4 with FormLinkImpl

use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.

the class TranslationToolI18nItemEditCrumbController method initOrUpdateCurrentItem.

private void initOrUpdateCurrentItem(UserRequest ureq) {
    // Set keys (must call before setting new currentItemPosition bundle name!
    if (bundlesSelection.getSelectedKey().equals(currentItem.getBundleName())) {
        // still in same bundle, just select the currentItemPosition key
        keysSelection.select(currentItem.getKey(), true);
        // Update key progress bar
        progressBarKey.setActual(keysSelection.getSelected() + 1);
    } else {
        // in new bundle, load new keys
        updateKeysSelectionAndProgress();
    }
    // Set reference value
    String refValue = i18nMgr.getLocalizedString(currentItem.getBundleName(), currentItem.getKey(), null, referenceLocale, false, false, false, false, 0);
    referenceArea.setValue(refValue);
    // Add target value
    String targetValue = i18nMgr.getLocalizedString(currentItem, null);
    targetArea.setValue(targetValue);
    // Add compare value
    updateCompareArea(ureq);
    // Add annotation
    currentAnnotation = i18nMgr.getAnnotation(currentItem);
    annotationArea.setValue(currentAnnotation);
    if (currentAnnotation == null) {
        annotationArea.setVisible(false);
        annotationAddLink = new FormLinkImpl("annotationAddLink", "annotationAddLink", "edit.button.add.annotation", Link.BUTTON_SMALL);
        this.flc.add(annotationAddLink);
    } else {
        annotationArea.setVisible(true);
        if (annotationAddLink != null) {
            this.flc.remove(annotationAddLink);
            annotationAddLink = null;
        }
    }
    // Push item to velocity
    this.flc.contextPut("i18nItem", currentItem);
    // Set all links
    this.flc.contextPut("hasPrevious", (currentItemPosition == 0 ? Boolean.FALSE : Boolean.TRUE));
    this.flc.contextPut("hasNext", (currentItemPosition + 1 == i18nItems.size() ? Boolean.FALSE : Boolean.TRUE));
}
Also used : FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)

Example 5 with FormLinkImpl

use of org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl in project OpenOLAT by OpenOLAT.

the class TranslationToolStartCrumbController method initAllItemsElements.

private void initAllItemsElements(FormUIFactory formFactory, FormItemContainer formLayout, String[] bundlesKeys, String[] bundlesValues) {
    // Add all bundles selector
    allBundlesSelection = formFactory.addDropdownSingleselect("allBundlesSelection", this.flc, bundlesKeys, bundlesValues, null);
    allBundlesSelection.addActionListener(FormEvent.ONCHANGE);
    allBundlesSelection.select(ALL_BUNDLES_IDENTIFYER, true);
    // Add all bundles children switch
    String[] allBundlesIncludeBundles = new String[] { translate("generic.limit.bundles.includeChildren") };
    allBundlesIncludeBundlesChildrenSwitch = formFactory.addCheckboxesHorizontal("allBundlesIncludeBundlesChildrenSwitch", null, flc, new String[] { KEYS_ENABLED }, // disabled label by setting i18nLabel to null
    allBundlesIncludeBundles);
    allBundlesIncludeBundlesChildrenSwitch.select(KEYS_ENABLED, true);
    allBundlesIncludeBundlesChildrenSwitch.addActionListener(FormEvent.ONCLICK);
    formLayout.add(allBundlesIncludeBundlesChildrenSwitch);
    allBundlesIncludeBundlesChildrenSwitch.setEnabled(false);
    // Add priority sort switch
    String[] allBundlesIncludePrio = new String[] { translate("generic.sort.by.priority") };
    allBundlesPrioritySortSwitch = formFactory.addCheckboxesHorizontal("allBundlesPrioritySortSwitch", null, flc, new String[] { KEYS_ENABLED }, // disabled label by setting i18nLabel to null
    allBundlesIncludePrio);
    allBundlesPrioritySortSwitch.select(KEYS_ENABLED, true);
    allBundlesPrioritySortSwitch.addActionListener(FormEvent.ONCLICK);
    formLayout.add(allBundlesPrioritySortSwitch);
    // Add button to trigger all keys search
    allListButton = new FormLinkImpl("allListButton", "allListButton", "generic.listButton", Link.BUTTON);
    formLayout.add(allListButton);
    allTranslateButton = new FormLinkImpl("allTranslateButton", "allTranslateButton", "generic.translateButton", Link.BUTTON);
    formLayout.add(allTranslateButton);
}
Also used : FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)

Aggregations

FormLinkImpl (org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)52 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)8 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)6 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 FormItem (org.olat.core.gui.components.form.flexible.FormItem)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 BusinessGroupShort (org.olat.group.BusinessGroupShort)4 BGArea (org.olat.group.area.BGArea)4 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 Locale (java.util.Locale)2 TimeZone (java.util.TimeZone)2 ValidationError (org.olat.core.gui.components.form.ValidationError)2 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)2 AutoCompleterImpl (org.olat.core.gui.components.form.flexible.impl.elements.AutoCompleterImpl)2 ItemValidatorProvider (org.olat.core.gui.components.form.flexible.impl.elements.ItemValidatorProvider)2