When you are developing widgets, consider how users might
want to customize and personalize the widgets. You can then provide
the appropriate code in the various widget attribute layers.
About this task
When you define a widget, its attributes are its customization
points. That is, you can use these attributes to customize the widget
for a particular use for all users and also personalize the widget
for a single user. There are four layers that expose these widget
attributes:
- The definition layer sets the default attribute values for all
instances of the widget.
- The administration layer sets attribute values for all instances
of a widget at run time. Superusers set these attributes when the
widget is in the config mode.
- The instance layer sets the attribute values for a particular
instance of a widget. Page editors set these attributes when the widget
is in the edit mode.
- The user layer sets the attribute values for a particular instances
of a widget for a particular user. Page viewers set these attributes
explicitly when the widget is in the personalize mode
or implicitly when the widget is in view mode.
See
Widget attribute layers for information
on these layers and how they interact to set attribute values.
Think
about the layers when you code each mode. Expose only the attributes
that make sense for a particular user. For example, if there is an
attribute that only the superuser should be able to change, put the
code to support that change in the config mode. If
there is a change that superusers and editors can make, put the code
to support that change in the config mode and in
the edit mode.
When you allow users to personalize
a widget, decide whether you want to set attributes explicitly, implicitly,
or both.
- An explicit personalization occurs when users deliberately decide
what they want to see. For example, when a user clicks Personalize from
the widget menu, he or she then consciously selects a setting and
saves it.
- An implicit personalization occurs when users are unaware that
they have made a choice about what they want to see. For example,
if a widget has a table and an attribute that sets which column sorts
the table, you can code the widget to change the attribute when the
user selects a column header. The action of selecting the column header
implies that the user prefers to sort the data in this way, and the
setting is saved automatically
Limit the personalization of a widget to the changes that
make sense for individual users. For example, for a weather widget,
individual users probably need to personalize the location of the
forecast. However, individual users probably do not need to personalize
the number of days in the forecast so you would not support changing
that attribute in the personalize mode or the view mode.
If you do want provide some customization, it might be more appropriate
to allow an administrator to customize the number of forecasted days
for all users and you would include the appropriate code in the config mode.