Component namesSometimes it is useful to retrieve a certain menu element from a menu bar
after it has been built by the menu builder, for example to further customize it
in a way which is not supported by SWIRL. For this reason each component built by
de menu builder is given a name that is the same as its PredicatesThe <menu i18n="file.caption"> <action id="new"> <caption i18n="new.text"/> </action> ... <separator unless="Mac OS X"> <action id="exit" unless="Mac OS X"> <caption i18n="new.text"/> </action> </menu>Note the unless attribute in both the <separator> and the <action> .
This attribute, and its opposite when , is supported by almost every element in the configuration file.
There is no magic happening here: predicates are simply strings that can be registered with the menu builder at run time. It is the application that needs to attach meaning to them. For example: if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) menuBuilder.setPredicate ("Mac OS X"); ... JMenuBar menuBar = menuBuilder.createJMenuBar("main.menu"); |
|