Hi Andreas thank you, i tried the solution you specified. 
  In the Addons.xcu i made the following changes.
   
  <node oor:name="m1" oor:op="replace">
         <prop oor:name="URL" oor:type="xs:string">
      <value>service:name.vojta.openoffice.wavelet.Wavelet?button1</value>
</prop>
  <node oor:name="m2" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
       <value>service:name.vojta.openoffice.wavelet.Wavelet?button2</value>
  </prop>
   
  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/";);
    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?
   
   
  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 <com/sun/star/uno/XInterface.idl>
  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
  <prop oor:name="URL" oor:type="xs:string">
  <value>
  com.sun.star.demo:sayHello</value>
  </prop>
   
  I am not able to understand this one point..
   
  With regards,
  Bharathy B
   
  Andreas Schlüns <[EMAIL PROTECTED]> wrote:
  bharathy b wrote:
> Hi i wanted to know if the following is possible using the XJobExecutor.
> 
> Is it possible to have more than one trigger method for an XJobExecutor?
> 
> At present i have added a toolbar button to the writer document using an 
> Addon. (Using an UNO Component in Java).
> Onclick of the button creates an htm file in C drive.
> 
> But now i need to add more buttons to the writer document using a Addon. 
> Suppose i want to add 3 buttons using a single addon. how can i specify the 
> trigger method for the remaining 2 buttons. 
> 

If you implement an XJobExecutor you use an URL like 
"service:". You can use "service:?argument".
In such case your implementation will be called within 
"trigger('argument')".

Some examples:

Button 1 URL = "service:YourService?button1" => trigger('button1')
Button 2 URL = "service:YourService?button2?somethingspecial" => 
trigger('button2?somethingspecial')

You will get the whole string from the first "?" till the end as one 
string argument. Parsing these string value is up to your code.

> Are there any better ways of doing this?
> I tried using ProtocolHandlerAddon but i am still not able to understand 
> dispatcher implementation and how to get the Add-on register itself for the 
> protocol part of the command URL.

Implementing a ProtocolHandler is the better way ...
Because you can specify your own URL schema as e.g. 
"vnd.your_url:/param1?arg1=value1".

Further a ProtocolHandler will be initialized with the right 
environment. It will get the current frame/controller/model so it can
start working directly, without the need fort searching those resources.


> 
> Please reply and suggest me how to accomplish this..


> 
> With Regards,
> Bharathy B
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail Beta.

Regards
Andreas

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



                        
---------------------------------
See the all-new, redesigned Yahoo.com.  Check it out.

Reply via email to