@Override
  public int doEndTag() throws JspException {
    try {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

      IntegerWrapper panelCount =
          (IntegerWrapper) request.getAttribute("liferay-ui:panel-container:panelCount" + _id);

      request.removeAttribute("liferay-ui:panel-container:panelCount" + _id);

      if ((panelCount != null) && (panelCount.getValue() >= 1)) {
        PortalIncludeUtil.include(pageContext, getStartPage());
      }

      writeBodyContent(pageContext.getOut());

      if ((panelCount != null) && (panelCount.getValue() >= 1)) {
        PortalIncludeUtil.include(pageContext, getEndPage());
      }

      request.removeAttribute("liferay-ui:panel-container:id");
      request.removeAttribute("liferay-ui:panel-container:accordion");
      request.removeAttribute("liferay-ui:panel-container:persistState");
      request.removeAttribute("liferay-ui:panel-container:extended");
      request.removeAttribute("liferay-ui:panel-container:cssClass");

      return EVAL_PAGE;
    } catch (Exception e) {
      throw new JspException(e);
    }
  }
Beispiel #2
0
  public int doEndTag() throws JspException {
    try {
      PortalIncludeUtil.include(pageContext, getEndPage());

      return EVAL_PAGE;
    } catch (Exception e) {
      throw new JspException(e);
    }
  }
Beispiel #3
0
  public int doStartTag() throws JspException {
    try {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

      request.setAttribute("liferay-ui:user-display:user-id", String.valueOf(_userId));
      request.setAttribute("liferay-ui:user-display:user-name", _userName);

      User user = null;

      try {
        user = UserLocalServiceUtil.getUserById(_userId);

        if (user.isDefaultUser()) {
          user = null;
        }

        request.setAttribute("liferay-ui:user-display:user", user);

        pageContext.setAttribute("userDisplay", user);
      } catch (NoSuchUserException usue) {
        request.removeAttribute("liferay-ui:user-display:user");

        pageContext.removeAttribute("userDisplay");
      }

      request.setAttribute("liferay-ui:user-display:url", _url);
      request.setAttribute("liferay-ui:user-display:displayStyle", String.valueOf(_displayStyle));

      PortalIncludeUtil.include(pageContext, getStartPage());

      if (user != null) {
        return EVAL_BODY_INCLUDE;
      } else {
        return SKIP_BODY;
      }
    } catch (Exception e) {
      throw new JspException(e);
    }
  }
  protected int processEndTag() throws Exception {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    IntegerWrapper iconCount =
        (IntegerWrapper) request.getAttribute("liferay-ui:icon-menu:icon-count");

    request.removeAttribute("liferay-ui:icon-menu:icon-count");

    Boolean singleIcon = (Boolean) request.getAttribute("liferay-ui:icon-menu:single-icon");

    request.removeAttribute("liferay-ui:icon-menu:single-icon");

    JspWriter jspWriter = pageContext.getOut();

    if ((iconCount != null)
        && (iconCount.getValue() >= 1)
        && ((singleIcon == null) || _showWhenSingleIcon)) {

      if (!FileAvailabilityUtil.isAvailable(pageContext.getServletContext(), getStartPage())) {

        if (_showExpanded) {
          jspWriter.write("<div class=\"lfr-component ");
          jspWriter.write("lfr-menu-list lfr-menu-expanded align-");
          jspWriter.write(_align);
          jspWriter.write(" ");
          jspWriter.print(_cssClass);
          jspWriter.write("\" id=\"");
          jspWriter.write(_id);
          jspWriter.write("\">");
        } else {
          jspWriter.write("<span title=\"");
          jspWriter.write(LanguageUtil.get(pageContext, _message));
          jspWriter.write("\"><ul class='lfr-component lfr-actions ");
          jspWriter.write("align-");
          jspWriter.write(_align);
          jspWriter.write(" direction-");
          jspWriter.write(_direction);
          jspWriter.write(" max-display-items-");
          jspWriter.write(String.valueOf(_maxDisplayItems));
          jspWriter.write(" ");

          if (Validator.isNotNull(_cssClass)) {
            jspWriter.print(_cssClass);
          }

          if (_disabled) {
            jspWriter.write(" disabled");
          }

          if (_extended) {
            jspWriter.write(" lfr-extended");
          }

          if (_showArrow) {
            jspWriter.write(" show-arrow");
          }

          jspWriter.write("\' id=\"");
          jspWriter.write(_id);
          jspWriter.write("\">");
          jspWriter.write("<li class=\"lfr-trigger\"><strong>");
          jspWriter.write("<a class=\"nobr\" href=\"javascript:;\">");

          if (Validator.isNotNull(_icon)) {
            jspWriter.write("<img alt=\"\" src=\"");
            jspWriter.write(_icon);
            jspWriter.write("\" />");
          }

          jspWriter.write("<span class=\"taglib-text\">");
          jspWriter.write(LanguageUtil.get(pageContext, _message));
          jspWriter.write("</span></a></strong>");
        }

        jspWriter.write("<ul>");
      } else {
        PortalIncludeUtil.include(pageContext, getStartPage());
      }
    }

    writeBodyContent(jspWriter);

    if ((iconCount != null)
        && (iconCount.getValue() >= 1)
        && ((singleIcon == null) || _showWhenSingleIcon)) {

      if (!FileAvailabilityUtil.isAvailable(pageContext.getServletContext(), getEndPage())) {

        jspWriter.write("</ul>");

        if (_showExpanded) {
          jspWriter.write("</div>");

          ScriptTag.doTag(
              null, "liferay-menu", "Liferay.Menu.handleFocus('#" + _id + "menu');", pageContext);
        } else {
          jspWriter.write("</li></ul></span>");
        }
      } else {
        PortalIncludeUtil.include(pageContext, getEndPage());
      }
    }

    request.removeAttribute("liferay-ui:icon-menu:showWhenSingleIcon");

    return EVAL_PAGE;
  }