You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Madhav Bhargava <Ma...@infosys.com> on 2006/12/26 11:30:12 UTC

Why does the constructor of the same custom component gets called after restoreState?

Hi All,



I have developed a custom component. This component has only one
HtmlPanelNavigationMenu component which constructs dynamically depending
on the current role and some other factors.

The Panel is constructed properly and changes properly on role changes.
However there is a strange behavior. Let me explain:



HtmlPanelNavigationMenu is composed of HtmlCommandNavigationItem
components. Take the following example:



Home

Message Center

  >> Message

  >> Reminders



The parent is Message Center and once clicked it expands into Message
and Reminder sub menu.

Following happens when Message Center is clicked:

1. Calls the constructor for the custom component

2. Calls restoreState  - at the end of this call all the children list
for this custom component is available.

3. Calls encodeBegin, encodeChildren and encodeEnd methods.



At the end the left Nav is expanded and is rendered properly.





However when Message link is clicked then the following happens:



1.	Enters the constructor of the custom component
2.	Enters restoreState method
3.	Again enters the constructor of the same custom component
instead of invoking the encodeBegin
4.	Does not enter restoreState but now it enters encodeBegin





As it is clear from Step 3 and 4 that when it enters encodeBegin it does
not have any children because it does not call restoreState the second
time. The end result is that the page for Message is displayed but the
left navigation menu vanishes completely.



Can anyone point out what is going wrong here?

Any help will be appreciated.



Thanks and Rgds,

Madhav





**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***