Okay, I've done a little research about those findNestingForm /
findParentForm methods. An implementation is actually provided by:

1) public static UIForm findParentForm(...) in shared.renderkit.RenderUtils
2) public static FormInfo findNestingForm(...) in shared.util._ComponentUtils
3) public static FormInfo findNestingForm(...)  in
renderkit.html.util.DummyFormUtils
4) protected UIForm findParentForm(...) in custom.subform.SubFormRenderer

Usage notes:

1) RenderUtils.findParentForm
This method seems to be only called by HtmlTabbedPaneRenderer object,
which, anyway, doesn't care about the type of the returned object,
only check for null value.

2) _ComponentUtils.findNestingForm
This method is invoked by the objects:
 - HtmlButtonRendererBase
 - HtmlLinkRendererBase
 - AjaxDecodePhaseListener
 - DummyFormUtils
And none of the these seems to need a cast to UIForm, they only ask
the name to FormInfo or use the UIComponent interface.

3) DummyFormUtils.findNestingForm
This method is a wrapper for the _ComponentUtils one, which creates
and return a dummy form if another one isn't already there, and that
the SubFormRenderer one is used only by itself, and implemented in the
same way of the RenderUtils one.
It is used by the objects:
 - HtmlCollapsiblePanelRenderer
 - HtmlTreeImageCommandLinkRenderer
 - HtmlButtonRenderer
 - ExtendedHtmlButtonRenderer
 - ExtendedHtmlLinkRenderer
None of them do any UIForm cast. Some of these class simply override
the superclass findNestingForm to call the DummyFormUtils instead of
the _ComponentUtils implementation.

4) SubFormRenderer.findParentForm
This is only used by the same class, its implemented in a similar way
of RenderUtils, and does not actually need the returned object to be
an UIForm (it call an UIComponent interface method).

I'm not sure I've found *every* usage of
_ComponentUtils.findNestingForm, but for the great majrority of them I
think that it is safe to return a Trinidad form.

Maybe we can do some cleanout, removing the RenderUtils.findParentForm
and making SubFormRenderer and HtmlTabbedPaneRenderer use the
_ComponentUtils method? What do you think about this?

Ciao
Cosma

2006/7/5, Mario Ivankovits <[EMAIL PROTECTED]>:
Hi Cosma!
> Thank for your review Mario,
No problem ;-)

> using findNestingForm may be good, but I don't know if it is used
> elsewhere. Maybe other objects "rely" on the component returned to be
> an UIForm?
Could you please check this, e.g. a cast to UIForm will fail.
But if this is not the case, I think its best to change this method and
add a note to the javadoc that it is not necessarily true that the
returned component is a UIForm.

Thanks!
Ciao,
Mario


Reply via email to