Search in sources :

Example 21 with ChangePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ChangePartEvent 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));
}
Also used : ClosePartEvent(org.olat.modules.portfolio.ui.editor.event.ClosePartEvent) Slider(org.olat.modules.forms.model.xml.Slider) ChangePartEvent(org.olat.modules.portfolio.ui.editor.event.ChangePartEvent) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType)

Example 22 with ChangePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ChangePartEvent in project openolat by klemens.

the class TextInputEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (StringHelper.containsNonWhitespace(rowsEl.getValue())) {
        try {
            int rows = Integer.parseInt(rowsEl.getValue());
            textInput.setRows(rows);
        } catch (NumberFormatException e) {
            logError("Cannot parse integer: " + rowsEl.getValue(), null);
        }
    }
    textInputCtrl.update();
    fireEvent(ureq, new ChangePartEvent(textInput));
    fireEvent(ureq, new ClosePartEvent(textInput));
}
Also used : ClosePartEvent(org.olat.modules.portfolio.ui.editor.event.ClosePartEvent) ChangePartEvent(org.olat.modules.portfolio.ui.editor.event.ChangePartEvent)

Aggregations

ChangePartEvent (org.olat.modules.portfolio.ui.editor.event.ChangePartEvent)22 ClosePartEvent (org.olat.modules.portfolio.ui.editor.event.ClosePartEvent)6 SliderType (org.olat.modules.forms.model.xml.Rubric.SliderType)2 Slider (org.olat.modules.forms.model.xml.Slider)2 AddElementEvent (org.olat.modules.portfolio.ui.editor.event.AddElementEvent)2