What happens then to the previous value the user just typed in??
If for example you used a normal detachable model (so not readonly)
And the first time you load some default stuff.
Then a user alters the textarea and submits.
Then the page is rendered again. Then in your case the input he made is gone? Because you again do a load depending on the list.
I would do this different. Just give the textarea a normal model that can be updated.
Then do a onSelectionChange on the list and when the list changes you push the value that you want to set in the textarea.
Of course this can also be done in an own textarea detachable model. But then you need to know the previous selected value of the list.
johan
On 7/14/06, Nino Wael <[EMAIL PROTECTED]> wrote:
So heres what I do, code is possibly flawed. I've tried with the abstractmodel instead which works but gets multiple hits pr request which makes it hard to detect if I should repopulate, actually it seems as it hits on modelchanging and onmodelchanged...
Basicly what Im trying to do is to have a dependency on a dropdown and a listbox, so if the dropdown is changed and one thing is selected in the listbox my LoadableDetachableModel should be populated with new values. If listbox.size!=1 then no values should be loaded.
In the begining I based my example on Igors Ajax radiochoice example.
LoadableDetachableModel detachdebugmodel = new LoadableDetachableModel() {
public ItemContainer previous = new ItemContainer();
private boolean previousUpdate = false;
private String value = "";
protected Object load() {
value = "No Populate compare";
if (reportModel.getOmraade().getDataItem() != null
&& previous.getDataItem() != null) {
if (!reportModel.getOmraade().getDataItem().equals(
previous.getDataItem())) {
previousUpdate = true;
value = "Repopulate AreaType changed!";
return value;
}
}
if (reportModel.getOmraade_selected().getDualModel().getFill()
.size() == 1) {
if (previous.getDataItem ().equals(
reportModel.getOmraade().getDataItem()) == false
|| !previousUpdate) {
value = "Enable Populate compareTypes and enable compareTypes";
previousUpdate = true;
return value;
}
value = "not changed no need to update";
return value;
} else {
previous
.setDataItem( reportModel.getOmraade().getDataItem());
value = "EMPTY & disable CompareTypes";
previousUpdate = false;
return value;
}
}
};
TextArea myText = new TextArea("debugmodel", detachdebugmodel);
-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Johan Compagner
Sent: Fri 14-07-2006 13:37
To: wicket-user@lists.sourceforge.net
Cc:
Subject: Re: [Wicket-user] Playing with models:)
But what do you set then?
another id?
You can't set the object really. Because the object is loaded in the load
method by i guess an id.
So the id is the real object not the thing that you would get through
setObject()..
johan
On 7/14/06, Nino Wael <[EMAIL PROTECTED] > wrote:
>
> That is indeed is suitable, but in the example im doing, I use the model
> in a wicket.markup.html.form.TextArea, which need a model where it can
> store an object in as well.
>
> So I guess I need a loadableDetachableModel which implements Abstractmodel
> instead of abstractreadonlymodel?
>
> Regards Nino
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED]] On Behalf Of Gwyn Evans
> Sent: 14. juli 2006 12:39
> To: wicket-user@lists.sourceforge.net
> Subject: Re: [Wicket-user] Playing with models:)
>
> You'd normally set all the internal objects up during the initial
> load() processing, which is called once at the start of each request.
>
> If that's not suitable, you might want to expand on what you're trying
> to do & during what phase of a request?
>
> /Gwyn
>
> On 14/07/06, Nino Wael <[EMAIL PROTECTED]> wrote:
> > Hi Eelco
> >
> > It seems as the LoadableDetachableModel do not support setobject? What
> should I use instead?
> >
> > -regards Nino
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED]] On Behalf Of Eelco Hillenius
> > Sent: 14. juli 2006 09:26
> > To: wicket-user@lists.sourceforge.net
> > Subject: Re: [Wicket-user] Playing with models:)
> >
> > IModel#getObject is called anytime a component accesses it. Basically,
> > you should never depend on that method getting called a fixed number
> > of times; it is not designed for that. Typically if you need to do
> > heavy operations such as loading data from a database, you should use
> > detachable models. A good model for such things is
> > LoadableDetachableModel. the #load method is only called once a
> > request, and the loaded object is then reused throughout the request.
> > At the end of the request, the model is detached and the temporary
> > object is cleaned up.
> >
> > Eelco
> >
> >
> > On 7/14/06, Nino Wael <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > Hah got your Attention there, though sadly enough its only
> abstractmodels.
> > >
> > >
> > >
> > > Im not sure when getObject are supposed to be called(what triggers a
> call).
> > >
> > >
> > >
> > > The following I can see are that my model are called on page
> construct(which
> > > makes sense to me). But on form submit the model are called two times,
> is
> > > that behaviour normal, also in what order are models called? My model
> are
> > > dependant on some of the other model on the page so I would always
> need for
> > > them to be updated first.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Regards Nino
> > >
> > >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user