synchronized(render_mutex) { //o_clusterOK by:fj
// we let all dirty components render themselves.
// not offered (since not usability-useful) is the include of new js-libraries and css-libraries here, since this may invoke a screen reload
// which disturbes the user and lets him/her loose the focus and the cursor.
AsyncMediaResponsible amr = null;
long rstart = 0;
if (isDebugLog) {
rstart = System.currentTimeMillis();
debugMsg = new StringBuilder("update:").append(String.valueOf(dCnt)).append(";");
}
for (int i = 0; i < dCnt; i++) {
Component toRender = dirties.get(i);
boolean wasDomR = toRender.isDomReplaceable();
if (!wasDomR) {
throw new AssertException("cannot replace as dom fragment:"+toRender.getComponentName()+" ("+toRender.getClass().getName()+"),"+toRender.getExtendedDebugInfo());
}
Panel wrapper = new Panel("renderpanel");
wrapper.setDomReplaceable(false); // to omit <div> around the render helper panel
RenderResult renderResult = null;
StringOutput jsol = new StringOutput();
StringOutput hdr = new StringOutput();
String result = null;
try {
toRender.setDomReplaceable(false);
wrapper.setContent(toRender);
String newTimestamp = String.valueOf(timestamp);
URLBuilder ubu = new URLBuilder(uriPrefix,getInstanceId(), newTimestamp,wbackofficeImpl);
renderResult = new RenderResult();
// if we have an around-component-interception
// set the handler for this render cycle
InterceptHandler interceptHandler = wbackofficeImpl.getInterceptHandler();
if (interceptHandler != null) {
InterceptHandlerInstance dhri = interceptHandler.createInterceptHandlerInstance();
renderResult.setInterceptHandlerRenderInstance(dhri);
}
Renderer fr = Renderer.getInstance(wrapper,null, ubu, renderResult, gsettings);
jsol = new StringOutput();
fr.renderBodyOnLoadJSFunctionCall(jsol,toRender);
hdr = new StringOutput();
fr.renderHeaderIncludes(hdr, toRender);
long pstart = 0;
if (isDebugLog) {
pstart = System.currentTimeMillis();
}
result = fr.render(toRender).toString();
if (isDebugLog) {
long pstop = System.currentTimeMillis();
debugMsg.append(toRender.getComponentName()).append(":").append((pstop - pstart));
if (i < dCnt - 1)
debugMsg.append(",");
}
} catch (Exception e) {
throw new OLATRuntimeException(Window.class,renderResult.getLogMsg(), renderResult.getRenderException());
} finally {
toRender.setDomReplaceable(true);
}
if (renderResult.getRenderException() != null) throw new OLATRuntimeException(Window.class, renderResult.getLogMsg(),
renderResult.getRenderException());
AsyncMediaResponsible curAmr = renderResult.getAsyncMediaResponsible();
if (curAmr != null) {
if (amr != null) {
throw new AssertException("can set amr only once in a screen!");
} else {
amr = curAmr;