Search in sources :

Example 1 with DropdownItem

use of org.olat.core.gui.components.dropdown.DropdownItem in project OpenOLAT by OpenOLAT.

the class FormUIFactory method addDropdownMenu.

public DropdownItem addDropdownMenu(String name, String i18nLabel, FormItemContainer formLayout, Translator translator) {
    DropdownItem dropdown = new DropdownItem(name, name, translator);
    dropdown.setEmbbeded(true);
    dropdown.setButton(true);
    setLabelIfNotNull(i18nLabel, dropdown);
    formLayout.add(dropdown);
    return dropdown;
}
Also used : DropdownItem(org.olat.core.gui.components.dropdown.DropdownItem)

Example 2 with DropdownItem

use of org.olat.core.gui.components.dropdown.DropdownItem in project OpenOLAT by OpenOLAT.

the class FeedbacksEditorController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormContextHelp("Test editor QTI 2.1 in detail#details_testeditor_feedback");
    formLayout.setElementCssClass("o_sel_assessment_item_feedbacks");
    DropdownItem dropdownEl = uifactory.addDropdownMenu("add.feedback.menu", null, formLayout, getTranslator());
    dropdownEl.setOrientation(DropdownOrientation.right);
    dropdownEl.setElementCssClass("o_sel_add_feedbacks");
    dropdownEl.setVisible(!restrictedEdit && !readOnly);
    dropdownEl.setEmbbeded(true);
    addHintButton = uifactory.addFormLink("add.hint.feedback", formLayout, Link.LINK);
    addHintButton.setElementCssClass("o_sel_add_hint");
    addHintButton.setVisible(enable.isEnabled(ModalFeedbackType.hint));
    dropdownEl.addElement(addHintButton);
    addCorrectSolutionButton = uifactory.addFormLink("add.correctSolution.feedback", formLayout, Link.LINK);
    addCorrectSolutionButton.setElementCssClass("o_sel_add_correct_solution");
    addCorrectSolutionButton.setVisible(enable.isEnabled(ModalFeedbackType.correctSolution));
    dropdownEl.addElement(addCorrectSolutionButton);
    addCorrectButton = uifactory.addFormLink("add.correct.feedback", formLayout, Link.LINK);
    addCorrectButton.setElementCssClass("o_sel_add_correct");
    addCorrectButton.setVisible(enable.isEnabled(ModalFeedbackType.correct));
    dropdownEl.addElement(addCorrectButton);
    addIncorrectButton = uifactory.addFormLink("add.incorrect.feedback", formLayout, Link.LINK);
    addIncorrectButton.setElementCssClass("o_sel_add_incorrect");
    addIncorrectButton.setVisible(enable.isEnabled(ModalFeedbackType.incorrect));
    dropdownEl.addElement(addIncorrectButton);
    addAnsweredButton = uifactory.addFormLink("add.answered.feedback", formLayout, Link.LINK);
    addAnsweredButton.setElementCssClass("o_sel_add_answered");
    addAnsweredButton.setVisible(enable.isEnabled(ModalFeedbackType.answered));
    dropdownEl.addElement(addAnsweredButton);
    addEmptyButton = uifactory.addFormLink("add.empty.feedback", formLayout, Link.LINK);
    addEmptyButton.setElementCssClass("o_sel_add_empty");
    addEmptyButton.setVisible(enable.isEnabled(ModalFeedbackType.empty));
    dropdownEl.addElement(addEmptyButton);
    addAdditionalButton = uifactory.addFormLink("add.additional.feedback", formLayout, Link.LINK);
    addAdditionalButton.setElementCssClass("o_sel_add_conditional");
    dropdownEl.addElement(addAdditionalButton);
    ModalFeedbackBuilder hint = itemBuilder.getHint();
    hintForm = new SimpleFeedbackForm(hint, ModalFeedbackType.hint);
    hintForm.initForm(ureq, formLayout);
    hintForm.setVisible(!hintForm.isEmpty());
    ModalFeedbackBuilder correctSolution = itemBuilder.getCorrectSolutionFeedback();
    correctSolutionForm = new SimpleFeedbackForm(correctSolution, ModalFeedbackType.correctSolution);
    correctSolutionForm.initForm(ureq, formLayout);
    correctSolutionForm.setVisible(!correctSolutionForm.isEmpty());
    ModalFeedbackBuilder correct = itemBuilder.getCorrectFeedback();
    correctForm = new SimpleFeedbackForm(correct, ModalFeedbackType.correct);
    correctForm.initForm(ureq, formLayout);
    correctForm.setVisible(!correctForm.isEmpty());
    ModalFeedbackBuilder incorrect = itemBuilder.getIncorrectFeedback();
    incorrectForm = new SimpleFeedbackForm(incorrect, ModalFeedbackType.incorrect);
    incorrectForm.initForm(ureq, formLayout);
    incorrectForm.setVisible(!incorrectForm.isEmpty());
    ModalFeedbackBuilder answered = itemBuilder.getAnsweredFeedback();
    answeredForm = new SimpleFeedbackForm(answered, ModalFeedbackType.answered);
    answeredForm.initForm(ureq, formLayout);
    answeredForm.setVisible(!answeredForm.isEmpty());
    ModalFeedbackBuilder empty = itemBuilder.getEmptyFeedback();
    emptyForm = new SimpleFeedbackForm(empty, ModalFeedbackType.empty);
    emptyForm.initForm(ureq, formLayout);
    emptyForm.setVisible(!emptyForm.isEmpty());
    List<ModalFeedbackBuilder> additionals = itemBuilder.getAdditionalFeedbackBuilders();
    if (additionals != null && additionals.size() > 0) {
        int count = 0;
        for (ModalFeedbackBuilder additional : additionals) {
            RuledFeedbackForm conditionForm = new RuledFeedbackForm(additional, ++count);
            conditionForm.initForm(ureq, formLayout);
            additionalForms.add(conditionForm);
        }
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("additionals", additionalForms);
    }
    // Submit Button
    if (!restrictedEdit && !readOnly) {
        uifactory.addFormSubmitButton("submit", formLayout);
    }
    updateAddButtons();
}
Also used : ModalFeedbackBuilder(org.olat.ims.qti21.model.xml.ModalFeedbackBuilder) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) DropdownItem(org.olat.core.gui.components.dropdown.DropdownItem)

