The steps described in this article are only necessary if you want to allow all add-ons to add actions and active settables to your action bar, or if you want to configure a standard Lucy action so that it appears in your action bar.
If you just want to add a tool bar or menu bar to your application which is unrelated to the Lucy action bar mechanism, you
can simply use the standard JDK classes, for example
The contents of the action bars in the UI are kept in-sync with the contents of the
Each time an add-on inserts an action in the
TLcyActionBarManager, the action bar in the UI is notified of this change and shows the action.
You can use the same mechanism for your own action bars. It allows you to:
Configure your own actions and active settables to appear in your action bar.
Configure the standard Lucy actions and active settables to appear in your action bar.
To add an action bar to the UI, and keep it in-sync with the
ILcyActionBarimplementation. Lucy has default implementations for the most common types of action bars. The
TLcyToolBarimplementation represents a tool bar, for example, and
TLcyMenuBarrepresents a menu bar.
Use the utility method of the
TLcyActionBarUtilclass to insert all actions and active settables registered with the action bar manager for this action bar. The use of this utility method also ensures that the action bar remains in-sync with the action bar manager.
TLcyActionBarManager actionBarManager = lucy.getUserInterfaceManager().getActionBarManager(); //Obtain a parsed version of the configuration file, e.g. by using a TLcyStringPropertiesCodec //If using an ALcyPreferencesAddOn, you can use ALcyPreferencesAddOn#getPreferences() ALcyProperties configuration = parseConfigurationFile(); String configurationPrefix = "MyAddOnPrefix."; TLcyActionBarUtil.setupAsConfiguredActionBar( toolBar, toolBarName, mapComponent, configuration, configurationPrefix, (JComponent) mapComponent.getComponent(), actionBarManager );
This utility method requires the full identifier of the action bar, which includes the name as well as the context. In this example, the context is the map component. For a global action bar, the context can be replaced with