I am trying to load custom images for my Wicket Ratings Panel as per the wiki page. But I am not getting an image while loading the page. Following is the code snippet.
public class ConfirmationPage extends BasePage{
private static RatingModel ratingModel = new RatingModel();
ResourceReference WICKETSTAR0 = new PackageResourceReference(ConfirmationPage.class, "C:\\codebase_temp\\ent_voice_vida_mock\\Source\\com\\usaa\\voice\\vida\\pages\\WicketStar0.png");
ResourceReference WICKETSTAR1 = new PackageResourceReference(ConfirmationPage.class, "C:\\codebase_temp\\ent_voice_vida_mock\\Source\\com\\usaa\\voice\\vida\\pages\\WicketStar1.png");
ratingtHeading.add(new RatingPanel("rating1", new PropertyModel<Integer>(ratingModel, "rating"))
{
private static final long serialVersionUID = 1L;
@Override
protected String getActiveStarUrl(int iteration)
{
IRequestHandler handler = new ResourceReferenceRequestHandler(WICKETSTAR1);
return getRequestCycle().urlFor(handler).toString();
}
@Override
protected String getInactiveStarUrl(int iteration)
{
IRequestHandler handler = new ResourceReferenceRequestHandler(WICKETSTAR0);
return getRequestCycle().urlFor(handler).toString();
}
@Override
protected void onRated(int rating, AjaxRequestTarget arg1) {
ConfirmationPage.ratingModel.addRating(rating);
}
@Override
protected boolean onIsStarActive(int arg0) {
return true;
}
});
Following is the html file for this where "rating1" is the corresponding component.
<div wicket:id="surveyTable">
<div class="listContainer">
<div wicket:id="surveySection" class="pi-data">
<div wicket:id="ratingHeading">
<span class="ellipsis" wicket:id="rating1"></span>
</div>
<div wicket:id="commentHeading">
<input class="ellipsis" wicket:id="comments"></input>
</div>
</div>
</div>
</div>
Please let me know what I am doing wrong. Appreciate your help!
If you are using package resource reference and of the image files are stored into the same package as the page and html markup files then you should not need to give fully qualified path for the image. Also, you could refer to following link for similar code. https://stackoverflow.com/a/31998043/2533034