X

Geertjan's Blog

  • June 28, 2006

OpenOffice.org API and Diagram Generation

Geertjan Wielenga
Product Manager
One of the OpenOffice.org applications is called Draw. It is a graphics package. Just like Writer and Calc, which I looked at in previous blog entries, you can incorporate Draw into your application, via the OpenOffice.org API. Here, for example, is a drag and drop interface for generating an organigram:

When you click "Generate Organigram", the Draw application opens, showing you (in the case of the above design) the following organigram:

There are really no secrets to this usage of the OpenOffice.org API. It comes directly from pages 648 and 649 of the Developer's Guide. The only difference is that, instead of hardcoded values, the values are generated when the employee items are dropped. And, to make that happen, all you need to do is work through the tutorials on http://platform.netbeans.org/tutorials. There's a few tutorials there that describe how to use the Component Palette API.

PS: I removed the borders round the dropped JButton, made a new screenshot, and uploaded it here. Looks better like this, imho. Plus, you can see the palette's scrollbar, which you get for free without any programming on your side. Plus plus, the icons are pretty cool—they happen to have little shadows as part of the icon, which make it appear as if the icons themselves are casting a shadow on the TopComponent.

Join the discussion

Comments ( 3 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.