Re: DropDownChoice problem

2010-05-28 Thread Dr. Wolf Blecher
Hi,

just a few guesses:
- I don't think that this is according to a language problem.
- as far as I can see in your HTML code the DropDown is inside the span
wicket:id=adress_border, so maybe this is an issue
- may be you just ommited it, but I don't see a closing tag for your select
wicket:id=adress_city
- If I remember correctly, there (has been?) is an issue about wicket and the
short format of closing tags like in your input tag. May be you can try
input wicket:id=address id=address class=address title=an address in
Belgium type=text/input
- According to the error messages you presented, the error is not in the Java
Code but in the HTML markup you provided, so may be you have to look here
I'm not an HTML expert and may be this is valid HTML, but why do you use e.g.
\span instead of span as opening tag?

Good luck

Wolf

Am 27.05.2010 23:26, schrieb Matthieu:
 
 Hello,
 
 
 I've a problem with the DropDownChoice (and maybe language?). 
 
 I've a Panel who's rendering perfectly when i set the language in english
 and not rendering when i set in french... 
 
 
 The message from wicket :
 
 WicketMessage: The component(s) below failed to render. A common problem is
 that you have 
 added a component in code but forgot to reference it in the markup (thus the
 component will never be rendered).
  
 1. [Component id = address_city]
  
 Root cause:
  
 org.apache.wicket.WicketRuntimeException: The component(s) below failed to
 render. A common problem is that you 
 have added a component in code but forgot to reference it in the markup
 (thus the component will never be rendered).
 
 
 1. [Component id = address_city]
 
 
 My java code is :
 
 
 final DropDownChoice cityChoice = new DropDownChoice(address_city, new
 PropertyModel
 (form.getModelObject(), city), cityList); (here you can see the
 address_city)
 
 
 final AjaxFormComponentUpdatingBehavior updatingBehavior2 = new
 AjaxFormComponentUpdatingBehavior(onchange) {
 
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
 
   getAddress(form, customer_address, cityChoice, the_map);
 
   }
 
 };
 
 cityChoice.add(updatingBehavior2);
 
 
 form.add(cityChoice);
 
  
 My html code is :
 
 
 \span wicket:id=address_border\input wicket:id=address id=address 
 class=address
 title=an address in Belgium type=text /\select wicket:id=address_city
 
 I don't really understand why, anyone to explain me the problem?
 
 
 Thank you.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: DropDownChoice problem

2010-05-28 Thread Matthieu

Hi,

thanks for you input! It's not a html problem, when i copy/paste the
english html code (who is working) into my _fr html file, i get the same
error...

yes, i ommited /select in this mail but not in my code :)

and i write my mails in html format so i have to break the html code with \


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-problem-tp2233814p2235230.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: DropDownChoice problem

2010-05-28 Thread James Carman
Make sure it's using the markup files you think it is.  Turn on the logging
for the markup finder thingy.

On May 28, 2010 5:23 PM, Matthieu m_fradco...@hotmail.com wrote:


Hi,

thanks for you input! It's not a html problem, when i copy/paste the
english html code (who is working) into my _fr html file, i get the same
error...

yes, i ommited /select in this mail but not in my code :)

and i write my mails in html format so i have to break the html code with \


--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-problem-tp2233814p2235230.html

Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-...


DropDownChoice problem

2010-05-27 Thread Matthieu

Hello,


I've a problem with the DropDownChoice (and maybe language?). 

I've a Panel who's rendering perfectly when i set the language in english
and not rendering when i set in french... 


The message from wicket :

WicketMessage: The component(s) below failed to render. A common problem is
that you have 
added a component in code but forgot to reference it in the markup (thus the
component will never be rendered).



1. [Component id = address_city]


Root cause:


org.apache.wicket.WicketRuntimeException: The component(s) below failed to
render. A common problem is that you 
have added a component in code but forgot to reference it in the markup
(thus the component will never be rendered).


1. [Component id = address_city]


My java code is :


final DropDownChoice cityChoice = new DropDownChoice(address_city, new
PropertyModel
(form.getModelObject(), city), cityList); (here you can see the
address_city)


final AjaxFormComponentUpdatingBehavior updatingBehavior2 = new
AjaxFormComponentUpdatingBehavior(

onchange) {

@Override

protected void onUpdate(AjaxRequestTarget target) {

getAddress(form, customer_address, cityChoice, 
the_map);

}

};

cityChoice.add(updatingBehavior2);


form.add(cityChoice);



My html code is :


\span wicket:id=address_border\input

wicket:id=address id=address class=address

title=an address in Belgium type=text /\select
wicket:id=address_city

I don't really understand why, anyone to explain me the problem?


Thank you.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-problem-tp2233814p2233814.html
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: DropDownChoice problem

2010-04-29 Thread Josh Kamau
Thanks all for your response.

It worked after i override the equals Method on my beans

Thanks again

Regards
Josh

