Customizing bookmarks

About this task

The toolkit offers another kind of Desktop personalization to save a user's preferences between logons. A user may customize a set of bookmarks that launch tasks.

With this component, it is possible for the user to customize the Desktop by dragging an icon (or button) associated with a task to a shortcut area, which will be saved between logons. This allows the user to save his configuration on exiting. To makes this option available, two classes are available to the Desktop: BookmarkArea and Bookmark.

The information about the BookmarkArea is kept in the BookmarkArea configuration file (named BMA.xml by default). The Desktop tag of the Desktop configuration file contains a BookmarkID attribute that specifies the name of the BookmarkArea definition file. For example, if the value of this attribute is set to BookmarkID, then the BookmarkArea configuration will be read from the BMABookmarkID.xml file. This file is found in the location specified in the client configuration file (dse.ini). The BookmarkArea itself is initialized in much the same way that the Desktop is.

The following is an example of the steps required to define a user configuration:

Procedure

  1. To define a BookmarkArea in the Desktop configuration file (Desktop.xml), add the following tag:
    <CustomizableArea width="167" height="457" name="BookmarkArea">
        <BookmarkArea alignment="vertical"/>
    </CustomizableArea>
    where the alignment attribute indicates whether the BookmarkArea will be horizontal or vertical (note that the sizes of the components depend on this choice).
  2. If you want different bookmark areas for different users, you must set the BookmarkId of the Desktop at runtime (with code in a logon panel, for instance) or set the attribute in the Desktop configuration file as follows:
    <Desktop width="977" height="630"
          finalizerClass="com.ibm.dse.samples.appl.OpenDesktop"
          finalizerMethod="exit" bookmarkId="XXX">
           ...
    </Desktop>
    The application will look for the BMAXXX.xml file in the location specified in the client configuration file (dse.ini).
  3. The BookmarkArea configuration file (BMA.xml by default) will have the following structure:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE Desktop SYSTEM "desktop.dtd" >
    <Desktop width="977" height="630" >
      <BookmarkArea>
         <Bookmark name="Bookmark" label="Totals" taskName="T1" code=""/>
         <Bookmark name="Bookmark" label="Reset Password" taskName="T1" code=""/>
      </BookmarkArea>
    </Desktop>

Results

When the Desktop is initialized, the application will read the desktop.xml file and then the BMAXXX.xml file. In both cases, the same mechanism is used to instantiate the components. Note that if the components of the BookmarkArea are changed at runtime (either added or removed), then the BMAXXX.xml file will change when you exit normally (using the Exit button) from the Desktop. You also can define an empty bookmarkArea (without a BMA file) by omitting the bookmarkID attribute, and the BMA.xml file will be automatically created at runtime when adding components to the bookmark area.