protected Set getTerms(Map requestMap) { if (requestMap.containsKey(TERM_TAG)) { return (Set) requestMap.get(TERM_TAG); } Set returned = HelpTagHelper.getHelpManager().getSortedWorksiteTerms(); requestMap.put(TERM_TAG, returned); return returned; }
/** * @param context FacesContext for the request we are processing * @param component UIComponent to be rendered * @exception IOException if an input/output error occurs while rendering * @exception NullPointerException if <code>context</code> or <code>component</code> is null */ public void encodeEnd(FacesContext context, UIComponent component) throws IOException { String hoverStr = (String) RendererUtil.getAttribute(context, component, "hover"); String linkStr = (String) RendererUtil.getAttribute(context, component, "link"); String firstOnlyStr = (String) RendererUtil.getAttribute(context, component, "firstOnly"); if (hoverStr == null) hoverStr = ""; if (linkStr == null) linkStr = ""; if (firstOnlyStr == null) firstOnlyStr = ""; // Get the temp writer ResponseWriter writer = context.getResponseWriter(); // place the original writer back context.setResponseWriter(originalWriter); // ensure everything is passed out to the string writer writer.flush(); // read the result String content = tempWriter.toString(); StringReader strReader = new StringReader(content); Set termSet = getTerms(context.getExternalContext().getRequestMap()); GlossaryEntry[] terms = new GlossaryEntry[termSet.size()]; terms = (GlossaryEntry[]) termSet.toArray(terms); HelpTagHelper.renderHelp( strReader, content.length(), originalWriter, terms, firstOnlyStr.equals("true"), hoverStr.equals("true"), linkStr.equals("true")); // originalWriter.writeText("--" + tempWriter.toString()+"--", null); }