Hi Daniel,

> I guess there is a theoretical API and a real api.

Well, as Mikhail said, the API definition allows for rejecting an
attempt to attach a new model.

As a secondary thought, I'd say that a VetoException or something like
this would have been a better API design, since it would allow returning
more information (and thus would have saved you the question, since you
would have got a message saying "not allowed for this implementation").

> I take it then that exchanging models can't be done?

Yes.

However, it would be interesting to know what you want to achieve with
this. Even if replacing a model at an existing controller would be
implemented, there's hardly any aspect of the controller which would
survive this. In other words, the controller would implicitly need to
reset itself to a state which pretty much equals its state when it's
newly created, and got its very first model.

That said, perhaps Mikhails suggestion to simply load the new document
into the existing frame suits your needs.

> Is there a quick way to exchange or replace the contents of a Model with
> that of another model?

Try using XLoadable::load a second time. If your Model_B really exists
as model only (and not as file), then store it to a temporary location
beforehand.

In my understanding, XLoadable::load should be reusable, though I of
course do not know whether its implemented this way everywhere :)

Depending on your application architecture, you need to care for side
effects. E.g. if some of your components caches any direct or indirect
property (in a very broad sense) of the model, you need to invalidate
all those data.
Again, I think evaluating the "load another document into the same
frame" approach is worth an evaluation, to prevent this kind of problems.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [email protected] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to