private static void writeJavaScriptReference(boolean defer, ResponseWriter writer, String src) throws IOException { writer.startElement(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_ELEM, null); writer.writeAttribute(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_TYPE_ATTR, org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null); if(defer) { writer.writeAttribute(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_ELEM_DEFER_ATTR, "true", null); } writer.writeURIAttribute(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SRC_ATTR, src, null); writer.endElement(HTML.SCRIPT_ELEM); }
@Override protected void endExternalElement(ResponseWriter writer, UIComponent component, String resourceUrl) throws IOException { writer.writeURIAttribute("href", resourceUrl, "href"); String media = (String) component.getAttributes().get("media"); if (media != null) { writer.writeAttribute("media", media, "media"); } writer.endElement("link"); }
writer.startElement(HTML.ANCHOR_ELEM, component); writer.writeURIAttribute(HTML.HREF_ATTR, facesContext.getExternalContext().encodeActionURL(href), null);
private void write(ResponseWriter responseWriter) throws IOException { responseWriter.startElement("script", scriptComponent); Set<String> attributeNames = attributes.keySet(); for (String attributeName : attributeNames) { BufferedScriptAttribute attribute = attributes.get(attributeName); if (attribute.uriAttribute) { responseWriter.writeURIAttribute(attributeName, attribute.value, attribute.property); } else { responseWriter.writeAttribute(attributeName, attribute.value, attribute.property); } } responseWriter.endElement("script"); }
writer.startElement(HTML.ANCHOR_ELEM, component); writer.writeURIAttribute(HTML.HREF_ATTR, facesContext.getExternalContext().encodeActionURL(href), null);
@Override protected void endExternalElement(ResponseWriter writer, UIComponent component, String resourceUrl) throws IOException { writer.writeURIAttribute("href", resourceUrl, "href"); String media = (String) component.getAttributes().get("media"); if (media != null) { writer.writeAttribute("media", media, "media"); } writer.endElement("link"); }
public static void encodeImage(ResponseWriter writer, FacesContext context, String attrIconValue, String styleClass) throws IOException { writer.startElement(IMG_ELEMENT, null); writer.writeAttribute(ALT_ATTRIBUTE, "", null); writer.writeAttribute(CLASS_ATTRIBUTE, styleClass, null); writer.writeURIAttribute(SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null); writer.endElement(IMG_ELEMENT); } }
protected void encodeHtmlGraphicImageEnd(FacesContext context, HtmlGraphicImage htmlGraphicImage) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement(JsfConstants.IMG_ELEM, htmlGraphicImage); RendererUtil.renderIdAttributeIfNecessary(writer, htmlGraphicImage, getIdForRender(context, htmlGraphicImage)); final String url = getUrl(context, htmlGraphicImage); writer.writeURIAttribute(JsfConstants.SRC_ATTR, url, null); renderRemainAttributes(htmlGraphicImage, writer, ignoreComponent); writer.endElement(JsfConstants.IMG_ELEM); }
@Override protected void endExternalElement(ResponseWriter writer, UIComponent component, String resourceUrl) throws IOException { writer.writeURIAttribute("href", resourceUrl, "href"); String media = (String) component.getAttributes().get("media"); if (media != null) { writer.writeAttribute("media", media, "media"); } writer.endElement("link"); }
public static void encodeImage(ResponseWriter writer, FacesContext context, String attrIconValue, String styleClass) throws IOException { writer.startElement(IMG_ELEMENT, null); writer.writeAttribute(ALT_ATTRIBUTE, "", null); writer.writeAttribute(CLASS_ATTRIBUTE, styleClass, null); writer.writeURIAttribute(SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null); writer.endElement(IMG_ELEMENT); } }
protected void encodeHtmlGraphicImageEnd(FacesContext context, UIGraphic graphic) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement(JsfConstants.IMG_ELEM, graphic); RendererUtil.renderIdAttributeIfNecessary(writer, graphic, getIdForRender(context, graphic)); final String url = getUrl(context, graphic); writer.writeURIAttribute(JsfConstants.SRC_ATTR, url, null); renderRemainAttributes(graphic, writer, ignoreComponent); writer.endElement(JsfConstants.IMG_ELEM); }
public static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue) throws IOException { if (!shouldRenderAttribute(attributeValue)) { return; } ResponseWriter writer = facesContext.getResponseWriter(); String prefixedAttributeName = prefixAttributeName(attributeName, writer); if (Arrays.binarySearch(URI_ATTRIBUTE_NAMES, attributeName) >= 0) { writer.writeURIAttribute(prefixedAttributeName, attributeValue, null); } else if (Arrays.binarySearch(BOOLEAN_ATTRIBUTE_NAMES, attributeName) >= 0) { boolean booleanAttributeValue = Boolean.valueOf(String.valueOf(attributeValue)); if (booleanAttributeValue) { // TODO - is passing in Boolean.TRUE value documented somewhere? writer.writeAttribute(prefixedAttributeName, Boolean.TRUE, null); } } else { writer.writeAttribute(prefixedAttributeName, attributeValue, null); } }
public static void encodeImage(ResponseWriter writer, FacesContext context, String attrIconValue, String styleClass) throws IOException { writer.startElement(IMG_ELEMENT, null); writer.writeAttribute(ALT_ATTRIBUTE, "", null); writer.writeAttribute(CLASS_ATTRIBUTE, styleClass, null); writer.writeURIAttribute(SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null); writer.endElement(IMG_ELEMENT); } }
writer.startElement(HTML.IMG_ELEM, uiComponent); writer.writeURIAttribute(HTML.SRC_ATTR, facesContext.getExternalContext().encodeResourceURL(src), JSFAttr.VALUE_ATTR);
public static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue) throws IOException { if (!shouldRenderAttribute(attributeValue)) { return; } ResponseWriter writer = facesContext.getResponseWriter(); String prefixedAttributeName = prefixAttributeName(attributeName, writer); if (Arrays.binarySearch(URI_ATTRIBUTE_NAMES, attributeName) >= 0) { writer.writeURIAttribute(prefixedAttributeName, attributeValue, null); } else if (Arrays.binarySearch(BOOLEAN_ATTRIBUTE_NAMES, attributeName) >= 0) { boolean booleanAttributeValue = Boolean.valueOf(String.valueOf(attributeValue)); if (booleanAttributeValue) { // TODO - is passing in Boolean.TRUE value documented somewhere? writer.writeAttribute(prefixedAttributeName, Boolean.TRUE, null); } } else { writer.writeAttribute(prefixedAttributeName, attributeValue, null); } }
/** * @param context * @param component * @param writer * @param clientId * @throws IOException */ public void encodeBeginForm(FacesContext context, UIComponent component, ResponseWriter writer, String clientId) throws IOException { String actionURL = getActionUrl(context); String encodeActionURL = context.getExternalContext().encodeActionURL(actionURL); writer.startElement(HtmlConstants.FORM_ELEMENT, component); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId, null); writer.writeAttribute(HtmlConstants.METHOD_ATTRIBUTE, "post", null); writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "margin:0; padding:0; display: inline;", null); writer.writeURIAttribute(HtmlConstants.ACTION_ATTRIBUTE, encodeActionURL, "action"); }
writer.startElement(HTML.IMG_ELEM, uiComponent); writer.writeURIAttribute(HTML.SRC_ATTR, facesContext.getExternalContext().encodeResourceURL(src), null);
public static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue) throws IOException { if (!shouldRenderAttribute(attributeValue)) { return; } ResponseWriter writer = facesContext.getResponseWriter(); String prefixedAttributeName = prefixAttributeName(attributeName, writer); if (Arrays.binarySearch(URI_ATTRIBUTE_NAMES, attributeName) >= 0) { writer.writeURIAttribute(prefixedAttributeName, attributeValue, null); } else if (Arrays.binarySearch(BOOLEAN_ATTRIBUTE_NAMES, attributeName) >= 0) { boolean booleanAttributeValue = Boolean.valueOf(String.valueOf(attributeValue)); if (booleanAttributeValue) { // TODO - is passing in Boolean.TRUE value documented somewhere? writer.writeAttribute(prefixedAttributeName, Boolean.TRUE, null); } } else { writer.writeAttribute(prefixedAttributeName, attributeValue, null); } }
protected void encodeCustomIcon(FacesContext context, UIComponent component, String styleClass, String iconSource) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement(HtmlConstants.IMG_ELEMENT, component); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null); writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null); writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(iconSource, context), null); writer.endElement(HtmlConstants.IMG_ELEMENT); }
protected void renderAsActive(FacesContext context, NavigationCase navCase, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); assert(writer != null); writer.startElement("a", component); writeIdAndNameAttributes(context, writer, component); String hrefVal = getEncodedTargetURL(context, component, navCase); hrefVal += getFragment(component); writer.writeURIAttribute("href", hrefVal, "outcome"); renderLinkCommonAttributes(writer, component); renderPassThruAttributes(context, writer, component, ATTRIBUTES, null); writeValue(writer, component); }