After restarting Jetty ... this change appears to not work for me. Can anyone see why it might not be passing SELECTED value back to the BeanEditForm?
I have implemented GenericSelectModel for a type "Note" but in the interest of space, I've not included it here. To that point, I have BOLDED a line below in the setter for Note in EditNoteBlock.java. When it is present, the "Note" properly gets passed back to the BeanEditForm. When it is missing, the resulting entity has no Note reference. That tells me that PropertyEditContext is getting injected from the environment AND it is passing its value to the BeanEditForm ... but I'm not sure what to do so that it automatically populates the 'note' instance variable. Would it be related to a problem in my GenericSelectModel class? I pulled that down from the wiki - but not sure which method in there would be responsible or play a role in the AUTOMATIC setting of this value. I was using @Property above the Note instance declaration but to make this example more obvious, I include the getters and setters explicitly - and again, it only works when I implement 'setNote' and manually assign with context.setPropertyValue(...). Thoughts? -Luther *EditNoteBlock.java* @SuppressWarnings("unused") public class EditNoteBlock { @Environmental private PropertyEditContext context; @Inject private PropertyAccess propertyAccess; @Inject private PersistenceService persistenceService; private Note note; private GenericSelectModel<Note> notes; public GenericSelectModel<Note> getNotes() { List<Note> list = persistenceService.findAll(Note.class); notes = new GenericSelectModel<Note>(list, Note.class, "title", "id", propertyAccess); return this.notes; } /** * @return the note */ public Note getNote() { return note; } /** * @param note the note to set */ public void setNote(Note note) { * // context.setPropertyValue(note);* this.note = note; } } *EditNoteBlock.tml* <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <t:Block t:id="noteBlock"> <t:Label for="select">Parent</t:Label><t:Select model="notes" encoder="notes" value="note" blankOption="NEVER"/> </t:Block> </div> *CreateNote.java * public class CreateNote { @Inject private PersistenceService persistenceService; @Property private Note note; Object onSuccess() { Date now = new Date(); note.setCreatedOn(now); note.setLastModifiedOn(now); persistenceService.create(note); return ListNotes.class; } } *CreateNote.tml* <t:Layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <ul class="links"> <li><t:PageLink page="note/ListNotes">List Notes</t:PageLink></li> </ul> <h2>Create Note</h2> <t:BeanEditForm t:id="note"/> </t:Layout> On Tue, Feb 24, 2009 at 10:05 AM, Luther Baker <lutherba...@gmail.com>wrote: > I removed my explicit assignment to PropertyEditContext and it continues to > work as you suggest ... and using BeanEditor works fine in this case. > > Thanks for the suggestions, > > -Luther > > > > > On Mon, Feb 23, 2009 at 8:51 PM, Thiago H. de Paula Figueiredo < > thiag...@gmail.com> wrote: > >> On Sun, Feb 22, 2009 at 8:17 PM, Luther Baker <lutherba...@gmail.com> >> wrote: >> > I have written an application property block (per the BeanEditForm >> tutorial) >> > for a custom type. Is there a ideal event in the block component when I >> can >> > assign the property to the PropertyEditContext? >> >> You don't assign values to PropertyEditContext: >> BeanEditorForm/BeanEditor does that for you automatically. Note that >> the tutorial never assign values to it. >> >> > c) one final note - if I validate the custom property in this edit block >> - >> > how do I indicate the problem ... if I don't have a form object etc as >> the >> > Validation page suggests, >> >> Use BeanEditor instead. BeanEditForm is nothing more than a Form >> component with an Errors and a BeanEditor component declared inside >> it. >> >> -- >> Thiago >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >