[EMAIL PROTECTED] wrote:

> 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();
> 
> 
> my problem is that the LoadComponentFromUrl seems to delay and the rest
> lines return NullPointerException...

Why do you retrieve the component from the Desktop instead of taking the
return value of loadComponentFromURL()?

XComponent document = loader.loadComponentFromURL (
                     "private:factory/swriter",
                     "_blank",
                     0,
                     loadProps);
XModel xModel = (XModel)
    UnoRuntime.queryInterface(XModel.class,document);

The "currentComponent" indeed is not reliable as it requires that the
freshly loaded component got the focus.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.


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

Reply via email to