List Info

Thread: Regarding XJobExecutor.




Regarding XJobExecutor.
user name
2006-07-21 10:06:07
Hi Andreas i tried the method you suggested , again. It
worked. Thank you.
  public void trigger(String sEvent)
  { 
  String buttonName;
  buttonName=sEvent;
  if(buttonName.equals("button1"))
  yahoocom();
  else if(buttonName.equals("button2"))
  googlecom();
  }
   
  and in Addons.xcu 
  <node oor:name="m1"
oor:op="replace">
  <prop oor:name="URL"
oor:type="xs:string">
 
<value>service:name.vojta.openoffice.wavelet.Wavelet?b
utton1</value>
  </prop>
   
  <node oor:name="m2"
oor:op="replace">
  <prop oor:name="URL"
oor:type="xs:string">
 
<value>service:name.vojta.openoffice.wavelet.Wavelet?b
utton2</value>
  </prop>
  Thank you.
   
  With Regards
  Bharathy B
  

Andreas Schlüns <andreas.schluenssun.com> wrote:
  bharathy b wrote:
> Hi Andreas thank you, i tried the solution you
specified. 
> In the Addons.xcu i made the following changes.
> 
> 
> 

> service:name.vojta.openoffice.wavelet.Wavelet?button1
> 

> 
> 

> service:name.vojta.openoffice.wavelet.Wavelet?button2
> 

> 
> and in Wavelet.java i made the following change
> 
> public void trigger(String buttonName)
> {
> try{
> if (buttonName == "button1")
> {
> URL yahoo = new URL("http://www.yahoo.com/"
;);
> BufferedReader in = new BufferedReader(
> new InputStreamReader(
> yahoo.openStream()));
> String inputLine;
> File outFile = new
File("c:\\button1.htm");
> FileWriter out = new FileWriter(outFile);
> while ((inputLine = in.readLine()) != null)
> { 
> out.write(inputLine);
> }
> in.close(); 
> out.close();
> }
> else
> if (buttonName == "button2")
> {
> URL google = new URL("http://www.google.com/&qu
ot;);
> BufferedReader in = new BufferedReader(
> new InputStreamReader(
> google.openStream()));
> String inputLine;
> File outFile = new
File("c:\\button2.htm");
> FileWriter out = new FileWriter(outFile);
> while ((inputLine = in.readLine()) != null)
> { 
> out.write(inputLine);
> }
> in.close(); 
> out.close();
> }
> }
> catch(java.io.IOException e){} 
> }
> 
> 
> The buttons appear but dont get triggered. Whats wrong
in this method?

If this method will be called ... nothing was wrong.
If it's not called you may be implement your service wrong.
Then the optional interface XJobExecutor couldnt be queried
on your 
implementation and isnt used.

Was your methor trigger() called ... even with right or
wrong arguments 
? If not - please check your service implementation and
registration.

> 
> 
> Regarding the ProtocolHandlerAddon method..
> 
> I want to know where should i define sayHello( ).
> 
> 
> public String sayHello() { return "Hello
world"
> }
> 
> 
> This is XTestFunction1.idl in
C:\ProtoToolbar\Code\com\sun\star\demo
> #include 
> module com { module sun { module star { module demo {
> interface XTestFunction1 :
com::sun::star::uno::XInterface {
> String sayHello();
> };
> };};};};
> 
> This is TestFunction1.idl in
C:\ProtoToolbar\Code\com\sun\star\demo
> 
> #include "XTestFunction1.idl"
> module com { module sun { module star { module demo {
> service TestFunction1 
> {
> interface com::sun::star::demo::XTestFunction1;
> };};};};};
> 
> 
> C:\ProtoToolbar\Code\com\sun\star\demo also
contains TestFunction1.urd, XTestFunction1.urd and demo.rdb
> 
> Should i define sayHello( ) in TestFunction1.java or
XTestFunction1.java? so that sayHello( ) gets called onclick
of the button
> Should the value of the URL in the Addons.xcu be
> 

> 
> com.sun.star.demo:sayHello
> 

> 
> I am not able to understand this one point..

Implementing a ProtocolHandler isnt so different against
implementation 
of a JobExecutor. All interfaces are still defined and can
be used.
But your implementation has to support and implement it.

A Protocolhandler has to implement the existing interfaces:
com.sun.star.frame.XDispatchProvider
com.sun.star.frame.XDispatch
[optional] com.sun.star.lang.XInitialization

> 
> With regards,
> Bharathy B
> 

Regards
Andreas

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org



 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone
calls.  Great rates starting at 1˘/min.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )