use of org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute in project OpenOLAT by OpenOLAT.
the class CourseLayoutGeneratorController method prepareStyleEditor.
private void prepareStyleEditor(Map<String, Map<String, Object>> customConfig) {
// keep config order
guiWrapper = new LinkedHashMap<String, Map<String, FormItem>>();
List<AbstractLayoutElement> allElements = customCMgr.getAllAvailableElements();
List<AbstractLayoutAttribute> allAttribs = customCMgr.getAllAvailableAttributes();
styleFlc.contextPut("allAttribs", allAttribs);
// needed reference to get listener back.
styleFlc.setUserObject(this);
for (AbstractLayoutElement abstractLayoutElement : allElements) {
String elementType = abstractLayoutElement.getLayoutElementTypeName();
Map<String, Object> elConf = customConfig.get(elementType);
AbstractLayoutElement concreteElmt = abstractLayoutElement.createInstance(elConf);
HashMap<String, FormItem> elAttribGui = new HashMap<String, FormItem>();
List<AbstractLayoutAttribute> attributes = concreteElmt.getAvailableAttributes();
for (AbstractLayoutAttribute attrib : attributes) {
String compName = elementType + ELEMENT_ATTRIBUTE_DELIM + attrib.getLayoutAttributeTypeName();
FormItem fi = attrib.getFormItem(compName, styleFlc);
fi.addActionListener(FormEvent.ONCHANGE);
elAttribGui.put(attrib.getLayoutAttributeTypeName(), fi);
}
guiWrapper.put(elementType, elAttribGui);
}
styleFlc.contextPut("guiWrapper", guiWrapper);
}
use of org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute in project openolat by klemens.
the class CourseLayoutGeneratorController method prepareStyleEditor.
private void prepareStyleEditor(Map<String, Map<String, Object>> customConfig) {
// keep config order
guiWrapper = new LinkedHashMap<String, Map<String, FormItem>>();
List<AbstractLayoutElement> allElements = customCMgr.getAllAvailableElements();
List<AbstractLayoutAttribute> allAttribs = customCMgr.getAllAvailableAttributes();
styleFlc.contextPut("allAttribs", allAttribs);
// needed reference to get listener back.
styleFlc.setUserObject(this);
for (AbstractLayoutElement abstractLayoutElement : allElements) {
String elementType = abstractLayoutElement.getLayoutElementTypeName();
Map<String, Object> elConf = customConfig.get(elementType);
AbstractLayoutElement concreteElmt = abstractLayoutElement.createInstance(elConf);
HashMap<String, FormItem> elAttribGui = new HashMap<String, FormItem>();
List<AbstractLayoutAttribute> attributes = concreteElmt.getAvailableAttributes();
for (AbstractLayoutAttribute attrib : attributes) {
String compName = elementType + ELEMENT_ATTRIBUTE_DELIM + attrib.getLayoutAttributeTypeName();
FormItem fi = attrib.getFormItem(compName, styleFlc);
fi.addActionListener(FormEvent.ONCHANGE);
elAttribGui.put(attrib.getLayoutAttributeTypeName(), fi);
}
guiWrapper.put(elementType, elAttribGui);
}
styleFlc.contextPut("guiWrapper", guiWrapper);
}
use of org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute in project OpenOLAT by OpenOLAT.
the class AbstractLayoutElement method initAttributeConfig.
protected void initAttributeConfig() {
if (getConfig() != null) {
List<AbstractLayoutAttribute> avAttribs = getAvailableAttributes();
for (AbstractLayoutAttribute abstractLayoutAttribute : avAttribs) {
String type = abstractLayoutAttribute.getLayoutAttributeTypeName();
if (type.equals(PreviewLA.IDENTIFIER)) {
StringBuffer sbPreviewStyle = new StringBuffer();
prepareAttributePart(0, sbPreviewStyle);
abstractLayoutAttribute.setAttributeValue(sbPreviewStyle.toString());
} else {
abstractLayoutAttribute.setAttributeValue((String) getConfig().get(type));
}
}
}
}
use of org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute in project OpenOLAT by OpenOLAT.
the class AbstractLayoutElement method prepareAttributePart.
protected void prepareAttributePart(int rel, StringBuffer sb) {
for (AbstractLayoutAttribute attrib : availableAttributes) {
if (StringHelper.containsNonWhitespace(attrib.getAttributeValue())) {
sb.append("\t");
sb.append(attrib.getRelativeCompiledAttribute(rel));
}
}
}
use of org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute in project openolat by klemens.
the class AbstractLayoutElement method initAttributeConfig.
protected void initAttributeConfig() {
if (getConfig() != null) {
List<AbstractLayoutAttribute> avAttribs = getAvailableAttributes();
for (AbstractLayoutAttribute abstractLayoutAttribute : avAttribs) {
String type = abstractLayoutAttribute.getLayoutAttributeTypeName();
if (type.equals(PreviewLA.IDENTIFIER)) {
StringBuffer sbPreviewStyle = new StringBuffer();
prepareAttributePart(0, sbPreviewStyle);
abstractLayoutAttribute.setAttributeValue(sbPreviewStyle.toString());
} else {
abstractLayoutAttribute.setAttributeValue((String) getConfig().get(type));
}
}
}
}
Aggregations