Package org.apache.myfaces.custom.buffer

Examples of org.apache.myfaces.custom.buffer.HtmlBufferResponseWriterWrapper


    }

    private String getScriptBtn(FacesContext facesContext, UIComponent uiComponent, String dateFormat, String popupButtonString)
        throws IOException
    {
        HtmlBufferResponseWriterWrapper writer = HtmlBufferResponseWriterWrapper.
                getInstance(facesContext.getResponseWriter());

        HtmlInputCalendar calendar = (HtmlInputCalendar)uiComponent;
        boolean renderButtonAsImage = calendar.isRenderPopupButtonAsImage();

        writer.write("if (!document.layers) {\n");
        writer.write("document.write('");

        if (!renderButtonAsImage) {
            // render the button
            writer.startElement(HTML.INPUT_ELEM, uiComponent);
            writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_BUTTON, null);

            writeOnclickJsCalendarFunctionCall(writer,facesContext,uiComponent,dateFormat);

            if(popupButtonString==null)
                popupButtonString="...";
            writer.writeAttribute(HTML.VALUE_ATTR, StringEscapeUtils.escapeJavaScript(popupButtonString), null);
            /*
            if (renderButtonAsImage) {
                writer.writeAttribute(HTML.ID_ATTR, buttonId, null);
                writer.writeAttribute(HTML.NAME_ATTR, buttonId, null);
                writer.writeAttribute(HTML.STYLE_ATTR, "visibility:hidden;",null);
            } else {
                HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
            }
            */
            writer.endElement(HTML.INPUT_ELEM);
        } else {
            // render the image
            writer.startElement(HTML.IMG_ELEM, uiComponent);
            writer.writeAttribute(HTML.SRC_ATTR, AddResource.getResourceMappedPath(HtmlCalendarRenderer.class, "images/calendar.gif", facesContext), null);
            writer.writeAttribute(HTML.STYLE_ATTR, "vertical-align:bottom;", null);

            //writer.writeAttribute(HTML.ONCLICK_ATTR, "document.getElementById(\\'"+buttonId+"\\').click()",null);
            writeOnclickJsCalendarFunctionCall(writer, facesContext,uiComponent,dateFormat);
            //writer.writeAttribute(HTML.ONMOUSEOVER_ATTR, "this.style.cursor=\\'hand\\';", null);
            //writer.writeAttribute(HTML.ONMOUSEOUT_ATTR, "this.style.cursor=\\'default\\';", null);

            writer.endElement(HTML.IMG_ELEM);
        }

        writer.write("');");
        writer.write("\n}");

        return writer.toString();
    }
View Full Code Here


            if(ajaxComponent instanceof AjaxComponent)
            {               

                try
                {
                    HtmlBufferResponseWriterWrapper wrapper = HtmlBufferResponseWriterWrapper.getInstance(null);
                    context.setResponseWriter(wrapper);

                    ((AjaxComponent) ajaxComponent).encodeAjax(context);

                    StringBuffer buf = new StringBuffer(wrapper.toString());

                    buf.insert(0,Integer.toHexString(buf.length())+"\r\n");
                    buf.append("\r\n"+0+"\r\n\r\n");

                    //todo: fix this to work in PortletRequest as well
View Full Code Here

TOP

Related Classes of org.apache.myfaces.custom.buffer.HtmlBufferResponseWriterWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.