Saving Theme Configurations with Bandana
To persist the configuration of a theme you can make use of the Bandana persistence framework.
For example, the Left Navigation Theme uses the persister to store it's configuration values.
Defining a Settings Bean
The recommended way of saving the settings, is to create a simple configuration bean which implements the Serializable interface.
The bean for the Left Navigation Theme for example, simply consists of two String variables and their getter and setter methods.
Saving the Bean
Bandana can be used to save a configuration object with a given context, where the context refers to a space.
The setValue function of the BandanaManager has three arguments:
- @param context The context to store this value in
- @param key The key of the object
- @param value The value to be stored
Retrieving the Bean
The configuration object can be retrieved by using bandanaManager.getValue. This method will get the configuration object, starting with the given context and looking up in the context hierarchy if no context is found.
- @param context The context to start looking in
- @param key The key of the BandanaConfigurationObject object
- @return Object object for this key, or null if none exists.