Search in sources :

Example 1 with SliderOverviewElement

use of org.olat.modules.forms.ui.component.SliderOverviewElement 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 2 with SliderOverviewElement

use of org.olat.modules.forms.ui.component.SliderOverviewElement in project openolat by klemens.

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)

Aggregations

ArrayList (java.util.ArrayList)2 Identity (org.olat.core.id.Identity)2 EvaluationFormResponse (org.olat.modules.forms.EvaluationFormResponse)2 SliderOverviewElement (org.olat.modules.forms.ui.component.SliderOverviewElement)2 SliderPoint (org.olat.modules.forms.ui.component.SliderPoint)2 SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)2