Dynamic resources

In stage 2 of SimplyHTML a dynamic way of using resource bundles was implemented. It is capable of providing internationalization support and of dynamic creation of components such as menus and tool bars from parameters from a resource bundle.

This functionality needs to be made available to plug-ins as well which is why a new class DynamicResource now provides these features formerly contained in class FrmMain.

Class DynamicResource

Class DynamicResource provides methods for menu and tool bar creation based on parameters stored in ResourceBundles. As well, it stores and associates actions with components created in such way allowing for retrieval of component by their associated action name.

Class FrmMain has been changed to now use class DynamicResource for all internationalization and menu creation. It now makes publicly available a static instance of DynamicResource referencing components and actions of SimplyHTML. By having one static instance of DynamicResource in FrmMain, any object can use its utility methods without instantiating DynamicResources again.

All classes relying on FrmMain's former functionality have been changed accordingly. Please see the source code and SimplyHTML's main . properties file for examples of how parameters can be created for automatic component creation.

Using class DynamicResource for plug-ins

Class AbstractPlugin is an abstract base class plug-ins can use. By extending class AbstractPlugin a plug-in inherits some automatic initialization methods being performed upon construction. If a . properties file exists in the plug-in package (e.g. com.lightdev.app.shtm.plugin.installed.MyPlugIn.properties), class AbstractPlugin automatically creates a ResourceBundle for that . properties file. It then uses FrmMain's DynamicResource instance to create menus from the menu definitions found in that .properties file.

If a different approach of plug-in construction is desired, a plug-in class either can be declared not to extend class AbstractPlugin or can override some or all methods of class AbstractPlugin accordingly.