This drawable object example inherits from IDLitWindow and creates an ISURFACE display in a Java application. A listbox is populated with manipulator string values that, when selected, allow you to draw annotations, rotate, or zoom within the exported IDLitWindow object. Avoid exposing any manipulator that has an associated widget interface (such as a profile line manipulator) since such widget functionality is not supported in objects that subclass from IDLitWindow.

The object definition file, export_itwinmanip_doc__define.pro is located in the examples/doc/bridges subdirectory of the IDL distribution. Run the example procedure by entering export_itwinmanip_doc__define at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT export_itwinmanip_doc__define.pro.

Complete the following steps to duplicate this example.

  1. In an IDL Editor window, open the object definition file by entering .EDIT export_itwinmanip_doc__define.pro at the command prompt.

    It is best to test the functionality of an object before exporting it. After compiling the file, enter the following lines at the command line and make sure the output is what is expected for this object.

    oWin = OBJ_NEW("export_itwinmanip_doc")
    oWin->CHANGEMANIPULATOR, "annotation/oval"

    This will let you draw a oval annotation in the window. If you press the Delete key, the annotation will be removed. The available manipulator strings are printed in the IDL output window.

  2. Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
  3. Select to create a Java export object by selecting File > New Project > Java and browse to select export_itwinmanip_doc__define.pro. Click Open to load the file into the Export Assistant.
  4. Note: Export Bridge Assistant details are available in Specifying Information for Exporting. Refer to that section if you need more information about the following items.

  5. Set export object characteristics as described in the following table. When you select the tree view item listed in the left column, configure the related properties as noted in the right column.
  6. Tree View Item Property Configuration
    IDL Export Bridge Project

    Accept the default value or make changes as desired:

    • Output classname
    • Process name
    • Output directory
    export_itwinmanip_doc Drawable object equals True
    Package name export_itwinmanip_doc
    CHANGEMANIPULATOR method

    Enter different name if desired and mark Export as True

    MANIPID argument

    Mutability: In

    Type: JIDLString

    Array: False

    Export: True

  7. 5. Save the project by selecting File > Save project. Accept the default name and location or make changes as desired.
  8. 6. Verify that the object elements you want to export are listed in the Export log panel. If the expected items are not present, one or more items may still have an UNSPECIFIED field value that must be changed.
  9. 7. Build the export object by selecting Build > Build object. The Build log panel shows the results of the build process. A subdirectory, named export_itwinmanip_doc (based on the object name), contains the .java and .class files, and is located in the Output directory.

Using the Java Export Object

The following section describes using the Java export object in a simple application.

Note: The files for this example, export_itwinmanip_doc_example.java, and export_itwinmanip_delete.java, are located in the examples/doc/bridges/java subdirectory of the IDL distribution.

In this example, the export_itwinmanip_doc_example.java file contains the code to display the listbox and IDLitWindow drawing canvas. The export_itwinmanip_delete.java file subclasses the previous file and handles key press events, passing them on to the IDL object OnKeyboard method so that selected visualizations can be deleted.

  1. Open the files named export_itwinmanip_doc_example.java and export_itwinmanip_delete.java in the location referenced above and copy them to your <output directory>/export_itwinmanip_doc directory where <output directory> was the directory specified as the Output directory in the Assistant.
  2. Open the Windows Command window by selecting Start > Run and enter cmd in the textbox.
  3. Use the cd command to change to the directory containing the export_itwinmanip_doc directory.
  4. Reference the classpath of javaidlb.jar in the compile statement. Enter the following two commands (as single lines) to compile and run the program, replacing IDL_DIR with the IDL installation directory:
  5. javac -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" export_itwinmanip_doc\*.java
    java -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" export_itwinmanip_doc.export_itwinmanip_doc_example

Tip: See Note on Running the Java Examples for information on running Java commands on a non-Windows platform.

After compiling and running the project, a Java interface will display a a surface in an IDLitWindow. Select a manipulator from the listbox to use it in the IDLitWindow display. If you press the Delete key while visualizations are selected, they will be removed from the view.