Author |
Message |
10/06/2008 10:34:03
|
hilka
Power User
Joined: 23/11/2007 09:00:08
Messages: 191
Offline
|
Hello Captain,
I tried to implement some kind of automatic detection of changes in a page, so if the user tries to leave the page without saving the changes, we can react and ask the user if he/she wants to save the changes.
You suggested to use the IPropertyResolverAware to find these changes. My imagination of this interface was to have the possibility to see the name of the property that changed and check, if the property is interesting for me (changes should be detected) and set a flag that is evaluated if the user leaves the page.
But it seems this interface only brings up components that have the flush property set. Example: I have a page with some fields and a combobox. The only control with the flush property set is the combobox. Now, if I change the value of some other field and press a button (flush is invoked), then the only property that is shown here is the combobox of which the value was not changed.
Do you have any ideas on how to solve my problem?
Tobias
|
|
|
10/06/2008 14:46:29
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
...the interface is valid for all set-property activities that pass data from the screen to the managed bean processing.
Could you view the example, in the Demp Workplace "General Issues" ==> "General Issues" ==> "Property Change Notification"?
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
10/06/2008 15:36:38
|
wocher
Power User
Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline
|
ok the interface is in my BeanWrapperUI and its work then the user click of cancel in the edit field and he has not saved. But then the user edit a entry and then he close the page in the workspace oder close the complet application.
When the warning does not come. Wich way can i go for this proplem?
Greet Wocher
|
„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz
Rainer Wocher Quentia Development GmbH (Sotware Developer) |
|
|
10/06/2008 16:34:27
|
hilka
Power User
Joined: 23/11/2007 09:00:08
Messages: 191
Offline
|
Ok Captain,
I see how the mechanism works. Only the values directly owned by a bean (has the direct getter/setter) are transfered to this method.
But we often use value object, and these value objects contain the properties, the bean only includes a reference to the value object. Do we have to implement this interface in every value object?
One idea that come to my mind is to have some kind of central instance in the bean (in every bean) that receives the expressions like "vo.firstname", so we do not have to implement the interface in every value object. With this it would be possible to declare the properties, which are used to find out if something was changed in a central position and react in every bean the same way (by calling save or cancel in this bean).
Tobias
|
|
|
23/01/2009 09:25:50
|
levy
Power User
Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline
|
Hi,
Just a question: I the Property Change Notification demo, it seems to me that only the reactOnSetValue(Object property, Object value) method is called. When would the other method of IPropertyResolverAware, reactOnSetValue(int index, Object value), be called?
Regards, Daniel
|
|
|
23/01/2009 09:37:12
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
...in case you referenced an array as last element of your expression: #{d.harry.car[4]}.
Just to make sure: #{d.harry.car[4].name} is again the normal way - it really depends on the last element of the expression.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
27/01/2009 08:34:24
|
levy
Power User
Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline
|
(How) can we distinguish #{d.harry.car[4]} from let's say #{d.harry.truck[4]} in the same bean?
Daniel
|
|
|
27/01/2009 10:06:26
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
Hi,
hope, I got you right...:
IPropertyResolverAware is implemented by the bean in which the "set" finally is made. I.e. we call it directly with at this object which will be the target of the "set". So, in your example the method would be called in different object instances.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
|