Hello 

Thank you very much both for the immediate answer...

I changed the 
XComponent xCurrentComponent = xDesktop.getCurrentComponent()
 XModel xModel =
(XModel)UnoRuntime.queryInterface(XModel.class,xCurrentComponent);


with the 
XModel xModel = (XModel)
    UnoRuntime.queryInterface(XModel.class,document);

and now everything works fine...
Thank you very much .... i am very fresh to OOo and i am having a few
problems with it....
Thanks for helping Mathias and Andreas 

Ciao..for the time..


Mathias Bauer wrote:
> 
> [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]
> 
> 
> 
=)
-- 
View this message in context: 
http://www.nabble.com/Java---LoadComponentFromUrl-tp20600458p20617781.html
Sent from the openoffice - dev mailing list archive at Nabble.com.


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

Reply via email to