use of org.olat.modules.forms.model.xml.Rubric.SliderType in project OpenOLAT by OpenOLAT.
the class RubricEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
commitFields();
commitStepLabels();
String selectedType = typeEl.getSelectedKey();
SliderType type = SliderType.valueOf(selectedType);
rubric.setSliderType(type);
if (type == SliderType.continuous) {
rubric.setStart(1);
rubric.setEnd(100);
rubric.setSteps(100);
} else {
int steps = Integer.parseInt(stepsEl.getSelectedKey());
rubric.setStart(1);
rubric.setEnd(steps);
rubric.setSteps(steps);
}
for (Iterator<Slider> sliderIt = rubric.getSliders().iterator(); sliderIt.hasNext(); ) {
Slider slider = sliderIt.next();
if (!StringHelper.containsNonWhitespace(slider.getStartLabel()) && !StringHelper.containsNonWhitespace(slider.getEndLabel())) {
sliderIt.remove();
}
}
rubricCtrl.updateForm();
fireEvent(ureq, new ChangePartEvent(rubric));
fireEvent(ureq, new ClosePartEvent(rubric));
}
use of org.olat.modules.forms.model.xml.Rubric.SliderType 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);
}
use of org.olat.modules.forms.model.xml.Rubric.SliderType in project openolat by klemens.
the class RubricEditorController method formOK.
@Override
protected void formOK(UserRequest ureq) {
commitFields();
commitStepLabels();
String selectedType = typeEl.getSelectedKey();
SliderType type = SliderType.valueOf(selectedType);
rubric.setSliderType(type);
if (type == SliderType.continuous) {
rubric.setStart(1);
rubric.setEnd(100);
rubric.setSteps(100);
} else {
int steps = Integer.parseInt(stepsEl.getSelectedKey());
rubric.setStart(1);
rubric.setEnd(steps);
rubric.setSteps(steps);
}
for (Iterator<Slider> sliderIt = rubric.getSliders().iterator(); sliderIt.hasNext(); ) {
Slider slider = sliderIt.next();
if (!StringHelper.containsNonWhitespace(slider.getStartLabel()) && !StringHelper.containsNonWhitespace(slider.getEndLabel())) {
sliderIt.remove();
}
}
rubricCtrl.updateForm();
fireEvent(ureq, new ChangePartEvent(rubric));
fireEvent(ureq, new ClosePartEvent(rubric));
}
Aggregations