Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.richfaces.renderkit.html;
 
 import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
 import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
 import static org.richfaces.renderkit.HtmlConstants.TD_ELEM;
 import static org.richfaces.renderkit.html.DivPanelRenderer.attributeAsString;
 
 
import  javax.faces.context.FacesContext;
import  javax.faces.context.ResponseWriter;
import  org.richfaces.renderkit.util.PanelIcons;
import  org.richfaces.renderkit.util.PanelIcons.State;
    public AccordionItemHeaderRenderer() {
        super("header""rf-ac-itm");
    }
    protected void encodeHeaderLeftIcon(ResponseWriter writer, FacesContext contextAbstractAccordionItem panel)
        throws IOException {
        String iconInactive = panel.isDisabled() ? panel.getLeftDisabledIcon() : panel.getLeftInactiveIcon();
        String iconActive = panel.isDisabled() ? panel.getLeftDisabledIcon() : panel.getLeftActiveIcon();
        encodeTdIcon(writercontext + "-ico"iconInactiveiconActive,
            panel.isDisabled() ? State.headerDisabled : State.header);
    }
    protected void encodeHeaderRightIcon(ResponseWriter writer, FacesContext contextAbstractAccordionItem panel)
        throws IOException {
        String iconInactive = panel.isDisabled() ? panel.getRightDisabledIcon() : panel.getRightInactiveIcon();
        String iconActive = panel.isDisabled() ? panel.getRightDisabledIcon() : panel.getRightActiveIcon();
        // TODO nick - should this be "-ico-exp"? also why expanded icon state is connected with right icon alignment?
        encodeTdIcon(writercontext + "-exp-ico"iconInactiveiconActive,
            panel.isDisabled() ? State.headerDisabled : State.header);
    }
    @Override
    protected void encodeTdIcon(ResponseWriter writer, FacesContext contextString cssClassString attrIconCollapsedValue,
        String attrIconExpandedValue, PanelIcons.State statethrows IOException {
        if (isIconRendered(attrIconCollapsedValue) || isIconRendered(attrIconExpandedValue)) {
            writer.startElement(TD_ELEM, null);
            writer.writeAttribute(CLASS_ATTRIBUTE, cssClassnull);
            if (isIconRendered(attrIconExpandedValue)) {
                encodeIdIcon(writercontextattrIconExpandedValue + "-act"state);
            }
            if (isIconRendered(attrIconCollapsedValue)) {
                encodeIdIcon(writercontextattrIconCollapsedValue + "-inact"state);
            }
            writer.endElement(TD_ELEM);
        }
    }
    @Override
    protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext contextAbstractAccordionItem titledItem)
        throws IOException {
        if (titledItem.isDisabled()) {
            encodeHeader(writercontexttitledItem..);
        } else {
            encodeHeader(writercontexttitledItem..);
            encodeHeader(writercontexttitledItem..);
        }
    }
    private static void encodeHeader(ResponseWriter writer, FacesContext contextAbstractAccordionItem component,
        AbstractTogglePanelTitledItem.HeaderStates statethrows IOException {
        writer.startElement(DIV_ELEM, null);
        writer.writeAttribute(CLASS_ATTRIBUTE,
            HtmlUtil.concatClasses("rf-ac-itm-lbl-" + state.abbreviation(), attributeAsString(componentstate.headerClass())),
            null);
        writeFacetOrAttr(writercontextcomponent"header"component.getHeaderFacet(state));
        writer.endElement(DIV_ELEM);
    }
New to GrepCode? Check out our FAQ X