use of org.apache.ofbiz.widget.model.ModelScreenWidget in project ofbiz-framework by apache.
the class MacroScreenRenderer method renderColumnContainer.
@Override
public void renderColumnContainer(Appendable writer, Map<String, Object> context, ColumnContainer columnContainer) throws IOException {
String id = columnContainer.getId(context);
String style = columnContainer.getStyle(context);
StringBuilder sb = new StringBuilder("<@renderColumnContainerBegin");
sb.append(" id=\"");
sb.append(id);
sb.append("\" style=\"");
sb.append(style);
sb.append("\" />");
executeMacro(writer, sb.toString());
for (Column column : columnContainer.getColumns()) {
id = column.getId(context);
style = column.getStyle(context);
sb = new StringBuilder("<@renderColumnBegin");
sb.append(" id=\"");
sb.append(id);
sb.append("\" style=\"");
sb.append(style);
sb.append("\" />");
executeMacro(writer, sb.toString());
for (ModelScreenWidget subWidget : column.getSubWidgets()) {
try {
subWidget.renderWidgetString(writer, context, this);
} catch (GeneralException e) {
throw new IOException(e);
}
}
executeMacro(writer, "<@renderColumnEnd />");
}
executeMacro(writer, "<@renderColumnContainerEnd />");
}
use of org.apache.ofbiz.widget.model.ModelScreenWidget in project ofbiz-framework by apache.
the class WidgetFactory method loadStandardWidgets.
/**
* Loads the standard OFBiz screen widgets.
*/
protected static void loadStandardWidgets() {
for (Class<?> clz : ModelScreenWidget.class.getClasses()) {
try {
// Subclass of ModelScreenWidget and non-abstract
if (ModelScreenWidget.class.isAssignableFrom(clz) && (clz.getModifiers() & Modifier.ABSTRACT) == 0) {
try {
Field field = clz.getField("TAG_NAME");
Object fieldObject = field.get(null);
if (fieldObject != null) {
Class<? extends ModelScreenWidget> widgetClass = UtilGenerics.cast(clz);
registerScreenWidget(fieldObject.toString(), widgetClass);
}
} catch (Exception e) {
Debug.logError(e, module);
}
}
} catch (Exception e) {
Debug.logError(e, module);
}
}
try {
registerScreenWidget("iterate-section", IterateSectionWidget.class);
} catch (Exception e) {
Debug.logError(e, module);
}
}
Aggregations