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========================
<page-specification class="com.psaunders.usefulstuff.tapestry.page.ResultPage">
<component id="myResult" type="VisualResult">
<binding name="itemList" expression="page.itemList"/>
<binding name="startItemNumber" expression="page.startItemNumber"/>
<binding name="itemCount" expression="page.itemsPerPage"/>
</component>
</page-specification>
======== end ResultPage.page ==================
This is the specification for the VisualResult component:
========= VisualResult.jwc ==============
<specification allow-informal-parameters="yes"
class="com.psaunders.usefulstuff.tapestry.VisualResult">
<description> Render a search result, though detail is in VisualItem component
</description>
<parameter name="itemList" direction="in" java-type="java.util.List"
required="yes" />
<parameter name="startItemNumber" direction="in" java-type="java.lang.Integer"
required="yes" />
<parameter name="itemCount" direction="in" java-type="java.lang.Integer"
required="yes" />
<component id="theItem" type="VisualItem">
<binding name="item" property-path="components.foreachItem.value"/>
</component>
<component id="foreachItem" type="Foreach">
<binding name="source" property-path="itemList"/>
</component>
</specification>
========= 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