public void renderContainerBegin( Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { String containerId = container.getId(context); String autoUpdateTarget = container.getAutoUpdateTargetExdr(context); HttpServletRequest request = (HttpServletRequest) context.get("request"); String autoUpdateLink = ""; if (UtilValidate.isNotEmpty(autoUpdateTarget) && UtilHttp.isJavaScriptEnabled(request)) { if (UtilValidate.isEmpty(containerId)) { containerId = getNextElementId(); } HttpServletResponse response = (HttpServletResponse) context.get("response"); ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); autoUpdateLink = rh.makeLink(request, response, autoUpdateTarget); } Map<String, Object> parameters = FastMap.newInstance(); parameters.put("id", containerId); parameters.put("style", container.getStyle(context)); parameters.put("autoUpdateLink", autoUpdateLink); parameters.put("autoUpdateInterval", container.getAutoUpdateInterval()); executeMacro(writer, "renderContainerBegin", parameters); }
public void renderScreenletBegin( Appendable writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException { HttpServletRequest request = (HttpServletRequest) context.get("request"); HttpServletResponse response = (HttpServletResponse) context.get("response"); boolean javaScriptEnabled = UtilHttp.isJavaScriptEnabled(request); ModelScreenWidget.Menu tabMenu = screenlet.getTabMenu(); if (tabMenu != null) { tabMenu.renderWidgetString(writer, context, this); } String title = screenlet.getTitle(context); boolean collapsible = screenlet.collapsible(); ModelScreenWidget.Menu navMenu = screenlet.getNavigationMenu(); ModelScreenWidget.Form navForm = screenlet.getNavigationForm(); String expandToolTip = ""; String collapseToolTip = ""; String fullUrlString = ""; String menuString = ""; boolean showMore = false; if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || collapsible) { showMore = true; if (collapsible) { this.getNextElementId(); Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap); if (uiLabelMap != null) { expandToolTip = (String) uiLabelMap.get("CommonExpand"); collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); } if (!javaScriptEnabled) { requestParameters.put( screenlet.getPreferenceKey(context) + "_collapsed", collapsed ? "false" : "true"); String queryString = UtilHttp.urlEncodeArgs(requestParameters); fullUrlString = request.getRequestURI() + "?" + queryString; } } if (!collapsed) { StringWriter sb = new StringWriter(); if (navMenu != null) { MenuStringRenderer savedRenderer = (MenuStringRenderer) context.get("menuStringRenderer"); MenuStringRenderer renderer = new ScreenletMenuRenderer(request, response); context.put("menuStringRenderer", renderer); navMenu.renderWidgetString(sb, context, this); context.put("menuStringRenderer", savedRenderer); } else if (navForm != null) { renderScreenletPaginateMenu(sb, context, navForm); } menuString = sb.toString(); } } Map<String, Object> parameters = FastMap.newInstance(); parameters.put("id", screenlet.getId(context)); parameters.put("title", title); parameters.put("collapsible", collapsible); parameters.put("saveCollapsed", screenlet.saveCollapsed()); parameters.put("collapsibleAreaId", screenlet.getId(context) + "_col"); parameters.put("expandToolTip", expandToolTip); parameters.put("collapseToolTip", collapseToolTip); parameters.put("fullUrlString", fullUrlString); parameters.put("padded", screenlet.padded()); parameters.put("menuString", menuString); parameters.put("showMore", showMore); parameters.put("collapsed", collapsed); parameters.put("javaScriptEnabled", javaScriptEnabled); executeMacro(writer, "renderScreenletBegin", parameters); }