org.apache.wicket.examples.ajax.builtin
Class RatingsPage.RatingModel

java.lang.Object
  extended by org.apache.wicket.examples.ajax.builtin.RatingsPage.RatingModel
All Implemented Interfaces:
java.io.Serializable, IClusterable
Enclosing class:
RatingsPage

public static class RatingsPage.RatingModel
extends java.lang.Object
implements IClusterable

Rating model for storing the ratings, typically this comes from a database.

See Also:
Serialized Form

Constructor Summary
RatingsPage.RatingModel()
           
 
Method Summary
 void addRating(int nrOfStars)
          Adds the vote from the user to the total of votes, and calculates the rating.
 java.lang.Integer getNrOfVotes()
          Gets the number of cast votes.
 java.lang.Double getRating()
          Gets the rating.
 int getSumOfRatings()
          Returns the sum of the ratings.
 boolean isActive(int star)
          Returns whether the star should be rendered active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RatingsPage.RatingModel

public RatingsPage.RatingModel()
Method Detail

isActive

public boolean isActive(int star)
Returns whether the star should be rendered active.

Parameters:
star - the number of the star
Returns:
true when the star is active

getNrOfVotes

public java.lang.Integer getNrOfVotes()
Gets the number of cast votes.

Returns:
the number of cast votes.

addRating

public void addRating(int nrOfStars)
Adds the vote from the user to the total of votes, and calculates the rating.

Parameters:
nrOfStars - the number of stars the user has cast

getRating

public java.lang.Double getRating()
Gets the rating.

Returns:
the rating

getSumOfRatings

public int getSumOfRatings()
Returns the sum of the ratings.

Returns:
the sum of the ratings.


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.