OrgTree Sample

This sample is located in \Samples\Scripting\Orgtree.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

This sample shows how to host a JavaBean in a Microsoft® ActiveX® container. The sample builds an organization tree from a list of employees, their titles, and their managers. The sample provides a display area for the tree and a form with buttons for entering employee information. Employees are inserted in the appropriate place in the tree based on their position in the management structure. You can also remove employees from the tree.

You must have Microsoft® Internet Explorer 4.0 or later installed to use this sample.

Using the Sample

To compile the sample

Use Nmake.exe to compile the makefile in \Samples\Scripting\Orgtree.

To install the sample on the server

Client

Run Register.bat in \Samples\Scripting\Orgtree. This batch file runs javareg to register the Java/COM object and generates a type library file. A dialog box appears that indicates the object was registered correctly.

To uninstall the sample from the server

Client

Run Remove.bat in \Samples\Scripting\Orgtree. This batch file uses javareg to remove the Java/COM object from the registry. A dialog box appears that indicates the object was removed correctly.

To use the sample

  1. Open the \Samples\Scripting\Orgtree\Orgtree_app.htm file from Internet Explorer to run the applet.

  2. To add an employee to the chart, enter the employee's name, title, and manager. Click Add. Employees are inserted in the appropriate place in the tree based on which employees they manage and who their own manager is.

  3. To remove an employee, select the employee's name in the chart. Click Remove.

  4. Selecting an employee in the tree displays information about that employee in the form that follows the tree. You can expand and collapse tree nodes by clicking the plus and minus signs next to the nodes. Double-clicking Organization toggles between hiding and displaying the entire tree.

Key Project Files

OrgTree.java

This class builds the tree from the list of employees, their titles, and managers. This class also removes employees from the tree, and registers listeners for tree selection events.

OrgTreeEventListener.java

This class defines the interface for tree selection events.

OrgTreeNode.java

This class defines individual nodes in the tree.

Technologies Demonstrated

Scripting

ActiveX

© 1999 Microsoft Corporation. All rights reserved. Terms of use.