コード例 #1
0
  @Override
  protected void setAttributes(HttpServletRequest request) {
    String id = _id;

    if (Validator.isNull(id)) {
      id = PortalUtil.generateRandomKey(request, IconTag.class.getName());
    }

    request.setAttribute("liferay-ui:icon:cssClass", _cssClass);
    request.setAttribute("liferay-ui:icon:data", _data);
    request.setAttribute("liferay-ui:icon:id", id);
    request.setAttribute("liferay-ui:icon:image", _image);
    request.setAttribute("liferay-ui:icon:imageHover", _imageHover);
    request.setAttribute("liferay-ui:icon:label", String.valueOf(_label));
    request.setAttribute("liferay-ui:icon:lang", _lang);
    request.setAttribute("liferay-ui:icon:message", _message);
    request.setAttribute("liferay-ui:icon:method", _method);
    request.setAttribute("liferay-ui:icon:onClick", _onClick);
    request.setAttribute("liferay-ui:icon:src", _src);
    request.setAttribute("liferay-ui:icon:srcHover", _srcHover);
    request.setAttribute("liferay-ui:icon:target", _target);
    request.setAttribute("liferay-ui:icon:toolTip", String.valueOf(_toolTip));
    request.setAttribute("liferay-ui:icon:url", _url);
  }
コード例 #2
0
  @Override
  public int doStartTag() {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    if (_direction == null) {
      if (_align.equals("left")) {
        _direction = "right";
      } else {
        _direction = "left";
      }
    }

    if (_icon == null) {
      _icon = themeDisplay.getPathThemeImages() + "/common/tool.png";
    }

    if (Validator.isNull(_id)) {
      String randomKey = PortalUtil.generateRandomKey(request, IconMenuTag.class.getName());

      _id = randomKey + StringPool.UNDERLINE + "menu";
    } else {
      PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

      String namespace = portletDisplay.getNamespace();

      _id = namespace.concat(_id);
    }

    request.setAttribute("liferay-ui:icon-menu:icon-count", new IntegerWrapper());
    request.setAttribute(
        "liferay-ui:icon-menu:showWhenSingleIcon", String.valueOf(_showWhenSingleIcon));

    return EVAL_BODY_BUFFERED;
  }