If I remember correctly, the set method is called by the page recorder itself when reconstructing the properties in the beginning of a request cycle, but at that time the recorder is still locked (disallowing changes), so you get that exception. I cannot test this at the moment, but is this still an issue?
For other reasons mostly we have adopted the following pattern, and it resolves this problem as well:
public ValueType getProperty() { return _property; }
public void setProperty(ValueType value) { _property = value; }
public void updateProperty(ValueType value) { setProperty(value); fireObservedChange("property", value); }
Basically, you differentiate between setting w/o recording and setting w/ recording. Property changes that you want recorded are then done using updateProperty().
There is a certain logic in allowing fireObservedChange() in the setProperty method in some situations as well; I am sure Howard can help you there.
Best regards,
-mb
[EMAIL PROTECTED] wrote:
G'day to all,
I have a very simple application.
Keywords are inputted into my search page, which does a search, and then
sets the properties of my result page. The result page then has a component
that displays the results.
ie.
searchPage
|
| itemList (The search results)
| currPageNumber
| itemsPerPage
\/
ResultPage
|
|
| itemList
| startItemNumber
| itemCount
|
\/
VisualResult componenent (on ResultPage)
I am getting this error whenever the fireObservedChange() is called in the
setter methods of my persistent page (ResultPage.java) .
"net.sf.tapestry.ApplicationRuntimeException: Page recorder for page Result is locked after a commit(), but received a change to property itemList of component Result."
I want the ResultPage to be persistent so that the user can navigate through
the search results.
If I comment out the fireObservedChange, my page works fine, though won't be persistent of course.
I have included all relevant source below. There may be something obvious that I'm doing wrong.
I am using Tapestry-2.2-rc1.
I have read through all of mail archives to no avail.
Please excuse the long mail, though I want to reduce confusion.
I would be very thankful if anyone can point out what I'm doing wrong.
Thankyou,
Patrick.
============ code snippet from calling page (searchPage)======================
// Get handle to Result.page
// and set the itemList (search results)
ResultPage resultPage = (ResultPage)cycle.getPage("Result");
resultPage.setItemList(itemList);
resultPage.setCurrPageNumber(new Integer(1));
resultPage.setItemsPerPage(new Integer(5));
cycle.setPage(resultPage);
============================================
This is the resultPage:
============== start ResultPage.java =======
package com.psaunders.usefulstuff.tapestry.page;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.html.BasePage;
public class ResultPage extends BasePage
{
private List _itemList;
private int _currPageNumber;
private int _itemsPerPage;
public void detach() {
setItemList(null);
super.detach();
}
public List getItemList() {
return _itemList;
}
public void setItemList(List itemList) {
this._itemList = itemList;
fireObservedChange("itemList", _itemList);
}
public void setCurrPageNumber(Integer currPageNumber) {
this._currPageNumber = currPageNumber.intValue();
//fireObservedChange("currPageNumber", currPageNumber);
Usefulstuff.Log.info(" Set curr page to" + this._currPageNumber );
}
public void setItemsPerPage(Integer itemsPerPage) {
this._itemsPerPage = itemsPerPage.intValue();
//fireObservedChange("itemsPerPage", itemsPerPage);
Usefulstuff.Log.info(" Set items per page to" + this._itemsPerPage );
}
public Integer getItemsPerPage(){
return new Integer(this._itemsPerPage);
}
// Calculate offset of starting item.
public Integer getStartItemNumber(){
return new Integer( _currPageNumber * _itemsPerPage + 1) ;
}
}
========= end ResultPage.java====================
======== ResultPage.page========================
======== end ResultPage.page ==================
This is the specification for the VisualResult component:
========= VisualResult.jwc ==============Render a search result, though detail is in VisualItem component
========= end VisualResult.jwc ==============
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
