You named the panel "rating" in your java but did not define "rating" in your 
html

Sent from my iPhone

On Jan 23, 2012, at 12:18 PM, Daniel Watrous <daniel.watr...@gmail.com> wrote:

> I've been trying to override the default RatingPanel markup, but I'm
> having trouble. I found this:
> http://apache-wicket.1842946.n4.nabble.com/How-to-override-RatingPanel-default-CSS-td1873783.html
> 
> I create the subclass:
> 
> public abstract class MovieRatingPanel extends RatingPanel {
>    public MovieRatingPanel(String id, IModel model, int
> numberOfStars, boolean defaultCss) {
>        super(id, model, numberOfStars, defaultCss);
>    }
> }
> 
> I then change the RatingPanel to MovieRatingPanel in my markup:
> 
>                movieItem.add(new MovieRatingPanel ("rating", new
> PropertyModel<Integer>(rating, "rating"), 5, false) {
>                    @Override
>                    public boolean onIsStarActive(int star) {
>                        return rating.isActive(star);
>                    }
>                    @Override
>                    public void onRated(int newRating,
> AjaxRequestTarget target) {
>                        movieItem.getModelObject().setRating(newRating);
>                        rating.updateRating(newRating);
> 
>                        Session session =
> HibernateUtil.getSessionFactory().getCurrentSession();
>                        session.beginTransaction();
>                        session.update(movieItem.getModelObject());
>                        session.getTransaction().commit();
> 
>                        movieList.detach();
>                    }
>                });
> 
> The markup is
> 
> <html xmlns:wicket="http://wicket.apache.org";>
> <head>
> </head>
> <body>
> <wicket:panel>
>    <div class="wicketRating" wicket:id="rater">
>        <div class="wicketRatingStars"><span wicket:id="element"><a
> href="#" wicket:id="link"><img wicket:id="star"/></a></span></div>
>    </div>
> </wicket:panel>
> </body>
> </html>
> 
> I am getting the Exception:
> Last cause: 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 = rating]
> 
> I'm not sure how to extend this so that I can simply replace the
> default markup with my own. Any pointers?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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

Reply via email to