On Wed, Apr 28, 2010 at 5:28 PM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 I remember having a similar problem because missing the equal on some
 bean. Could that be the case?

 Ernesto

 On Wed, Apr 28, 2010 at 4:20 PM, Josh Kamau joshnet2...@gmail.com wrote:
  Hi team
 
  I need your help
 
  I am using a DropDownChoiceT in a form as follows:
 
  DropDownChoiceNationality lstNationality = new
  DropDownChoiceNationality(nationality,getNationalities());
 
   The form has a CompoundPropertyModel
 
  After adding the dropdown to the form, i am able to save the record
  properly. However, when i display a  form with an existing record,
 
  the DropDownChoice is not showing the current 'nationality' and it is
 only
  showing Choose One;
 
  When i replace is with a textfield, the correct record is displayed. Is
  where could i be going wrong?
 
  Regards.
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




DropDownChoice problem

2010-04-28 Thread Josh Kamau
Hi team

I need your help

I am using a DropDownChoiceT in a form as follows:

DropDownChoiceNationality lstNationality = new
DropDownChoiceNationality(nationality,getNationalities());

 The form has a CompoundPropertyModel

After adding the dropdown to the form, i am able to save the record
properly. However, when i display a  form with an existing record,

the DropDownChoice is not showing the current 'nationality' and it is only
showing Choose One;

When i replace is with a textfield, the correct record is displayed. Is
where could i be going wrong?

Regards.


Re: DropDownChoice problem

2010-04-28 Thread Ernesto Reinaldo Barreiro
I remember having a similar problem because missing the equal on some
bean. Could that be the case?

Ernesto

On Wed, Apr 28, 2010 at 4:20 PM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi team

 I need your help

 I am using a DropDownChoiceT in a form as follows:

 DropDownChoiceNationality lstNationality = new
 DropDownChoiceNationality(nationality,getNationalities());

  The form has a CompoundPropertyModel

 After adding the dropdown to the form, i am able to save the record
 properly. However, when i display a  form with an existing record,

 the DropDownChoice is not showing the current 'nationality' and it is only
 showing Choose One;

 When i replace is with a textfield, the correct record is displayed. Is
 where could i be going wrong?

 Regards.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



SV: DropDownChoice problem

2010-04-28 Thread Wilhelmsen Tor Iver
 After adding the dropdown to the form, i am able to save the record
 properly. However, when i display a  form with an existing record,
 
 the DropDownChoice is not showing the current 'nationality' and it is
 only
 showing Choose One;

Sounds like Wicket gets confused regarding value/id, try setting an 
IChoiceRenderer, e.g.

lstNationality.setChoiceRenderer(new ChoiceRenderer(name, id));

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: DropDownChoice problem

2010-04-28 Thread Xavier López
Hi,

I also bumped into this matter when starting with Wicket, make sure the
Collection returned by getNationalities() contains the value of the
'nationality' attribute of the CPM's backing object, or use a suitable
ChoiceRenderer, as Wilhelmsen suggests, in order to be able to put as
choices the same objects you can have in the 'nationality' attribute.

I think the DDC's ModelObject has to be/will be one of the objects in the
choices list before rendering/after form submission

Cheers,
Xavier

2010/4/28 Wilhelmsen Tor Iver toriv...@arrive.no

  After adding the dropdown to the form, i am able to save the record
  properly. However, when i display a  form with an existing record,
 
  the DropDownChoice is not showing the current 'nationality' and it is
  only
  showing Choose One;

 Sounds like Wicket gets confused regarding value/id, try setting an
 IChoiceRenderer, e.g.

 lstNationality.setChoiceRenderer(new ChoiceRenderer(name, id));

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Klein bottle for rent--inquire within.


Re: DropDownChoice problem

2010-04-28 Thread Swanthe Lindgren

I had the same problem you do. Solved it by doing

lstNationality.setDefaultModel(new 
PropertyModelNationality(getDefaultModel(), nationality));


but I bet you that Igor is gonna jump right in an say how its supposed 
to be done and why.


//Swanthe

On 2010-04-28 16:20, Josh Kamau wrote:

Hi team

I need your help

I am using a DropDownChoiceT  in a form as follows:

DropDownChoiceNationality  lstNationality = new
DropDownChoiceNationality(nationality,getNationalities());

  The form has a CompoundPropertyModel

After adding the dropdown to the form, i am able to save the record
properly. However, when i display a  form with an existing record,

the DropDownChoice is not showing the current 'nationality' and it is only
showing Choose One;

When i replace is with a textfield, the correct record is displayed. Is
where could i be going wrong?

Regards.

   



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket DropDownChoice problem

2010-02-24 Thread saravana kumar
Hi,

 My DropDownChoice have Values like follows
  Choose One(default for wicket)
  One
  Two
  Three
   If i choose one,some panel disabled and enabled
   If i choose two,some panel disabled and enabled
   when i choose to default(Choose One) nothing will happen here after and i
couldn't catch object value also.
   can u please give solution for me?



-- 
Thanks  Regards,
Shavang.


Re: Wicket DropDownChoice problem

