Sorry, I was in a hurry because I had to get off the train. :)
Ok, I have a Person class and a House class. Each of these has a
class side method called #register: that stores the instance in an
ordered collection of the class side. Person and House both have full
descriptions and are capable of displaying themselves, so the
"manager" class just allows one to make many of these.
So the use case is, you see the first page, it has a list of Persons
and a list of Houses, these are queried from the instances registered
with the class (i.e. in the class side collection variable). The user
clicks "add" on, say, Person. Now they get the Person page, as
described by the Person class, they type in there information and
click "Save".
This is where I need the custom memento (and tell me if I'm doing this
wrong): If you click save that winds up calling "commit" on the
memento and actually writing the data to the object, but this new
object wont be registered in the class side collection (and therefor
will simply cease to exist when this session expires). So my custom
memento simply lets everything work as normal and then calls "Person
register: self model" to get the new object registered.
The problem happens when "save" returns on Person and you go back to
the manager page. You see your nice new Person in the report table as
expected, but right below is the same Person again! And if you edit
either one the changes reflect in both. And the really hairy thing
is, even though House is almost exactly the same in every way (I can
find no relevant difference) it doesn't have this behavior.
(couple of comments below as well)
On Nov 20, 2007 9:36 PM, Lukas Renggli <renggli(a)iam.unibe.ch> wrote:
That's the form?
Below was the description that the manager uses to show the list of Houses.
MAToManyRelationDescription new
classes: (Array with: House);
label: 'Houses';
accessor: (MASelectorAccessor new
readSelector: #houses;
writeSelector: nil;
yourself);
default: Array new;
priority: 20;
yourself
Why don't you write your manager class manually and display the
editors for houses and persons as children? You can use the #onAnswer:
handler of the Magritte components to get notified when the user hits
add (save).
Hrm, I thought that's what I was doing. The above description is
saved in the manager as a component under houseComponent and is
returned from the children method of the manager. But I will go look
up uses of onAnswer to try and figure out what you mean.