You could write a method that sets the visibility on the relevant components. The Form components have to be visible to that method though (or you have to use a visitor).

Regards,

Daan

Op 1 apr 2009, om 08:32 heeft Boydens Joeri (OZ) het volgende geschreven:

Hi,



I have this page where I have different components that need to be show
or hidden, depending on the value of some model fields.  I implemented
this by overriding the isVisible method of the components.  Now I was
wondering if there is a less verbose way of handling this? (I can't
group the components because it's not possible in the html markup).



item.add(new TextField("value") {

                                        public boolean isVisible() {


OnlineBookingParametersArticle     article =
(OnlineBookingParametersArticle) getParent().getModel().getObject();

                                              return
article.getArticle().getNumberInStock() > 0;

                                        }

                                  });



                                  item.add(new
Label("article.numberOfArticlesLabel", "Geen beschikbaar") {

                                        public boolean isVisible() {


OnlineBookingParametersArticle     article =
(OnlineBookingParametersArticle) getParent().getModel().getObject();

                                              return
article.getArticle().getNumberInStock() <= 0;

                                        }

                                  });



                                  item.add(new
Label("article.description"));



                                  item.add(new
WebMarkupContainer("participantInfo") {

                                                    public boolean
isVisible() {


OnlineBookingParametersArticle       article =
(OnlineBookingParametersArticle) getParent().getModel().getObject();

                                                          return
article.getArticle().getNumberInStock() > 0;

                                                    }

                                              }

                                              .add(new
Label("article.numberOfRequiredParticipants"))

                                              .add(new
Label("article.maximumNumberOfParticipants")));





                                  item.add(new Link("contactLink"){

                                        @Override

                                        public void onClick(){

                                              //TODO : go to correct
page

                                        }

                                        @Override

                                        public boolean isVisible() {


OnlineBookingParametersArticle     article =
(OnlineBookingParametersArticle) getParent().getModel().getObject();

                                              return
article.getArticle().getNumberInStock() <= 0;

                                        }

                                  });







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

Reply via email to