public void renderScreenletSubWidget(
     Appendable writer,
     Map<String, Object> context,
     ModelScreenWidget subWidget,
     ModelScreenWidget.Screenlet screenlet)
     throws GeneralException, IOException {
   if (subWidget.equals(screenlet.getNavigationForm())) {
     HttpServletRequest request = (HttpServletRequest) context.get("request");
     HttpServletResponse response = (HttpServletResponse) context.get("response");
     if (request != null && response != null) {
       Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
       globalCtx.put("NO_PAGINATOR", true);
       FormStringRenderer savedRenderer = (FormStringRenderer) context.get("formStringRenderer");
       HtmlFormRenderer renderer = new HtmlFormRenderer(request, response);
       renderer.setRenderPagination(false);
       context.put("formStringRenderer", renderer);
       subWidget.renderWidgetString(writer, context, this);
       context.put("formStringRenderer", savedRenderer);
     }
   } else {
     subWidget.renderWidgetString(writer, context, this);
   }
 }
  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);
  }