Search in sources :

Example 66 with FormLink

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

the class SmsPhoneComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    SmsPhoneComponent smsCmp = (SmsPhoneComponent) source;
    SmsPhoneElement smsFte = smsCmp.getSmsPhoneElement();
    String id = smsCmp.getFormDispatchId();
    String phoneNumber = smsFte.getPhone();
    if (!StringHelper.containsNonWhitespace(phoneNumber)) {
        phoneNumber = smsFte.getTranslator().translate("sms.phone.not.available");
    }
    sb.append("<p id=\"").append(id).append("\" ").append(" class='form-control-static ");
    if (StringHelper.containsNonWhitespace(smsCmp.getElementCssClass())) {
        sb.append(smsCmp.getElementCssClass());
    }
    sb.append("'>").append(phoneNumber).append("</p>");
    sb.append("<div class='o_form_example help-block'>").append(smsFte.getTranslator().translate("sms.phone.hint")).append("</div>");
    if (smsFte.getAndResetFormDirty()) {
        FormJSHelper.setFlexiFormDirtyOnLoad(sb, smsFte.getRootForm());
    }
    sb.append("<div class='form-inline'>");
    FormLink editLink = smsFte.getEditLink();
    if (editLink != null && editLink.isVisible()) {
        Component cmp = editLink.getComponent();
        cmp.getHTMLRendererSingleton().render(renderer, sb, cmp, ubu, translator, renderResult, args);
    }
    if (StringHelper.containsNonWhitespace(phoneNumber)) {
        sb.append("&nbsp;");
        FormLink removeLink = smsFte.getRemoveLink();
        if (removeLink != null && removeLink.isVisible()) {
            Component cmp = removeLink.getComponent();
            cmp.getHTMLRendererSingleton().render(renderer, sb, cmp, ubu, translator, renderResult, args);
        }
    }
    sb.append("</div>");
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Component(org.olat.core.gui.components.Component)

Example 67 with FormLink

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

the class DialogElementListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            DialogElementRow row = tableModel.getObject(se.getIndex());
            if ("forum".equals(se.getCommand())) {
                fireEvent(ureq, new SelectRowEvent(row));
            } else if ("delete".equals(se.getCommand())) {
                doConfirmDelete(ureq, row);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("download".equals(cmd)) {
            doFileDelivery(ureq, (DialogElement) link.getUserObject());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) DialogElement(org.olat.course.nodes.dialog.DialogElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 68 with FormLink

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

the class BGCopySingleGroupStep method getStepTitle.

@Override
public FormItem getStepTitle() {
    String groupName = StringHelper.escapeHtml(groupToCopy.getName());
    String title = getTranslator().translate("copy.wizard.bgstep", new String[] { groupName });
    FormLink fl = new FormLinkImpl("copy.wizard." + groupToCopy.getKey(), null, title, Link.FLEXIBLEFORMLNK + Link.NONTRANSLATED);
    fl.setTranslator(getTranslator());
    return fl;
}
Also used : FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 69 with FormLink

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

the class FavoritBusinessGroupListController method searchTableItems.

@Override
protected List<BGTableItem> searchTableItems(BusinessGroupQueryParams params) {
    List<BusinessGroupRow> rows = businessGroupService.findBusinessGroupsWithMemberships(params, getIdentity());
    List<BGTableItem> items = new ArrayList<>(rows.size());
    for (BusinessGroupRow row : rows) {
        BusinessGroupMembership membership = row.getMember();
        Boolean allowLeave = membership != null;
        Boolean allowDelete = isAdmin() ? Boolean.TRUE : (membership == null ? null : new Boolean(membership.isOwner()));
        FormLink markLink = uifactory.addFormLink("mark_" + row.getKey(), "mark", "", null, null, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        BGTableItem item = new BGTableItem(row, markLink, allowLeave, allowDelete);
        items.add(item);
    }
    return items;
}
Also used : BusinessGroupMembership(org.olat.group.BusinessGroupMembership) ArrayList(java.util.ArrayList) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) BusinessGroupRow(org.olat.group.model.BusinessGroupRow)

Example 70 with FormLink

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

the class PendingEnrollmentController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("reservations", reservations);
    }
    for (ReservationWrapper reservation : reservations) {
        FormLink acceptLink = uifactory.addFormLink("accept_" + reservation.getKey(), "accept", null, formLayout, Link.BUTTON);
        acceptLink.setUserObject(reservation);
        acceptLink.setIconLeftCSS("o_icon o_icon_accept");
        FormLink rejectLink = uifactory.addFormLink("reject_" + reservation.getKey(), "reject", null, formLayout, Link.BUTTON);
        rejectLink.setUserObject(reservation);
        rejectLink.setIconLeftCSS("o_icon o_icon_reject");
        formLayout.add(acceptLink.getName(), acceptLink);
        formLayout.add(rejectLink.getName(), rejectLink);
    }
    // Button layout
    FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    uifactory.addFormSubmitButton("submit", "ok", buttonLayout);
    uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

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