Search in sources :

Example 61 with FormLink

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

the class TitleEditorController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    List<String> headingFormatLinkNames = new ArrayList<>();
    for (int i = 1; i <= 6; i++) {
        FormLink headingFormatLink = uifactory.addFormLink("h" + i, "h" + i, "h" + i, null, formLayout, Link.LINK);
        headingFormatLinkNames.add(headingFormatLink.getComponent().getComponentName());
    }
    flc.getFormItemComponent().contextPut("headingFormatLinkNames", headingFormatLinkNames);
    String cmpId = "title-" + CodeHelper.getRAMUniqueID() + "h";
    String content = title.getContent();
    titleItem = uifactory.addRichTextElementForStringDataCompact(cmpId, null, content, 8, 80, null, formLayout, ureq.getUserSession(), getWindowControl());
    titleItem.getEditorConfiguration().setSendOnBlur(true);
    titleItem.getEditorConfiguration().disableMenuAndMenuBar();
    staticItem = uifactory.addStaticTextElement(cmpId + "_static", content, formLayout);
    flc.getFormItemComponent().contextPut("cmpId", cmpId);
}
Also used : ArrayList(java.util.ArrayList) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 62 with FormLink

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

the class SharedPagesController method loadModel.

private void loadModel(boolean resetPage, boolean resetInternal) {
    searchParams.setSearchString(tableEl.getQuickSearchString());
    List<AssessedPage> sharedItems = portfolioService.searchSharedPagesWith(getIdentity(), searchParams);
    List<SharedPageRow> rows = new ArrayList<>(sharedItems.size());
    for (AssessedPage sharedItem : sharedItems) {
        SharedPageRow row = new SharedPageRow(sharedItem.getOwner(), userPropertyHandlers, getLocale());
        row.setPageKey(sharedItem.getPageKey());
        row.setPageTitle(sharedItem.getPageTitle());
        row.setStatus(sharedItem.getPageStatus());
        row.setMark(sharedItem.isMarked());
        row.setUserStatus(sharedItem.getUserStatus());
        row.setLastChanges(sharedItem.getLastModified());
        FormLink markLink = uifactory.addFormLink("mark_" + (counter++), "mark", "", null, flc, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(sharedItem.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        markLink.setTitle(translate(sharedItem.isMarked() ? "details.bookmark.remove" : "details.bookmark"));
        markLink.setUserObject(row);
        row.setBookmarkLink(markLink);
        rows.add(row);
    }
    model.setObjects(rows);
    tableEl.reset(resetPage, resetInternal, true);
}
Also used : ArrayList(java.util.ArrayList) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 63 with FormLink

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

the class EPViewModeController method formInnerEvent.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formInnerEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.components.form.flexible.FormItem, org.olat.core.gui.components.form.flexible.impl.FormEvent)
 */
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableLink || source == detailsLink) {
        FormLink link = (FormLink) source;
        if (!link.getCmd().equals(userPrefsMode)) {
            String newUserPrefsMode = link.getCmd();
            ePFMgr.setUsersPreferedArtefactViewMode(getIdentity(), newUserPrefsMode, context);
            userPrefsMode = newUserPrefsMode;
            fireEvent(ureq, new Event(VIEWMODE_CHANGED_EVENT_CMD));
        }
    }
}
Also used : Event(org.olat.core.gui.control.Event) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 64 with FormLink

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

the class GenericSelectionPropertyHandlerController method addOptionField.

/**
 * adds an option field to the form (one row in the table)
 *
 * @param val
 */
