Creating plug-ins for SimplyHTML

A plug-in can be any Java object implementing interface SHTMLPlugin. As specified by interface SHTMLPlugin, a plug-in should provide

Above parts need not to be present in all cases, returning null in one or more parts is sufficient as well. Apart from above specification, plug-in developers are free to design their plug-in in any way they like. As SimplyHTML is open source (and will remain as such), plug-ins can access all its public parts as described in SimplyHTML's API documentation.

Class AbstractPlugin

To further simplify plug-in creation, there is an abstract base class that can be used to build a new plug-in upon. It basically implements a generic way of creating menus from a resource bundle (if one is delivered with the plug-in). See chapter ' Dynamic resources' and the source code for class AbstractPlugin for details.

Plug-ins are not obliged to extend AbstractPlugin or they can override some or all of its classes to adjust the plug-in accordingly. When extending AbstractPlugin unchanged, a .properties file should be provided with the new plug-in having menu definitions, etc.

Class PluginTemplate

Another help for plug-in developers is class PluginTemplate. It constructs a working - though functionless - plug-in for SimplyHTML. Plug-in developers can use it as a copy template for own plug-ins or for explanatory purposes.

With class PluginTemplate two .properties files are provided too. They have the necessary menu definitions and texts for english and german language. Use these .properties files as an example for how to define appropriate .properties files for you plug-ins.

Defining actions for plug-ins

A plug-in typically adds functionality to SimplyHTML which can best be provided to SimplyHTML through respective action classes. To integrate action classes of plug-ins with SimplyHTML, they should be connected to plug-in menu items.

Actions from plug-ins are added to SimplyHTML by using FrmMain's DynamicResource instance. Call method addAction of class DynamicResource passing it an instance of a plug-in action along with its command name. The action command should has to be the same expression as it was used to identify the menu item in the ResourceBundle. See method initActions of class FrmMain for an example.