001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.util.StringUtil;
019 import com.liferay.portal.kernel.util.WebKeys;
020 import com.liferay.portal.theme.ThemeDisplay;
021 import com.liferay.taglib.FileAvailabilityUtil;
022
023 import javax.servlet.jsp.JspWriter;
024
025
029 public class IconHelpTag extends IconTag {
030
031 @Override
032 protected String getPage() {
033 if (FileAvailabilityUtil.isAvailable(servletContext, _PAGE)) {
034 return _PAGE;
035 }
036 else {
037 return null;
038 }
039 }
040
041 @Override
042 protected int processEndTag() throws Exception {
043 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
044 WebKeys.THEME_DISPLAY);
045
046 JspWriter jspWriter = pageContext.getOut();
047
048 String id = StringUtil.randomId();
049
050 jspWriter.write("<span class=\"taglib-icon-help\"><img alt=\"\" ");
051 jspWriter.write("aria-labelledby=\"");
052 jspWriter.write(id);
053 jspWriter.write("\" ");
054 jspWriter.write("onBlur=\"Liferay.Portal.ToolTip.hide();\" ");
055 jspWriter.write("onFocus=\"Liferay.Portal.ToolTip.show(this);\" ");
056 jspWriter.write("onMouseOver=\"Liferay.Portal.ToolTip.show(this);\" ");
057 jspWriter.write("src=\"");
058 jspWriter.write(themeDisplay.getPathThemeImages());
059 jspWriter.write("/portlet/help.png\" tabIndex=\"0\" ");
060 jspWriter.write("/><span ");
061 jspWriter.write("class=\"hide-accessible tooltip-text\" ");
062 jspWriter.write("id=\"");
063 jspWriter.write(id);
064 jspWriter.write("\" >");
065 jspWriter.write(LanguageUtil.get(request, getMessage()));
066 jspWriter.write("</span></span>");
067
068 return EVAL_PAGE;
069 }
070
071 private static final String _PAGE = "/html/taglib/ui/icon_help/page.jsp";
072
073 }