That is indeed a useful link. Thank you...
However, I still get the same behavior
Here is what I have:
public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;
private ArrayList<GPSCoord> coords = new ArrayList<GPSCoord>();
public HomePage() {
final ArrayList tabsList = new ArrayList();
final PropertyModel<ArrayList<GPSCoord>> model = new
PropertyModel<ArrayList<GPSCoord>>(this, "coords");
tabsList.add(new AbstractTab(new Model<String>("City Chooser")) {
@Override
public WebMarkupContainer getPanel(String string) {
return new CitiesPanel(string, model);
}
});
tabsList.add(new AbstractTab(new Model<String>("Map Tab")) {
@Override
public WebMarkupContainer getPanel(String string) {
CoordsPanel panel = new CoordsPanel(string, model);
return panel;
}
});
TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabsList);
add(tabbedPanel);
}
}
Something weird happens though: in my second panel (CoordsPanel), when I click
a submit button the data gets refreshed inside the model and I can see the
changes when I switch tabs, but only then - and it is still the only way I can
perform changes in the model.
In the second panel there is nothing special, only an AjaxSubmitLink that
repaints a WebMarkupContainer. Does that have any impact in the TabbedPanel?
A 19/06/2012, às 21:39, Martin Grigorov-4 [via Apache Wicket] escreveu:
> it sounds like you are using static models.
> read about dynamic models at:
> https://cwiki.apache.org/WICKET/working-with-wicket-models.html
>
> On Tue, Jun 19, 2012 at 11:36 PM, nunofaria11 <[hidden email]> wrote:
>
> > By doesn't work I meant the data (inside the model) that was supposed to
> > change does not change.
> >
> > 2012/6/19 Martin Grigorov-4 [via Apache Wicket] <
> > [hidden email]>
> >
> >> On Tue, Jun 19, 2012 at 11:26 PM, nunofaria11 <[hidden
> >> email]<http://user/SendEmail.jtp?type=node&node=4650084&i=0>>
> >> wrote:
> >> > Hi, I am trying to properly share a model between tabs in a TabbedPanel.
> >> > I've been trying to pass the model to the Panels returned in the
> >> getPanel
> >> > hook (below), but it seems not to work.
> >>
> >> "Doesn't work" doesn't explain much.
> >> Give us more information/code.
> >>
> >> >
> >> >
> >> >
> >> > tabs.add(new AbstractTab(new Model("Title")) {
> >> >
> >> >
> >> > @Override
> >> >
> >> > public WebMarkupContainer getPanel(String panelId) {
> >> >
> >> > return new MyPanel(panelId, model);
> >> > }
> >> >
> >> > });
> >> >
> >> > TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
> >> >
> >> >
> >> >
> >> > Can someone point me to an example where this is done?
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> http://apache-wicket.1842946.n4.nabble.com/Properly-share-data-model-in-TabbedPanel-tp4650082.html
> >> > Sent from the Users forum mailing list archive at Nabble.com.
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [hidden
> >> > email]<http://user/SendEmail.jtp?type=node&node=4650084&i=1>
> >> > For additional commands, e-mail: [hidden
> >> > email]<http://user/SendEmail.jtp?type=node&node=4650084&i=2>
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Grigorov
> >> jWeekend
> >> Training, Consulting, Development
> >> http://jWeekend.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden
> >> email]<http://user/SendEmail.jtp?type=node&node=4650084&i=3>
> >> For additional commands, e-mail: [hidden
> >> email]<http://user/SendEmail.jtp?type=node&node=4650084&i=4>
> >>
> >>
> >>
> >> ------------------------------
> >> If you reply to this email, your message will be added to the discussion
> >> below:
> >>
> >>
> >> .
> >> NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >>
> >>
> >
> >
> >
> > --
> > Nuno Faria
> >
> >
> > --
> > View this message in context:
> > http://apache-wicket.1842946.n4.nabble.com/Properly-share-data-model-in-TabbedPanel-tp4650082p4650085.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-wicket.1842946.n4.nabble.com/Properly-share-data-model-in-TabbedPanel-tp4650082p4650087.html
> To unsubscribe from Properly share data model in TabbedPanel, click here.
> NAML
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Properly-share-data-model-in-TabbedPanel-tp4650082p4650092.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]