Marc Santhoff wrote:

> Hi,
> 
> I'm asking myself if it is possible to start implementing the following
> scenario:
> 
> A doc is opened in a frame (and window). On a command of the user the
> component attached to the frame is stored elsewhere to keep the
> reference and a second document (component) is loaded into that frame.
> After a task is done by the user the second component get's saved and
> destroyed and the first component is attached to the frame again.
> 
> The goal is to reuse the window presented to the user with variing
> contents.
> 
> Will this work or am I asking for trouble regarding attached listeners,
> dispatch or whatelse?

A "component" inside a frame comprises a controller and a model. You can
not keep the controller without the frame, but you can keep the model
and you can use this model later on to recreate a controller including a
view from it without reloading the document.

To preserve the model from being closed when its last controller gets
destroyed you must register as a close listener at it and deny its
request for becoming closed.

The recreation of the view is a little bit tricky because the necessary
API currently does not exist (it's in the making though).

We ourselves use the following replacement:
use the loadComponentFromURL() method of the desired frame, but pass a
parameter "Model" in the MediaDescriptor that contains a reference to
the model. This will advise the frame loader to use the existing model
and not creating and loading a new one. You must provide the valid URL
of the document though (or the stream it was loaded from) to pass the
type detection and to avoid confusion in the documents' internal media
descriptor.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to