Hi [EMAIL PROTECTED],

see inline :-)

Hello ,
Thanks in advance for listening to me..
I have created an application in which i try to open a new Writer Document
with LoadComponentFromUrl.
My next steps are to get the

XComponent document = loader.loadComponentFromURL (
"private:factory/swriter", "_blank", 0, loadProps); XComponent xCurrentComponent = xDesktop.getCurrentComponent()
XModel xModel = (XModel)
UnoRuntime.queryInterface(XModel.class,xCurrentComponent);
XController xController = xModel.getCurrentController();
XFrame xFrame = xController.getFrame();

a)
"document" is already the XModel ! There is no need to use xDesktop.getCurrentComponent (). On ther other side "getCURRENTComponent()" means what it says ... it returns the current component which has the focus. Because that depends from the OS you use it can happen that focus was not set already into the new loaded document at the time you asked for it. Anyway: "document" is already what you want.

b)
Same for getCurrentController() ... it depends on focus and can return NULL. Better solution would be to use new interface XModel2 ... where you find a method getControllers() returning an enumeration of all currently for that model existing controller objects. OK - using that enumeration its up to you to decide which of those controller objects has to be used further :-) ... but the you can get the frame from that controller easy by calling getFrame().





my problem is that the LoadComponentFromUrl seems to delay and the rest
lines return NullPointerException...
How can i overcome this problem so that the LoadComponentFromUrl finishes
and then go on to the rest of the code??

Thanks in advance

Best Regards
Andreas

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

Reply via email to