question regarding model behavior

View: New views
6 Messages — Rating Filter:   Alert me  

question regarding model behavior

by ulf schneider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello,
i've got a problem with the behavior of a LoadableDetachableModel in  
one of my pages.

following scenario:
user opens a page (let's call it READING) with the  
LoadableDetachableModel for reading (the user can not enter any  
content). the loading of the model data and the display in the page is  
ok.

from the READING page the user can open another page (called EDITING)  
which uses again a LoadableDetachableModel to display the contents for  
editing. the loading of the model data and the display in the page is  
ok.
the EDITING page contains a reference to the READING page.

after submitting the EDITING page i call setResponsePage with the  
reference to the READING page, so that the user can see the results of  
his editing in the READING page.
again the loading of the model data and the display in the page is ok  
- the user can see the modified data in the READING page.


now the problem:
when i do the same but start from a DataView: open READING page, go on  
to EDITING page, submit EDITING page and display READING page by  
calling setResponsePage to the READING reference, the modifications of  
the editing process are not displayed. instead an old model without  
the modifications is displayed.
i can see, that the model in the READING page is properly detached and  
loaded and i can see that the model contains the right data, but the  
data is not displayed in the page.
do you have any idea?

best regards, ulf.

--
ulf schneider
+49 163 2505164
us@...

datenlabor gmbh
sitz: paderborn, hrb 8819
geschäftsführer: ulf schneider
www.datenlabor.net
ibm business partner






Re: question regarding model behavior

by James Carman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you need to maintain a reference to the reading page?  Is there
some state that it needs to maintain while the user edits what they're
reading?  Can it not be built from scratch again?

On Wed, Oct 14, 2009 at 4:49 AM, ulf schneider <us@...> wrote:

> hello,
> i've got a problem with the behavior of a LoadableDetachableModel in one of
> my pages.
>
> following scenario:
> user opens a page (let's call it READING) with the LoadableDetachableModel
> for reading (the user can not enter any content). the loading of the model
> data and the display in the page is ok.
>
> from the READING page the user can open another page (called EDITING) which
> uses again a LoadableDetachableModel to display the contents for editing.
> the loading of the model data and the display in the page is ok.
> the EDITING page contains a reference to the READING page.
>
> after submitting the EDITING page i call setResponsePage with the reference
> to the READING page, so that the user can see the results of his editing in
> the READING page.
> again the loading of the model data and the display in the page is ok - the
> user can see the modified data in the READING page.
>
>
> now the problem:
> when i do the same but start from a DataView: open READING page, go on to
> EDITING page, submit EDITING page and display READING page by calling
> setResponsePage to the READING reference, the modifications of the editing
> process are not displayed. instead an old model without the modifications is
> displayed.
> i can see, that the model in the READING page is properly detached and
> loaded and i can see that the model contains the right data, but the data is
> not displayed in the page.
> do you have any idea?
>
> best regards, ulf.
>
> --
> ulf schneider
> +49 163 2505164
> us@...
>
> datenlabor gmbh
> sitz: paderborn, hrb 8819
> geschäftsführer: ulf schneider
> www.datenlabor.net
> ibm business partner
>
>
>
>
>
>

Re: question regarding model behavior

by ulf schneider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello james,
if i only would think about how to get from EDITING back to READING  
you were right. i could always instantiate a complete new READING page.

but there are two possible sequences in how to get to EDITING and i  
want to give the user a way to step back both sequences.
1) homepage -> READING -> EDITING; step back: READING -> homepage
2) homepage -> DateView with lots of links to READING pages ->  
EDITING; step back: -> READING -> DataView -> homepage

of course i could maintain the step-back information in page  
parameters but i thought this would not be the wicket way - am i wrong?

in addition: after struggling for two days with that issue i cleaned  
my project in eclipse (i did not know how to help myself anymore).  
now, when stepping back, the READING page shows the right information  
for both sequences 1) and 2).
so please excuse me for bothering you with that question, i think my  
problem is solved now.

best regards, ulf.

--
ulf schneider
+49 163 2505164
us@...

datenlabor gmbh
sitz: paderborn, hrb 8819
geschäftsführer: ulf schneider
www.datenlabor.net
ibm business partner





Am 14.10.2009 um 14:01 schrieb James Carman:

