Search in sources :

Example 71 with FormLink

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

the class TeacherRollCallController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            TeacherRollCallRow row = tableModel.getObject(se.getIndex());
            if ("all".equals(cmd)) {
                doCheckAllRow(row);
            }
        }
    } else if (source instanceof MultipleSelectionElement) {
        MultipleSelectionElement check = (MultipleSelectionElement) source;
        TeacherRollCallRow row = (TeacherRollCallRow) check.getUserObject();
        if (row.getAuthorizedAbsence() == check) {
            doAuthorizedAbsence(row, check);
            if (check.isAtLeastSelected(1)) {
                doCalloutReasonAbsence(ureq, check.getFormDispatchId() + "_C_0", row);
            }
        } else {
            doCheckRow(row, check);
        }
    } else if (reopenButton == source) {
        doReopen(ureq);
    } else if (closeLectureBlocksButton == source) {
        if (validateFormLogic(ureq)) {
            saveLectureBlocks();
            doConfirmCloseLectureBlock(ureq);
        }
    } else if (cancelLectureBlockButton == source) {
        saveLectureBlocks();
        doConfirmCancelLectureBlock(ureq);
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if (cmd != null && cmd.startsWith("abs_reason_")) {
            TeacherRollCallRow row = (TeacherRollCallRow) link.getUserObject();
            doCalloutReasonAbsence(ureq, link.getFormDispatchId(), row);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 72 with FormLink

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

the class ExtendedSearchController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == searchButton) {
        doSearch(ureq);
    } else if (source instanceof SingleSelection) {
        SingleSelection attrEl = (SingleSelection) source;
        if (attrEl.isOneSelected()) {
            Object uObject = attrEl.getUserObject();
            if (uObject instanceof ConditionalQuery) {
                ConditionalQuery query = (ConditionalQuery) uObject;
                query.selectAttributeType(attrEl.getSelectedKey(), null);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink button = (FormLink) source;
        if (button.getCmd().startsWith("add")) {
            ConditionalQuery query = (ConditionalQuery) button.getUserObject();
            addParameter(query);
        } else if (button.getCmd().startsWith("remove")) {
            ConditionalQuery query = (ConditionalQuery) button.getUserObject();
            removeParameter(query);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 73 with FormLink

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

the class CourseReminderEditController method initRuleForm.

protected RuleElement initRuleForm(UserRequest ureq, RuleSPI ruleSpi, ReminderRule rule) {
    String id = Integer.toString(counter++);
    String type = ruleSpi.getClass().getSimpleName();
    SingleSelection typeEl = uifactory.addDropdownSingleselect("rule.type.".concat(id), null, rulesCont, typeKeys, typeValues, null);
    typeEl.addActionListener(FormEvent.ONCHANGE);
    for (String typeKey : typeKeys) {
        if (type.equals(typeKey)) {
            typeEl.select(typeKey, true);
        }
    }
    FormLink addRuleButton = uifactory.addFormLink("add.rule.".concat(id), "add", "add.rule", null, rulesCont, Link.BUTTON);
    addRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_add");
    addRuleButton.setElementCssClass("o_sel_course_add_rule");
    FormLink deleteRuleButton = uifactory.addFormLink("delete.rule.".concat(id), "delete", "delete.rule", null, rulesCont, Link.BUTTON);
    deleteRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
    deleteRuleButton.setElementCssClass("o_sel_course_delete_rule");
    RuleEditorFragment editor = ruleSpi.getEditorFragment(rule, entry);
    FormItem customItem = editor.initForm(rulesCont, this, ureq);
    RuleElement ruleEl = new RuleElement(typeEl, addRuleButton, deleteRuleButton, editor, customItem);
    typeEl.setUserObject(ruleEl);
    addRuleButton.setUserObject(ruleEl);
    deleteRuleButton.setUserObject(ruleEl);
    return ruleEl;
}
Also used : RuleEditorFragment(org.olat.modules.reminder.RuleEditorFragment) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormItem(org.olat.core.gui.components.form.flexible.FormItem) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 74 with FormLink

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

the class VideoAdminListController method initTable.

private void initTable() {
    List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress();
    List<TranscodingQueueTableRow> rows = new ArrayList<>();
    for (VideoTranscoding videoTranscoding : videoTranscodings) {
        String title = videoManager.getDisplayTitleForResolution(videoTranscoding.getResolution(), getTranslator());
        String resid = String.valueOf(videoTranscoding.getVideoResource().getResourceableId());
        FormLink resourceLink = uifactory.addFormLink("res_" + counter++, "viewResource", resid, resid, flc, Link.LINK + Link.NONTRANSLATED);
        resourceLink.setUserObject(videoTranscoding);
        FormLink deleteLink = uifactory.addFormLink("del_" + counter++, "deleteQuality", "quality.delete", "quality.delete", flc, Link.LINK);
        deleteLink.setUserObject(videoTranscoding);
        deleteLink.setIconLeftCSS("o_icon o_icon_delete_item o_icon-fw");
        String fileSize = "";
        if (videoTranscoding.getSize() != 0) {
            fileSize = Formatter.formatBytes(videoTranscoding.getSize());
        } else if (videoTranscoding.getStatus() == VideoTranscoding.TRANSCODING_STATUS_WAITING) {
            fileSize = translate("transcoding.waiting");
        } else if (videoTranscoding.getStatus() <= VideoTranscoding.TRANSCODING_STATUS_DONE) {
            fileSize = translate("transcoding.processing") + ": " + videoTranscoding.getStatus() + "%";
        }
        RepositoryEntry videoRe = repositoryService.loadByResourceKey(videoTranscoding.getVideoResource().getKey());
        if (videoRe == null)
            continue;
        String displayname = videoRe.getDisplayname();
        String initialAuthor = videoRe.getInitialAuthor();
        String fullName = userManager.getUserDisplayName(initialAuthor);
        FormLink authorLink = uifactory.addFormLink("author_" + counter++, "viewAuthor", fullName, fullName, flc, Link.LINK + Link.NONTRANSLATED);
        authorLink.setUserObject(initialAuthor);
        Date creationDate = videoTranscoding.getCreationDate();
        rows.add(new TranscodingQueueTableRow(resourceLink, displayname, creationDate, authorLink, title, fileSize, videoTranscoding.getFormat(), deleteLink));
    }
    tableModel.setObjects(rows);
    if (flc.hasFormComponent(tableEl)) {
        flc.remove(tableEl);
    }
    if (flc.hasFormComponent(refreshButton)) {
        flc.remove(refreshButton);
    }
    tableEl = uifactory.addTableElement(getWindowControl(), "queue", tableModel, getTranslator(), flc);
    tableEl.setCustomizeColumns(false);
    tableEl.setNumOfRowsEnabled(false);
    refreshButton = uifactory.addFormLink("button.refresh", flc, Link.BUTTON);
    refreshButton.setIconLeftCSS("o_icon o_icon_refresh o_icon-fw");
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Date(java.util.Date)

Example 75 with FormLink

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

the class VideoAdminListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink && ((FormLink) source).getCmd().equals("deleteQuality")) {
        FormLink link = (FormLink) source;
        VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
        videoManager.deleteVideoTranscoding(videoTranscoding);
    } else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewAuthor")) {
        showUserInfo(ureq, baseSecurity.findIdentityByName((String) source.getUserObject()));
    } else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewResource")) {
        FormLink link = (FormLink) source;
        VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
        launch(ureq, videoTranscoding);
    }
    initTable();
}
Also used : VideoTranscoding(org.olat.modules.video.VideoTranscoding) 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