2010-02-24 Thread Pedro Santos
You may want use setNullValid method

On Wed, Feb 24, 2010 at 6:55 AM, saravana kumar shav...@gmail.com wrote:

 Hi,

  My DropDownChoice have Values like follows
  Choose One(default for wicket)
  One
  Two
  Three
   If i choose one,some panel disabled and enabled
   If i choose two,some panel disabled and enabled
   when i choose to default(Choose One) nothing will happen here after and i
 couldn't catch object value also.
   can u please give solution for me?



 --
 Thanks  Regards,
 Shavang.




-- 
Pedro Henrique Oliveira dos Santos


Re: DropDownChoice problem

2008-04-18 Thread Johan Compagner
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]



DropDownChoice problem

2008-04-17 Thread Andrew Broderick
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


Re: DropDownChoice problem

2008-04-17 Thread Ryan Gravener
Use Long instead of long

On Thu, Apr 17, 2008 at 5:05 PM, Andrew Broderick
[EMAIL PROTECTED] 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




-- 
Ryan Gravener
http://ryangravener.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice problem

2008-04-17 Thread Andrew Broderick
I tried changing both the property being set by the DropDownChoice and the 
property used in the Author class to Long, and it didn't make any 
difference any help appreciated!

Thanks

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Gravener
Sent: Thursday, April 17, 2008 4:23 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice problem

Use Long instead of long

On Thu, Apr 17, 2008 at 5:05 PM, Andrew Broderick
[EMAIL PROTECTED] 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




--
Ryan Gravener
http://ryangravener.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice problem

2008-04-17 Thread John Krasnay
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]



Re: DropDownChoice problem

2008-01-25 Thread Mathias P.W Nilsson

Yes, I have read all about it. It solved when I used just new Model() and not
PropertyModel


-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-problem-tp15095051p15097813.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DropDownChoice problem

2008-01-25 Thread Mathias P.W Nilsson

Hi!

I can't get the simples DropDownChoice to work! I want to return the object
in my model but it returns string

This is what I have so far. I have a ArrayList of Category objects. Each of
this Objects have a list of child Categories. I want to render the Category
id and name in the list and when onSelectionChanged is fired I want to
Category object. Can this be done? In my renderer I want the childcategories
to be indented


-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-problem-tp15095051p15095051.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice problem

2008-01-25 Thread icecode

can you post some code? and wicket tags?


Mathias P.W Nilsson wrote:
 
 Hi!
 
 I can't get the simples DropDownChoice to work! I want to return the
 object in my model but it returns string
 
 This is what I have so far. I have a ArrayList of Category objects. Each
 of this Objects have a list of child Categories. I want to render the
 Category id and name in the list and when onSelectionChanged is fired I
 want to Category object. Can this be done? In my renderer I want the
 childcategories to be indented
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-problem-tp15095051p15096272.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice problem

2008-01-25 Thread icecode
);
   
 DropDownChoice ddc = 
 new DropDownChoice(
   category, 
 new PropertyModel( new se.boardstore.model.Category(),
 name),
 new LoadableDetachableModel() {
   private static final long 
 serialVersionUID = 1L;
 
   @Override
 protected Object load() { 
 return HomePage.this.categories;
 }
 
 
 },new TestChoiceRenderer()
 ){
   private static final long 
 serialVersionUID = 1L;
 
   protected boolean wantOnSelectionChangedNotifications() 
 {
 return true;
 }
 
 /**
  * Called when a option is selected of a dropdown list that
 wants to be
  * notified of this event.
  *
  * @param newSelection The newly selected object of the
 backing model
  */
 protected void onSelectionChanged(Object newSelection) {
   
   System.out.println( newSelection.getClass() );
   
   //se.boardstore.model.Category category =
 (se.boardstore.model.Category) newSelection;
   //System.out.println( category.getName() );
 }
 };
 
 form.add( ddc );
 
 
 
 Button submit = new Button( Submit );
 form.add( submit );
 
 
 }
 
 class LoginForm extends Form{
   
   public LoginForm( String identifier ){
   super( identifier );
   }
   
   public void onSubmit(){
   System.out.println( JEpp );
   AutoCompletePage p = new AutoCompletePage( new 
 PageParameters());
   setResponsePage( p  );
   }
 }
 
 class TestChoiceRenderer implements IChoiceRenderer {
 
 public Object getDisplayValue(Object object) {
 // I don't know if it can be anything other...??
 if (object instanceof se.boardstore.model.Category) {
   se.boardstore.model.Category so =
 (se.boardstore.model.Category) object;
 
   
   return so.getName();
 }
 return null;
 }
 
 public String getIdValue(Object key, int index) {
 // I don't know if it can be anything other...??
 if (key instanceof se.boardstore.model.Category) {
   se.boardstore.model.Category selectOption =
 (se.boardstore.model.Category) key;
 return selectOption.getId().toString();
 
 }
 return null;
 }
 
 }
 
 }
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-problem-tp15095051p15097014.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]