.getInstance(facesContext.getExternalContext()) .getBorderRenderersRegistry();
.getInstance(facesContext).getBorderRenderersRegistry();
    public final void encodeContainerEnd(IHtmlWriter writer, Renderer renderer)            throws WriterException {        this.writer = writer;        this.renderer = renderer;        try {            IComponentRenderContext componentRenderContext = writer                    .getComponentRenderContext();            FacesContext facesContext = componentRenderContext                    .getFacesContext();            String borderType = null;            if (imageButtonFamilly.isBorder(facesContext)) {                borderType = imageButtonFamilly.getBorderType(facesContext);                IBorderRenderersRegistry borderRendererRegistry = RcfacesContext                        .getInstance(facesContext.getExternalContext())                        .getBorderRenderersRegistry();                UIComponent cmp = (UIComponent) imageButtonFamilly;                htmlBorderWriter = (IHtmlBorderRenderer) borderRendererRegistry                        .getBorderRenderer(facesContext,                                RenderKitFactory.HTML_BASIC_RENDER_KIT, cmp                                        .getFamily(), cmp.getRendererType(),                                borderType);            }            text = imageButtonFamilly.getText(facesContext);            textPosition = imageButtonFamilly.getTextPosition(facesContext);            if (htmlBorderWriter == null && (text != null)) {                IBorderRenderersRegistry borderRendererRegistry = RcfacesContext                        .getInstance(facesContext.getExternalContext())                        .getBorderRenderersRegistry();                htmlBorderWriter = (IHtmlBorderRenderer) borderRendererRegistry                        .getBorderRenderer(facesContext,                                RenderKitFactory.HTML_BASIC_RENDER_KIT, null,                                null, NONE_BORDER_ID);            }            boolean disabled = imageButtonFamilly.isDisabled(facesContext);            boolean selected = false;            if (imageButtonFamilly instanceof ISelectedCapability) {                selected = ((ISelectedCapability) imageButtonFamilly)                        .isSelected();            }            String width = null;            String height = null;            if (imageButtonFamilly instanceof ISizeCapability) {                ISizeCapability sizeCapability = (ISizeCapability) imageButtonFamilly;                width = sizeCapability.getWidth();                if (width != null) {                    alignHorizontal = true;                }                height = sizeCapability.getHeight();            }            int tableHorizontalSpan = computeHorizontalSpan();            int tableVerticalSpan = computeVerticalSpan();            String mainComponent = null;            if (htmlBorderWriter == null) {                if (isCompositeComponent()) {                    if (width == null && height == null) {                        mainComponent = "SPAN";                    } else {                        mainComponent = "DIV";                    }                } else {                    mainComponent = "INPUT";                }                writer.startElement(mainComponent);            } else {                mainComponent = "DIV";                writer.startElement(mainComponent);                htmlBorderWriter.initialize(writer, width, height,                        tableHorizontalSpan, tableVerticalSpan, disabled,                        selected);            }            if (borderType != null) {                writer.writeAttribute("v:borderType", borderType);            }            String classSuffix = null;            if (disabled) {                classSuffix = "_disabled";            } else if ((imageButtonFamilly instanceof ISelectedCapability)                    && ((ISelectedCapability) imageButtonFamilly).isSelected()) {                classSuffix = "_selected";            }            writeAttributes(classSuffix);            if (classSuffix != null) {                writer.writeAttribute("v:className", getClassName());            }            boolean initJavascript = initializeJavaScript();            String originalImageSrc = getImageURL(facesContext);            if (originalImageSrc != null) {                imageSrc = AbstractCameliaRenderer.rewriteURL(                        componentRenderContext,                        IURLRewritingProvider.IMAGE_URL_TYPE, "imageURL",                        originalImageSrc, null);            }            String disabledSrc = getDisabledImageURL(facesContext);            if (disabledSrc != null) {                disabledSrc = AbstractCameliaRenderer.rewriteURL(                        componentRenderContext,                        IURLRewritingProvider.IMAGE_URL_TYPE,                        "disabledImageURL", disabledSrc, originalImageSrc);            }            if (disabled) {                if (disabledSrc != null) {                    initJavascript = true;                    writer.writeAttribute("v:imageURL", imageSrc);                    imageSrc = disabledSrc;                    componentRenderContext.setAttribute(                            DISABLED_IMAGE_RENDERED, Boolean.TRUE);                }                String selectedSrc = getSelectedImageURL(facesContext);                if (selectedSrc != null) {                    selectedSrc = AbstractCameliaRenderer.rewriteURL(                            componentRenderContext,                            IURLRewritingProvider.IMAGE_URL_TYPE,                            "selectedImageURL", selectedSrc, originalImageSrc);                    if (selectedSrc != null) {                        initJavascript = true;                        writer                                .writeAttribute("v:selectedImageURL",                                        selectedSrc);                    }                }                componentRenderContext.setAttribute(SELECTED_IMAGE_RENDERED,                        Boolean.TRUE);            } else {                String selectedSrc = getSelectedImageURL(facesContext);                if (selectedSrc != null) {                    selectedSrc = AbstractCameliaRenderer.rewriteURL(                            componentRenderContext,                            IURLRewritingProvider.IMAGE_URL_TYPE,                            "selectedImageURL", selectedSrc, originalImageSrc);                    if (selectedSrc != null) {                        initJavascript = true;                        if (selected) {                            if (imageSrc != null) {                                writer.writeAttribute("v:imageURL", imageSrc);                            }                            imageSrc = selectedSrc;                        } else {                            writer.writeAttribute("v:selectedImageURL",                                    selectedSrc);                        }                        componentRenderContext.setAttribute(                                SELECTED_IMAGE_RENDERED, Boolean.TRUE);                    }                }                if (disabledSrc != null) {                    initJavascript = true;                    writer.writeAttribute("v:disabledImageURL", disabledSrc);                    componentRenderContext.setAttribute(                            DISABLED_IMAGE_RENDERED, Boolean.TRUE);                }            }            if (htmlBorderWriter == null && mainComponent.equals("INPUT")) {                writer.writeAttribute("type", "image");                if (imageSrc != null) {                    writer.writeAttribute("src", imageSrc);                }                writer.writeAttribute("align", "baseline");                writeImageAttributes(writer, imageButtonFamilly);            }            String hoverSrc = getHoverImageURL(facesContext);            if (hoverSrc != null) {                hoverSrc = AbstractCameliaRenderer.rewriteURL(                        componentRenderContext,                        IURLRewritingProvider.IMAGE_URL_TYPE, "hoverImageURL",                        hoverSrc, originalImageSrc);                if (hoverSrc != null) {                    initJavascript = true;                    writer.writeAttribute("v:hoverImageURL", hoverSrc);                }            }            /*             * Le javascript s'occupe de ca ! if (button == false &&             * imageJavascript == false) { writer.writeAttribute("href",             * "javascript:void(0)"); }             */            if (initJavascript) {                writer.enableJavaScript();            }            if (htmlBorderWriter != null) {                htmlBorderWriter.startComposite(writer);                if (textPosition == ITextPositionCapability.BOTTOM_POSITION) {                    writeBottomPosition();                } else if (textPosition == ITextPositionCapability.TOP_POSITION) {                    writeTopPosition();                } else if (textPosition == IHorizontalTextPositionCapability.RIGHT_POSITION) {                    writeRightPosition();                } else {                    writeLeftPosition();                }                htmlBorderWriter.endComposite(writer);            } else if ("INPUT".equals(mainComponent) == false) {                // htmlBorderWriter=null;                // Nous sommes dans DIV ou SPAN                writeImage();            }            if (isCompositeComponent()) {                writeEndCompositeComponent();            }            if (mainComponent != null) {                writer.endElement(mainComponent);            }        } finally {            this.writer = null;            this.renderer = null;        }        super.encodeContainerEnd(writer, renderer);    }