Search in sources :

Example 16 with SliderWrapper

use of org.olat.modules.forms.ui.model.SliderWrapper in project OpenOLAT by OpenOLAT.

the class RubricController method forgeDiscreteSlider.

private SliderWrapper forgeDiscreteSlider(Slider slider, Rubric element) {
    SliderElement sliderEl = uifactory.addSliderElement("slider_" + (count++), null, flc);
    sliderEl.setDomReplacementWrapperRequired(false);
    sliderEl.addActionListener(FormEvent.ONCHANGE);
    sliderEl.setMinValue(element.getStart());
    sliderEl.setMaxValue(element.getEnd());
    sliderEl.setStep(1);
    SliderWrapper sliderWrapper = new SliderWrapper(slider, sliderEl);
    sliderEl.setUserObject(sliderWrapper);
    return sliderWrapper;
}
Also used : SliderElement(org.olat.core.gui.components.form.flexible.elements.SliderElement) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper)

Example 17 with SliderWrapper

use of org.olat.modules.forms.ui.model.SliderWrapper in project OpenOLAT by OpenOLAT.

the class CompareEvaluationsFormController method forgeSliderStats.

private SliderWrapper forgeSliderStats(Slider slider, Rubric element, List<EvaluationFormResponse> responses) {
    String id = "overview_" + (count++);
    SliderOverviewElement overviewEl = new SliderOverviewElement(id);
    overviewEl.setMinValue(element.getStart());
    overviewEl.setMaxValue(element.getEnd());
    flc.add(id, overviewEl);
    List<SliderPoint> values = new ArrayList<>();
    if (responses != null && responses.size() > 0) {
        for (EvaluationFormResponse response : responses) {
            if (response.getNumericalResponse() != null) {
                Identity evaluator = response.getSession().getIdentity();
                String color = evaluatorToColors.get(evaluator);
                double value = response.getNumericalResponse().doubleValue();
                values.add(new SliderPoint(color, value));
            }
        }
    }
    overviewEl.setValues(values);
    return new SliderWrapper(slider, overviewEl);
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) SliderOverviewElement(org.olat.modules.forms.ui.component.SliderOverviewElement) ArrayList(java.util.ArrayList) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse) Identity(org.olat.core.id.Identity) SliderPoint(org.olat.modules.forms.ui.component.SliderPoint)

Example 18 with SliderWrapper

use of org.olat.modules.forms.ui.model.SliderWrapper in project OpenOLAT by OpenOLAT.

the class CompareEvaluationsFormController method forgeRubric.

private EvaluationFormElementWrapper forgeRubric(Rubric element) {
    EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
    wrapper.setSliderOverview(true);
    List<Slider> sliders = element.getSliders();
    List<SliderWrapper> sliderWrappers = new ArrayList<>(sliders.size());
    for (Slider slider : sliders) {
        String responseIdentifier = slider.getId();
        List<EvaluationFormResponse> responses = identifierToResponses.get(responseIdentifier);
        SliderWrapper sliderWrapper = forgeSliderStats(slider, element, responses);
        sliderWrappers.add(sliderWrapper);
    }
    wrapper.setSliders(sliderWrappers);
    return wrapper;
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Slider(org.olat.modules.forms.model.xml.Slider) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 19 with SliderWrapper

use of org.olat.modules.forms.ui.model.SliderWrapper in project openolat by klemens.

the class RubricController method forgeDiscreteSlider.

private SliderWrapper forgeDiscreteSlider(Slider slider, Rubric element) {
    SliderElement sliderEl = uifactory.addSliderElement("slider_" + (count++), null, flc);
    sliderEl.setDomReplacementWrapperRequired(false);
    sliderEl.addActionListener(FormEvent.ONCHANGE);
    sliderEl.setMinValue(element.getStart());
    sliderEl.setMaxValue(element.getEnd());
    sliderEl.setStep(1);
    SliderWrapper sliderWrapper = new SliderWrapper(slider, sliderEl);
    sliderEl.setUserObject(sliderWrapper);
    return sliderWrapper;
}
Also used : SliderElement(org.olat.core.gui.components.form.flexible.elements.SliderElement) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper)

Example 20 with SliderWrapper

use of org.olat.modules.forms.ui.model.SliderWrapper in project openolat by klemens.

the class RubricController method updateForm.

protected void updateForm() {
    EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(rubric);
    List<Slider> sliders = rubric.getSliders();
    List<SliderWrapper> sliderWrappers = new ArrayList<>(sliders.size());
    for (Slider slider : sliders) {
        SliderType type = rubric.getSliderType();
        SliderWrapper sliderWrapper = null;
        if (type == SliderType.discrete) {
            sliderWrapper = forgeDiscreteRadioButtons(slider, rubric);
        } else if (type == SliderType.discrete_slider) {
            sliderWrapper = forgeDiscreteSlider(slider, rubric);
        } else if (type == SliderType.continuous) {
            sliderWrapper = forgeContinuousSlider(slider, rubric);
        }
        if (sliderWrapper != null) {
            sliderWrappers.add(sliderWrapper);
        }
    }
    wrapper.setSliders(sliderWrappers);
    flc.contextPut("element", wrapper);
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Slider(org.olat.modules.forms.model.xml.Slider) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType)

Aggregations

SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)24 SliderElement (org.olat.core.gui.components.form.flexible.elements.SliderElement)10 ArrayList (java.util.ArrayList)8 EvaluationFormElementWrapper (org.olat.modules.forms.ui.model.EvaluationFormElementWrapper)8 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)6 EvaluationFormResponse (org.olat.modules.forms.EvaluationFormResponse)6 Slider (org.olat.modules.forms.model.xml.Slider)6 SliderType (org.olat.modules.forms.model.xml.Rubric.SliderType)4 FileUploadWrapper (org.olat.modules.forms.ui.model.FileUploadWrapper)4 TextInputWrapper (org.olat.modules.forms.ui.model.TextInputWrapper)4 File (java.io.File)2 BigDecimal (java.math.BigDecimal)2 FileElement (org.olat.core.gui.components.form.flexible.elements.FileElement)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 FileElementEvent (org.olat.core.gui.components.form.flexible.impl.elements.FileElementEvent)2 Identity (org.olat.core.id.Identity)2 SliderOverviewElement (org.olat.modules.forms.ui.component.SliderOverviewElement)2 SliderPoint (org.olat.modules.forms.ui.component.SliderPoint)2 ValidationMessage (org.olat.modules.portfolio.ui.editor.ValidationMessage)2