Hi<br><br>I attached a patch with better documentation for TransientStateHelper -<br>TransientStateHolder and the answers requested. If you need anything<br>else just let me know and I'll do it.<br><br> I resume the comments below:<br>
<br>EB> Leonardo, why is the preceding state traversal saved into <br>EB> this funky two element array, whereas the next one, described <br>EB> below, saved into the normal Map?<br><br>It is necessary to save the "initial rolled up state" in a way that the <br>
state could be restored without depend of the row where the <br>component or the model is, so an implementation option could<br>be use an array like structure, so traversing it could restore the state.<br>Since the row index is attached to the client id of child components, <br>
use a Map in this case will work on simple datatables but will not work<br>on nested datatables correctly.<br><br>EB>Traverse the children as done with markInitialState, saving the <br>EB>state of each child. Because the saveState calls during this pass <br>
EB>happen after the call to markInitialState, the state saved is the <br>EB>so called "delta" state of each component. Because this <br>EB>traversal happens during a per-row operation (in this case, <br>
EB>setRowIndex) the rolled up state must be saved in a row-aware <br>EB>data structure. One implementation choice would be to save <br>EB>the state from this pass in a Map keyed by the return from <br>EB>javax.faces.component.UIComponent#getContainerClientId.<br>
<br>The algorithm uses as key is call child.getClientId() that calls <br>UIData.getContainerClientId() later, but other alternative could be <br>use child.getClientId() but trim the value from <br>UIData.getContainerClientId(). That makes easier fix the <br>
problem when a row is deleted.<br><br>EB> Why do we need to bother passing null to<br>EB> restoreTransientState()? There must be a good reason, but I need<br>EB> to include it in the specification.</p><br>
<br>It is necessary to pass null to restoreTransientState()<br>to indicate the transient state should discarded from the previous one,<br>otherwise the transient state could be shared between rows.<br><br><br><br>To include the patch in jsf 2.1, we need to resolve the following point left:<br>
<br>- On UIData.markInitialState do not use a facesContext attribute <br>"com.sun.faces.MARK_INITIAL_STATE", instead it could be better to use<br>a variable on FacesContext to indicate when we are marking the initial state,<br>
like FacesContext.isProcessingEvents() works.<br><br>It could be event better to add flags to indicate when the current view is being<br>built using pss and when the view is being refreshed. It comes in handy in some<br>situations, but that's another issue (and I'm not found yet strong arguments to <br>
support this more than myfaces PSS solution uses it in multiple places).<br><br>best regards,<br><br>Leonardo<br><br><div class="gmail_quote">2010/8/26 Martin Marinschek <span dir="ltr"><<a href="mailto:mmarinschek@apache.org">mmarinschek@apache.org</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi all,<br>
<br>
thanks to Ed and Leonardo for this discussion - I really believe this<br>
is a positive example how any spec work should go ;)<br>
<br>
@Leonardo: if you need help with the wording, just ping me.<br>
<br>
@everyone else who is interested in this: please can you also invest<br>
some work to review this? this is really a delicate issue, and might<br>
change quite a lot of the UIData behaviour, so it makes sense you<br>
invest the time.<br>
<br>
best regards,<br>
<font color="#888888"><br>
Martin<br>
</font><div><div></div><div class="h5"><br>
On 8/26/10, Ed Burns <<a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a>> wrote:<br>
>>>>>> On Wed, 25 Aug 2010 20:12:59 -0500, Leonardo Uribe <<a href="mailto:lu4242@gmail.com">lu4242@gmail.com</a>><br>
>>>>>> said:<br>
><br>
> LU> The problem with allow it with a context-param is there is no way to<br>
> LU> "reset" the deltas or remove rows to synchronize the model with the<br>
> LU> component state.<br>
><br>
> LU> Suppose a simple use case, where there is a datatable and an option<br>
> LU> that removes one row. Since we don't have a way to notify the<br>
> LU> component that the row has been removed the state of the deleted row<br>
> LU> will be applied on the next one.<br>
><br>
> Ok, I see.<br>
><br>
> Now, when I discussed with the expert community at a recent meeting the<br>
> process for accepting new features for 2.1, I tried to be as clear as<br>
> possible that we'd need the contributing party to do *all* of the work.<br>
> Leorando, you've done the code, and it's great, but the spec language is<br>
> even more important since this body, technically, is partially<br>
> responsible for the spec. Oracle, as the sponsor, is solely responsible<br>
> for the impl. Now, as I said, I'm delighted with your contribution of<br>
> an implementation for this feature, but I need you to author as much as<br>
> possible of the spec text.<br>
><br>
> I've started by documenting the preserveRowComponentState property in<br>
> the UIData.setPreserveRowComponentState() method.<br>
><br>
> Please take a look at the javadoc I've generated in this attachment [1]<br>
> to issue 153 [2]. I've posed some questions in there, you can anwser<br>
> them here. Also, please correct my where I've gone wrong.<br>
><br>
> If you could submit a text file with sketches of the javadoc for other<br>
> elements of this feature, for example, the new TransientStateHelper<br>
> interface, it would really increase the likelihood of this feature<br>
> making it into 2.1.<br>
><br>
> [1]<br>
> <a href="https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/271/153-javadocs.zip" target="_blank">https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/271/153-javadocs.zip</a><br>
><br>
> [2]<br>
> <a href="https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=153" target="_blank">https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=153</a><br>
><br>
> --<br>
> | <a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a> | office: +1 407 458 0017<br>
> | homepage: | <a href="http://ridingthecrest.com/" target="_blank">http://ridingthecrest.com/</a><br>
> | 12 work days until JSF 2.1 Milestone 3<br>
><br>
<br>
<br>
</div></div><div><div></div><div class="h5">--<br>
<br>
<a href="http://www.irian.at" target="_blank">http://www.irian.at</a><br>
<br>
Your JSF powerhouse -<br>
JSF Consulting, Development and<br>
Courses in English and German<br>
<br>
Professional Support for Apache MyFaces<br>
</div></div></blockquote></div><br>