Yes i also hope that these questions are finally dont come any more.
Checkout the current trunk and its way more clear
On 4/18/08, John Krasnay <[EMAIL PROTECTED]> wrote:
> This has to qualify as one of the most common questions on the list!
> Hopefully, generics in 1.4 will make it more clear.
>
> The items in your list have to be the same type as the value model (the
> PropertyModel in your case). In your case, Wicket is complaining because
> the PropertyModel returns a long, but the list contains Authors.
>
> The cleanest solution is to change your property type to Author. If you
> can't, you can either give the DDC a list of author IDs instead of
> Authors (in which case you need to implement
> ChoiceRenderer.getDisplayValue to look up the author's name given an ID)
> or implement a custom model instead of the property model:
>
> IModel authorModel = IModel() {
> public Object getObject() {
> return lookUpAuthor(article.getArticleAuthorId());
> }
> public void setObject(Object object) {
> article.setArticleAuthorId(((Author) object).getId());
> }
> }
>
> HTH
>
> jk
>
>
> On Thu, Apr 17, 2008 at 04:05:45PM -0500, Andrew Broderick wrote:
> > Hi,
> >
> > I have a DropDownChoice in a form, with markup:
> >
> > <select wicket:id="authors" />
> >
> > In my Form class, I add it like this:
> >
> > add(new DropDownChoice("authors", new
> PropertyModel(this.article, "articleAuthorId"),
> > acService.getAuthors(), new
> ChoiceRenderer("authorDisplayName", "articleAuthorId")));
> >
> > this.article refers to a class that has a property of articleAuthorId:
> >
> > public long getArticleAuthorId() {
> > return articleAuthorId;
> > }
> >
> > public void setArticleAuthorId(long articleAuthorId) {
> > this.articleAuthorId = articleAuthorId;
> > }
> >
> > The acService.getAuthors() call gets a list of Author objects:
> >
> > public class Author implements Serializable {
> >
> > private long articleAuthorId;
> > private String authorFirstName;
> > private String authorMiddleName;
> > private String authorLastName;
> > private String authorDisplayName;
> >
> >
> > public String getAuthorFirstName() {
> > return authorFirstName;
> > }
> > public void setAuthorFirstName(String authorFirstName) {
> > this.authorFirstName = authorFirstName;
> > }
> > public String getAuthorMiddleName() {
> > return authorMiddleName;
> > }
> > public void setAuthorMiddleName(String authorMiddleName) {
> > this.authorMiddleName = authorMiddleName;
> > }
> > public String getAuthorLastName() {
> > return authorLastName;
> > }
> > public void setAuthorLastName(String authorLastName) {
> > this.authorLastName = authorLastName;
> > }
> > public String getAuthorDisplayName() {
> > return authorDisplayName;
> > }
> > public void setAuthorDisplayName(String authorDisplayName) {
> > this.authorDisplayName = authorDisplayName;
> > }
> > public Long getId()
> > {
> > return new Long(getArticleAuthorId());
> > }
> > public long getArticleAuthorId() {
> > return articleAuthorId;
> > }
> > public void setArticleAuthorId(long articleAuthorId) {
> > this.articleAuthorId = articleAuthorId;
> > }
> > }
> >
> > The error I get when I try to render the page is:
> >
> > WicketMessage: No get method defined for class: class java.lang.Long
> expression: articleAuthorId
> >
> > I don't understand this, as the class used for the choices is Author, not
> java.lang.Long ....
> >
> > Any help appreciated!
> >
> > Thanks
> >
> >
> >
> >
> > _______________________________________________________
> >
> > The information in this email or in any file attached
> > hereto is intended only for the personal and confiden-
> > tial use of the individual or entity to which it is
> > addressed and may contain information that is propri-
> > etary and confidential. If you are not the intended
> > recipient of this message you are hereby notified that
> > any review, dissemination, distribution or copying of
> > this message is strictly prohibited. This communica-
> > tion is for information purposes only and should not
> > be regarded as an offer to sell or as a solicitation
> > of an offer to buy any financial product. Email trans-
> > mission cannot be guaranteed to be secure or error-
> > free. P6070214
>
> ---------------------------------------------------------------------
> 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]