Class RatingsPage.RatingModel
- java.lang.Object
-
- org.apache.wicket.examples.ajax.builtin.RatingsPage.RatingModel
-
- All Implemented Interfaces:
Serializable,IClusterable
- Enclosing class:
- RatingsPage
public static class RatingsPage.RatingModel extends Object implements IClusterable
Rating model for storing the ratings, typically this comes from a database.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RatingModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRating(int nrOfStars)Adds the vote from the user to the total of votes, and calculates the rating.IntegergetNrOfVotes()Gets the number of cast votes.DoublegetRating()Gets the rating.intgetSumOfRatings()Returns the sum of the ratings.booleanisActive(int star)Returns whether the star should be rendered active.
-
-
-
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 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 Double getRating()
Gets the rating.- Returns:
- the rating
-
getSumOfRatings
public int getSumOfRatings()
Returns the sum of the ratings.- Returns:
- the sum of the ratings.
-
-