You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Jochen Traunecker <ma...@yahoo.com> on 2007/01/10 09:16:43 UTC

[Trinidad] TreeTable: right place to update backingbean in processing lifecylce?

Background: 
I use a TreeTable backed by some TableModel created in a session scoped backing bean (sessionbean): 


<tr:treeTable value="#{sessionbean.treemodel}" rowDisclosureListener="#{eventbean.processDisclosure}" > 


The treemodel is created by querying some database and I want to present the user always the latest state of the data stored in the database (no refresh button, etc.). So whenever the user interacts with the browser/Server, like expanding/collapsing some node I want to present the latest database state. In addition I want to inform the user, if he tried to expand some treenode that does not exist anymore (as some other user deleted it in the meantime)
                          


Questions: 
a) Am I right, that within the entire JSF-Request processing lifecycle backingbeans/datamodels should be updated AFTER INVOKE_APPLICATION? 
b) Is registering some rowDisclosureListener an appropriate way to check, that all nodes in RowDisclosureEvent.addedSet are still valid

BEFORE RESTORE_VIEW(1)
AFTER RESTORE_VIEW(1)
BEFORE - APPLY_REQUEST_VALUES(2)
      sessionbean.getTreeModel invoked by JSF-Framework (treemodel might contain stale data with respect to the database)
AFTER APPLY_REQUEST_VALUES(2)
BEFORE PROCESS_VALIDATIONS(3)
AFTER PROCESS_VALIDATIONS(3)
BEFORE UPDATE_MODEL_VALUES(4)
AFTER UPDATE_MODEL_VALUES(4)
BEFORE INVOKE_APPLICATION(5)
* DisclosureEvent fired - get all nodes from event and check, if they are still valid with respect to the database
* Inform user (update some information text field, etc.)  that node can not be expanded as it is deleted by some other user 
 AFTER INVOKE_APPLICATION(5)
* update sessionbean treemodel with data from database (right place?)
 BEFORE RENDER_RESPONSE(6)
 sessionbean.getTreeModel invoked by JSF-Framework (treemodel contains up-to-date data)
  AFTER RENDER_RESPONSE(6)






__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 

Re: [Trinidad] TreeTable: right place to update backingbean in processing lifecylce?

Posted by Adam Winer <aw...@gmail.com>.
In general, you should be updating model data during
invoke application, in response to the event that
triggers it.  If you're using a PhaseListener to do this, then
I'd consider "BEFORE RENDER_RESPONSE(6)"
if you want to perform an update whether or
not validation succeeded, and AFTER
INVOKE_APPLICATION(5) if you want to know that
validation succeeded.

-- Adam


On 1/10/07, Jochen Traunecker <ma...@yahoo.com> wrote:
> Background:
> I use a TreeTable backed by some TableModel created in a session scoped backing bean (sessionbean):
>
>
> <tr:treeTable value="#{sessionbean.treemodel}" rowDisclosureListener="#{eventbean.processDisclosure}" >
>
>
> The treemodel is created by querying some database and I want to present the user always the latest state of the data stored in the database (no refresh button, etc.). So whenever the user interacts with the browser/Server, like expanding/collapsing some node I want to present the latest database state. In addition I want to inform the user, if he tried to expand some treenode that does not exist anymore (as some other user deleted it in the meantime)
>
>
>
> Questions:
> a) Am I right, that within the entire JSF-Request processing lifecycle backingbeans/datamodels should be updated AFTER INVOKE_APPLICATION?
> b) Is registering some rowDisclosureListener an appropriate way to check, that all nodes in RowDisclosureEvent.addedSet are still valid
>
> BEFORE RESTORE_VIEW(1)
> AFTER RESTORE_VIEW(1)
> BEFORE - APPLY_REQUEST_VALUES(2)
>       sessionbean.getTreeModel invoked by JSF-Framework (treemodel might contain stale data with respect to the database)
> AFTER APPLY_REQUEST_VALUES(2)
> BEFORE PROCESS_VALIDATIONS(3)
> AFTER PROCESS_VALIDATIONS(3)
> BEFORE UPDATE_MODEL_VALUES(4)
> AFTER UPDATE_MODEL_VALUES(4)
> BEFORE INVOKE_APPLICATION(5)
> * DisclosureEvent fired - get all nodes from event and check, if they are still valid with respect to the database
> * Inform user (update some information text field, etc.)  that node can not be expanded as it is deleted by some other user
>  AFTER INVOKE_APPLICATION(5)
> * update sessionbean treemodel with data from database (right place?)
>  BEFORE RENDER_RESPONSE(6)
>  sessionbean.getTreeModel invoked by JSF-Framework (treemodel contains up-to-date data)
>   AFTER RENDER_RESPONSE(6)
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
>