I' m trying to do something very simple. When I click a link, I change the
Model of a panel, but the Panel doesn't show the content of the new Model. I
tried to do this with a simple Label and that works. It has got to be
something very stupid, but I've been looking at it all morning and I just
don't get it. So I've got:

- Label
- Panel
- Link that changes both the model of Label and Panel

the Label shows the content of the new Model, the Panel shows the old
content... . Code of my index page:

public class Index extends BasePage {

   private final SectionPanel sectionPanel; //section
   private final ListView sectionMenu; // menu with the link
   private final Label test; // test Label

   public Index() throws ApplicationException{
       super();

       // components

       // the panel that doesn't update when the model is changed
       this.sectionPanel = new SectionPanel("section", new Model(
this.instrumentModel.getSectionModels().get(0)));
       add(sectionPanel);

       // test label
       this.testje = new Label("testje", new Model("blah"));
       add(testje);

       // menu
       this.sectionMenu = new ListView("sectionMenu",
this.instrumentModel.getSectionModels()){

           @Override
           protected void populateItem(final ListItem item) {

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

                   private static final long serialVersionUID =
374665526654182939L;

                   @Override
                   public void onClick() {
                       sectionPanel.setModel(item.getModel()); // this
doesn't work
                       sectionPanel.modelChanged();
                       testje.setModel(new PropertyModel (
item.getModelObject(),"some.property")); // this works
                   }

               });
           }

       };
       add(sectionMenu);

--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to