Example 3 with DropdownItem

use of org.olat.core.gui.components.dropdown.DropdownItem in project openolat by klemens.

the class FeedbacksEditorController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormContextHelp("Test editor QTI 2.1 in detail#details_testeditor_feedback");
    formLayout.setElementCssClass("o_sel_assessment_item_feedbacks");
    DropdownItem dropdownEl = uifactory.addDropdownMenu("add.feedback.menu", null, formLayout, getTranslator());
    dropdownEl.setOrientation(DropdownOrientation.right);
    dropdownEl.setElementCssClass("o_sel_add_feedbacks");
    dropdownEl.setVisible(!restrictedEdit && !readOnly);
    dropdownEl.setEmbbeded(true);
    addHintButton = uifactory.addFormLink("add.hint.feedback", formLayout, Link.LINK);
    addHintButton.setElementCssClass("o_sel_add_hint");
    addHintButton.setVisible(enable.isEnabled(ModalFeedbackType.hint));
    dropdownEl.addElement(addHintButton);
    addCorrectSolutionButton = uifactory.addFormLink("add.correctSolution.feedback", formLayout, Link.LINK);
    addCorrectSolutionButton.setElementCssClass("o_sel_add_correct_solution");
    addCorrectSolutionButton.setVisible(enable.isEnabled(ModalFeedbackType.correctSolution));
    dropdownEl.addElement(addCorrectSolutionButton);
    addCorrectButton = uifactory.addFormLink("add.correct.feedback", formLayout, Link.LINK);
    addCorrectButton.setElementCssClass("o_sel_add_correct");
    addCorrectButton.setVisible(enable.isEnabled(ModalFeedbackType.correct));
    dropdownEl.addElement(addCorrectButton);
    addIncorrectButton = uifactory.addFormLink("add.incorrect.feedback", formLayout, Link.LINK);
    addIncorrectButton.setElementCssClass("o_sel_add_incorrect");
    addIncorrectButton.setVisible(enable.isEnabled(ModalFeedbackType.incorrect));
    dropdownEl.addElement(addIncorrectButton);
    addAnsweredButton = uifactory.addFormLink("add.answered.feedback", formLayout, Link.LINK);
    addAnsweredButton.setElementCssClass("o_sel_add_answered");
    addAnsweredButton.setVisible(enable.isEnabled(ModalFeedbackType.answered));
    dropdownEl.addElement(addAnsweredButton);
    addEmptyButton = uifactory.addFormLink("add.empty.feedback", formLayout, Link.LINK);
    addEmptyButton.setElementCssClass("o_sel_add_empty");
    addEmptyButton.setVisible(enable.isEnabled(ModalFeedbackType.empty));
    dropdownEl.addElement(addEmptyButton);
    addAdditionalButton = uifactory.addFormLink("add.additional.feedback", formLayout, Link.LINK);
    addAdditionalButton.setElementCssClass("o_sel_add_conditional");
    dropdownEl.addElement(addAdditionalButton);
    ModalFeedbackBuilder hint = itemBuilder.getHint();
    hintForm = new SimpleFeedbackForm(hint, ModalFeedbackType.hint);
    hintForm.initForm(ureq, formLayout);
    hintForm.setVisible(!hintForm.isEmpty());
    ModalFeedbackBuilder correctSolution = itemBuilder.getCorrectSolutionFeedback();
    correctSolutionForm = new SimpleFeedbackForm(correctSolution, ModalFeedbackType.correctSolution);
    correctSolutionForm.initForm(ureq, formLayout);
    correctSolutionForm.setVisible(!correctSolutionForm.isEmpty());
    ModalFeedbackBuilder correct = itemBuilder.getCorrectFeedback();
    correctForm = new SimpleFeedbackForm(correct, ModalFeedbackType.correct);
    correctForm.initForm(ureq, formLayout);
    correctForm.setVisible(!correctForm.isEmpty());
    ModalFeedbackBuilder incorrect = itemBuilder.getIncorrectFeedback();
    incorrectForm = new SimpleFeedbackForm(incorrect, ModalFeedbackType.incorrect);
    incorrectForm.initForm(ureq, formLayout);
    incorrectForm.setVisible(!incorrectForm.isEmpty());
    ModalFeedbackBuilder answered = itemBuilder.getAnsweredFeedback();
    answeredForm = new SimpleFeedbackForm(answered, ModalFeedbackType.answered);
    answeredForm.initForm(ureq, formLayout);
    answeredForm.setVisible(!answeredForm.isEmpty());
    ModalFeedbackBuilder empty = itemBuilder.getEmptyFeedback();
    emptyForm = new SimpleFeedbackForm(empty, ModalFeedbackType.empty);
    emptyForm.initForm(ureq, formLayout);
    emptyForm.setVisible(!emptyForm.isEmpty());
    List<ModalFeedbackBuilder> additionals = itemBuilder.getAdditionalFeedbackBuilders();
    if (additionals != null && additionals.size() > 0) {
        int count = 0;
        for (ModalFeedbackBuilder additional : additionals) {
            RuledFeedbackForm conditionForm = new RuledFeedbackForm(additional, ++count);
            conditionForm.initForm(ureq, formLayout);
            additionalForms.add(conditionForm);
        }
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("additionals", additionalForms);
    }
    // Submit Button
    if (!restrictedEdit && !readOnly) {
        uifactory.addFormSubmitButton("submit", formLayout);
    }
    updateAddButtons();
}
Also used : ModalFeedbackBuilder(org.olat.ims.qti21.model.xml.ModalFeedbackBuilder) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) DropdownItem(org.olat.core.gui.components.dropdown.DropdownItem)

Example 4 with DropdownItem

use of org.olat.core.gui.components.dropdown.DropdownItem in project openolat by klemens.

the class FormUIFactory method addDropdownMenu.

public DropdownItem addDropdownMenu(String name, String i18nLabel, FormItemContainer formLayout, Translator translator) {
    DropdownItem dropdown = new DropdownItem(name, name, translator);
    dropdown.setEmbbeded(true);
    dropdown.setButton(true);
    setLabelIfNotNull(i18nLabel, dropdown);
    formLayout.add(dropdown);
    return dropdown;
}
Also used : DropdownItem(org.olat.core.gui.components.dropdown.DropdownItem)

Aggregations

DropdownItem (org.olat.core.gui.components.dropdown.DropdownItem)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 ModalFeedbackBuilder (org.olat.ims.qti21.model.xml.ModalFeedbackBuilder)2