private void addOptionField(String val) {
    int teNumber = optionFieldNames.size() + 1;
    TextElement te = uifactory.addTextElement(OPTFIELD_PREFIX + teNumber, null, 10, "", hcFlc);
    te.setValue(val);
    if (StringHelper.containsNonWhitespace(val)) {
        uifactory.addStaticTextElement(OPTFIELD_TRSLBL_PREFIX + teNumber, null, "(" + translate(val) + ")", hcFlc);
    }
    FormLink tl = uifactory.addFormLink(OPTFIELD_TRS_PREFIX + teNumber, "gsphc.translate", "label", hcFlc, Link.LINK);
    FormLink re = uifactory.addFormLink(OPTFIELD_RMV_PREFIX + teNumber, "gsphc.remove", "label", hcFlc, Link.BUTTON_XSMALL);
    re.setUserObject(te);
    tl.setUserObject(te);
    optionFieldNames.add(String.valueOf(teNumber));
    hcFlc.contextPut("optionfields", optionFieldNames);
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 65 with FormLink

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

the class UsrPropCfgTableController method buildPropertyHandlerTable.

/**
 * builds the userPropertyHandler-Table
 */
private void buildPropertyHandlerTable() {
    List<UserPropertyHandler> myHandlerList = usrPropCfgMng.getUserPropertiesConfigObject().getPropertyHandlers();
    // first search for all group-values in the propertyHandlers
    List<String> allGroupValues = new ArrayList<>();
    for (UserPropertyHandler handler : myHandlerList) {
        String group = handler.getGroup();
        if (!allGroupValues.contains(group))
            allGroupValues.add(group);
    }
    // take the defaults
    for (int k = 0; k < GROUP_KEYS.length; k++) {
        String group = GROUP_KEYS[k];
        if (!allGroupValues.contains(group))
            allGroupValues.add(group);
    }
    final String[] selectableGroups = allGroupValues.toArray(new String[0]);
    // the table-rows
    String handlerName;
    SingleSelection groupDropdown;
    FormToggle fi;
    FormLink translateLink;
    FormLink handlerLink;
    String translatedName;
    for (UserPropertyHandler handler : myHandlerList) {
        handlerName = handler.getName();
        // the group field
        groupDropdown = uifactory.addDropdownSingleselect(FT_NAME_PREFIX_GRPN + handlerName, propTableFlc, selectableGroups, selectableGroups, null);
        if (Arrays.asList(selectableGroups).contains(handler.getGroup())) {
            groupDropdown.select(handler.getGroup(), true);
        } else {
            logWarn("could not set group-select to " + handler.getGroup() + " (" + handler.getName() + ")", null);
        }
        groupDropdown.setUserObject(handler);
        groupDropdown.showLabel(false);
        groupDropdown.addActionListener(FormEvent.ONCHANGE);
        // the "active"-toggle button
        fi = uifactory.addToggleButton(FT_NAME_PREFIX_TGL + handlerName, "&nbsp;", propTableFlc, null, null);
        if (usrPropCfgMng.getUserPropertiesConfigObject().isActiveHandler(handler))
            fi.toggleOn();
        else
            fi.toggleOff();
        if (!UsrPropCfgManager.canBeDeactivated(handler))
            fi.setEnabled(false);
        fi.setUserObject(handler);
        rowToggleButtonsMap.put(handlerName, fi);
        // the "translate" link
        if (isPropertyHandlerTranslated(handler)) {
            translateLink = uifactory.addFormLink(FT_NAME_PREFIX_TRANSL + handlerName, "upc.edittranslate", "label", propTableFlc, Link.LINK);
        } else {
            translateLink = uifactory.addFormLink(FT_NAME_PREFIX_TRANSL + handlerName, "upc.translate", "label", propTableFlc, Link.LINK);
            translateLink.setCustomEnabledLinkCSS("o_ochre");
        }
        translateLink.setUserObject(handler);
        // the "handler-config" link
        if (handlerConfigCtrlFactory.hasConfig(handler)) {
            handlerLink = uifactory.addFormLink(FT_NAME_PREFIX_HDNL + handlerName, "upc.hndlconfig", "label", propTableFlc, Link.LINK);
            handlerLink.setUserObject(handler);
        }
        // put the translation (in the current language) for the property
        translatedName = I18nManager.getInstance().getLocalizedString(UserPropertyHandler.class.getPackage().getName(), handler.i18nFormElementLabelKey(), null, getLocale(), true, true);
        uifactory.addStaticTextElement(FT_NAME_PREFIX_TRANSNAME + handlerName, (translatedName == null ? "-" : translatedName), propTableFlc);
    }
    propTableFlc.contextPut("rows", myHandlerList);
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) ArrayList(java.util.ArrayList) FormToggle(org.olat.core.gui.components.form.flexible.elements.FormToggle) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)376 ArrayList (java.util.ArrayList)108 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)64 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)40 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)36 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)34 List (java.util.List)30 FormItem (org.olat.core.gui.components.form.flexible.FormItem)28 HashMap (java.util.HashMap)26 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)24 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 Date (java.util.Date)18 Map (java.util.Map)18 Link (org.olat.core.gui.components.link.Link)18 Identity (org.olat.core.id.Identity)18 Component (org.olat.core.gui.components.Component)16 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)16 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)16 Controller (org.olat.core.gui.control.Controller)16 Event (org.olat.core.gui.control.Event)16