Search in sources :

Example 36 with FormLink

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

the class GroupAssessmentController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (applyToAllEl == source) {
        boolean allGroup = applyToAllEl.isAtLeastSelected(1);
        table.setVisible(!allGroup);
        if (groupPassedEl != null) {
            groupPassedEl.setVisible(allGroup);
        }
        if (groupScoreEl != null) {
            groupScoreEl.setVisible(allGroup);
        }
        if (groupCommentEl != null) {
            groupCommentEl.setVisible(allGroup);
        }
    } else if (source == saveAndDoneButton) {
        if (validateFormLogic(ureq)) {
            applyChanges(true);
            fireEvent(ureq, Event.CLOSE_EVENT);
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if ("comment".equals(link.getCmd())) {
            AssessmentRow row = (AssessmentRow) link.getUserObject();
            doEditComment(ureq, row);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 37 with FormLink

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

the class MultipleChoiceEditorController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink button = (FormLink) source;
        String cmd = button.getCmd();
        if ("rm".equals(cmd)) {
            updateCorrectAnswers(ureq);
            doRemoveSimpleChoice((SimpleChoiceWrapper) button.getUserObject());
        } else if ("add".equals(cmd)) {
            updateCorrectAnswers(ureq);
            doAddSimpleChoice(ureq);
        } else if ("up".equals(cmd)) {
            updateCorrectAnswers(ureq);
            doMoveSimpleChoiceUp((SimpleChoiceWrapper) button.getUserObject());
        } else if ("down".equals(cmd)) {
            updateCorrectAnswers(ureq);
            doMoveSimpleChoiceDown((SimpleChoiceWrapper) button.getUserObject());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 38 with FormLink

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

the class KPrimEditorController method wrapAnswer.

private void wrapAnswer(UserRequest ureq, SimpleAssociableChoice choice) {
    List<FlowStatic> choiceFlow = choice.getFlowStatics();
    String choiceContent = itemBuilder.getHtmlHelper().flowStaticString(choiceFlow);
    String choiceId = "answer" + count++;
    RichTextElement choiceEl = uifactory.addRichTextElementForQTI21(choiceId, "form.imd.answer", choiceContent, 8, -1, itemContainer, answersCont, ureq.getUserSession(), getWindowControl());
    choiceEl.getEditorConfiguration().setSimplestTextModeAllowed(TextMode.oneLine);
    choiceEl.setUserObject(choice);
    choiceEl.setEnabled(!readOnly);
    choiceEl.setVisible(!readOnly);
    answersCont.add("choiceId", choiceEl);
    String choiceRoId = "answerro" + count++;
    FlowFormItem choiceReadOnlyEl = new FlowFormItem(choiceRoId, itemFile);
    choiceReadOnlyEl.setFlowStatics(choiceFlow);
    choiceReadOnlyEl.setMapperUri(mapperUri);
    answersCont.add(choiceRoId, choiceReadOnlyEl);
    FormLink upLink = uifactory.addFormLink("up-".concat(choiceId), "up", "", null, answersCont, Link.NONTRANSLATED);
    upLink.setIconLeftCSS("o_icon o_icon-lg o_icon_move_up");
    upLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(upLink);
    answersCont.add("up-".concat(choiceId), upLink);
    FormLink downLink = uifactory.addFormLink("down-".concat(choiceId), "down", "", null, answersCont, Link.NONTRANSLATED);
    downLink.setIconLeftCSS("o_icon o_icon-lg o_icon_move_down");
    downLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(downLink);
    answersCont.add("down-".concat(choiceId), downLink);
    choiceWrappers.add(new KprimWrapper(choice, choiceEl, choiceReadOnlyEl, upLink, downLink));
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) FlowStatic(uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic) FlowFormItem(org.olat.ims.qti21.ui.components.FlowFormItem) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 39 with FormLink

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

the class SingleChoiceEditorController method wrapAnswer.

private void wrapAnswer(UserRequest ureq, SimpleChoice choice) {
    List<FlowStatic> choiceFlow = choice.getFlowStatics();
    String choiceContent = itemBuilder.getHtmlHelper().flowStaticString(choiceFlow);
    String choiceId = "answer" + count++;
    RichTextElement choiceEl = uifactory.addRichTextElementForQTI21(choiceId, "form.imd.answer", choiceContent, 8, -1, itemContainer, answersCont, ureq.getUserSession(), getWindowControl());
    choiceEl.setEnabled(!readOnly);
    choiceEl.setVisible(!readOnly);
    choiceEl.getEditorConfiguration().setSimplestTextModeAllowed(TextMode.oneLine);
    choiceEl.setUserObject(choice);
    answersCont.add("choiceId", choiceEl);
    String choiceRoId = "answerro" + count++;
    FlowFormItem choiceReadOnlyEl = new FlowFormItem(choiceRoId, itemFile);
    choiceReadOnlyEl.setFlowStatics(choiceFlow);
    choiceReadOnlyEl.setMapperUri(mapperUri);
    answersCont.add(choiceRoId, choiceReadOnlyEl);
    FormLink removeLink = uifactory.addFormLink("rm-".concat(choiceId), "rm", "", null, answersCont, Link.NONTRANSLATED);
    removeLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete");
    removeLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(removeLink);
    answersCont.add("rm-".concat(choiceId), removeLink);
    FormLink addLink = uifactory.addFormLink("add-".concat(choiceId), "add", "", null, answersCont, Link.NONTRANSLATED);
    addLink.setIconLeftCSS("o_icon o_icon-lg o_icon_add");
    addLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(addLink);
    answersCont.add("add-".concat(choiceId), addLink);
    FormLink upLink = uifactory.addFormLink("up-".concat(choiceId), "up", "", null, answersCont, Link.NONTRANSLATED);
    upLink.setIconLeftCSS("o_icon o_icon-lg o_icon_move_up");
    upLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(upLink);
    answersCont.add("up-".concat(choiceId), upLink);
    FormLink downLink = uifactory.addFormLink("down-".concat(choiceId), "down", "", null, answersCont, Link.NONTRANSLATED);
    downLink.setIconLeftCSS("o_icon o_icon-lg o_icon_move_down");
    downLink.setEnabled(!restrictedEdit && !readOnly);
    answersCont.add(downLink);
    answersCont.add("down-".concat(choiceId), downLink);
    choiceWrappers.add(new SimpleChoiceWrapper(choice, choiceEl, choiceReadOnlyEl, removeLink, addLink, upLink, downLink));
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) FlowStatic(uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic) FlowFormItem(org.olat.ims.qti21.ui.components.FlowFormItem) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 40 with FormLink

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

the class SingleChoiceEditorController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink button = (FormLink) source;
        String cmd = button.getCmd();
        if ("rm".equals(cmd)) {
            updateCorrectAnswer(ureq);
            doRemoveSimpleChoice((SimpleChoiceWrapper) button.getUserObject());
        } else if ("add".equals(cmd)) {
            updateCorrectAnswer(ureq);
            doAddSimpleChoice(ureq);
        } else if ("up".equals(cmd)) {
            updateCorrectAnswer(ureq);
            doMoveSimpleChoiceUp((SimpleChoiceWrapper) button.getUserObject());
        } else if ("down".equals(cmd)) {
            updateCorrectAnswer(ureq);
            doMoveSimpleChoiceDown((SimpleChoiceWrapper) button.getUserObject());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : 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