public void renderSubContentBegin(
      Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content)
      throws IOException {
    String enableEditName = content.getEnableEditName(context);
    String enableEditValue = (String) context.get(enableEditName);

    Map<String, Object> parameters = FastMap.newInstance();
    parameters.put("editContainerStyle", content.getEditContainerStyle(context));
    parameters.put("editRequest", content.getEditRequest(context));
    parameters.put("enableEditValue", enableEditValue == null ? "" : enableEditValue);
    executeMacro(writer, "renderSubContentBegin", parameters);
  }
  public void renderSubContentEnd(
      Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content)
      throws IOException {
    String editMode = "Edit";
    String editRequest = content.getEditRequest(context);
    String enableEditName = content.getEnableEditName(context);
    String enableEditValue = (String) context.get(enableEditName);
    String expandedContentId = content.getContentId(context);
    String expandedMapKey = content.getMapKey(context);
    String urlString = "";
    if (editRequest != null && editRequest.toUpperCase().indexOf("IMAGE") > 0) {
      editMode += " Image";
    }
    if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) {
      HttpServletResponse response = (HttpServletResponse) context.get("response");
      HttpServletRequest request = (HttpServletRequest) context.get("request");
      if (request != null && response != null) {
        if (editRequest.indexOf("?") < 0) editRequest += "?";
        else editRequest += "&amp;";
        editRequest += "contentId=" + expandedContentId;
        if (UtilValidate.isNotEmpty(expandedMapKey)) {
          editRequest += "&amp;mapKey=" + expandedMapKey;
        }
        ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
        RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
        urlString = rh.makeLink(request, response, editRequest, false, false, false);
      }
    }

    Map<String, Object> parameters = FastMap.newInstance();
    parameters.put("urlString", urlString);
    parameters.put("editMode", editMode);
    parameters.put("editContainerStyle", content.getEditContainerStyle(context));
    parameters.put("editRequest", editRequest);
    parameters.put("enableEditValue", enableEditValue == null ? "" : enableEditValue);
    executeMacro(writer, "renderSubContentEnd", parameters);
  }