dev@woodstock.java.net

Re: fix for issue 488

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Mon, 06 Aug 2007 12:22:16 -0400

Looks good, Sean. Go ahead with your put back.

Dan

Sean Comerford wrote:
> Was away a few days but getting back to this...
>
> With regards to getting at the FacesContext, I hear what you (Rick) are saying
> but, given my current lack of complete familiarity with the code base, I prefer
> a "KISS" approach.
>
> So, as Dan suggested, I simply changed the private method I altered to receive
> an existing instance of FacesContext (eliminating the need to call
> getCurrentInstance again) from its caller. I've attached the latest diff.
>
> Assuming there are no further objections, am I allowed to commit directly to
> the repository? Think I am but wanted to make sure I follow any "process".
>
> --- richard ratta <Richard.Ratta_at_Sun.COM> wrote:
>
>
>> In general you always want to avoid calling
>> "FacesContext.currentInstance" and have interfaces
>> pass an existing FacesContext instance. You want to do this in case some
>> part of the code
>> swapped out the "currentInstance instance" with a wrapper context in
>> order to something
>> interesting.
>>
>> -rick
>>
>> Dan Labrecque wrote:
>>
>>
>>> In regard to your fix, how about modifying the private method to
>>> accept FacesContext as a parameter? For example, similar to the
>>> renderSelectedTab method below. I don't believe there is any
>>> performance gain, but we already have the FacesContext available in
>>> encodeChildren.
>>>
>>> private List renderSelectedTab(FacesContext context,
>>> ResponseWriter writer...
>>>
>>> Dan
>>>
>>> Sean Comerford wrote:
>>>
>>>
>>>> I've attached a list of the "gotchas" I came across building the 3
>>>>
>> projects.
>>
>>>> Also, I have a simple 3 line fix to something (surprise surprise) I botched
>>>>
>> a
>>
>>>> long time ago - issue 488. Diffs follow - advise if there is some other
>>>> specific way to send reviews.
>>>>
>>>> Now when do I get paid? I'm hungry Dick and we have an agreement!
>>>>
>>>> ----------------------------
>>>>
>>>> RCS file:
>>>>
>>> /cvs/woodstock/webui/src/runtime/com/sun/webui/jsf/renderkit/html/TabSetRenderer.java,v
>>>
>>>> retrieving revision 1.1
>>>> diff -u -w -b -r1.1 TabSetRenderer.java
>>>> --- TabSetRenderer.java 16 Feb 2007 01:44:40 -0000 1.1
>>>> +++ TabSetRenderer.java 31 Jul 2007 23:53:21 -0000
>>>> @@ -226,6 +226,11 @@
>>>>
>>>> writer.startElement("div", tabSet);
>>>>
>>>> + String clientId =
>>>> tabSet.getClientId(FacesContext.getCurrentInstance());
>>>> + if (clientId != null) {
>>>> + writer.writeAttribute("id", clientId, null);
>>>> + }
>>>> +
>>>> if (style != null) {
>>>> writer.writeAttribute("style", style, null); // NOI18N
>>>> }
>>>>
>
> later,
> Sean
> http://seanc.us
>
> ------------------------------------------------------------------------
>
> ===================================================================
> RCS file: /cvs/woodstock/webui/src/runtime/com/sun/webui/jsf/renderkit/html/TabSetRenderer.java,v
> retrieving revision 1.1
> diff -u -w -b -r1.1 TabSetRenderer.java
> --- TabSetRenderer.java 16 Feb 2007 01:44:40 -0000 1.1
> +++ TabSetRenderer.java 6 Aug 2007 15:34:17 -0000
> @@ -173,7 +173,7 @@
> }
>
> // open the initial div containing the entire tab set
> - startTabSetDiv(writer, tabSet, theme);
> + startTabSetDiv(context, writer, tabSet, theme);
>
> // render the a11y skip link
> renderSkipLink(context, tabSet, theme);
> @@ -200,8 +200,8 @@
> /**
> * Helper function called by encodeChildren to open the TabSet div.
> */
> - private void startTabSetDiv(ResponseWriter writer, TabSet tabSet,
> - Theme theme) throws IOException {
> + private void startTabSetDiv(FacesContext context, ResponseWriter writer,
> + TabSet tabSet, Theme theme) throws IOException {
> String style = tabSet.getStyle();
> String styleClass = tabSet.getStyleClass();
>
> @@ -226,6 +226,13 @@
>
> writer.startElement("div", tabSet);
>
> + // use component client id for enclosing div id
> + String clientId = tabSet.getClientId(context);
> +
> + if (clientId != null) {
> + writer.writeAttribute("id", clientId, null);
> + }
> +
> if (style != null) {
> writer.writeAttribute("style", style, null); // NOI18N
> }
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>