Thanks;)

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner
Sent: 14. juli 2006 15:07
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Playing with models:)

 

Disableding/Enableing can be done with pull (attributemodifiers on C/D that are looking at A/B)
Setting the defaults could be done by push so A/B pushing values ot C/D
That last part could also be one by the backing bean ofcourse.
So if you you have a bean where A sets its value on. Then when that value is set you also set the value of C
and c then pulls that data.

johan

On 7/14/06, Nino Wael <[EMAIL PROTECTED]> wrote:

Ok scratch what I send previously. I'll try to explain more clearly what Im trying to do.

 

This picture describes show what I have, I'll now try to describe the flow

http://www.badongo.com/pic/237253

 

This is what I got currently:

 

The component which contains B are based on the Palette component from wicket extensions.

 

A populates the component below as C does D

 

So this is the functionality I need:

 

When A or B is changed C needs to be repopulated and D needs to be emptied

 

If B.size are different from 1 then C and D needs to be disabled

 

If E is clicked then C and D needs to be disabled (this is partly working with an ajax call, however the backing model does not seem to be updated).

 

If C is changed then D needs to be repopulated (this is working already with an ajax call).

 

 

My original idea was to make the components A/B aware of C/D and make A/B make an direct repopulation on C/D. However looking at all the facilities with models I thought that I could make the C/D model aware of A/B instead.

 

Would the correct thing  to do make A/B model notify C/D model that a change had happend?

 

Or would it be that the A/B component needs to be aware of the C/D component and make A/B call a populate on C/D?

 

The last idea I got now and what I think should work is that the A/B model needs to be aware of the C/D component and repopulate/disable/enable when appropriate.

 

 

Hopes this makes a bit sense?

 

Regards Nino

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Johan Compagner
Sent: 14. juli 2006 14:18


To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Playing with models:)

 

ok you just want to prefill it everytime the page/textarea is rendered?
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

 

-------------------------------------------------------------------------
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

Reply via email to