dev@javaserverfaces.java.net

RE: Re: Form w/ PrependId = False and findComponent

From: <jacob_at_hookom.net>
Date: Wed, 01 Feb 2006 12:44:48 -0500

Wouldn't you agree though that this is necessary within the spec-- if even an alternate method or return value (PCs ?)

>
>Jacob,
>
>findComponent() has nothing to do with clientId, despite
>the similarity in syntax: it's strictly about searching
>through NamingContainers. prependId deals strictly with
>how clientIds are generated.
>
>-- Adam
>
>
>Jacob Hookom wrote:
>> the findComponent(UIComponent base, String id) pre-parses the clientId
>> and carries the expectation that the NamingContainer will always prefix.
>>
>> <h:form id="fooForm" prependId="false">
>> <h:inputText id="fooText" ... />
>> </h:form>
>>
>> UIViewRoot.findComponent(":fooText") -> null
>>
>> I agree that using the ":" should start from the root of the tree, but
>> the UIComponentBase should *not* dictate naming behavior around its
>> children implementing NamingContainer.
>>
>> It should work something like:
>>
>> findComponent(String id) {
>> // if prefix, start from root and pass substring
>> if (id == myclientid) { return this; }
>> Iterator itr = this.getFacetsAndChildren();
>> while (itr.hasNext()) {
>> uic = itr.next().findComponent(id);
>> if (uic != null) return uic;
>> }
>> return null;
>> }
>>
>> // UIForm
>>
>> findComponent(String id) {
>> if (id == myclientid) { return this; }
>> if (prependId && !id.startswith(myclientId)) { return null; }
>> return super.findComponent(id);
>> }
>>
>> // UIData
>>
>> findComponent(String id) {
>> if (id == myclientid) { return this; }
>> if (id.startswith(myclientid)) id = id.removeindex
>> else return null;
>> this.setRow(index);
>> return super.findComponent(id);
>> // possibly set orig rowindex
>> }
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
>For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>