You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2007/08/21 22:49:48 UTC

[Trinidad] skinning af|showDetail::disclosed-icon for different components

Is there a way to customize "af|showDetail::disclosed-icon" for only
one component?

For example, this isn't working:

af|panelAccordion::container af|showDetail::disclosed-icon

Re: [Trinidad] skinning af|showDetail::disclosed-icon for different components

Posted by Andrew Robinson <an...@gmail.com>.
I got it to work, but it is a hack and subject to bugs.

I subclassed the PanelAccordionRenderer:
  protected void encodeAll(FacesContext context, RenderingContext arc,
    UIComponent component, FacesBean bean) throws IOException
  {
    Map<String, String> origResMap = arc.getSkinResourceKeyMap();
    Map<String, String> resMap = origResMap == null ?
      new HashMap<String, String>() : new HashMap<String, String>(origResMap);

    arc.setSkinResourceKeyMap(resMap);
    try
    {
      resMap.put(SkinSelectors.AF_SHOW_DETAIL_DISCLOSED_ICON_NAME,
        "af|panelAccordion::disclosed-icon");
      resMap.put(SkinSelectors.AF_SHOW_DETAIL_UNDISCLOSED_ICON_NAME,
        "af|panelAccordion::undisclosed-icon");
      super.encodeAll(context, arc, component, bean);
    }
    finally
    {
      arc.setSkinResourceKeyMap(origResMap);
    }
  }

This now lets me have my own icon. Unfortunately the author of
PanelAccordionRenderer made some methods private (like
_encodeDetailItem) and didn't break up encodeAll into smaller methods,
so there is no way I can remove the map for the children. As a result,
all children that may have disclosure icons will also get the
accordion version instead of the standard one.

On 8/21/07, Scott O'Bryan <da...@gmail.com> wrote:
> No, I don't think there is.  You see, even though these icons are in the
> skinning stylesheet, they are actually served from the server.  The
> server query's the skinning system to get the url for these icons.
>
> Andrew Robinson wrote:
> > Is there a way to customize "af|showDetail::disclosed-icon" for only
> > one component?
> >
> > For example, this isn't working:
> >
> > af|panelAccordion::container af|showDetail::disclosed-icon
> >
> >
>
>

Re: [Trinidad] skinning af|showDetail::disclosed-icon for different components

Posted by Scott O'Bryan <da...@gmail.com>.
No, I don't think there is.  You see, even though these icons are in the 
skinning stylesheet, they are actually served from the server.  The 
server query's the skinning system to get the url for these icons.

Andrew Robinson wrote:
> Is there a way to customize "af|showDetail::disclosed-icon" for only
> one component?
>
> For example, this isn't working:
>
> af|panelAccordion::container af|showDetail::disclosed-icon
>
>