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;
}
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);
}
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;
}
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;
}
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);
}
Aggregations