> Do you need to maintain a reference to the reading page?  Is there
> some state that it needs to maintain while the user edits what they're
> reading?  Can it not be built from scratch again?
>
> On Wed, Oct 14, 2009 at 4:49 AM, ulf schneider <us@...>  
> wrote:
>> hello,
>> i've got a problem with the behavior of a LoadableDetachableModel  
>> in one of
>> my pages.
>>
>> following scenario:
>> user opens a page (let's call it READING) with the  
>> LoadableDetachableModel
>> for reading (the user can not enter any content). the loading of  
>> the model
>> data and the display in the page is ok.
>>
>> from the READING page the user can open another page (called  
>> EDITING) which
>> uses again a LoadableDetachableModel to display the contents for  
>> editing.
>> the loading of the model data and the display in the page is ok.
>> the EDITING page contains a reference to the READING page.
>>
>> after submitting the EDITING page i call setResponsePage with the  
>> reference
>> to the READING page, so that the user can see the results of his  
>> editing in
>> the READING page.
>> again the loading of the model data and the display in the page is  
>> ok - the
>> user can see the modified data in the READING page.
>>
>>
>> now the problem:
>> when i do the same but start from a DataView: open READING page, go  
>> on to
>> EDITING page, submit EDITING page and display READING page by calling
>> setResponsePage to the READING reference, the modifications of the  
>> editing
>> process are not displayed. instead an old model without the  
>> modifications is
>> displayed.
>> i can see, that the model in the READING page is properly detached  
>> and
>> loaded and i can see that the model contains the right data, but  
>> the data is
>> not displayed in the page.
>> do you have any idea?
>>
>> best regards, ulf.
>>
>> --
>> ulf schneider
>> +49 163 2505164
>> us@...
>>
>> datenlabor gmbh
>> sitz: paderborn, hrb 8819
>> geschäftsführer: ulf schneider
>> www.datenlabor.net
>> ibm business partner
>>
>>
>>
>>
>>
>>


Re: question regarding model behavior

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

does your dataprovider return an ldm from its model(object) method?

-igor

On Wed, Oct 14, 2009 at 1:49 AM, ulf schneider <us@...> wrote:

> hello,
> i've got a problem with the behavior of a LoadableDetachableModel in one of
> my pages.
>
> following scenario:
> user opens a page (let's call it READING) with the LoadableDetachableModel
> for reading (the user can not enter any content). the loading of the model
> data and the display in the page is ok.
>
> from the READING page the user can open another page (called EDITING) which
> uses again a LoadableDetachableModel to display the contents for editing.
> the loading of the model data and the display in the page is ok.
> the EDITING page contains a reference to the READING page.
>
> after submitting the EDITING page i call setResponsePage with the reference
> to the READING page, so that the user can see the results of his editing in
> the READING page.
> again the loading of the model data and the display in the page is ok - the
> user can see the modified data in the READING page.
>
>
> now the problem:
> when i do the same but start from a DataView: open READING page, go on to
> EDITING page, submit EDITING page and display READING page by calling
> setResponsePage to the READING reference, the modifications of the editing
> process are not displayed. instead an old model without the modifications is
> displayed.
> i can see, that the model in the READING page is properly detached and
> loaded and i can see that the model contains the right data, but the data is
> not displayed in the page.
> do you have any idea?
>
> best regards, ulf.
>
> --
> ulf schneider
> +49 163 2505164
> us@...
>
> datenlabor gmbh
> sitz: paderborn, hrb 8819
> geschäftsführer: ulf schneider
> www.datenlabor.net
> ibm business partner
>
>
>
>
>
>

Re: question regarding model behavior

by ulf schneider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi igor, yes it does. here is the code:

/**
  * a {@link LoadableDetachableModel} will be returned.
  *
  * @see org.apache.wicket.markup.repeater.data.IDataProvider#model
(java.lang.Object)
  */
public IModel<Profile> model(final Profile object) {

        return new LoadableDetachableModel<Profile>() {

                private static final long serialVersionUID = 1L;

                @Override
                protected Profile load() {
                        return object;
                }
        };
}

--
ulf schneider
+49 163 2505164
us@...

datenlabor gmbh
sitz: paderborn, hrb 8819
geschäftsführer: ulf schneider
www.datenlabor.net
ibm business partner





Am 15.10.2009 um 06:18 schrieb Igor Vaynberg:

> does your dataprovider return an ldm from its model(object) method?
>
> -igor
>
> On Wed, Oct 14, 2009 at 1:49 AM, ulf schneider <us@...>  
> wrote:
>> hello,
>> i've got a problem with the behavior of a LoadableDetachableModel  
>> in one of
>> my pages.
>>
>> following scenario:
>> user opens a page (let's call it READING) with the  
>> LoadableDetachableModel
>> for reading (the user can not enter any content). the loading of  
>> the model
>> data and the display in the page is ok.
>>
>> from the READING page the user can open another page (called  
>> EDITING) which
>> uses again a LoadableDetachableModel to display the contents for  
>> editing.
>> the loading of the model data and the display in the page is ok.
>> the EDITING page contains a reference to the READING page.
>>
>> after submitting the EDITING page i call setResponsePage with the  
>> reference
>> to the READING page, so that the user can see the results of his  
>> editing in
>> the READING page.
>> again the loading of the model data and the display in the page is  
>> ok - the
>> user can see the modified data in the READING page.
>>
>>
>> now the problem:
>> when i do the same but start from a DataView: open READING page, go  
>> on to
>> EDITING page, submit EDITING page and display READING page by calling
>> setResponsePage to the READING reference, the modifications of the  
>> editing
>> process are not displayed. instead an old model without the  
>> modifications is
>> displayed.
>> i can see, that the model in the READING page is properly detached  
>> and
>> loaded and i can see that the model contains the right data, but  
>> the data is
>> not displayed in the page.
>> do you have any idea?
>>
>> best regards, ulf.
>>
>> --
>> ulf schneider
>> +49 163 2505164
>> us@...
>>
>> datenlabor gmbh
>> sitz: paderborn, hrb 8819
>> geschäftsführer: ulf schneider
>> www.datenlabor.net
>> ibm business partner
>>
>>
>>
>>
>>
>>


Re: question regarding model behavior

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

that model is not really an LDM is it, that might as wlel be return
new Model(object); couple that with an item reuse strategy and youve
got a recipe for stale data.

-igor

On Thu, Oct 15, 2009 at 12:02 AM, ulf schneider <us@...> wrote:

> hi igor, yes it does. here is the code:
>
> /**
>  * a {@link LoadableDetachableModel} will be returned.
>  *
>  * @see
> org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object)
>  */
> public IModel<Profile> model(final Profile object) {
>
>        return new LoadableDetachableModel<Profile>() {
>
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected Profile load() {
>                        return object;
>                }
>        };
> }
>
> --
> ulf schneider
> +49 163 2505164
> us@...
>
> datenlabor gmbh
> sitz: paderborn, hrb 8819
> geschäftsführer: ulf schneider
> www.datenlabor.net
> ibm business partner
>
>
>
>
>
> Am 15.10.2009 um 06:18 schrieb Igor Vaynberg:
>
>> does your dataprovider return an ldm from its model(object) method?
>>
>> -igor
>>
>> On Wed, Oct 14, 2009 at 1:49 AM, ulf schneider <us@...> wrote:
>>>
>>> hello,
>>> i've got a problem with the behavior of a LoadableDetachableModel in one
>>> of
>>> my pages.
>>>
>>> following scenario:
>>> user opens a page (let's call it READING) with the
>>> LoadableDetachableModel
>>> for reading (the user can not enter any content). the loading of the
>>> model
>>> data and the display in the page is ok.
>>>
>>> from the READING page the user can open another page (called EDITING)
>>> which
>>> uses again a LoadableDetachableModel to display the contents for editing.
>>> the loading of the model data and the display in the page is ok.
>>> the EDITING page contains a reference to the READING page.
>>>
>>> after submitting the EDITING page i call setResponsePage with the
>>> reference
>>> to the READING page, so that the user can see the results of his editing
>>> in
>>> the READING page.
>>> again the loading of the model data and the display in the page is ok -
>>> the
>>> user can see the modified data in the READING page.
>>>
>>>
>>> now the problem:
>>> when i do the same but start from a DataView: open READING page, go on to
>>> EDITING page, submit EDITING page and display READING page by calling
>>> setResponsePage to the READING reference, the modifications of the
>>> editing
>>> process are not displayed. instead an old model without the modifications
>>> is
>>> displayed.
>>> i can see, that the model in the READING page is properly detached and
>>> loaded and i can see that the model contains the right data, but the data
>>> is
>>> not displayed in the page.
>>> do you have any idea?
>>>
>>> best regards, ulf.
>>>
>>> --
>>> ulf schneider
>>> +49 163 2505164
>>> us@...
>>>
>>> datenlabor gmbh
>>> sitz: paderborn, hrb 8819
>>> geschäftsführer: ulf schneider
>>> www.datenlabor.net
>>> ibm business partner
>>>
>>>
>>>
>>>
>>>
>>>
>
>