* skins to reload are set in the <div class="PortalResponseScript">
*/
public void processRender(WebuiRequestContext context) throws Exception {
PortalRequestContext pcontext = (PortalRequestContext) context;
JavascriptManager jsMan = context.getJavascriptManager();
// Add JS resource of current portal
String portalOwner = pcontext.getPortalOwner();
jsMan.loadScriptResource(ResourceScope.PORTAL, portalOwner);
//
Writer w = context.getWriter();
if (!context.useAjax()) {
// Support for legacy resource declaration
jsMan.loadScriptResource(ResourceScope.SHARED, JavascriptConfigParser.LEGACY_JAVA_SCRIPT);
// Need to add bootstrap as immediate since it contains the loader
jsMan.loadScriptResource(ResourceScope.SHARED, "bootstrap");
super.processRender(context);
} else {
UIMaskWorkspace uiMaskWS = getChildById(UIPortalApplication.UI_MASK_WS_ID);
if (uiMaskWS.isUpdated())
pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
if (getUIPopupMessages().hasMessage()) {
pcontext.addUIComponentToUpdateByAjax(getUIPopupMessages());
}
Set<UIComponent> list = context.getUIComponentToUpdateByAjax();
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>(3);
List<UIComponent> uiDataComponents = new ArrayList<UIComponent>(5);
if (list != null) {
for (UIComponent uicomponent : list) {
if (uicomponent instanceof UIPortlet)
uiPortlets.add((UIPortlet) uicomponent);
else
uiDataComponents.add(uicomponent);
}
}
w.write("<div class=\"PortalResponse\">");
w.write("<div class=\"PortalResponseData\">");
for (UIComponent uicomponent : uiDataComponents) {
if (log.isDebugEnabled())
log.debug("AJAX call: Need to refresh the UI component " + uicomponent.getName());
renderBlockToUpdate(uicomponent, context, w);
}
w.write("</div>");
if (!context.getFullRender()) {
for (UIPortlet uiPortlet : uiPortlets) {
if (log.isDebugEnabled())
log.debug("AJAX call: Need to refresh the Portlet " + uiPortlet.getId());
w.write("<div class=\"PortletResponse\" style=\"display: none\">");
w.append("<div class=\"PortletResponsePortletId\">" + uiPortlet.getId() + "</div>");
w.append("<div class=\"PortletResponseData\">");
/*
* If the portlet is using our UI framework or supports it then it will return a set of block to updates. If
* there is not block to update the javascript client will see that as a full refresh of the content part
*/
uiPortlet.processRender(context);
w.append("</div>");
w.append("<div class=\"PortletResponseScript\"></div>");
w.write("</div>");
}
}
w.write("<div class=\"MarkupHeadElements\">");
List<String> headElems = ((PortalRequestContext) context).getExtraMarkupHeadersAsStrings();
for (String elem : headElems) {
w.write(elem);
}
w.write("</div>");
w.write("<div class=\"LoadingScripts\">");
writeLoadingScripts(pcontext);
w.write("</div>");
w.write("<div class=\"PortalResponseScript\">");
JavascriptManager jsManager = pcontext.getJavascriptManager();
String skin = getAddSkinScript(pcontext.getControllerContext(), list);
if (skin != null) {
jsManager.require("SHARED/skin", "skin").addScripts(skin);
}
w.write(jsManager.getJavaScripts());
w.write("</div>");
w.write("</div>");
}
}