public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { super.encodeBegin(facesContext, uiComponent); DomBasicRenderer.validateParameters(facesContext, uiComponent, UIInput.class); KindEditor ke = (KindEditor) uiComponent; ResponseWriter writer = facesContext.getResponseWriter(); // String clientId =ke.getId(); String clientId = uiComponent.getClientId(facesContext); writer.startElement(HTML.TEXTAREA_ELEM, uiComponent); writer.writeAttribute(HTML.ID_ATTR, clientId, null); writer.writeAttribute(HTML.NAME_ATTR, clientId, null); renderHtmlAttributes(facesContext, writer, uiComponent); PassThruAttributeWriter.renderBooleanAttributes( writer, uiComponent, PassThruAttributeWriter.EMPTY_STRING_ARRAY); Object styleClass = uiComponent.getAttributes().get("styleClass"); if (styleClass != null) { writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null); } renderNumericAttributeOrDefault(writer, uiComponent, HTML.ROWS_ATTR, "2"); renderNumericAttributeOrDefault(writer, uiComponent, HTML.COLS_ATTR, "20"); writer.writeAttribute(HTML.STYLE_ATTR, "display:none;", null); }
/** * @param facesContext * @param uiComponent * @throws IOException */ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { if (facesContext == null || uiComponent == null) { throw new NullPointerException("facesContext or uiComponent is null"); } UIOutput output = (UIOutput) uiComponent; String linkVal = getValue(facesContext, uiComponent); if (!output.isRendered()) return; ResponseWriter writer = facesContext.getResponseWriter(); if (writer == null) { throw new NullPointerException("ResponseWriter is null"); } if (!checkDisabled(uiComponent)) { writer.startElement("a", uiComponent); } else { writer.startElement("span", uiComponent); } writer.writeAttribute("id", uiComponent.getClientId(facesContext), "id"); if (null == linkVal || 0 == linkVal.length()) { linkVal = ""; } clientId = output.getClientId(facesContext); linkVal = appendParameters(facesContext, uiComponent, linkVal); if (!checkDisabled(uiComponent)) { writer.writeURIAttribute( "href", facesContext.getExternalContext().encodeResourceURL(linkVal), "href"); } // ICE-2169 PassThruAttributeWriter.renderHtmlAttributes(writer, uiComponent, passThruAttributes); Boolean visibleAttribute = (Boolean) uiComponent.getAttributes().get("visible"); boolean isVisible = visibleAttribute == null ? true : visibleAttribute.booleanValue(); String style = (String) uiComponent.getAttributes().get(HTML.STYLE_ATTR); if (!isVisible) { if (style == null) { style = ""; } else if (style.trim().length() == 0 || style.trim().endsWith(";")) { // nothing } else { style += ";"; } style += "display:none;"; } if (style != null) writer.writeAttribute(HTML.STYLE_ATTR, style, HTML.STYLE_ATTR); String styleClass = (String) output.getAttributes().get("styleClass"); if (styleClass != null) writer.writeAttribute("class", styleClass, "styleClass"); writer.flush(); }
protected void renderHtmlAttributes( FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent) throws IOException { PassThruAttributeWriter.renderHtmlAttributes(writer, uiComponent, passThruAttributes); // fix for ICE-2514 String app = (String) uiComponent.getAttributes().get(HTML.ONMOUSEDOWN_ATTR); String rend = ONMOUSEDOWN_FOCUS; String combined = DomBasicRenderer.combinedPassThru(app, rend); writer.writeAttribute(HTML.ONMOUSEDOWN_ATTR, combined, HTML.ONMOUSEDOWN_ATTR); }