You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Laurent Cornelis <la...@ubiquity.be> on 2003/06/11 11:06:07 UTC

Utility of fireObservedChange

Hi,

I have a question about persistent properties in pages. I don't understand
the purpose of fireObservedChange method.

Imagine, I have a page with a property userBestFriend. I want each time the
user visit the page, this property is shown.

Here is the code of my page :

public class MyPage extends BasePage {

 private String _userBestFriend;

 protected void initialize() {
   _userBestFriend = ((MyVisit)getVisit()).getUserBestFriend();
 }

 public String getUserBestFriend() {
   return _userBestFriend;
 }

 public void setUserBestFriend(String newFriend) {
   _userBestFriend = newFriend;
   fireObservedChange("userBestFriend",newFriend);
 }

 public void changeFriend(IRequestCycle cycle) {
   ((MyVisit)getVisit()).setUserBestFriend(getUserBestFriend());
 }
}


It works fine. And if I remove the fireObservedChange, it works the same
way.

So, what is this method for ?

Regards,

Laurent Cornelis