Search in sources :

Example 1 with ClosePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ClosePartEvent in project OpenOLAT by OpenOLAT.

the class PageEditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (addCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            PageElement element = addCtrl.getPageElement();
            AddElementInfos uobject = addCtrl.getUserObject();
            EditorFragment fragment = doAddPageElement(ureq, element, uobject.getReferenceFragment(), uobject.getTarget());
            // close editor right away (file upload etc makes more sense)
            doSaveElement(ureq, fragment);
        }
        cmc.deactivate();
        cleanUp();
    } else if (addElementsCtrl == source) {
        addCalloutCtrl.deactivate();
        cleanUp();
        if (event instanceof AddElementEvent) {
            AddElementEvent aee = (AddElementEvent) event;
            doAddElement(ureq, aee.getReferenceFragment(), aee.getHandler(), aee.getTarget());
        }
    } else if (addCalloutCtrl == source) {
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    } else if (isEditorPartController(source)) {
        EditorFragment fragment = getEditorFragment(source);
        if (event instanceof ChangePartEvent) {
            ChangePartEvent changeEvent = (ChangePartEvent) event;
            PageElement element = changeEvent.getElement();
            fragment.setPageElement(element);
            fireEvent(ureq, Event.CHANGED_EVENT);
        } else if (event instanceof ClosePartEvent) {
            doSaveElement(ureq, fragment);
        }
    }
    super.event(ureq, source, event);
}
Also used : ClosePartEvent(org.olat.modules.portfolio.ui.editor.event.ClosePartEvent) AddElementEvent(org.olat.modules.portfolio.ui.editor.event.AddElementEvent) ChangePartEvent(org.olat.modules.portfolio.ui.editor.event.ChangePartEvent)

Example 2 with ClosePartEvent

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

the class PageEditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (addCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            PageElement element = addCtrl.getPageElement();
            AddElementInfos uobject = addCtrl.getUserObject();
            EditorFragment fragment = doAddPageElement(ureq, element, uobject.getReferenceFragment(), uobject.getTarget());
            // close editor right away (file upload etc makes more sense)
            doSaveElement(ureq, fragment);
        }
        cmc.deactivate();
        cleanUp();
    } else if (addElementsCtrl == source) {
        addCalloutCtrl.deactivate();
        cleanUp();
        if (event instanceof AddElementEvent) {
            AddElementEvent aee = (AddElementEvent) event;
            doAddElement(ureq, aee.getReferenceFragment(), aee.getHandler(), aee.getTarget());
        }
    } else if (addCalloutCtrl == source) {
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    } else if (isEditorPartController(source)) {
        EditorFragment fragment = getEditorFragment(source);
        if (event instanceof ChangePartEvent) {
            ChangePartEvent changeEvent = (ChangePartEvent) event;
            PageElement element = changeEvent.getElement();
            fragment.setPageElement(element);
            fireEvent(ureq, Event.CHANGED_EVENT);
        } else if (event instanceof ClosePartEvent) {
            doSaveElement(ureq, fragment);
        }
    }
    super.event(ureq, source, event);
}
Also used : ClosePartEvent(org.olat.modules.portfolio.ui.editor.event.ClosePartEvent) AddElementEvent(org.olat.modules.portfolio.ui.editor.event.AddElementEvent) ChangePartEvent(org.olat.modules.portfolio.ui.editor.event.ChangePartEvent)

Example 3 with ClosePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ClosePartEvent in project OpenOLAT by OpenOLAT.

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)

Example 4 with ClosePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ClosePartEvent 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));
}
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 5 with ClosePartEvent

use of org.olat.modules.portfolio.ui.editor.event.ClosePartEvent 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)

Aggregations

ChangePartEvent (org.olat.modules.portfolio.ui.editor.event.ChangePartEvent)6 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