You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Fabien D." <du...@hotmail.com> on 2008/04/04 10:21:14 UTC

Get back value for a RatingPanel

Hi

I have a problem to get back the value of a rating panel. It displays well.

This is the déclaration :

	    	RatingPanel rating = new RatingPanel(str_rating,model_rating,5,true){
	    		private double rating = 0;
	    		
	    		protected String getActiveStarUrl(int iteration){
	                return WICKETSTAR1;
	            }

	            protected String getInactiveStarUrl(int iteration){
	                return WICKETSTAR0;
	            }

	            protected boolean onIsStarActive(int star)
	            {
	            	return star < ((int)(rating + 0.5));
	            }
	     
	            protected void onRated(int rating, AjaxRequestTarget target)
	            {
	                    this.rating = rating;
	            }
	        };
	    	rating.setRatingLabelVisible(false);
	    	this.form_evaluation.add(rating);

And in the method on submit of my form : 
                         protected void onSubmit() {
				log.info(""+model_rating.getObject());
				setResponsePage(new ProjetPage("ajoutinftechnique"));
			}

But the value is null, so how i can get back the value of this special panel
?

Thank you in advance for your help.


-- 
View this message in context: http://www.nabble.com/Get-back-value-for-a-RatingPanel-tp16488179p16488179.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Get back value for a RatingPanel

Posted by Maurice Marrink <ma...@gmail.com>.
Where do you set the value of the model?
It looks to me like you need to get rid of rating double in the panel
and use that as the model value.
Something like this:
protected boolean onIsStarActive(int star)
                   {
                       return star < ((int)(model_rating.getObject()+ 0.5));
                   }

                   protected void onRated(int rating, AjaxRequestTarget target)
                   {
                          model_rating.setObject(rating)
                   }

Note i skipped all casts / type checks etc.
Try reading http://www.theserverside.com/tt/articles/content/IntroducingApacheWicket/article.html

Maurice

On Fri, Apr 4, 2008 at 10:21 AM, Fabien D. <du...@hotmail.com> wrote:
>
>  Hi
>
>  I have a problem to get back the value of a rating panel. It displays well.
>
>  This is the déclaration :
>
>                 RatingPanel rating = new RatingPanel(str_rating,model_rating,5,true){
>                         private double rating = 0;
>
>                         protected String getActiveStarUrl(int iteration){
>                         return WICKETSTAR1;
>                     }
>
>                     protected String getInactiveStarUrl(int iteration){
>                         return WICKETSTAR0;
>                     }
>
>                     protected boolean onIsStarActive(int star)
>                     {
>                         return star < ((int)(rating + 0.5));
>                     }
>
>                     protected void onRated(int rating, AjaxRequestTarget target)
>                     {
>                             this.rating = rating;
>                     }
>                 };
>                 rating.setRatingLabelVisible(false);
>                 this.form_evaluation.add(rating);
>
>  And in the method on submit of my form :
>                          protected void onSubmit() {
>                                 log.info(""+model_rating.getObject());
>                                 setResponsePage(new ProjetPage("ajoutinftechnique"));
>                         }
>
>  But the value is null, so how i can get back the value of this special panel
>  ?
>
>  Thank you in advance for your help.
>
>
>  --
>  View this message in context: http://www.nabble.com/Get-back-value-for-a-RatingPanel-tp16488179p16488179.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Get back value for a RatingPanel

Posted by "Fabien D." <du...@hotmail.com>.
hi ,

Thank you, it was that :)
-- 
View this message in context: http://www.nabble.com/Get-back-value-for-a-RatingPanel-tp16488179p16535662.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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