You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have a class Guest, which has parameters #isAttending (Boolean) and #person (Person class). Person class has the given names, family name and title.
Guest UI is a Dialog that contains #isAttending (a checkbox) and Person (a Presenter).
In Guest>>#model: I have an aspectBuffer to buffer changes. However the changes to person are always written even if I send #cancel. The change to #isAttending is always buffered.
Is there a way around this? I followed the PersonalMoney example, specifically PersonalAccountTransactionDialog>>#model: where the aspectBuffer is used.
Vince
vin...@gmail.com
unread,
Mar 23, 2021, 7:10:04 AM3/23/21
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I had to override copy. The changes in the Dialog are correctly buffered and discarded when I press 'Cancel' and written to the backing model when I press 'Save'.
super model: anObject.
aspectBuffer := self model.
self person model: (aspectBuffer aspectValue: #person).
self isAttending model: (aspectBuffer aspectValue: #isAttending)
The class comment for AspectBuffer says: "In order to be correctly used with an AspectBuffer, a subject object must be able to be sensibly duplicated using #copy."
So I implemented the following:
Guest>>#copy
^ self species new
person: self person copy;
isAttending: self isAttending copy