[Contents] [Previous] [Next] [Index]

## Chapter 6
Using Composer Plug-ins

This document describe how to integrate Composer plug-ins into applications built with Visual JavaScript (VJS). Composer plug-ins already offer a modular, easy way to extend the functionality of Netscape Communicator for web-page design and email messaging. Composer plug-ins act on the content of an HTML document. They edit or add features to the text in the web page.

This document includes the following sections:

- What Can Plug-ins Do?

- Understanding Plug-in Architecture

- Packaging Plug-ins for Use in VJS

- Installing a Plug-in

## What Can Plug-ins Do?

VJS enables you to integrate new or existing Composer plug-ins into your applications. You can write Composer plug-ins that add services such as:

- search and replace
- word-processor file import/export
- editing parameters for applets, objects
- frame designers
- form designers
- fancy text effects
- color pickers
- font pickers
- publishing assistants
- document wizards or templates
- spelling and grammar checkers

The Netscape Component Developer's Kit (CDK) enabling you to bring much of the same modular, functional extensibility to the applications you build with VJS that plug-ins provide to Communicator and Navigator. In fact, you can leverage most existing Composer plug-ins directly in your VJS applications, unless those plug-ins:

- Perform image-encoding.

- Are designed as event handlers (although you may be able to recast these plug-ins as menu-accessible items instead).

Additionally, the following plug-in features are not fully supported:

- Range selection

- Multiple plug-ins in a single JAR file

- Stopping a running plug-in

When an application written with VJS invokes a plug-in, its passes an entire HTML document to the plug-in. The plug-in enables the user to modify the document. Upon return, the modified document is passed back to the application, where the changes are reflected immediately.

## Understanding Plug-in Architecture

Plug-ins have two parts: an interface, written in entirely in Java; and an implementation, also written in Java, but which can use the full power of the Netscape Java environment, including the JRI, to call into other languages, such as C++, C, or JavaScript. A page-oriented plug-in has a user interface (UI). Page-oriented VJS plug-ins use the same application programming interface (API) described in the Netscape Composer Plug-in Guide.

The Composer plug-in API is UI-independent, meaning that plug-ins can be written using any UI tool kit. Plug-ins that you plan to use in VJS, however, should be written to use AWT to ensure cross-platform and version migration compatibility.

## Packaging Plug-ins for Use in VJS

A plug-in is packaged in a JAR file. All class files and support files for the plug-in must be included in the JAR. A single JAR file can contain any number of plug-ins and their support files as long as each plug-in has a unique name.

Each JAR file for a plug-in must contain an initialization file, `netscape_plugin_composer.ini`, that contains information about the plug-ins. This file is a standard Java Properties file format, and usually contains the following declarations:

Property | Purpose
--- | ---
netscape.plugin.composer.factory | Single class name of a Factory class.
netscape.plugin.composer.classes | Colon-separated list of the class names for the plug-ins in this archive.

The `Factory` class property is only necessary if your plug-ins will be dynamically created at run time.

For instructions on creating a JAR file, see Packaging Components for Import. For more detailed information about creating and packaging plug-ins, see the Netscape Composer Plug-in Guide.

## Installing a Plug-in

With the exceptions noted in What Can Plug-ins Do?, you can use any plug-ins located in the Communicator or Navigator plugins directory. If you create a plug-in that's just for use with VJS, put the plug-in and its support files in the plugins directory under the directory where you installed VJS. During installation of VJS, the plugins subdirectory is created automatically. For more information about enabling plug-ins for use, see the Netscape Composer Plug-in Guide.

[Contents] [Previous] [Next] [Index]

Last Updated: 11/20/97 13:56:38

Copyright © 1997 Netscape Communications Corporation