encodeButton(context, colorPicker, clientId, value); encodeInline(context, colorPicker, clientId); if (!isValueBlank(onchange)) { writer.writeAttribute("onchange", onchange, null); renderPassThruAttributes(context, colorPicker, null);
protected void encodeScript(FacesContext context, ColorPicker colorPicker, String value) throws IOException { String clientId = colorPicker.getClientId(context); WidgetBuilder wb = getWidgetBuilder(context); wb.init("ColorPicker", colorPicker.resolveWidgetVar(), clientId) .attr("mode", colorPicker.getMode()) .attr("color", value, null); encodeClientBehaviors(context, colorPicker); wb.finish(); } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ColorPicker colorPicker = (ColorPicker) component; Converter converter = colorPicker.getConverter(); String value; if (converter != null) { value = converter.getAsString(context, component, colorPicker.getValue()); } else { value = (String) colorPicker.getValue(); } encodeMarkup(context, colorPicker, value); encodeScript(context, colorPicker, value); }
protected void encodeButton(FacesContext context, ColorPicker colorPicker, String clientId, String value) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("button", null); writer.writeAttribute("id", clientId + "_button", null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_ONLY_BUTTON_CLASS, null); renderAccessibilityAttributes(context, colorPicker); //text writer.startElement("span", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_CLASS, null); writer.write("<span id=\"" + clientId + "_livePreview\" " + "style=\"overflow:hidden;width:1em;height:1em;display:block;border:solid 1px #000;text-indent:1em;white-space:nowrap;"); if (value != null) { writer.write("background-color:#" + value); } writer.write("\">Live Preview</span>"); writer.endElement("span"); writer.endElement("button"); }
/** * @see org.primefaces.component.colorpicker.ColorPickerRenderer#decode(javax.faces.context.FacesContext, * javax.faces.component.UIComponent) */ @Override public void decode(FacesContext context, UIComponent component) { decodeBehaviors(context, component); super.decode(context, component); }
encodeButton(context, clientId, value); encodeInline(context, clientId); if (!isValueBlank(onchange)) { writer.writeAttribute("onchange", onchange, null); renderPassThruAttributes(context, colorPicker, null);
protected void encodeScript(FacesContext context, ColorPicker colorPicker, String value) throws IOException { String clientId = colorPicker.getClientId(context); WidgetBuilder wb = getWidgetBuilder(context); wb.initWithDomReady("ColorPicker", colorPicker.resolveWidgetVar(), clientId) .attr("mode", colorPicker.getMode()) .attr("color", value, null); encodeClientBehaviors(context, colorPicker); wb.finish(); } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ColorPicker colorPicker = (ColorPicker) component; Converter converter = colorPicker.getConverter(); String value; if (converter != null) { value = converter.getAsString(context, component, colorPicker.getValue()); } else { value = (String) colorPicker.getValue(); } encodeMarkup(context, colorPicker, value); encodeScript(context, colorPicker, value); }