Configuring user preferences in gadgets
In the previous two recipes, we saw how to create gadgets from both static content and dynamic content. In this recipe, we will go one step further and display the gadget content based on user input.
The user will configure the gadget during its creation or modify it later, and the gadget content will vary depending on the configuration parameters.
Getting ready
Create the Hello Gadget, populated with dynamic content, as described in the previous recipe.
How to do it...
In this recipe, we will let the user choose whether to display the name in the greeting message or not. There will be a property on the gadget named displayName
. If it is set to true
, the gadget will display the username and the greeting message will be Hello, Jobin Kuruvilla. If the displayName
property is set to false
, the greeting message will be Hello!
The following are the steps to configure the user preferences:
Include the
setprefs
and theviews
features under theModulePrefs
element...