use of org.olat.course.config.ui.courselayout.attribs.SpecialAttributeFormItemHandler in project openolat by klemens.
the class CourseLayoutGeneratorController method compileCustomConfigFromGuiWrapper.
private Map<String, Map<String, Object>> compileCustomConfigFromGuiWrapper() {
// get config from wrapper-object
elWithErrorExists = false;
Map<String, Map<String, Object>> customConfig = new HashMap<String, Map<String, Object>>();
for (Iterator<Entry<String, Map<String, FormItem>>> iterator = guiWrapper.entrySet().iterator(); iterator.hasNext(); ) {
Entry<String, Map<String, FormItem>> type = iterator.next();
String cIdent = type.getKey();
Map<String, Object> elementConfig = new HashMap<String, Object>();
Map<String, FormItem> element = type.getValue();
for (Entry<String, FormItem> entry : element.entrySet()) {
String attribName = entry.getKey();
if (!attribName.equals(PreviewLA.IDENTIFIER)) {
// exclude preview
FormItem foItem = entry.getValue();
String value = "";
if (foItem instanceof SingleSelection) {
value = ((SingleSelection) foItem).isOneSelected() ? ((SingleSelection) foItem).getSelectedKey() : "";
} else if (foItem.getUserObject() != null && foItem.getUserObject() instanceof SpecialAttributeFormItemHandler) {
// enclosed item
SpecialAttributeFormItemHandler specHandler = (SpecialAttributeFormItemHandler) foItem.getUserObject();
value = specHandler.getValue();
if (specHandler.hasError()) {
elWithErrorExists = true;
}
} else {
throw new AssertException("implement a getValue for this FormItem to get back a processable value.");
}
elementConfig.put(attribName, value);
}
}
customConfig.put(cIdent, elementConfig);
}
return customConfig;
}
use of org.olat.course.config.ui.courselayout.attribs.SpecialAttributeFormItemHandler in project OpenOLAT by OpenOLAT.
the class CourseLayoutGeneratorController method compileCustomConfigFromGuiWrapper.
private Map<String, Map<String, Object>> compileCustomConfigFromGuiWrapper() {
// get config from wrapper-object
elWithErrorExists = false;
Map<String, Map<String, Object>> customConfig = new HashMap<String, Map<String, Object>>();
for (Iterator<Entry<String, Map<String, FormItem>>> iterator = guiWrapper.entrySet().iterator(); iterator.hasNext(); ) {
Entry<String, Map<String, FormItem>> type = iterator.next();
String cIdent = type.getKey();
Map<String, Object> elementConfig = new HashMap<String, Object>();
Map<String, FormItem> element = type.getValue();
for (Entry<String, FormItem> entry : element.entrySet()) {
String attribName = entry.getKey();
if (!attribName.equals(PreviewLA.IDENTIFIER)) {
// exclude preview
FormItem foItem = entry.getValue();
String value = "";
if (foItem instanceof SingleSelection) {
value = ((SingleSelection) foItem).isOneSelected() ? ((SingleSelection) foItem).getSelectedKey() : "";
} else if (foItem.getUserObject() != null && foItem.getUserObject() instanceof SpecialAttributeFormItemHandler) {
// enclosed item
SpecialAttributeFormItemHandler specHandler = (SpecialAttributeFormItemHandler) foItem.getUserObject();
value = specHandler.getValue();
if (specHandler.hasError()) {
elWithErrorExists = true;
}
} else {
throw new AssertException("implement a getValue for this FormItem to get back a processable value.");
}
elementConfig.put(attribName, value);
}
}
customConfig.put(cIdent, elementConfig);
}
return customConfig;
}
Aggregations