protected void encodeMarkup(FacesContext context, Password password) throws IOException { ResponseWriter writer = context.getResponseWriter(); String clientId = password.getClientId(context); boolean disabled = password.isDisabled(); String inputClass = Password.STYLE_CLASS; inputClass = password.isValid() ? inputClass : inputClass + " ui-state-error"; inputClass = !disabled ? inputClass : inputClass + " ui-state-disabled"; String styleClass = password.getStyleClass() == null ? inputClass : inputClass + " " + password.getStyleClass(); writer.startElement("input", password); writer.writeAttribute("id", clientId, "id"); writer.writeAttribute("name", clientId, null); writer.writeAttribute("type", "password", null); writer.writeAttribute("class", styleClass, null); if (password.getStyle() != null) { writer.writeAttribute("style", password.getStyle(), null); } String valueToRender = ComponentUtils.getValueToRender(context, password); if (!isValueEmpty(valueToRender) && password.isRedisplay()) { writer.writeAttribute("value", valueToRender, null); } renderPassThruAttributes(context, password, HTML.INPUT_TEXT_ATTRS); if (disabled) writer.writeAttribute("disabled", "disabled", null); if (password.isReadonly()) writer.writeAttribute("readonly", "readonly", null); writer.endElement("input"); }
protected void encodeMarkup(FacesContext context, Editor editor) throws IOException { ResponseWriter writer = context.getResponseWriter(); String clientId = editor.getClientId(context); String valueToRender = ComponentUtils.getValueToRender(context, editor); String inputId = clientId + "_input"; String style = editor.getStyle(); style = style == null ? "visibility:hidden" : "visibility:hidden;" + style; writer.startElement("div", editor); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", style, null); if (editor.getStyleClass() != null) { writer.writeAttribute("class", editor.getStyleClass(), null); } writer.startElement("textarea", null); writer.writeAttribute("id", inputId, null); writer.writeAttribute("name", inputId, null); if (valueToRender != null) { writer.write(valueToRender); } writer.endElement("textarea"); writer.endElement("div"); }
@Override public void encodeMarkup(FacesContext context, InputTextarea inputTextarea) throws IOException { ResponseWriter writer = context.getResponseWriter(); String clientId = inputTextarea.getClientId(context); String valueToRender = ComponentUtils.getValueToRender(context, inputTextarea); String style = inputTextarea.getStyle(); String styleClass = inputTextarea.getStyle(); styleClass = (styleClass == null) ? InputTextarea.MOBILE_STYLE_CLASS : InputTextarea.MOBILE_STYLE_CLASS + " " + styleClass; writer.startElement("textarea", null); writer.writeAttribute("data-role", "none", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("name", clientId, null); writer.writeAttribute("class", styleClass, null); renderPassThruAttributes(context, inputTextarea, HTML.INPUT_TEXTAREA_ATTRS); if (inputTextarea.isDisabled()) writer.writeAttribute("disabled", "disabled", "disabled"); if (inputTextarea.isReadonly()) writer.writeAttribute("readonly", "readonly", "readonly"); if (style != null) writer.writeAttribute("style", style, null); if (valueToRender != null) writer.writeText(valueToRender, "value"); renderPassThruAttributes(context, inputTextarea, HTML.TEXTAREA_ATTRS); renderDomEvents(context, inputTextarea, HTML.INPUT_TEXT_EVENTS); writer.endElement("textarea"); }