Ok Pablo here it all is attached. For good measure you can pick one from
this list at http://saxton.ws:8080/gbapt/teamList.html (password is shown)
Thanks Pablo, I need a pointer.
Don
Pablo Ruggia wrote:
mmmm, can you send your template and specification files to have more details ??
On 5/6/05, Don Saxton <[EMAIL PROTECTED]> wrote:
I am having a problem with contrib:table on clicking a sortable column
and on paging a table. The table looks good and other actions like
editting a row or saving seem to work. Could it be that rewinding is
biting me? The error messages aren't talking to me. on the form.java
there is a getTeam() and on team there is a getQuedQuestionGroup(). And
to be sure I added a
<property-specification name="quedQuestionGroup" type="java.util.Set"/>
Apparently I don't know what it means to resolve an expression, because
'team.quedquestionGroup' is what is being displayed in the table.
on sorting or paging a table:
Unable to resolve expression 'team.quedquestionGroup' for
[EMAIL PROTECTED]
and then:
source is null for getProperty(null, "quedquestionGroup")
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="org.appfuse.webapp.action.other.TeamForm">
<bean name="delegate" class="org.appfuse.webapp.action.Validator"/>
<property-specification name="team" type="org.appfuse.model.other.Team"/>
<property-specification name="quedQuestionGroup" type="java.util.Set"/>
<property-specification name="manager" type="org.appfuse.service.other.TeamManager">
global.appContext.getBean("teamManager")
</property-specification>
<property-specification name="message" type="java.lang.String"/>
<bean name="modifieddateValidator" class="org.apache.tapestry.valid.DateValidator">
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<component id="modifieddateField" type="ValidField">
<binding name="value" expression="team.modifieddate"/>
<binding name="validator" expression="beans.modifieddateValidator"/>
<message-binding name="displayName" key="team.modifieddate"/>
</component>
<bean name="modifiedbyuseridValidator" class="org.apache.tapestry.valid.NumberValidator">
<set-property name="valueType">"int"</set-property>
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<component id="modifiedbyuseridField" type="ValidField">
<binding name="value" expression="team.modifiedbyuserid"/>
<binding name="validator" expression="beans.modifiedbyuseridValidator"/>
<message-binding name="displayName" key="team.modifiedbyuserid"/>
</component>
<bean name="longnameValidator" class="org.apache.tapestry.valid.StringValidator">
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<component id="longnameField" type="ValidField">
<binding name="value" expression="team.longname"/>
<binding name="validator" expression="beans.longnameValidator"/>
<message-binding name="displayName" key="team.longname"/>
</component>
<bean name="storyidValidator" class="org.apache.tapestry.valid.NumberValidator">
<set-property name="valueType">"int"</set-property>
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<!-- found fk on col storyID -->
<component id="storyidPropertySelection" type="PropertySelection">
<binding name="model" expression="storyPropertySelectionModel"/>
<binding name="value" expression="team.story"/>
</component>
<component id="storyidField" type="ValidField">
<binding name="value" expression="team.storyid"/>
<binding name="validator" expression="beans.storyidValidator"/>
<message-binding name="displayName" key="team.storyid"/>
</component>
<bean name="contestidValidator" class="org.apache.tapestry.valid.NumberValidator">
<set-property name="valueType">"int"</set-property>
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<!-- found fk on col contestID -->
<component id="contestidPropertySelection" type="PropertySelection">
<binding name="model" expression="contestPropertySelectionModel"/>
<binding name="value" expression="team.contest"/>
</component>
<component id="contestidField" type="ValidField">
<binding name="value" expression="team.contestid"/>
<binding name="validator" expression="beans.contestidValidator"/>
<message-binding name="displayName" key="team.contestid"/>
</component>
<bean name="periodValidator" class="org.apache.tapestry.valid.StringValidator">
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<component id="periodField" type="ValidField">
<binding name="value" expression="team.period"/>
<binding name="validator" expression="beans.periodValidator"/>
<message-binding name="displayName" key="team.period"/>
</component>
<bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
<property-specification name="row"/>
<context-asset name="stylesheet" path="/styles/team.css"/>
<!-- context-asset name="stylesheet" path="/styles/team.css"/ -->
<context-asset name="upArrow" path="/images/arrow_up.png"/>
<context-asset name="downArrow" path="/images/arrow_down.png"/>
<context-asset name="add" path="/images/tab-add-unselected.gif"/>
<context-asset name="lookup" path="/images/icon-magnify.gif"/>
<context-asset name="edit" path="/images/icon-pencil.gif"/>
<context-asset name="save" path="/images/button-save.gif"/>
<context-asset name="delete" path="/images/icon-trash.gif"/>
</page-specification>
package org.appfuse.webapp.action.other;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
import org.appfuse.webapp.action.BasePage;
import org.apache.tapestry.valid.IValidationDelegate;
import org.apache.tapestry.valid.ValidationConstraint;
import org.appfuse.model.other.Team;
import org.appfuse.webapp.util.AbstractListPropertySelectionModel;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.IPage;
import org.appfuse.service.other.TeamManager;
// imports for foreign keys
import org.appfuse.model.other.Contest;
//no skip fk manager
import org.appfuse.service.other.ContestManager;
import org.appfuse.webapp.action.other.ContestForm;
import org.appfuse.model.other.Story;
//no skip fk manager
import org.appfuse.service.other.StoryManager;
import org.appfuse.webapp.action.other.StoryForm;
import org.appfuse.service.hr.PersonManager;
import org.appfuse.model.hr.Person;
import org.appfuse.model.hr.Person;
import org.appfuse.webapp.action.hr.PersonForm;
import org.appfuse.service.other.QuedquestionManager;
import org.appfuse.model.other.Quedquestion;
import org.appfuse.model.other.Quedquestion;
import org.appfuse.webapp.action.other.QuedquestionForm;
import org.appfuse.service.other.RecordedanswerManager;
import org.appfuse.model.other.Recordedanswer;
import org.appfuse.model.other.Recordedanswer;
import org.appfuse.webapp.action.other.RecordedanswerForm;
import org.appfuse.service.other.RunningscoreManager;
import org.appfuse.model.other.Runningscore;
import org.appfuse.model.other.Runningscore;
import org.appfuse.webapp.action.other.RunningscoreForm;
public abstract class TeamForm extends BasePage implements PageRenderListener {
public abstract TeamManager getManager();
public abstract void setManager(TeamManager mgr);
public abstract void setTeam(Team team);
public abstract Team getTeam();
private String priorPage;// where we came from
private Integer id; //this form is based on an object with this primary
key id
/**
* @return Returns the id.
*/
private Integer getLocalId() {return id;}
/**
* @param id The id to set.
*/
private void setLocalId(Integer id) {this.id = id;}
/**
* @return Returns the priorPage.
*/
public String getPriorPage() {
return priorPage;
}
/**
* @param priorPage The priorPage to set.
*/
public void setPriorPage(String priorPage) {
this.priorPage = priorPage;
}
public void pageBeginRender(PageEvent event) {
if (log.isDebugEnabled() && event.getRequestCycle().isRewinding())
log.debug("TeamForm.pageBeginRender is rewinding.");
if ((null != getTeam()) && !(event.getRequestCycle().isRewinding())){
setLocalId(getTeam().getId()); // save for rewind
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender has Team object. Saved
key identity.");
}else{
if (null != getLocalId()) {
Team team = getManager().getTeam(getLocalId());
setTeam(team);
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender retrieved Team
object using saved ID.");
}else{
setTeam(new Team());
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender created new
Team object.");
}
// fix up foreign keys
Contest contest = getTeam().getContest();
if (null == contest){
getTeam().setContest(new Contest());
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender added empty
Contest for editting.");
}/*else{
Integer id = contest.getId();
Contest temp = new Contest();
temp.setId(id);
getTeam().setContest(temp); // mutable
//getTeam().setContest((Contest)contest.clone()); //
mutable
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender added a cloned
Contest for editting.");
}*/
Story story = getTeam().getStory();
if (null == story){
getTeam().setStory(new Story());
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender added empty Story
for editting.");
}/*else{
Integer id = story.getId();
Story temp = new Story();
temp.setId(id);
getTeam().setStory(temp); // mutable
//getTeam().setStory((Story)story.clone()); // mutable
if (log.isDebugEnabled())
log.debug("TeamForm.pageBeginRender added a cloned
Story for editting.");
}*/
}
}
public void cancel(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("Entering 'cancel' method");
}
if (null != getPriorPage())
cycle.activate(getPriorPage());
else
cycle.activate("teamList");
}
public void delete(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("entered 'delete' method");
}
Integer pkey = getTeam().getId();
getManager().removeTeam(pkey);
IPage nextPage;
if (null != getPriorPage())
nextPage = cycle.getPage(getPriorPage());// where we came from
else
nextPage = cycle.getPage("teamList");
((BasePage)nextPage).setMessage(getMessage("team.deleted"));
setPriorPage(null); //release page
cycle.activate(nextPage);
}
public void addPerson(IRequestCycle cycle) {
org.appfuse.model.hr.Person person = new org.appfuse.model.hr.Person();
person.setTeam(getTeam());
if (log.isDebugEnabled()) {
log.debug("adding Person connected to Team." );
}
PersonForm nextPage = (PersonForm) cycle.getPage("personForm");
nextPage.setPerson(person);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void deletePerson(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("entered 'deletePerson' method");
}
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
PersonManager personManager = (PersonManager)
ctx.getBean("personManager");
personManager.removePerson(pkey);
//cycle.activate(this); //rewind???
}
public void editPerson(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching person with key: " + pkey.toString());
}
//org.appfuse.model.hr.Person person =
getPersonManager().getPerson(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
PersonManager personManager = (PersonManager)
ctx.getBean("personManager");
Person person = personManager.getPerson(pkey);
PersonForm nextPage = (PersonForm) cycle.getPage("personForm");
nextPage.setPerson(person);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void addQuedquestion(IRequestCycle cycle) {
org.appfuse.model.other.Quedquestion quedquestion = new
org.appfuse.model.other.Quedquestion();
quedquestion.setTeam(getTeam());
if (log.isDebugEnabled()) {
log.debug("adding Quedquestion connected to Team." );
}
QuedquestionForm nextPage = (QuedquestionForm)
cycle.getPage("quedquestionForm");
nextPage.setQuedquestion(quedquestion);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void deleteQuedquestion(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("entered 'deleteQuedquestion' method");
}
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
QuedquestionManager quedquestionManager = (QuedquestionManager)
ctx.getBean("quedquestionManager");
quedquestionManager.removeQuedquestion(pkey);
//cycle.activate(this); //rewind???
}
public void editQuedquestion(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching quedquestion with key: " + pkey.toString());
}
//org.appfuse.model.other.Quedquestion quedquestion =
getQuedquestionManager().getQuedquestion(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
QuedquestionManager quedquestionManager = (QuedquestionManager)
ctx.getBean("quedquestionManager");
Quedquestion quedquestion =
quedquestionManager.getQuedquestion(pkey);
QuedquestionForm nextPage = (QuedquestionForm)
cycle.getPage("quedquestionForm");
nextPage.setQuedquestion(quedquestion);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void addRecordedanswer(IRequestCycle cycle) {
org.appfuse.model.other.Recordedanswer recordedanswer = new
org.appfuse.model.other.Recordedanswer();
recordedanswer.setTeam(getTeam());
if (log.isDebugEnabled()) {
log.debug("adding Recordedanswer connected to Team." );
}
RecordedanswerForm nextPage = (RecordedanswerForm)
cycle.getPage("recordedanswerForm");
nextPage.setRecordedanswer(recordedanswer);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void deleteRecordedanswer(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("entered 'deleteRecordedanswer' method");
}
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
RecordedanswerManager recordedanswerManager =
(RecordedanswerManager) ctx.getBean("recordedanswerManager");
recordedanswerManager.removeRecordedanswer(pkey);
//cycle.activate(this); //rewind???
}
public void editRecordedanswer(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching recordedanswer with key: " + pkey.toString());
}
//org.appfuse.model.other.Recordedanswer recordedanswer =
getRecordedanswerManager().getRecordedanswer(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
RecordedanswerManager recordedanswerManager =
(RecordedanswerManager) ctx.getBean("recordedanswerManager");
Recordedanswer recordedanswer =
recordedanswerManager.getRecordedanswer(pkey);
RecordedanswerForm nextPage = (RecordedanswerForm)
cycle.getPage("recordedanswerForm");
nextPage.setRecordedanswer(recordedanswer);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void addRunningscore(IRequestCycle cycle) {
org.appfuse.model.other.Runningscore runningscore = new
org.appfuse.model.other.Runningscore();
runningscore.setTeam(getTeam());
if (log.isDebugEnabled()) {
log.debug("adding Runningscore connected to Team." );
}
RunningscoreForm nextPage = (RunningscoreForm)
cycle.getPage("runningscoreForm");
nextPage.setRunningscore(runningscore);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void deleteRunningscore(IRequestCycle cycle) {
if (log.isDebugEnabled()) {
log.debug("entered 'deleteRunningscore' method");
}
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
RunningscoreManager runningscoreManager = (RunningscoreManager)
ctx.getBean("runningscoreManager");
runningscoreManager.removeRunningscore(pkey);
//cycle.activate(this); //rewind???
}
public void editRunningscore(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching runningscore with key: " + pkey.toString());
}
//org.appfuse.model.other.Runningscore runningscore =
getRunningscoreManager().getRunningscore(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
RunningscoreManager runningscoreManager = (RunningscoreManager)
ctx.getBean("runningscoreManager");
Runningscore runningscore =
runningscoreManager.getRunningscore(pkey);
RunningscoreForm nextPage = (RunningscoreForm)
cycle.getPage("runningscoreForm");
nextPage.setRunningscore(runningscore);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
public void save(IRequestCycle cycle) {
if (getValidationDelegate().getHasErrors()) {
return;
}
boolean isNew = (getTeam().getId() == null);
if (log.isDebugEnabled())
log.debug("Is Team object new? " + isNew);
//
Imported keys validation check - for existence
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
org.appfuse.service.Manager aManager =
(org.appfuse.service.Manager) ctx.getBean("manager");
String msgKey ="";
//Team team = getTeam();
// -----------------------------------------------------
// Imported keys validation check - for Contest
// -----------------------------------------------------
try {
//Integer fkey = getTeam().getContest().getId();
Integer fkey = getTeam().getContestid();
if (null != fkey)
msgKey = fkey.toString();
if (null != fkey){
org.appfuse.model.other.Contest contest
=
(org.appfuse.model.other.Contest)
aManager.getObject(org.appfuse.model.other.Contest.class,fkey);
getTeam().setContest(contest);
if (log.isDebugEnabled())
log.debug("TeamForm.save
Contest set on Team.");
}else{
getTeam().setContest(null);
if (log.isDebugEnabled())
log.debug("TeamForm.save null
Contest set on Team.");
}
} catch
(org.springframework.orm.ObjectRetrievalFailureException excp) {
IValidationDelegate delegate = getValidationDelegate();
addError(delegate, "idField",
format("contest.notfound",msgKey),
ValidationConstraint.CONSISTENCY);
return;
}
// -----------------------------------------------------
// Imported keys validation check - for Story
// -----------------------------------------------------
try {
//Integer fkey = getTeam().getStory().getId();
Integer fkey = getTeam().getStoryid();
if (null != fkey)
msgKey = fkey.toString();
if (null != fkey){
org.appfuse.model.other.Story story =
(org.appfuse.model.other.Story)
aManager.getObject(org.appfuse.model.other.Story.class,fkey);
getTeam().setStory(story);
if (log.isDebugEnabled())
log.debug("TeamForm.save Story
set on Team.");
}else{
getTeam().setStory(null);
if (log.isDebugEnabled())
log.debug("TeamForm.save null
Story set on Team.");
}
} catch
(org.springframework.orm.ObjectRetrievalFailureException excp) {
IValidationDelegate delegate = getValidationDelegate();
addError(delegate, "idField",
format("story.notfound",msgKey),
ValidationConstraint.CONSISTENCY);
return;
}
getManager().saveTeam(getTeam());
String key = (isNew) ? "team.added" : "team.updated";
IPage nextPage;
if (null != getPriorPage())
nextPage = cycle.getPage(getPriorPage());// where we came from
else
nextPage = cycle.getPage("teamList");
((BasePage)nextPage).setMessage(getMessage(key));
setPriorPage(null); //release page
//setTeam(null); // release Team
cycle.activate(nextPage);
}
public IPropertySelectionModel getContestPropertySelectionModel(){
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
org.appfuse.service.other.ContestManager contestManager =
(org.appfuse.service.other.ContestManager) ctx.getBean("contestManager");
return new
AbstractListPropertySelectionModel(contestManager.getContests(null)){
public String getValue(int index){
return
((org.appfuse.model.other.Contest)list.get(index)).getId().toString();
}
public String getLabel(int index){
return
((org.appfuse.model.other.Contest)list.get(index)).getContestname().toString();
// for moment
}
};
}
public void editImportedContest(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching contest with key: " + pkey.toString());
}
//org.appfuse.model.other.Contest contest =
getContestManager().getContest(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
ContestManager contestManager = (ContestManager)
ctx.getBean("contestManager");
Contest contest = contestManager.getContest(pkey);
ContestForm nextPage = (ContestForm)
cycle.getPage("contestForm");
nextPage.setContest(contest);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
// do what
// finish with what
public IPropertySelectionModel getStoryPropertySelectionModel(){
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
org.appfuse.service.other.StoryManager storyManager =
(org.appfuse.service.other.StoryManager) ctx.getBean("storyManager");
return new
AbstractListPropertySelectionModel(storyManager.getStorys(null)){
public String getValue(int index){
return
((org.appfuse.model.other.Story)list.get(index)).getId().toString();
}
public String getLabel(int index){
return
((org.appfuse.model.other.Story)list.get(index)).getLongname().toString(); //
for moment
}
};
}
public void editImportedStory(IRequestCycle cycle) {
Object[] parameters = cycle.getServiceParameters();
Integer pkey = (Integer) parameters[0];
if (log.isDebugEnabled()) {
log.debug("fetching story with key: " + pkey.toString());
}
//org.appfuse.model.other.Story story =
getStoryManager().getStory(pkey);
org.springframework.context.ApplicationContext ctx =
org.appfuse.webapp.util.RequestContext.getCtx();
StoryManager storyManager = (StoryManager)
ctx.getBean("storyManager");
Story story = storyManager.getStory(pkey);
StoryForm nextPage = (StoryForm) cycle.getPage("storyForm");
nextPage.setStory(story);
nextPage.setPriorPage("teamForm");
cycle.activate(nextPage);
}
// do what
// finish with what
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]