ReferencesA configuration file really serves two different purposes:
<configuration> <action id="exit"> <caption i18n="exit.text"/> </action> <root id="main.menu"> <menu i18n="menu.file.text"> <action-ref id="exit"/> </menu> </root> </configuration>(Do not forget to include the DOCTYPE declaration at the top.)
The <configuration> ... <root id="toolbar"> <action-ref id="exit"/> </root> </configuration>(This works with both versions of the configuration file given so far.) Accelerators, mnemonics, tool tips and iconsIn these simple examples we have only specified the caption text of the exit button. A more realistic example would include various other properties: <action id="exit"> <caption i18n="exit.text"/> <tooltip i18n="exit.tooltip"/> <menu-icon url="file:/tmp/icons/icon-M.png"/> <menu-icon-disabled url="file:/tmp/icons/icon-MD.png"/> <icon url="file:/tmp/icons/icon-B.png"/> <icon-disabled url="file:/tmp/icons/icon-BD.png"/> </action>(None of these elements is required, but they must always occur in the order given.) The Icons are referred to by URL. In the example a <action id="exit"> <caption i18n="exit.text"/> <tooltip i18n="exit.tooltip"/> <menu-icon url="classpath:/myapplication/resources/icon-M.png"/> <menu-icon-disabled url="classpath:/myapplication/resources/icon-MD.png"/> <icon url="classpath:/myapplication/resources/icon-B.png"/> <icon-disabled url="classpath:/myapplication/resources/icon-BD.png"/> </action>This allows us to store the icons in the same place as the configuration files. Mnemonics and accelerator keys are not configured in the XML configuration file, but in the resource bundle, as part of the caption text. (They also need to be localized.) For this we use the 'description string' format of the SWIRL Description class: menu.file.text = &File exit.text = E&xit program [alt F4]As you can see, mnemonics for menus are specified in the same way. |
|