This project has moved. For the latest updates, please go here.


1. AfterSeparatorUIAdapter

This class provides an UIElementAdapter for ToolStripItems in which new items will be added to the separator's owner collection. These new items are added after the separator to which the adapter is attached. The separator is hidden/shown in respect to the ToolStripItems that follows the separator.

Figure 1

The Test Suite Shell provides a tool bar (ToolStrip) with common tool bar items like Open and Save (Figure 1: Top). The Shell allows other modules to extend the tool bar with new items (Figure 1: Bottom). If new items are added by any module, a separator should divide the common items from the module specific menu items. This separator can be seen at the left end of the red rectangle in Figure 1. The specific feature of the AfterSeparatorUIAdapter is to show the separator if new items are added.

By using this class a developer does not need to care about showing and hiding of an seperator regarding the count of items that follows the seperator. The code snippet below shows how the Test Suite Shell configures the AfterSeparatorUIAdapter. The mainToolStripSeparator is hidden by this adapter until a new item is added.

    new AfterSeparatorUIAdapter(mainToolStripSeparator));

2. ToolStripDropDownItemUIAdapter

This class is an UIElementAdapter that wraps a ToolStripDropDownItem. The class extends the behavior of the ToolStripItemCollectionUIAdapter with automatic enabling/disabling or showing/hiding of the ToolStripDropDownItem in respect to the drop down items count.

Figure 2

In the top image of Figure 2 the Test Suite has no module loaded with the capability to create new documents. Thus the New item of the tool bar is disabled. In the bottom image of Figure 2 a module for handling RTF documents is available. This module registers a new menu item ("RTF Document") to the New item of the tool bar. The ToolStripDropDownItemUIAdapter automatic enables the New item of the tool bar. Thus the user can open the drop down menu as it is shown in the Figure 2.

An overloaded constructor of the ToolStripDropDownItemUIAdapter allows to show/hide the drop down item instead of enabling/disabling. By using this class a developer does not need to care about the manual handling of the ToolStripDropDownItem any more. The code snippet below shows how the Test Suite Shell configures this class.

    new ToolStripDropDownItemUIAdapter(newToolStripDropDownButton));

Last edited Oct 8, 2007 at 1:19 PM by jbe2277, version 10


No comments yet.