This topic describes programming concepts and requirements needed to extend IBM Director to include one or more new panels in the server preferences dialog.
IBM Director provides the server preferences dialog to allow users to configure specific properties that a server task might require for execution. If your organization is extending IBM Director with a new server task, you might need to extend this dialog to include tabbed pages allowing configuration of that new server task. To provide GUI interaction with a server preference class, you must understand how IBM Director implements this interface to allow your organization to display a configuration panel that is integrated into the IBM Director server preferences dialog.
Creating IBM Director tasks describes how to build your own management tasks and provides steps for adding your own server task extensions. One of the steps in that process is Identifying your task to IBM Director at startup. As described in this section, the extension class is a subclass of the TWGExtension abstract base class. Also described is the fact that new tasks are added in the InitClassInstances() method of the extension class. What is not described is that any server preference classes that are needed to support your server task must also be added in the InitClassInstances() method of the extension class. This is done through the TWGConfigPanelBeans class. This class handles the registration of all server preference classes with the server. At startup, IBM Director will be notified by the server of all server preferences classes that have been registered. The IBM Director Management Console will display a separate tabbed page in the server preferences dialog for each page registered. Note that one server preference class can register multiple pages.
Tasks can participate in IBM Director preference notebooks if there is a need. The participating task must provide a panel that implements required interfaces and must register it with the server. The console will recognize these panels and add them to the appropriate notebook. Server and Discovery Preferences panels should refrain from including JTabbedPane and should follow the GUI panel layout guidelines described in Director programming: best practices.
The Server preferences notebook is shown in Figure 1.
Figure 1. The Server Preferences notebook.
The Discovery Preferences notebook is shown in Figure 2.
Figure 2. The Discovery Preferences notebook.
The TWGConfigPanelBeans is the class to use to create your own server preference pages to allow your users to customize your server task. Using TWGConfigPanelBeans enables you to integrate your customized server preference pages for your server task in with the IBM Director server preferences dialog. Because a configuration panel bean instance is a persistent object, you should always check that an instance does not already exist before creating one.
The syntax of the constructor you should use is:
public TWGConfigPanelBeans( String inst_id, int sort_wt, String nls_bndl, String[] tab_lbls, String[] panel_beans) throws TWGPersistentObjectSaveException
Example:
private static final String CONFIG_PANEL_BEAN = "BobCo.MyServerTask.config"; . . try { // Register our configuration panel page but only if it is not already registered. if ( TWGConfigPanelBeans.getConfigPanelBeans( CONFIG_PANEL_BEAN ) == null ) { // Register one class bean for one page in the server preferences. // The page should have the tab label that is specified by the key found // in the resource bundle specified. The class to display on the page // is the one specified in the bean_cls array. String[] tab_ids = { "MyServerTask.MyPreferenceTab1" }; String[] bean_cls = { "com.BobCo.MyServerTask.BCServerPrefGui" }; TWGConfigPanelBeans cfg = new TWGConfigPanelBeans( CONFIG_PANEL_BEAN, 500, "com.BobCo.MyServerTask.BCServerResources", tab_ids, bean_cls ); } } catch ( TWGPersistentObjectSaveException posx ) { throw new TWGExtensionInitException("Error registering ConfigPanelBean"); }
Note: The configuration panel bean class must be constructed in the InitClassInstances() method of the extension class. The preceding code should appear in that method, typically after the server task has been created successfully.