The java component demo
=======================

The java component demo is a short example for a java component. It provides an
easy to use UI example which allows to load three different example document
types (writer, spreadsheet and draw document). For running this excample you
will need a full office installation.

Preconditions:

See the preconditions for all examples (C++ or Java) in the examples directory.


Preperation to run the demo:

1. Build the demo
   After building the demo with 0 errors you will find a demoComponent.jar in
   the example output class directory.

2. Register the component in the office installtion
   Before you can use the component you must install them into your current office
   environment. You can do that by providing an environment variable OFFICE_PATH
   which specify your office program directory then the component will be automatically
   installed in the build process, using the java component registration directly after
   building or you can use an BASIC script inside your office.

   - using java component registration

     java -classpath %OFFICEPROGRAMPATH%\classes\unoil.jar;\
		     %OFFICEPROGRAMPATH%\classes\sandbox.jar;\
		     %OFFICEPROGRAMPATH%\classes\jut.jar;\
		     %OFFICEPROGRAMPATH%\classes\java_uno.jar;\
		     %OFFICEPROGRAMPATH%\classes\ridl.jar;\
		     %OFFICEPROGRAMPATH%\classes\jurt.jar;\
		     %OFFICEPROGRAMPATH%\classes\juh.jar com.sun.star.tools.uno.RegComp \
		     %OFFICEPROGRAMPATH%\applicat.rdb register \
		     "file:///%DEMOCOMPONENTPATH%/demoComponent.jar" \
		     com.sun.star.loader.Java2

   - using BASIC script

     The basic script register the demoComponent, create an instance and revoke the
     component. 
   
     REM  *****  BASIC  *****
     sub registerDemoComponent
       REM get the Java loader
       createUnoService("com.sun.star.loader.Java2")

       REM get the implementation registration, use this command only the first time
       regImpl = createUnoService("com.sun.star.registry.ImplementationRegistration")

       REM register the instance inspector, you should customize the directory of the
       REM jar file, use this command only the first time
       regImpl.registerImplementation("com.sun.star.loader.Java2",
				      "file:///%DEMOCOMPONENTPATH%/demoComponent.jar", null)

       REM create a new instance of the DemoComponent
       objectCalcAddin = createUnoService("com.sun.star.demo.DemoComponent")

       REM show all supported interfaces
       msgbox( objectCalcAddin.dbg_supportedInterfaces )

       REM show all methods
       msgbox( objectCalcAddin.dbg_methods )

       REM revoke the jar file
       regImpl.revokeImplementation("file:///%DEMOCOMPONENTPATH%/demoComponent.jar", null)
     end sub

3. Starting the demo
   After registering the demo Compenent, use the following BASCI script to create a new
   instance of the demoCompoent.
      
   REM  *****  BASIC  *****
   sub createDemoComponent
     REM create a new instance of the DemoComponent
     dim demo as object
     demo = createUnoService("com.sun.star.demo.DemoComponent")

     REM show all supported interfaces
     msgbox( objectCalcAddin.dbg_supportedInterfaces )

     REM show all methods
     msgbox( objectCalcAddin.dbg_methods )

   end sub
     